Microsoft Put Off Fixing Zero Day for 2 Years
krebsonsecurity.com
krebsonsecurity.com
1) Take signed .MSI
2) Add my JAR of malware to the end of it
3) Send file to target
4) Target's computer recognizes the file as a signed MSI, ignoring the extra stuff at the end that's not part of the MSI
5) Target computer calls the JRE to launch the JAR
6) JRE ignores the MSI parts at the beginning of the file because compressed JAR files are loaded back-to-front
Obviously a major bug that signature validation ignores "extra" parts of the file, but a signature validation bug that (1) only affects specific types of files executed by a third-party runtime and (2) doesn't threaten system files (or any native executables at all) isn't an obviously critical vulnerability like an arbitrary "signature validation is totally broken" bug.
e: or any signed MSI from a compromised system, like happened to Palemoon last year: https://news.ycombinator.com/item?id=20435699
Endless rabbit-hole of course but that's already a lot of low-hanging fruit
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.
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-maliciou...
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
“ Digitally signed files are more trusted by the Operating System. This higher trust allows such files to execute in sensitive contexts or excluded from Antivirus scans.”
It seems that msi installer packages with a trusted code signature (1) are excluded from scans by various antivirus protections. Which kind of makes sense: driver packages may contain code that would trigger heuristics a lot.
> 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.
Microsoft can already do that. To be quite honest - pretty much every institution with the right signing powers can on practically all OS. Have you verified the latest chrome installer package?
This bug seems to allow something more insidious: you could download the latest google chrome msi and append your payload jar to that msi and redistribute it. The signature remains valid. This allows bypassing the code signing checks even if you have no code signing powers.
(1) not from Microsoft, Microsoft only hands out the certificates, the signing is done by the developer
And no, that’s not how the NSA works.
Isn't it like having a special 'I know my bag smells like drugs to sniffer dogs but I promise I don't have drugs' channel at airport arrivals; and when people go down that channel you don't bother to check their bags.
They don’t treat concatenated malicious files as safe, they trust that files signed by MS are safe. You aren’t supposed to be able to concatenate a file and still have the signature check out. That’s the bug.
If you want a good reason why, ask McAfee about the time that they incorrectly detected svchost.exe as a virus and made every customer’s windows machine around the world unbootable.
- 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).
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).
1) Take MicrosoftSigned.Msi
2) Append Malway.jar to it
3) Take file and rename it as RunMe.Jar
# Now you have a jar file that appears to be signed by Microsoft but contains malways.
4. Give target RunMe.jar and ask then to dbl-click it.
# Usually this file would prompt the user with a "You shouldn't trust this arbitrary file from the internet" prompt, but it doesn't because Windows thinks this file is correctly signed
5. Target is now infected
Or, even better, simultaneously put a silent drive-by browser zero-day in a website they visit regularly, like https://googleprojectzero.blogspot.com/2019/08/a-very-deep-d...
The attacker can drop/ exec files as they please, regardless of whether they're signed.
Anyone can feel free to correct me.
I know this can be done w/ Cat.
--Wow, so JAR files are read from bottom top so it literally masquerades.
That's interesting.
Zips can also be read from front to back, reading the header of each entry and skipping the compressed data to the next header, which is most of what zip repair utilities do (or did, not sure anyone repairs zips any more). But it's faster to read the index.
And to be clear, jars are zip files.
If they do claim it then they should properly verify signatures
Either way is wrong.
That's crazy the signature check wouldn't verify the file length.
Windows still sees it as a MSI file while doing signature checking. But because it has a .jar extension, the JRE runs it when you double click.
Signature verification is done as a independent check, completely separate from execution. Because windows needs to know the signature is valid before even allowing the file to be executed. It also needs to show the signature check in the right-click -> properties dialog.
'Quintero said this weakness would particularly acute if an attacker were to use it to hide a malicious Java file (.jar). And, he said, this exact attack vector was indeed detected in a malware sample sent to VirusTotal.
“In short, an attacker can append a malicious JAR to a MSI file signed by a trusted software developer (like Microsoft Corporation, Google Inc. or any other well-known developer), and the resulting file can be renamed with the .jar extension and will have a valid signature according Microsoft Windows,” Quintero wrote.'
In terms of practical impact, it sounds like you need a target where the JAR file will be run, but also where you'd expect Windows signatures validation alone to protect against malicious Jars.
"foo\u200fism.jar" (\u is the Python escape for arbitrary unicode codepoints)
And Windows will (as of a couple years ago, at least) render it as "fooraj.msi"
(Though I'm not sure what kind of verification prompt you'd get in this circumstance)
Here are a bunch of great real-life examples from the Playstation 4 hacking scene: https://www.psdevwiki.com/ps4/Working_Exploits
Or iOS exploit chains, some of which I've used intentionally as part of iOS jailbreak tools like unc0ver. From Project Zero's "very deep dive into iOS Exploit chains found in the wild": "Earlier this year Google's Threat Analysis Group (TAG) discovered a small collection of hacked websites. The hacked sites were being used in indiscriminate watering hole attacks against their visitors, using iPhone 0-day." https://googleprojectzero.blogspot.com/2019/08/a-very-deep-d...
I imagine the real-world application of this MSI thing is something like:
1) Get silently-malicious MSI on to target machine (via download server compromise, poisoned non-TLS download, redirect TLS-downgrade, etc etc)
2) Got malicious "trigger" exploit code on to any web page used by the target (via web server compromise, weak human security like admin passwords, etc etc).
3) There is no step three.
With this in mind we can look at even very recent real-world news—like the simultaneous patching of five Chrome exploits in June 2020—and instantly see how it's not just hypothetical: https://www.cisecurity.org/advisory/multiple-vulnerabilities...
For example, one of them (CVE-2020-6493) is "Use after free in WebAuthentication in Google Chrome prior to 83.0.4103.97 allowed a remote attacker who had compromised the renderer process to potentially perform a sandbox escape via a crafted HTML page". How many more of these do you think are hanging around out there, waiting for Google to get the 'okay' to fix?
a) A separate vulnerability that provides arbitrary code execution to run your trigger exploit
or
b) A vulnerability that allows you to execute a specific program/command on the target system
If you've got either of those, the ability to run a pre-existing JAR doesn't really increase your capabilities. You've already got at least user-level access. Having a way to distribute a malicious JAR in advance might be useful in some cases, but having a file sitting on disk in advance significantly increases the risk of having your exploit detected before you get to use it.
It strikes me that the primary use for this would be attacking a target that (1) has some level of system lockdown/scanning such that signing is required, (2) has Java installed on computers and uses it (not just a program that bundles in its own JRE), (3) has scanners vulnerable to the signature validation bug that assume signature OK == safe, (4) has some sort of network scanning IPS/IDS such that the "run malware" trigger needs to be small to avoid detection.
If (1) isn't the case, then there are probably easier ways to sneak your malware into position. If (2) isn't the case, your malware can't run. If (3) isn't the case, your attack risks getting detected in advance and burning any chance of using it. If (4) isn't the case, you'd probably be better off delivering the full malware via the browser sandbox escape/whatever network exploit you're using to avoid needing 1-3 in place first.
I would venture the guess that this has been used for (1) opportunistic malware intended for wide distribution with a low probability of any given target being compromised due to requiring the user to run the malicious JAR and (2) very targeted attacks on specific institutions that meet the 1-4 criteria.
I would actually expect a number of interesting institutions to match that profile - places likely to keep systems updated (or at least updated AV), so not guaranteed to be vulnerable to last month's patched bugs, who have some level of system lockdown and scanning such that hiding in plain sight behind file signature verification is necessary, who have some type of IDS/IPS such that the separate trigger needs to be kept to a minimum, and who rely on a set rather poorly packaged Java software. I'm sure the list of targets matching those criteria includes a number of financial institutions and infrastructure operators - targets that need to pay more that trivial lip-service to security, but where security is a "we've checked all the boxes so we're good" mindset.
This can depend on your country. Here in Brazil, the income tax preparation software (http://receita.economia.gov.br/interface/cidadao/irpf/2020/d...) is written in Java, and the install instructions in that page tell you to update Java, so it's probably not bundled. Since everyone with income above a certain amount (and several other situations) has to use that software to fill the tax report (the option to use the paper form has been discontinued many years ago), I'd guess a high number of personal Windows users in this country have Java installed.
You can damage most software vendors with just #1.
Then #2 is even worse.
#3 you already own them because #1,#2 let you download a poisoned msi to the machine. You can get cleaver and dynamically change the hash per download as described year ago when signature based AV was all we had, you dont need this trick.
Or... you could just drop powershell, python and execute it and own the machine without trying so hard with just #1 and #2.
Yes on your first part; no on the parenthetical. One exploit to let the malicious hanger-on into your computer. Another exploit—maybe in a web page you visit regularly—to trigger it. Compare to this real-world iOS attack: https://googleprojectzero.blogspot.com/2019/08/a-very-deep-d...
Here are twenty-three of them to get you started: https://github.com/arntsonl/calc_security_poc
One of the top ranking hackthebox players summarized PlayerTwo quite neatly [1].
[1] https://www.youtube.com/watch?v=u_GkIzCmU90 (13 min.)
Funnily enough this is exactly how real attacks tend to work https://googleprojectzero.blogspot.com/2019/08/a-very-deep-d...
I find it rather telling, how many argue that Microsoft is (obviously) wrong in their behavior, yet I don't read much about how the company deserves severe punishment (maybe even forced break-up or having control taken away from it altogether), for knowingly not fixing a security fuck-up like this, for this long. Maybe an interesting case for anthropologists one day, to study social/cultural conditioning.
I'm sure that Microsoft will have it's reasons and considerations, but that should not excuse or exclude them from liability for the consequences of their actions. Whether that will ever succeed in court, given both the reality of what Microsoft and the USA are (many other countries too, by extension), that is another story. But it should not take rocket science to figure out that it will only get worse if Microsoft gets away with this without repercussions (again). Guess, how we got here in the first place.
You have a bug that, at best allows a third-party runtime to execute a malicious program without warning the user that the program is untrusted. Practically, how would you write a statute so that this case would be different from Windows not warning about malicious file in $arbitrary third-party file format$ that exploits bug in $arbitrary third-party software$? You don't want vendors legally responsible for the behavior of third-party code on their systems, that's how you get entirely walled-garden platforms that have no user freedom.
The issue with defining liability here is primarily what conduct should make a company liable in the first place (and doing so in a way without horrible consequences for user freedom), not what the damages can be.
Easy. If a producer of software is made aware of a defect in their software that may lead to a breach of security, they are required to either fix it in x amount of days, or publicly disclose the full details of the vulnerability so that users of the software may make an informed decison on how to proceed.
You could even say that if they disclose that there is a vulnerability along with a temporary workaround, they get an extension of time to fix it or release the details.
Edit: after reading what I wrote I think it actually should apply to all bugs, not just security related ones. Either fix it, or let everyone know about it.
If a producer of software is made aware of a defect in their software that may lead to a breach of security
Now, I can guarantee you 100%, based on its track record, that a code execution and sandbox vulnerability exists right now in Adobe PDF readers. Should Windows be required warn users before opening a PDF file that it could be dangerous? What would be different for any other non-trivial software that consumes a non-trivial file format?
It is by no means a stretch to say that if Microsoft is liable in this case, they must be liable for not warning users on a whole host of other issues with third-party software.
I'm generally in favor of some kind of serious liabilities for vulnerabilities, but let's not pretend defining liability in an effective way is easy.
Now, I can guarantee you 100%, based on its track record, that a code execution and sandbox vulnerability exists right now in Adobe PDF readers. Should Windows be required warn users before opening a PDF file that it could be dangerous? What would be different for any other non-trivial software that consumes a non-trivial file format?
No, they only should only have to make a public release about their own, known defects. They shouldn't even have to notify users directly, just make it publicly known. Though it would be nice if they kept track of other vendor's defects and alerted users.
Except, of course, that Windows is absolutely correct in validating them as a MSI file. It just happens that it fails to correctly validate a file that is both a valid MSI and a valid JAR. Windows itself is incapable of doing anything dangerous with the (to its perspective) nonsense data appended beyond the validated contents of the file.
This is essentially a TOCTOU bug involving one vendor performing the check (MS) and one vendor performing the use (whoever shipped the JRE), both of which are technically correct in the most narrowly-scoped sense but produce a significant issue when combined.
If there's a bug in Windows here, there's a bug in the JRE.
Are there any comparable virtual machines that require signed bytecode by default? I’ve personally never heard of it, most of the time it’s verified when the package is downloaded, rather than when it’s executed.
Windows is basically completely responsible for this: Windows validates the MSI, windows knows what an MSI is, Windows knows it will be run by the JRE and validates it just as an MSI instead.
I think Windows is aware of this though, it's called JAR and explorer says the JRE should open it. Furthermore, should there be any sections in a signed MSI that aren't signed? Could that serve any legitimate purpose? No, it entirely defeats the purpose of signing it.
I would not be surprised if part of the delay fixing this involved MS finding out early on that a major user of MSI files was actually relying on this (perhaps some installer creation tool or AV scanner?) and decided that the user needed to fix their product and distribute the fixed version before a Windows patch was viable.
I could write a program that deletes your hard drive if you run a script named delete me.jpg. should Microsoft be liable?
But if companies become criminally liable for bugs, this can be bad news for open source projects. For example. My company wants to use some GPL software, but we need some extra features, so following the license, I implement them and release the source. The original maintainers like it and put it into the official tree. Unfortunately, my contribution introduces a serious security flaw in some other part that my company doesn't use, we simply overlooked that part, it is our fault, but we didn't mean any harm. We may even have seen the CVE, but because it wasn't about something we used, we didn't look into it. And now, suddenly just because we did everything by the rules and released our source code, we are now criminally liable... That kind of thing makes you think twice before you contribute to any open source project...
Usually open source projects have a very big "we are not responsible for anything, to the maximum intent permitted by law" warning to avoid this kind of problem. Companies are of course free to provide additional guarantees on derived products, that's one business model for open source developers.
But if you make a law where software developers are responsible for their bugs no matter the contract, even if there is no ill intent, this is going to be a problem.
You are pointing at a huge elephant in the room. When it comes to software, companies have incredible leeway.
A company can develop some very popular software and earn billions while also inserting malware or simply leaving vulnerabilities unpatched without any repercussion.
It is even legal to discover vulnerabilities in your own software and sell them (anonymously) on the 0-day market.
What about it? "The software is provided as is", remember?
"Provided as is" => "Used as is" ;-)
If everyone at once decided that they were no longer using windows, it’s not controversial that there would at least still be a massive amount of work and time to shift every legacy on windows to another platform. Even in this most extreme example of the market shifting, windows still has the security issues for the transition timeframe that the market alone can’t solve.
What nonsense is this?! Do you maybe mean "can or can't buy"? Otherwise, I don't see how this statement can be parsed such that it isn't obviously incorrect.
Edit: missing clarity - I think fines are appropriate when/if damage occurs, my reply was based on if notification happens without actively being exploited.
Why else would they leave a known vulnerability unfixed for two years!?
ISTM that someone else found out about the vulnerability out ("... which Microsoft acknowledged was actively being exploited.") -- perhaps after the NSA used it against them? -- so now that the cat is out of the bag and they are at risk of compromise -- they let Microsoft know and get it fixed.
I doubt there are any real systems where the only thing standing between the system being secure or not is Windows code signing.
And yet, if memory serves, they went to the trouble of stealing a code-signing certificate from a software development company so that they could do exactly that in an Iranian nuclear facility!
Besides, even if this one weren't all that useful on its own, we've seen time and again how a few of these these "minor" vulnerabilities can be "chained" together, eventually resulting in a full compromise.
Someone else found out? The bug was publicly announced 2 years ago. (Per the article we all read.)
You can't always stop using a 0 day. If the binary is deployed somewhere on a air gapped host computer that still receives updates, it's out of your hands. How can you be sure the update will get there while the binary is still on the computer? You risk detection which is very very bad when you run an APT. The tiny part of the campaign can make an entire country or even group of countries adopt stricter policies.
The government probably knows about enough holes to fix their malware promptly, but even if it does, it needs to "deploy" the fix all around the world otherwise it risks being noticed.
For years, they depended on a variety of pressures to get people to upgrade to new OS's. First there's the whole office/client/server version dependency graph including CALs and DCs to force businesses to upgrade whole swaths. And of course bug fixes: why fix in a current version when they can tell you it's fixed in future, go buy that? Psychology.
Then there's malware. Why would they sit by for around years (McAffe came out in 98!) watching the market get super-saturated with sketchy malware products and ignore security so badly? I think it's the same as above: upgrade now hoping it got fixed in the next new shiny. It's a human flaw.
This makes me want to scream to closed source lovers. Why do you put yourself in this position? Open source users can audit and fix it themselves, pay someone to do it, chose another fork, or even discuss flaws openly without getting sued (cough oracle cough). Closed source users have no insight, no transparency, and no recourse but to suffer their abuser.
Only problem with that theory is that windows 10 has free updates, seemingly forever. It was released in 2015 (with a free upgrade program from prior versions), still supported to this date,and has no signs of stopping.
Most likely part of an ongoing campaign by a three letter agency which would have requested the delay...
[1] https://www.virustotal.com/gui/file/dd71284ac6be9758a5046740...
IIRC the term was introduced to contrast with day-1 attacks with exploits developed by reverse engineering patches on the day they are released and attempting to exploit systems in the gap until they get patched.
Are the users supposed to receive an unexpected jar file and run it? Or can it pretend it's an MSI the user legitimately wanted, yet execute malicious code?
But the vulnerability makes it rather trivial to have appended arbitrary content, even executable code, to it, without impacting the supposed validity of the signature.
This is really bad.
Software development licences are a huge scam doing more for DRM than for actually real security.
As far as I can remember, jar is zip and zip has headers at the end of files. Making it possible to append a jar to something and disregard the first part. In this case a signed MSI.
And so you have a code signed JAR from Microsoft. Then what? I don’t know.
Is unsigned software subject to further restrictions by default compared to signed but "unknown" software (sometimes a pain to use with Defender)
And I kind of remember there was already other bugs with MS code signing checks? (not sure)
I agree this bug probably breaks the (informal/perceived?) security model of some hardened configuration, but that kind of hardening should not be considered completely sound anyway. It's like the UAC that is not to be considered a security boundary, yet somehow useful against casual threats or even just errors.
If you download and try to execute random code, you should consider it will be executed regardless of the expected checks and perceived hardening of your system. And you should consider that your OS is full of security bugs absolutely everywhere. Your web browser too (yep, that means JS is an insane threat now).
Not really a reason to not fix that kind of things though, but nothing serious enough to loose our mind.
Do people just use 0-day as a synonym for exploit now?
It is not that scary of a bug.
Wow, they made this public and MS still didn't handle it...I guess it should be more widely advertised then.
Besides, your point stands with Google's Project Zero preexisting 90 day period. & yet they get flak too about putting out this information (not that I agree with that flak)
Please, don't get me wrong. On itself I think this whole responsible disclosure culture is bullshit. It wouldn't be if more companies actually treated it more sincerely. But I have seen too many companies abuse responsible disclosure, or simply hide behind bug hunting programs to limit/squash exposure (too many times even without fixing anything), and then burn anyone who doesn't want to play by rules they themselves set.
The problem is, there are far more things than just legal prosecution when this would turn into a clash between companies and security researchers. However, maybe a union or anonymous organization could level that playing field. Problem with that is that many security researchers also want recognition, at the same time as feeling safe (.. something about cake).
A consequence of this choice is that ANY file concatenated with a ZIP file is a ZIP file (and the same therefore goes for JAR files as well.) So if you concatenate an MSI file with a ZIP/JAR file, your MSI file detector will look at the file and go "yeah, looks good!", and your ZIP/JAR file detector will also say yes. (This also shows off the hazards of automatic filetype sniffing.)
This is related to one of the very oldest Android rooting vulnerabilities. The update.zip files use the signed JAR file format, where the file contains a signature on its own contents. Naturally the signature can't cover the entire file; it only covers the contents referenced by the header.
But the sin-that-keeps-on-giving strikes even harder here: The end-of-file ZIP header also has an end-of-header comment field, of arbitrary size! This means that a single file can actually have MULTIPLE valid ZIP headers. Which means two different tools can interpret the file as two different ZIP files (much as the bug here can interpret the same file as either a ZIP or an MSI.)
Don't do drugs, kids. And don't do automatic filetype detection. And don't do ZIP/JAR files if you can avoid it. And for the love of god, don't put your header at the end.