Bill Marczak Profile picture
Oct 26 23 tweets 4 min read Twitter logo Read on Twitter
NEW: Kaspersky releases full details on how they captured the “Triangulation” (suspected US Government) exploits and iPhone spyware targeting their employees. securelist.com/operation-tria…
The way Kaspersky wrote this, it's an interesting case study of defenders working out how to capture a zero-click exploit. I especially like that Kaspersky said what they tried that *didn’t work*, in addition to what did ultimately work. Let’s dive in with a thread!
If you’re a researcher who’s never captured an exploit chain from a threat actor “on the wire” recently, then you might not have run up against several “annoying roadblocks” that face a defender who sets out to complete this task.
FIRST, mobile phones like iPhones have “certificate pinning”, where ~all communications with Apple servers will fail unless they are authenticated with a specific hard-coded (pinned) TLS certificate. This means that there’s no using mitmproxy to peer into comms with Apple servers
So what if you want to capture a malicious iMessage like the one Triangulation used (sent via Apple servers)? There’s no playbook, but Kaspersky was in luck: years of iMessage hardening means most exploits are now sent via (out-of-band) attachment rather than in the iMessage body
Here’s one thing Kaspersky tried: employees whose phones were previously hacked signed into a Mac device with their iCloud accounts, hoping Triangulation would send malicious iMessage attachments to the Mac (where Kaspersky could capture them much more easily than on an iPhone)
No such luck! Why? On your iCloud account, each device (each of your iPhones, iPads, Macs, etc) has a separate “push token” (say, for the “com[.]apple[.]madrid” -- iMessage -- “APNs (Apple Push Notification Service) topic”).
It takes a bit of work, but you (or anyone with an iCloud account) can look up (say) iMessage “push tokens” by connecting to the com[.]apple[.]madrid-lookup service and specifying an email address or phone number for the iCloud account you want to look up.
It’s not necessarily immediately trivial to see which push tokens are for an iPhone (versus, say, a Mac, or iPad), but perhaps you (the attacker) can understand this through clever querying, or by “probing” different “APNs topics” on the device.
Anyway, since the destination of an APNs message (e.g. an iMessage) is a single push token, you (the attacker) simply send your exploits only to those push tokens representing the iPhone(s) you want to target, and omit the Mac Minis and everything else.
So that’s why Kaspersky’s gambit didn’t work there.. But on to the next thing they tried: as is pretty standard for messaging apps (e.g., iMessage, WhatsApp ...), attachments are transmitted out-of-band via an HTTPS link (plus a decryption key) included in the message body.
The link and the decryption key are locally recorded. BUT, of course, if the message gains code execution (when it gets processed by iMessage), then what’s the first thing it’s gonna do?? Delete these records obvi. So you need a way to get at them before they’re deleted.
What Kaspersky did here was actually pretty ingenious. They flipped a few bits of the iMessage payload on-the-wire, causing it to fail to download, but still causing the metadata (the HTTPS URL for the attachment, and its decryption key) to be recorded on the phone.
They thus guaranteed that the attachment wouldn’t get code execution. They obtained the URL and decryption key from a regular iTunes backup. Then, Kaspersky just fetched (and decrypted) the attachment at their leisure! Gotta remember this technique 😀
What was the attachment? A malicious .watchface file that forced the phone to open a browser and navigate to a malicious URL (!!!) (Would love to know how that worked). Anyway, now we're in the browser, facing a second roadblock...
SECOND, as is standard these days, ~every competent threat actor uses JavaScript (JS) to do (e.g.) a Diffie-Hellman key exchange between the browser and the exploit server before fetching further exploits/spyware, in order to evade mitmproxy.
In this scheme, a “public” and “private” key are generated; the threat actor JS sends the “public” key to the exploit server, but only the “private” key (safely ensconced in the web browser’s memory) can be used to decrypt the exploits sent back by the exploit server.
This means that a naive “just use mitmproxy to strip the TLS, bro” solution doesn’t work, you need to do more. And, by the way, you can’t dump the web browser’s memory to recover the private key (no memory dumps on phones unless you, the defender, have an exploit to do this).
So you’re stuck right? Well not exactly. As Kaspersky shows, the standard playbook here is you (the defender) use here is you use mitmproxy to modify the threat actor’s encryption code as it is downloaded to cause it to generate a keypair where you “already know” the private key
At this point, Kaspersky just kept iterating through the various stages, modifying code as it was downloaded to subvert the attacker's encryption and obtain the next stage, until they got to the final payload.
So what are the takeaways for attackers here? Well first, don’t target security researchers! There’s a *huge* advantage that defenders get in terms of capturing and burning exploits/spyware when *they are* the target (vs someone else they're trying to defend).
Second, if you must target security researchers, don’t target them “too often” with the “same” tradecraft, otherwise they’ll do exactly what Kaspersky did: learn a tiny bit from each successive attack and ultimately gain enough knowledge to fully capture your exploits/spyware.
Third, gather telemetry on your attacks, and watch it like a hawk! Victim takes 3 seconds too long to fetch the next exploit or stage of spyware? Failures on a target exceed a threshold? Then your operations room should look like the Starship Enterprise during a Red Alert

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Bill Marczak

Bill Marczak Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @billmarczak

Apr 11
One neat technical detail we found while analyzing QuaDream's spyware () was the mechanism by which it subverts iCloud's two-factor authentication, presumably as part of a scheme to exfiltrate the user's data directly from iCloud.
iCloud's two-factor authentication appears to use a TOTP (time-based one-time-password) scheme, in which two-factor authentication codes valid for any time are entirely determined by applying a function to (1) the time and, (2) some private information present on the phone.
Rather than stealing (2), the way the spyware appears to defeat this scheme is by injecting code into the phone's heavily obfuscated "adid" process (part of the phone's Anisette framework), and hooking the "gettimeofday" syscall to fool "adid" about the current date and time.
Read 4 tweets
Apr 11
Check out our NEW @citizenlab report "Sweet QuaDreams: A First Look at Spyware Vendor QuaDream’s Exploits, Victims, and Customers", in which we uncover traces of a new iOS 14 zero-click deployed against civil society from (at least) Jan through Nov 2021 citizenlab.ca/2023/04/spywar…
The zero-click exploit, which we call ENDOFDAYS, appears to have made use of invisible malformed "Meeting" invitations processed by the iPhone's calendar app. ENDOFDAYS looks to have been deployed as a zero-day against iOS versions 14.4 and 14.4.2, and maybe other versions.
So, who are QuaDream's customers? Based on our Internet scanning and infrastructure analysis, we believe that QuaDream operators are located in AE, BG, CZ, HU, GH, IL, MX, RO, SG, and UZ (unclear if IL is customer or just QuaDream themselves) and potentially other countries too. Image
Read 16 tweets
Sep 29, 2022
NEW REPORT today from @Reuters @JoelSchectman providing more detail about fatal flaws in the CIA's defunct communications network. Iran and China compromised the network in 2011, and killed dozens of CIA assets reuters.com/investigates/s…
You probably first read reporting about the Iranian and Chinese compromise of the CIA's covert communications network in @JennaMC_Laugh and @zachsdorfman's excellent 2018 Yahoo News story: news.yahoo.com/cias-communica…
The CIA network reportedly consisted of benign looking websites with a hidden communications functionality, used by assets around the world to communicate back and forth with their agency handlers.
Read 14 tweets
Jan 13, 2022
New @citizenlab report, #ProjectTorogoz, documenting the use of NSO's Pegasus spyware in El Salvador, in collab w/ @AccessNow, w/ assistance from @FrontLineHRD @MohdMaskati, @socialtic, and @fundacionacceso, and w/ peer review from @AmnestyTech citizenlab.ca/2022/01/projec…
We confirmed, through forensic analysis, 35 cases of journalists and civil society members whose phones were successfully hacked with NSO Group's Pegasus spyware from July 2020 through November 2021.
The targets included journalists at @_elfaro_, @GatoEncerradoSV, @prensagrafica, @Disruptiva2, @ElMundoSV, @EDHNoticias, and 2 independent journalists. Also NGOs @fundaciondtj, @cristosal, and another (anonymous) NGO.
Read 18 tweets
Oct 24, 2021
New @citizenlab report "BREAKING THE NEWS", in which we show how New York Times journalist Ben Hubbard was hacked with Pegasus twice (July 2020 and June 2021), both after he complained to NSO about previous hacking attempts against him citizenlab.ca/2021/10/breaki…
We attribute the spyware to NSO Group with high confidence. NSO Group says that it couldn't have been them for "technical and contractual reasons," but it's quite likely they're wrong. We conclude it was their spyware with high confidence, as we show in our report.
Our confidence is bolstered by the fact that Hubbard's case has excellent evidence: he regularly took backups of his iPhones, so we can compare the before-and-after cases, and notice the telltale signs of Pegasus introduced onto (or deliberately cleaned up from) the phone.
Read 4 tweets
Sep 13, 2021
Stop and UPDATE your iPhones to iOS 14.8 NOW!!! We @citizenlab recovered NSO Group's FORCEDENTRY zero-click exploit (CVE-2021-30860) from the phone of a Saudi activist, and shared w/ Apple, who released iOS 14.8 today with a fix. citizenlab.ca/2021/09/forced…
We found the exploit and shared w/ Apple last Tuesday (Sep 7), and they released a fix today (six days later), underscoring the urgency of the update.
The exploit is invisible to the target, but in our forensic analysis, we found 31 files with the ".gif" extension on a target's phone. Of course, they weren't GIFs at all! 27 of them were the same 748-byte Adobe PSD file, and four were PDFs.
Read 4 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(