News for hackers. Stuff that matters.
Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by gzer0 on Friday September 08, 2023 @01:31AM (#37429741)
My best guess is that the vulnerability existed in the image processing libraries used to render PassKit attachment previews in iMessage. Specifically, there was likely an issue in the JPEG/PNG image decoders that are part of CoreGraphics framework on iOS.

When rendering a PassKit image attachment, the iMessage app would call CGImageCreateWithJPEGData or CGImageCreateWithPNGData to decode the attached image file. However, the decoders likely did not properly bounds check the dimensions specified in the image header.

By crafting a malicious JPEG/PNG that specified inflated dimensions, an attacker could cause the decoders to allocate an overly large buffer to hold the decoded pixel data. When copying pixel data from the file into the buffer, the attacker could overflow the bounds of the buffer and overwrite adjacent memory.

The PassKit image preview process likely ran with elevated system privileges intended for rendering app content seamlessly. So the overflow could allow overwriting pointers stored in adjacent memory. By overwriting a function pointer, the attacker could divert code execution to their own shellcode embedded in the image file.

The shellcode would then disable memory protections like ASLR and DEP that normally prevent arbitrary code execution. This would allow the attacker to execute a ROP gadget chain or other payload to jailbreak the sandbox and run remote commands on the device.

Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by danieldk on Friday September 08, 2023 @01:35AM (#37429775)
That’s in line with Apple’s security note, which says that it’s a vulnerability in ImageIO:

https://support.apple.com/en-us/HT213906

I wonder though, wasn’t Blastdoor supposed to stop these privilege escalations in their tracks?

Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by gzer0 on Friday September 08, 2023 @01:49AM (#37429880)
While the blastdoor sandbox was a major architectural improvement, it seems vulnerabilities were still present either in the code it relies on, the sandbox policy itself, or due to complex memory corruption bypass techniques.

Some possibilities for how exploit could bypass protections of the blastdoor sandbox:

- The vulnerability was in an image decoding library that blastdoor calls, but which runs outside the sandbox. CoreGraphics frameworks are likely not sandboxed themselves. So memory corruption there could still lead to privilege escalation.

  * The CoreGraphics frameworks like CGImage are core system libraries that predate Apple's sandboxing technologies. They were likely not designed with sandboxing in mind.
  * These graphics libraries need to be able to access hardware acceleration features like OpenGL/Metal, read and write image files, and render to the screen. Sandboxing them would likely break many of those features.
  * Apple may have determined that completely sandboxing mature system frameworks like CoreGraphics would impose too much performance overhead across the OS.
  * As a result, for backwards compatibility and performance reasons, Apple seems to have exempted these core graphics libraries from being sandboxed processes.
- The sandbox profile may allow more syscalls or access than necessary. The syscall filter is still in "permissive" mode. So kernel escalation could still be possible.

- Payload encryption and upload to iCloud bypasses blastdoor. So compromise of an external service could have allowed running outside the sandbox.

Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by glitchcrab on Friday September 08, 2023 @04:41AM (#37431122)
More LLM generated nonsense I suspect
Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by abhishekjha on Friday September 08, 2023 @02:00AM (#37429940)
Is there a POC for the same for a novice in the hacking field?

Would love to see it run myself.

Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by saagarjha on Friday September 08, 2023 @02:22AM (#37430111)
The bug is in the WebP decoder. Shellcode execution is not been a thing on iOS because of codesigning. ROP is basically not a thing on new devices because of PAC.
Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by nicce on Friday September 08, 2023 @02:24AM (#37430125)
> The shellcode would then disable memory protections like ASLR and DEP that normally prevent arbitrary code execution. This would allow the attacker to execute a ROP gadget chain or other payload to jailbreak the sandbox and run remote commands on the device.

This sounds like chicken - egg scenario. Can you clarify how original shellcode bypasses those protections?

I don’t think you can disable DEP on runtime.

Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by kafrofrite on Friday September 08, 2023 @02:41AM (#37430262)
DEP is a Windows implementation of a non-executable stack, i.e., memory permissions that do not allow execution on specific pages. Depending on the situation, an attacker can e.g., mmap() a new page with the execute permission set, write his shellcode there and jump there. Another way to bypass the NX bit is to actually use gadgets (snippets of code essentially) that are already there in the code thus they can be executed and redirect your instruction pointer to those addresses. Reusing code is generally known as ROP, JOP etc. and is mitigated by PAC for ARM (after v.8.3) and CFI for Intel (11th Gen onwards I believe).

That being said, Apple implements a ton of mitigations, both on a hardware level and on a software level which generally makes exploits on Apple devices interesting to analyze and see how they bypassed stuff.

Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by codyd51 on Friday September 08, 2023 @02:33AM (#37430195)
There are some misconceptions in your comments that I think could be useful to clear up.

When exploiting a running system, your goal typically won't be to disable ASLR (which would only impact newly spawned processes), but instead to 'infoleak' where ASLR has placed important things you care about, so you know where to access them.

Modern devices have mechanisms like KPP/KTRR, though, which make it impossible to modify kernel code anyhow.

You also propose that CoreGraphics might not be sandboxed. CoreGraphics is a dynamic library which can be loaded into any process. It's _processes_ that are sandboxed, not dynamic libraries, so CoreGraphics can definitely exist in a process that has a sandbox profile applied just fine.

You also mention that graphics functions might not be sandboxed because they need to access graphics acceleration features. This is a good thought! In fact, the kernel extension that enables hardware graphics acceleration, IOMobileFramebuffer, is accessible from the app sandbox for this very reason. As a point of interest, many vulnerabilities have been discovered in IOMobileFramebuffer over the years -- it's an attractive target specifically because it's reachable from the app sandbox.

Lastly, you mention jailbreaking the sandbox. I know what you mean, but "jailbreaking" typically refers to a series of abilities, such as the ability to control the kernel task, the ability to create RWX pages, the ability to bypass the FreeBSD MAC policies, etc. The ability to bypass sandbox restrictions is only one condition of a jailbreak, and a sandbox escape doesn't imply a full jailbreak. Also, jailbreaking doesn't entirely break "the sandbox" -- it's a selective change that can be applied on a per-process basis.

Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by tuyiown on Friday September 08, 2023 @04:12AM (#37430925)
> You also propose that CoreGraphics might not be sandboxed. CoreGraphics is a dynamic library which can be loaded into any process. It's _processes_ that are sandboxed, not dynamic libraries, so CoreGraphics can definitely exist in a process that has a sandbox profile applied just fine.

Surprisingly, the decoding process had an extra step that did decoding out of the sandbox not so long ago, hopefully it's fixed now.

https://googleprojectzero.blogspot.com/2021/12/a-deep-dive-i...

Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by wffurr on Friday September 08, 2023 @06:47AM (#37431980)
The JBIG2 based emulator never fails to amaze me.
Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by kubov on Friday September 08, 2023 @02:47AM (#37430312)
I dont know why, but this reads like a LLM output.
Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by rollulus on Friday September 08, 2023 @03:48AM (#37430743)
Looking at their history you’re likely right. Downvoted.
Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by rollcat on Friday September 08, 2023 @04:30AM (#37431043)
What's the point? It'll get feedback and get better at dressing up the noise.
Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by nicce on Friday September 08, 2023 @05:12AM (#37431339)
Do we want to encourage the use of LLMs in discussion? Soon there will be just LLMs...
Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by intelVISA on Friday September 08, 2023 @10:29AM (#37433959)
As an HN poster I endorse $yc and dislike $microsoft
Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by rollcat on Friday September 08, 2023 @05:03PM (#37439392)
> Do we want to encourage the use of LLMs in discussion?

Quite the opposite, but I think we need a better strategy. Downvoting a single offending comment is giving the spammer precise feedback on what worked and what didn't. Bot accounts should just be banned.

Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by nicce on Friday September 08, 2023 @03:54AM (#37430785)
Especially the final section makes much more sense now..
Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by pietro72ohboy on Friday September 08, 2023 @04:39AM (#37431112)
Such comments are now becoming the new “low-effort shitpost” on HN. If somethings unclear or incorrect, pointing it out may be a better idea
Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by xyst on Friday September 08, 2023 @04:18AM (#37430961)
Wow, so pretty much any app that renders images can be impacted. I also see this is a relatively old attack vector. Not something that’s novel.

What a blunder.

Re:NSO Group iPhone Zero-Click, Zero-Day Exploit Captured in... by top_sigrid on Friday September 08, 2023 @04:22AM (#37430986)
For a „best guess“ you’re making quite detailed assumptions, of which I have no idea and you bring up no reasons how you can assume these.

In the note they state that the exploit was in image processing with PassKit and iMessage. Your comment somehow reads like an extrapolation what might have happened without any more actual knowledge that you share.