You’ve Got 0-Click Mail: Unassisted iOS Attacks RCE via Mobilemail/Maild
blog.zecops.com
blog.zecops.com
* This was abused in the wild in targeted attacks against individuals including corporate executives and journalists, and, based on the presence of suspicious 0x41s in the exploit, likely purchased and minimally modified.
* On iOS 13 the attacks are even more powerful, as moving the mail parsing out-of-process means it is “0-click” and can silently crash without alerting the user of a problem (and the process’s VM layout is much more consistent to boot). Humorously, the error message that appears (“This message has no content”) is a common bug anyways so users have been trained to ignore it.
* Memory mapping files is hard, and there’s some non-trivial error cases that need to be checked.
* A fix is in iOS 13.4.5 beta.
(By the way, MobileMail and maild from the title are process names and are spelled as such.)
Source? I've been using MobileMail for more than a decade and never seen this bug.
I see it frequently, sometimes several times a week. I saw it just yesterday in the macOS mail client, but I don't know if it's related.
i hope you're wrong, no offense.
They've just noticed that apple releases stuff on fairly strict schedules and predictable behaviors, so it's easy to predict when the next minor point release will come out, based on previous behavior. Similar with a new iphone releasing every year after july at the very least.
It was presumably in the realm of million-dollar zero-days, so unless you have reason to believe you would be targeted by a state actor, is it safe to assume the current unpatched risk is negligible?
If the claims in this article are true (and I have no reason to doubt them), I don't think Apple will leave this unpatched for weeks.
> Q: Since when iOS is vulnerable to these bugs?
> A: iOS is vulnerable to these bugs at least since iOS 6 (Sept’ 2012). We haven’t checked earlier versions.
1. Go to Settings > Password & Accounts. Set Fetch New Data to "Manual" and disable "Push". This will ensure that new mail is only downloaded when you specifically request it, and it will no longer do so automatically.
and/or
2. Use Safari or different e-mail clients such as GMail and Outlook. These mail clients are unaffected by the currently disclosed 0days.
There's also no word on whether PAC (a new processor security feature available in current model iPhones) affects exploitation of these bugs. You're safer if you're running a device with an A12 CPU or higher (anything newer than an iPhone XS or XR).
You can use the iVerify mobile app to get push notifications when new public exploits for iOS come out. The news feed contains specific instructions to mitigate the impact. See more:
https://apps.apple.com/us/app/iverify/id1466120520
https://twitter.com/IsMyPhoneHacked/status/12529544579540090...
Some of them are deterministic and report with complete certainty. For example, the Volexity report about EVIL EYE includes IOCs for the exploit payload and we can detect and report whether that payload exists on your phone. (read that report here: https://www.volexity.com/blog/2020/04/21/evil-eye-threat-act...)
We also include more probabilistic, generic, or environmental checks that look for deviations from the known good for iOS. These are based on our deep knowledge of iOS and use little-noticed side channels to report information about iOS to the iVerify mobile app. These can possibly detect unknown jailbreaks. We walk a thin line to write our checks without violating Apple's rules (e.g., no private APIs).
It's certainly not foolproof, there are ways that a malware toolkit could avoid iVerify, but it's a great extra seatbelt to wear. It's also extremely effective at determining exposure to an attack immediately after IOCs are released.
Does this differ significantly from existing jailbreak detection tools, like checking for suspicious-looking files on disk, address-space scans for unexpected code and invalid signatures, and lower-level APIs having different behavior?
I think you mean an XS, XR, or anything newer
1. Malicious character encodings that can crash email clients such as Apple Mail.
2. Malicious RFC 2231 continuation indices designed to cause overallocation.
3. Base64 data containing illegal characters such as null bytes.
4. Unterminated comments and quoted-strings.
5. Missing multipart parts (e.g. no terminating boundary delimiter).
6. Malicious data designed to cause CPU-intensive decoding or stack overflows (aka MIME bombs, the email equivalent of zip bombs).
7. Malicious multiple occurrences of crucial headers and parameters, which could cause clients to render an email differently from that scanned by antivirus software.
8. Encoded words containing malicious control characters (cf. Mailsploit).
While it won't prevent this exact attack because it seems to be purely size-based, @ronomon/mime was able to detect attacks such as Tim Cotten's "Ghost Emails" Gmail hack [1] as well as recent CVEs reported against ClamAV [2] and SpamAssassin [3], which are variants of a MIME multipart attack I disclosed through Snyk, "How to crash an email server with a single email" [4].
[1] https://blog.cotten.io/ghost-emails-hacking-gmails-ux-to-hid...
[2] https://blog.clamav.net/2019/11/clamav-01021-and-01015-patch...
[3] http://mail-archives.apache.org/mod_mbox/spamassassin-announ...
[4] https://snyk.io/blog/how-to-crash-an-email-server-with-a-sin...
As the "memory-safe language" appears to be JavaScript, which lacks integers, how does the parser safely handle the 7bit encoding that still comes out from a large variety of email hosts?
However, I can tell you that JavaScript doesn't lack integers. It tries to make you think that numbers are just numbers, but if you store an integer in JavaScript it is represented as an actual integer. Equivalence checks work, there are even bitwise operators. It's only once a decimal is introduced that the representation changes to floating-point.
That's not exactly proof that JS has integers. I mean you can still do this:
> 1 === 1.00000000000000000000000000000000000000000000001
JS implementations may use integers as an optimisation. The problem is when you need to sure something actually is an integer.
You can also have bitwise operations on doubles, you just take part of the number and toss away the rest, and pretend it's an integer. But occasionally, and unexpectedly, it may cause a rounding issue, depending on how it is done.
However, looking more into it, this library relies heavily on the Buffer [0] API from Node (which does have proper integers, and Buffer is a Uint8Array). Which handles 7bit data by treating it as latin1 (ISO 8859-1), and tossing away 1 bit of every byte. Which might not be a bad way of handling it.
I don't know enough about Node's particular implementation to judge whether or not there are problems here. I do know that 7bit encodings can break a whole lot of parsers in unexpected ways.
That would be interesting. Would you please share some unit test cases and I will run them past @ronomon/mime?
This is not a full-device/root RCE, and the sandbox / ASLR does work to contain this.
I’ve had a problem with lots of bounce mails today on one of my accounts. Apparently somebody used my SMTP for spam which I find hard to believe since I keep my password safe. It’s not part of any known public data set.
From the founder/CEO of ZecOps twitter directly: https://twitter.com/ihackbanme/status/1252990118945681409
Q: If a user turns off mail sync for their accounts into the mail app, is that a mitigation?
A: Yes. If a user is not syncing emails it would mitigate the issue.
You can use third-party apps, or Safari if it's a webmail.
Actually, now that I re-watch an ad [0], they're not even making any claims about the iPhone's privacy. It's just showing a bunch of people doing private things, then posing a hypothetical question:
"If privacy matters in your life"
"It should matter to the phone your life is on"
"Privacy. That's iPhone."
Notice "It should ..." How many rounds of legal do you think that text went through.Oracle, for example, apparently learned the hard way about claiming software is "unbreakable".
Everyone here on HN knows that pretty much nothing is "secure".
https://www.apple.com/business/docs/site/AAW_Platform_Securi...
This scheme has many advantages. First, it prevents companies from overstating too much since if they claim a number much more than the cost to find a breach, then it becomes profitable for white-hats to demonstrate that (e.g. they say $1 Billion, but it only costs $1 Million). In fact, if they really overstate it they will be appropriately "fined" for their false advertising. This means that the number will probably be similar to or less than the true cost.
Second, it allows companies and users to choose their risk. If a user has uniquely valuable data or a specific use case with greater requirements, they can choose a service with the level they deem appropriate. If a company manages unimportant data or is too new to have high "security", they can specify a low number to properly reflect the value of data they can or will protect. This avoids the problem of a single fixed value that could prevent low "security"/importance systems from being created and could shield high "security"/importance systems from the liability they should have to manage.
I've never been entirely confident in my understanding of the background processing model for iOS apps, and this attack potentially affects people I know.
Alternatively, disable push e-mail and set the refresh interval to manually and make sure to never open the Mail app (as it could cause a manual refresh).
I'd guess that removing mail accounts from the device would do the job, though.
Q: If a user turns off mail sync for their accounts into the mail app, is that a mitigation? A: Yes. If a user is not syncing emails it would mitigate the issue.
I had to look this up. "AAA…" (0x414141… in ASCII/UTF-8) is traditionally used as arbitrary user input that's easy to spot in places it shouldn't end up.
As an added bonus, it provides users with interim fixes for situations like this, where the exploit is known and in the wild, but a patch is some time away.
It pretty much defaults to being this "reduced attack surface", and I wish more apps were like this. It's probably one of the more complex settings UIs you'll ever find in a mobile app, but that's because almost everything is able to be enabled or disabled... Want it to check and validate DKIM locally? That's a toggle switch. Want it to auto remove tracking pixels from html emails? That's a toggle. Want to view email from trusted contacts in html view? Pretty sure that's a toggle too.
No connection, just a happy user of a nice open source email client.
Implementing the parsing in a memory safe language would have helped.
RE:FW:RE:FW: that was a disaster.
Re: SV: Re: SV: Re: SV: Re: SV: Re: SV: Re: SV: Some topic
And adding one of those every for each message in the thread. (SV is short for "Svar" which means "Reply" in Swedish).You'd have thought he mess of localising the actual directory names in Windows (i.e. c:\Program Files, etc) rather than making it a display property in the file manager would have taught them something, but it didn't.
In years past, you could use this to download a fresh copy of the OS and install. But I don't know if that's still what it does.
It does. If you don't have a cached .ipsw for the latest iOS version, iTunes will download it for you. Your iPhone also contacts Apple to verify the IPSW iTunes gave it is both "from Apple" and still signed (https://ipsw.me/iPhone12,1) before installing it.
Surely you would need to keep the raw content of every email of every client to identify this?
Is that true? If so, how to remote code execution exploits like this work?
It seems we have had a few 0-day iOS vulnerabilities lately but so far no one has cared enough to build something really malicious. I understand Apple has patched them quickly but updates take still a week or two to get on all devices.
Surmise is the wrong word, the authors have actual evidence this is true.
To eliminate this class of bug you need to eliminate statements, such as in Haskell.
I love Swift, it's a great language, but we shouldn't rewrite our stacks every time a better language comes out. This is where the engineering trade-offs come in. Maybe over time, but over a long period of time.
But I think that you are incorrect in saying that it shouldn’t get re-written.
Memory-safety is a compelling reason to re-write something. It’s not just a flavor of the month thing, there are real and large security benefits to rewriting your shit in a memory safe language.
Honestly for any large projects (ie scale of iOS) it is amusing to see people think that they can forego a memory safe language and still be “secure.” Subscribe to the iOS discloses vulnerability mailing list and take a look at how many of those vulnerabilities are because of the lack of memory safety. Hint: it’s often the vast majority of them.
Edit: of course you're always allowed to check and discard the error. No language can stop people from purposefully shoot themselves in the foot, but at least safeties can be installed.
You can easily silence such a warning by writing `let _ = f(...)`, though, but I don't think that's a bad thing.
Presumably they need more DevOps skills...
iVerify pushes news with analysis of every new public exploit for iOS. Here are the instructions that it also posted to twitter (https://twitter.com/IsMyPhoneHacked/status/12529544579540090...)
1. Go to Settings > Password & Accounts. Set Fetch New Data to "Manual" and disable "Push". This will ensure that new mail is only downloaded when you specifically request it, and it will no longer do so automatically.
and/or
2. Use Safari or different e-mail clients such as GMail and Outlook. These mail clients are unaffected by the currently disclosed 0days.
https://blog.trailofbits.com/2019/11/14/introducing-iverify-...
https://www.vice.com/en_us/article/bjw474/this-app-will-tell...
The attacks profiled by Volexity earlier this week, the MobileSafari exploits that China was using to spy on Uyghurs, are now detected by iVerify. They released enough information that we pushed an update to all iVerify users to alert their phones if they were compromised.
The Volexity report is here: https://www.volexity.com/blog/2020/04/21/evil-eye-threat-act...
See: https://www.apple.com/business/docs/site/AAW_Platform_Securi...