Forensics

Recovering an LLM prompt from VRAM

Ollama keeps no history, but the KV cache in VRAM holds one vector per token. On a plain transformer they map back to the exact prompt; on a hybrid, partly.

Series to

Apple internals

The iOS security stack for vulnerability researchers, layer by layer, from the Boot ROM to the Objective-C runtime.

  1. #0, Start here: The Apple security stack
  2. #1, Boot chain: The iOS chain of trust
  3. #2, Kernel: XNU under the hood
  4. #3, Code signing: The iOS code-signing pipeline
  5. #4, Sandbox: The iOS sandbox
  6. #5, IOKit: IOKit up close
  7. #6, IPC: Mach messages, MIG and XPC
  8. #7, Zone allocator: The zone allocator up close
  9. #8, PAC: Pointer authentication
  10. #9, Monitors: SPTM, TXM and memory tagging
  11. #10, Userland: The Objective-C runtime and the shared cache
The 11 posts as a list
System Internals

Apple internals #9: SPTM, TXM and memory tagging

Page-table writes and code-signing decisions left the kernel's privilege level. A kernel with arbitrary read/write must ask two monitors, SPTM and TXM, instead.

System Internals

Apple internals #8: Pointer authentication

On arm64e the hardware signs the pointers worth hijacking and checks them on use. The key is out of reach of any memory write, so attacks work around it.

System Internals

Apple internals #7: The zone allocator up close

A memory-corruption bug is worth little until you decide what sits next to what you corrupted. Since iOS 15 the allocator decides that, not you.

System Internals

Apple internals #6: Mach messages, MIG and XPC

One way out of a sandbox is a service doing exactly what it was built to do, for a caller it misidentified. Mach messages, MIG, XPC, and what decides it.

System Internals

Apple internals #5: IOKit up close

IOKit is the widest kernel surface a sandboxed iOS process can reach: hundreds of drivers, each vending a user client. Where the bugs live, plus CVE-2022-32832.

System Internals

Apple internals #4: The iOS sandbox

AMFI decides what may run; the sandbox decides what a process may touch. The profile is that list, and escaping is more often reading it than corrupting memory.

System Internals

Apple internals #3: The iOS code-signing pipeline

AMFI's rejection is the last line of a longer check: a MACF module and a verdict keyed on one 20-byte cdhash, from trust cache through CoreTrust to amfid.

System Internals

Apple internals #2: XNU under the hood

XNU taken apart from an attacker's view: the Mach and BSD hybrid, the port-as-capability model the whole iOS security stack rests on, and what tfp0 actually is.

System Internals

Apple internals #1: The iOS chain of trust

iOS runs nothing it hasn't verified. The boot chain walked in reverse, from the Boot ROM through iBoot and Image4 to the kernelcache, with a stop at checkm8.

System Internals

Apple internals #0: The Apple security stack

The index for the series: ten posts from the SecureROM to objc_msgSend, what each layer of the iOS security stack decides, and which post covers which layer.

Reverse Engineering

How I broke Rhysida ransomware encryption

Rhysida derives every per-file AES key from a PRNG seeded with the encryption timestamp. Recover the timestamp and you regenerate every key.

Vulnerability Research

Sigreturn-oriented programming

One syscall reloads the whole CPU context from the stack. Forge the frame it reads and you control every register in one step. The technique we are named after.

Reverse Engineering

Building the smallest ELF program

From a default 16,704-byte hello world down to 73 bytes: stripping the toolchain layer by layer, removing sections, and overlapping the ELF and program headers.

Vulnerability Research

Javascript engine exploitation methodology

Recording of my talk on Javascript engine exploitation methodology, given in French at Quarks in the Shell 2023 (Quarkslab).

Vulnerability Research

ActiveX controller exploitation

Exploiting CVE-2011-4187, a stack buffer overflow in Novell iPrint Client's ActiveX component, from CVE ID to arbitrary code execution on Windows XP.

Reverse Engineering

Recovering payloads from PE resources

A packer hides a compressed payload in a PE's .rsrc section and unpacks it in memory at runtime. Reconstructed end to end, so you can pull the payload out.