5 ms·
Disagree on lack of severity; this is the kind of thing that calls into question any signed MSI I've downloaded over non-TLS HTTP or even over HTTPS served from
by Lammy 6y ago
Disagree on lack of severity; this is the kind of thing that calls into question any signed MSI I've downloaded over non-TLS HTTP or even over HTTPS served from a possibly-downgrade-attacked HTTP→HTTPS redirect.
e: or any signed MSI from a compromised system, like happened to Palemoon last year: https://news.ycombinator.com/item?id=20435699 https://news.ycombinator.com/item?id=20435699
Endless rabbit-hole of course but that's already a lot of low-hanging fruit
- cpgxiii 6y agoI don't think that follows from what's been disclosed. What seems to be the case, based on the disclosures, is that the signature validation code does a correct job validating the parts of the file the MSI header describes, but does not check parts of the file that aren't described in the header. As far as I'm aware, adding arbitrary anything to the end of an MSI doesn't do anything since it's not described in the headers, so you can't use this to compromise an actual MSI file. You can only use this bug to fake signing for specific other file types that are read back-to-front where the actual MSI parts will be ignored.
- Lammy 6y agoWell I guess the actual payloads would all be fairly individualized, so that makes sense.
- testplzignore 6y agoWhy are MSI files designed like this? Why allow for just a specific part of the file to be signed? (I have no technical experience dealing with them.)
- banthar 6y agoExtra bytes at end of file will be ignored by most formats. You generally don't want to depend on file length.
- Varriount 6y agoOther than a possible checksum calculated from the entire file contents, many binary formats use either: - Headers describing a section, including the length of a section. - Prefixing each section with a size. - Using a marker pattern (such as a null byte) to mark the end of a section of data. (there are more than these three, but these are the most common) That last one isn't used very often, and when it is, it's mostly for textual data. The consequence of using the first two techniques is that it's entirely possible to add data to the end of the format, since a parser would just read the last section and stop (assuming the format supports knowing what the last section is).
- Lammy 6y agoIf you hashed the entire file you wouldn't be able to append that hash to the file for distribution because it would change the hash of the file. That's why FOSS software signatures are usually MD5/SHAwhatever in a separate text file.
- wwright 6y agoThe format could still be "hash of everything else + everything else"
- Xylakant 6y agoRPMs contain the signatures in the archive. DEB packages don’t, something I consider a major shortcoming in the Debian package format.
- hnick 6y agoYou can, if the consuming system is format-aware. I think MSI can fall into that category. I developed something like this to put an md5 hash in a comment in the first line of a code module at a place I worked. It simply read the file, removed that line, and hashed the rest of the file data to generate the hash for comparison. This was just to stop programmers changing the code without submitting it to a secondary system for validation/tracking (easy to work around, but that shows intent to bypass policies when we see it in the repo).
- Xylakant 6y agoIf I read the description correctly, it would need to be a jar file, though, not an msi. The trick allows to hide a malicious jar file from the scanner, not to hide a malicious msi. I think it’s better described by “take a malicious jar and prepend a signed msi to hide it from the scanner.”
- a2tech 6y agoThis is separate from anything an AV might do, so forget the scanner part. A virus scanner with a signature for this malicious JAR will still catch it. What this is avoiding is the prompt and extra scrutiny Windows throws up if you try and run an executable from the Internet. Think of the legitimate MSI and malicious JAR files as separate short stories in the same book. The 'book' comes to your computer claiming to be one thing (the legitimately signed MSI) but the second chapter is something completely different (the malicious jar file). When your computer reads the book (calculates and verifies the signature) it only does it off the first chapter. That lets the second part slide under the additional scrutiny Windows applies to files downloaded from the Internet.
- Xylakant 6y agoBy “scanner” I meant the built-in windows defender tooling, which is - afair - affected. It trusts the signature. But you’re entirely correct - a virus scanner that does not rely on the signature w could catch the malicious code. However, this blog post mentions that various security solutions trust the windows code signing, but it does not mention which ones - https://blog.virustotal.com/2019/01/distribution-of-malicious-jar-appended.html?m=1 https://blog.virustotal.com/2019/01/distribution-of-maliciou...
- pbhjpbhj 6y ago>It trusts the signature. // Wtf? Am I reading this right, if part of the file is signed by MS then it just doesn't bother running it through the detection algo? That looks exceedingly like a designed in security hole. Presumably paired with the OP "bug" means MS could, with an NSA letter say, drop malware on devices if those devices were using Windows Defender for AV. Just as well MS don't snoop on what software user's are running./s
- proactivesvcs 6y agoAnd since Microsoft still serve updates from the Microsoft Update Catalog over HTTP, let's not mistakenly think that all downloads are protected via TLS, even today.
- gruez 6y agoIs this still the case for windows 10?
- smileybarry 6y agoYes, but all updates are a specialized .MSU format and don't fall in this end-of-file parsing trap.
- proactivesvcs 6y agoThe Update Catalog is only for manual downloads, so if you mean Windows Update, this is all downloaded over HTTPS.
- pbhjpbhj 6y agoOr any signed MSI if downloaded from a country where security services can secretly oblige companies to act against their users - China, USA, and probably many others.
- skocznymroczny 6y agoIs there any technologically advanced country where that is not the case?