Code Monkey home page Code Monkey logo

acorn's Introduction

Bugs and techniques to achieve untethered+unsandboxed code execution in iOS 11

Credits:
    @littlelailo - racoon bug (originally @pod2g)
    @S1guza - ASLR bug
    @ZecOps - sandbox escape writeup
    nemo - objective-c tricks
    @_bazad - memory spray
    @NedWilliamson - socket bug (exploit by @Jakeashacks)
    @5aelo - phrack JSC paper

Add iOS racoon executable and dyld_shared_cache_arm64 to device/ and type make.  Then collect racoon.conf and stage2.bin.  Enjoy!
        stage{2,5,6}.{bin,js} should be renamed according to STAGE{2,5,6}_NAME in config.h

===

racoon.conf
    use 'wins4'/'dns4' to write arbitrary bytes at relative offset, targeting `lcconf`
    point `lcconf` at the `_platform_memmove` lazy pointer and smash it
    use 'banner' to call `strlcpy` which loads the smashed lazy pointer with controlled data

stage1 sits inside the banner string and must not contain local pointers (runs at unknown address):
    1. remap shared cache at known address
    2. remap stage2 at known address inside racoon address space (stage2 must be on-disk, and must be accessible from the racoon sandbox)
    3. stash the current slide at stage2[0]
    4. jump to stage2

stage2 runs inside racoon at fixed address:
    1. relocate itself using stage2[0]
    2. fix back `_platform_memmove` lazy pointer
    3. unmap the secondary shared cache
    4. relocate stage3
    5. relocate stage4 and write it to disk (stage4 location must be accessible from the racoon sandbox)
    6. trigger cfprefsd bug
        push stage3 at GUESS_ADDR in a spray thread
        trigger cfprefsd bug which will execute stage3 in the faulty thread

stage3 is inside cfprefsd spray thread and must not contain local pointers (runs at unknown address after pivot):
    1. copy back itself on the faulty thread stack, because the spray thread will vanish
    2. pivot by means of `memmove+4`
    3. remap stage4 at known address inside cfprefsd address space
    4. jump to stage4, with x0 pointing inside the faulty thread stack

stage4 runs inside cfprefsd at fixed address:
    1. run the unsandboxed payload
        load and relocate stage5 at arbitrary address (faulty thread stack)
        jump to stage5

stage5 runs unsandboxed inside cfprefsd's stack:
    1. dlopen(JavaScriptCore)
    2. set up a leakval primitive & read/write/call for stage6
    3. run stage6.js

===

stage2 is split in two parts
    a. the auto-reloc code: uses gadgets from the shadow cache
    b. the actual code: uses gadgets from the main shared cache
stage2 begins with `rope` and ends with `rope_end`
    *rope = stage2[0] = slide
    external relocations is an array of offsets, each offset being relative to `rope`
    external relocations start with a 0, so it can be parsed backwards

stage3/4 have the same type of external relocations as stage2
stage5 has the same type of external relocations as stage2, preceded by local relocations of the same kind

acorn's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

acorn's Issues

/

@

iOS 10 Port Possible?

Just a noob casually passing by. I know this is more driven to iOS 11.x, and just wondering how far this can actually be pushed to support other versions. I have a 5S jailbroken on 10.3.3 with Spyware JBME and wondered if this can be ported to the JBME or even replace it. And I fully aware of this "may" not be stable at the moment, but I'm willing to test for iOS 10 support if possible. Anyways, sorry for the noob question. Any thoughts or suggestions will be appreciated :D

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.