< Return to Video

Nintendo Hacking 2016 (33c3)

  • 0:00 - 0:18
    33C3 preroll music
  • 0:18 - 0:24
    Herald: Good evening, everyone. In a few
    minutes, the Nintendo Hacking 2016 talk
  • 0:24 - 0:28
    will start. This talk will will be
    translated into German, and there are
  • 0:28 - 0:34
    English subtitles available. Anyway,
    without much further ado. These are
  • 0:34 - 0:38
    derrek, naehrwert and nedwill. They are
    three students that have been working on
  • 0:38 - 0:42
    hacking Nintendo platforms for a while
    now, and please give them a warm applause.
  • 0:42 - 0:54
    applause
  • 0:54 - 1:01
    naehrwert: Hi guys. So, welcome to our
    talk about Nintendo Hacking 2016. Let me
  • 1:01 - 1:06
    quickly introduce the other guys. This is
    derek, and that's ned, and I think I can
  • 1:06 - 1:11
    speak for the three of us to say that I am
    really happy that you guys are here today
  • 1:11 - 1:15
    and we are happy that we can be here today
    to tell you everything about what we did
  • 1:15 - 1:23
    in the past one and a half years. I will
    start with the state of the Wii U. I hope
  • 1:23 - 1:29
    a lot of you guys have seen failOverflow's
    talk in 2013 about hacking the Wii U. Not
  • 1:29 - 1:39
    much happened afterwards, until 2015 there
    is a public webkit exploit released and
  • 1:39 - 1:44
    this time we started looking into the Wii
    U. And, we wanted more access, right? Than
  • 1:44 - 1:48
    just user mode and because there is also
    the kernel running on a PowerPC and then
  • 1:48 - 1:54
    there is this other ARM processor that
    runs IOSU. Also user mode and kernel mode.
  • 1:54 - 1:58
    I am not going to consider the user mode
    today. Because I think there are currently
  • 1:58 - 2:06
    exploits that are way more fun. So, let's
    start with PowerPC kernel very quick. It
  • 2:06 - 2:10
    has all standard basic security measures,
    though it doesn't have any ASLR which
  • 2:10 - 2:20
    makes our lives easier. It has about 140
    syscalls. And we don't really.. We can't
  • 2:20 - 2:25
    really name them from start, right? Kinda
    need to reverse them. But there's a nice
  • 2:25 - 2:29
    thing. So, the Wii U uses this RPL
    mechanism for dynamic libraries. And
  • 2:29 - 2:34
    there's this really nice library. It's
    called coreinit.rpl and it contains a lot
  • 2:34 - 2:38
    of syscalls, shims and symbol names. So we
    can name all syscalls straight away
  • 2:38 - 2:44
    without much hassle and, it is important
    to know that all the syscalls use the safe
  • 2:44 - 2:50
    copy in/copy out mechanism to get data
    from the user space into the kernel space.
  • 2:50 - 2:56
    So we start reversing each syscall and we
    start looking for bugs And what we came
  • 2:56 - 3:02
    out with, at first, this is what we call
    I/O controlled VHAX Or, why indirections
  • 3:02 - 3:08
    are hard. It's actually a bug in the
    IPCKDriver_SubmitRequest syscall so what
  • 3:08 - 3:14
    this syscall is used for is: you want to
    submit requests from user mode to this
  • 3:14 - 3:20
    other processor running which I'm going to
    talk about later. And, so you submit this
  • 3:20 - 3:25
    kind of request structures and the kernel
    uses copy in to fetch the request
  • 3:25 - 3:29
    structure from user mode into kernel mode
    but there's a certain type of request
  • 3:29 - 3:35
    structure which contains an indirection
    like a second layer, right? And, well,
  • 3:35 - 3:41
    they just ignore that for the second level
    and hope for the best. So, let's look at
  • 3:41 - 3:45
    the relevant part. I'm really sorry I'm
    showing you this code here, but it's not
  • 3:45 - 3:49
    much more than that. So, there is
    something that is called ios packet in the
  • 3:49 - 3:54
    second line which is kind of this request
    that we submit from user mode into kernel
  • 3:54 - 3:58
    mode And in the top line there's this
    special request entry, so it contains a
  • 3:58 - 4:03
    physical address, a buffer size and a
    virtual address. And what we do from user
  • 4:03 - 4:08
    mode is we submit it filled out with the
    virtual address and the size. and the
  • 4:08 - 4:16
    kernel does this convenient thing for us.
    It kind of.. changes the virtual address
  • 4:16 - 4:21
    to the physical address. So we can see, it
    copies in these packets from user mode
  • 4:21 - 4:26
    into kernel mode using the safe mechanism
    and then it goes through all the entries
  • 4:26 - 4:30
    and fixes up the physical addresses for us
    but we can see in this line that it
  • 4:30 - 4:34
    doesn't use to the safe mechanism at all
    it doesn't care about whatever address we
  • 4:34 - 4:39
    put in there so this gives us some kind of
    right primitive to wherever we want
  • 4:39 - 4:46
    basically and this looks hard to exploit,
    right? Because the right kind of going
  • 4:46 - 4:55
    through this conversation but we actually
    only need one byte to exploit the kernel
  • 4:55 - 5:02
    and we do this by noting that this
    KIEffectiveToPhysical conversion function
  • 5:02 - 5:08
    actually returns 0 for any garbage input
    we get and there's a pretty high chance of
  • 5:08 - 5:14
    the input to the function to being garbage
    if we point to any part inside kernel data
  • 5:14 - 5:20
    so the strategy here is that we go into
    syscall handler address table and we
  • 5:20 - 5:25
    overwrite the last byte for one particular
    syscall handler and we hope that the new
  • 5:25 - 5:30
    address actually points to some usable
    gadget so we hope for the best basically
  • 5:30 - 5:34
    and the other important thing to note here
    is that our user mode code is running from
  • 5:34 - 5:38
    what we call the JIT area and what's
    really stupid is that the JIT area is
  • 5:38 - 5:44
    actually executable from kernel mode for
    some reason so that's nice too. Okay,
  • 5:44 - 5:50
    let's look at the relevant structures so
    this is the kernel and we should read this
  • 5:50 - 5:56
    from the bottom to the top. Ok, like in
    the last line the button we see this entry
  • 5:56 - 6:03
    to KeLoaderCall and then we can look at
    the last byte there it's hex F0. And what
  • 6:03 - 6:11
    we will do now is overwrite this last byte
    with 0 and what happens is that now this
  • 6:11 - 6:16
    syscall will actually point to this
    very usable gadget up there where it loads
  • 6:16 - 6:21
    this register r28 into the link register
    and just branches there the nice thing is
  • 6:21 - 6:28
    that we control our 28 from user mode so
    this gives us a way to just jump anywhere
  • 6:28 - 6:36
    basically so how do we exploit this. Well,
    we have our k-mode function there then we
  • 6:36 - 6:42
    just call ioctlv to this shifted address
    and from this point on we have this nice
  • 6:42 - 6:46
    syscall that just comes to anywhere we
    want and then we call it basically and
  • 6:46 - 6:53
    this calls our k-mode function. So, the
    Wii U starts out with full four hearts and
  • 6:53 - 7:00
    this gives us PowerPC kernel mode code
    execution so we subtract one hard and it's
  • 7:00 - 7:06
    quite nice but we can and need to go
    deeper and for that let's look at the IOSU
  • 7:06 - 7:12
    architecture. So IOSU is present as one
    big ELF file and this includes the kernel
  • 7:12 - 7:18
    and all the services and it's running on
    the Starbuck it, has a hardware way to
  • 7:18 - 7:24
    enforce no execute and again no ASLR,
    making our lives easier and it's a
  • 7:24 - 7:31
    microkernel design that has about a 140
    syscalls so another thing to notice that
  • 7:31 - 7:36
    the kernel spawns all these services as
    user mode processes so before we can
  • 7:36 - 7:40
    exploit the kernel we actually have to
    exploit one of these user mode processes
  • 7:40 - 7:46
    which we did but i'm not going to talk
    about and to look into the kernel, we
  • 7:46 - 7:52
    began by reversing all of the syscalls and
    search for bugs and what we came up with
  • 7:52 - 7:56
    is called MQHAX or message queue hax it
    contains another nice bug class that
  • 7:56 - 8:05
    apparently never dies. Integer overflows.
    And let's look at the code again so
  • 8:05 - 8:10
    there's this syscall, it's called create
    message queue you pass it a buffer and a
  • 8:10 - 8:14
    number of buffer entries and what they
    assumed was that each buffer entry is four
  • 8:14 - 8:18
    bytes so when they check the address range
    to just multiply the number of entries
  • 8:18 - 8:24
    with four bytes so does anyone see the
    integer overflow here and then a nice
  • 8:24 - 8:28
    thing is that it just to use the number of
    entries for the maximum number of entries
  • 8:28 - 8:34
    for the message queue and our right
    primitive again is the send message
  • 8:34 - 8:41
    syscall. So, I told you about this
    hardware NX right? So IOSU should be
  • 8:41 - 8:48
    enforcing that no executable memory is
    writeable and if you look at the kernel
  • 8:48 - 8:52
    section flags we actually see that
    KERNEL_TEXT is read execute and
  • 8:52 - 8:59
    KERNEL_DATA is read-write but these
    permissions are all lies. Ok so our
  • 8:59 - 9:05
    exploit strategy: well, let's look at the
    relevant part of the IOSU kernel so we see
  • 9:05 - 9:10
    that KERNEL_TEXT starts at this lower
    address, at hex 0x08120000 and
  • 9:10 - 9:15
    conveniently for us there is a syscall
    there and the addresses before that are
  • 9:15 - 9:21
    all valid so we create a message queue,
    I'm starting at minus eight bytes and this
  • 9:21 - 9:28
    magic hex 0x400- whatever-2 number and
    from this point on we just push two
  • 9:28 - 9:33
    messages and then ARM instruction to
    branch out three and what this does is it
  • 9:33 - 9:38
    actually causes the start of text section
    to be overwritten with branch R3 and let's
  • 9:38 - 9:44
    just look at the integer overflow right
    four times this value truncated to 4 bytes
  • 9:44 - 9:48
    gives 8 bytes so what kind of things is
    that the message queues is only bytes but
  • 9:48 - 9:55
    we can just push any messages we want ok
    so this gives us IOSU kernel-mode
  • 9:55 - 10:00
    execution and the nice thing about this is
    that we actually have full control over
  • 10:00 - 10:04
    the console unit now right so we can dump
    the console's OTP which contains all the
  • 10:04 - 10:10
    keys except for boot1 which we will come
    back to later because unfortunately the
  • 10:10 - 10:16
    pieces for boot1 are locked out as we have
    already seen. And now we want to make
  • 10:16 - 10:22
    everything persistent so how do we do
    that? We find that title content is only
  • 10:22 - 10:27
    verified at title install time but never
    at boot time because at boot time they
  • 10:27 - 10:32
    only verify the title binary so what you
    can do is you can actually start to mess
  • 10:32 - 10:39
    with the metadata of titles and overwrite
    it and what we did was to overwrite the
  • 10:39 - 10:45
    ROM for a DS game, exploited the emulator
    and got user mode code
  • 10:45 - 10:50
    execution again and another thing is that
    the console contains this config file
  • 10:50 - 10:55
    which tells it to boot into which
    title to boot so what you can do is you
  • 10:55 - 11:01
    overwrite the title ID with your modified
    DS emulator title and the next time you
  • 11:01 - 11:07
    start up the console it actually boots
    into the exploited game and yeah so just
  • 11:07 - 11:11
    gives us persistent code execution and
    cold boot with full control over to
  • 11:11 - 11:18
    console whatsoever so
    game over
  • 11:18 - 11:26
    applause
  • 11:26 - 11:34
    derrek: So, as we just saw, the kernel
    it's like pretty broken, right? So, what
  • 11:34 - 11:41
    is missing and I just copied this slide from
    failoverflow's talk as you can see we are
  • 11:41 - 11:49
    using the same d14 thing for our slides
    and basically the boot1 key which is the
  • 11:49 - 11:57
    second stage bootloader on Wii U and this
    key is still unknown and they tried to get
  • 11:57 - 12:05
    it somehow with some side-channel attacks
    thing but I think it never worked
  • 12:05 - 12:13
    so it would be nice to get this key and
    the first thing we did was to make a NAND
  • 12:13 - 12:22
    tracer so we can basically sniff all the
    traffic between NAND and boot1 to see what
  • 12:22 - 12:33
    boot1 reads from flash and so we get some
    nice addresses and we could compare this
  • 12:33 - 12:40
    with the file system on the / to see what
    file it is reading and we also kind of
  • 12:40 - 12:47
    mess around with some files on this file
    system and we found out that boot1
  • 12:47 - 12:53
    actually parses a file that is called
    system.xml and I don't know, it doesn't
  • 12:53 - 13:03
    really feel safe to parse an XML file in
    such a really early boot process I mean
  • 13:03 - 13:12
    there's a lot of stuff that could go
    wrong. So, we tried to attack this and we
  • 13:12 - 13:18
    tried some blind exploitation stuff but
    yeah unfortunately it didn't really work
  • 13:18 - 13:29
    so let's try something else. So, there's
    boot1, which of course boots this.. Sorry
  • 13:29 - 13:37
    we've got boot0 and this boots boot1 and
    failoverflow found out that this boot0
  • 13:37 - 13:43
    which is a bootrom of the security
    processor can be re-enabled again in
  • 13:43 - 13:49
    virtual Wii mode and you can just dump it
    so let's look at boot1... boot0 I'm sorry
  • 13:49 - 13:59
    and we can see that it reads boot1 key
    from OTP and then it locks out boot1 key
  • 13:59 - 14:06
    forever and this happens really early but
    it's basically kept in memory all the time
  • 14:06 - 14:15
    until it's done until it has launched
    boot1 or just panicked. So, this means
  • 14:15 - 14:23
    that we have to exploit boot0 to get the
    boot1 key and unfortunately, boot0 is
  • 14:23 - 14:30
    pretty safe it's kind of surprising
    because this is Wii U and basically this
  • 14:30 - 14:38
    gives us this question: How can you
    exploit something that has no bugs? So,
  • 14:38 - 14:44
    the answer is we have to introduce our own
    bugs - laughter - and we're doing this
  • 14:44 - 14:50
    by using fault injection and maybe you
    have heard of it already it's basically
  • 14:50 - 14:58
    you introduce an error into device by a
    glitching the clock, voltage, the reset
  • 14:58 - 15:05
    line you can also do electromagnetic
    injections. There are many ways. But
  • 15:05 - 15:12
    basically what you want to get is a
    mutated instruction, or instruction skip
  • 15:12 - 15:19
    or some corrupted registers and what you
    don't want is just a stupid lock up where
  • 15:19 - 15:28
    it just crashes and yeah that's all really
    useful so we want to glitch boot0 and to
  • 15:28 - 15:37
    do this we have to find a nice target like
    the weak spot of boot0 so let's take a
  • 15:37 - 15:45
    look what boot0 does first thing it does
    is it copies itself to ram for some
  • 15:45 - 15:49
    unknown reason I mean there's no good
    reason to do this but it's nice for us
  • 15:49 - 15:58
    because it copies itself to RAM and just
    executes from there and then it copies the
  • 15:58 - 16:05
    boot1 key to memory it locks out the auto
    key slot initializes some other stuff and
  • 16:05 - 16:12
    flash controller and then it starts
    reading the boot1 image and it does that
  • 16:12 - 16:23
    by just reading its header to this address
    and then they read the size from the
  • 16:23 - 16:31
    header field and they also do some max
    size check on this and please note that
  • 16:31 - 16:38
    the header itself is not encrypted and
    they also don't do any signature
  • 16:38 - 16:50
    verification here at this step so they use
    the size and reads the whole boot1 image
  • 16:50 - 16:55
    using size and then they do a real
    signature verification to make sure that
  • 16:55 - 17:00
    the image is not corrupted it then
    decrypts the boot1 code using the key from
  • 17:00 - 17:09
    RAM and then it clears the key and jumps
    to boot1entry point ok so what is the weak
  • 17:09 - 17:15
    spot here and I mean if you look at this
    you can pretty much already tell what it
  • 17:15 - 17:25
    is and of course it's this size check so
    what we can do is we can write our own
  • 17:25 - 17:32
    modified version of boot1 into flash with
    some really really large size in the
  • 17:32 - 17:44
    header so it reads the header and then
    it's supposed to do a size check and this
  • 17:44 - 17:51
    is exactly where we wanted to glitch it
    and eventually it will just skip the
  • 17:51 - 17:58
    instruction or something else happens and
    then basically the size check is bypassed
  • 17:58 - 18:03
    so when it's reading the boot1 image using
    this size it will actually overflow the
  • 18:03 - 18:09
    buffer and we have some jump instructions
    at the end so when it returns from the
  • 18:09 - 18:17
    flash read function it will eventually
    jump to our code and this is actually
  • 18:17 - 18:20
    boot0 code execution
  • 18:20 - 18:30
    applause
  • 18:30 - 18:35
    ok so we have boot0 code execution and you
    know we can just dump the boot1 key from
  • 18:35 - 18:43
    RAM and we didn't even need an exploit for
    this right so it's just boot0 is actually
  • 18:43 - 18:50
    pretty safe right but when it comes to
    pitching it's kind of fragile
  • 18:50 - 18:58
    because boot0 code is writeable and also
    the boot1 image buffer is in front of boot0
  • 18:58 - 19:05
    buffer so we can just overflow it and also
    the setup that I had was also surprisingly
  • 19:05 - 19:12
    stable so it works like fifty percent of
    the entire time so let's finally look at
  • 19:12 - 19:19
    boot1 and boot1 is able to understand the
    Wii U file system it uses real file path
  • 19:19 - 19:25
    strings to load the firmware image
    and of course the first
  • 19:25 - 19:33
    thing we did was to look at the xml parser
    and well unfortunately it seems pretty
  • 19:33 - 19:44
    safe and yeah but maybe we found a bug
    we're not really sure and we haven't
  • 19:44 - 19:50
    really tried to exploit it. Interest kind
    of faded out because you know it's after
  • 19:50 - 20:00
    all it's just the Wii U so that's it for
    Wii U and now I will hand over to nedwill.
  • 20:00 - 20:03
    He's talking about 3DS
  • 20:03 - 20:12
    applause
  • 20:12 - 20:18
    nedwill: Hi, everyone, I'm ned. I started 3DS
    this year and I'm basically a software
  • 20:18 - 20:23
    person so I'm going to be showing some of
    the homebrew side of 3DS where that's at
  • 20:23 - 20:30
    right now so just to reiterate from last
    year these guys broke userland, kernel and
  • 20:30 - 20:37
    the security processor they also broke the
    secret hardware key scrambler and since
  • 20:37 - 20:44
    then Nintendo has been kind of mad about
    this they released a lot of system updates
  • 20:44 - 20:51
    and they started a bug bounty program so
    there's a lot of bugs getting patched but
  • 20:51 - 20:56
    because of the amount of the level of
    exploitation we got last year it's
  • 20:56 - 21:02
    actually really easy to find new bugs and
    exploits so what I want to emphasize here
  • 21:02 - 21:06
    is that even though it's like a
    cat-and-mouse game because we have so much
  • 21:06 - 21:13
    control we can exploit more difficult
    books on the latest firmware so starting
  • 21:13 - 21:19
    with user space. This is where all
    homebrew comes from so already it's pretty
  • 21:19 - 21:25
    good like this has always been a huge
    focus for the homebrew community because
  • 21:25 - 21:29
    it's kind of where you know user space is
    where you want to be running your own
  • 21:29 - 21:37
    custom games you know modifying stuff so
    we have a bunch of game entry points and a
  • 21:37 - 21:42
    bunch of browser exploits but there's a
    couple limitations to leads and that's
  • 21:42 - 21:51
    that game carts cost money and they
    frequently are.. like the games that are
  • 21:51 - 21:57
    exploited are usually somewhat rare and
    unusual and so the price goes way up as
  • 21:57 - 22:04
    demand soars and for the browser every
    time we release a new browser exploit,
  • 22:04 - 22:10
    Nintendo can actually enforce that you're
    on the latest firmware, because before we
  • 22:10 - 22:16
    fetch any web page it will check that the
    system is on the latest version. So, they
  • 22:16 - 22:24
    can kind of remotely cut off web browser
    exploits. So looking at this I thought it
  • 22:24 - 22:28
    might be fun to look at if any of the
    system titles can be exploitable as
  • 22:28 - 22:37
    primary entry points and I found something
    called SOUNDHAX so just the basic like the
  • 22:37 - 22:42
    two probably most obvious things to look
    at are the image loader because it's got
  • 22:42 - 22:48
    JPEG parsing and also the music player.
    But, when I looked at the music player I
  • 22:48 - 22:52
    saw that they're parsing actually a lot of
    formats and maybe even have their own
  • 22:52 - 23:00
    custom playlists format and if they make a
    single mistake anywhere it's it's over so
  • 23:00 - 23:03
    then I was trying to compare with like
    open source implementations I didn't find
  • 23:03 - 23:11
    any overlap. It seemed like everything was
    custom. So that was pretty promising. So,
  • 23:11 - 23:15
    over the course of about a month, I found
    a bunch of bugs and I was trying to like
  • 23:15 - 23:20
    chain together little like logical bugs
    and it wasn't really working and then I
  • 23:20 - 23:26
    just found one that was really critical.
    So, I'm going to demonstrate that here.
  • 23:26 - 23:29
    So, actually studied mp3 for the whole
    month MPEG was like the
  • 23:29 - 23:36
    last day so I looked at it and they
    actually malloc 256 byte buffer for the
  • 23:36 - 23:43
    song name and then when they go to load it
    if they see a unicode BOM marker they just
  • 23:43 - 23:50
    memcpy the thing and that tag size is
    totally controlled so you know that's
  • 23:50 - 23:56
    that's it so this is like it was pretty
    great but it's a few pics place that's a
  • 23:56 - 24:02
    little tricky but this is what it looks
    like so we have our name chunk that we're
  • 24:02 - 24:09
    about to overflow and then like I'm a CTF
    player, so I put A's there and then the
  • 24:09 - 24:15
    next thing that happens is this gets freed
    and so this victim chunk that we have
  • 24:15 - 24:22
    overridden it's actually the way the 3DS
    heap works they actually track they have a
  • 24:22 - 24:26
    linked list of what things are currently
    allocated so this gives us the classical
  • 24:26 - 24:33
    heap unlink arbitrary write and so at this
    point we have a 4-byte write and we want
  • 24:33 - 24:40
    to get ROP out of it so we'll probably do
    a stack pivot so I looked at the binary
  • 24:40 - 24:47
    and there's only one pivot gadget and then
    i looked at the the thumb pivots, there
  • 24:47 - 24:51
    are actually a lot but because this CPU
    was too old didn't support the wide
  • 24:51 - 24:59
    instructions where all the pivots come up
    so unfortunately that one pivot
  • 24:59 - 25:08
    instruction has some arithmetic conditions
    on it specifically it was that in order to
  • 25:08 - 25:12
    you know load all your registers from
    memory the condition flags had to satisfy
  • 25:12 - 25:19
    less than and everywhere where we return
    from the function it had just checked that
  • 25:19 - 25:23
    like if this pointer is not null free it
    and so the comparisons wouldn't ever be
  • 25:23 - 25:30
    satisfied because nothing is mapped up in
    the negative area so of course CTF
  • 25:30 - 25:38
    workarounds. We can still do this so I
    overwrite the heap freelist head with the
  • 25:38 - 25:43
    stack address and so on the next malloc we
    just return that stack address and read
  • 25:43 - 25:51
    into it so there's a couple of constraints
    on this and the first one is really normal
  • 25:51 - 25:56
    like this is every pivot to stack heap
    thing you have to make sure that you have
  • 25:56 - 26:02
    a heap chunk on the stack and luckily this
    is actually pretty easy because all you
  • 26:02 - 26:07
    need is a size followed by two null
    pointers representing next and previous so
  • 26:07 - 26:12
    when malloc goes to look there it seems
    like the size is big enough and then
  • 26:12 - 26:19
    nothing else is in the queue so just
    return this and then this worked so we
  • 26:19 - 26:24
    memcpy the next tag to the stack and like
    we just specify that size and malloc some
  • 26:24 - 26:31
    unintelligible for us and then from
    there we're done because we can just do a
  • 26:31 - 26:35
    little little ROP chain, we memcpy the
    shellcode to the heap and then use an
  • 26:35 - 26:42
    existing exploit gspwn which has been
    around for a long time to override the
  • 26:42 - 26:52
    text section and jump there so there's the
    first heart so you can't really talk about
  • 26:52 - 26:58
    homebrew without also talking about kernel
    because we want to get access to more
  • 26:58 - 27:03
    syscalls like the 3DS actually sandboxes a
    lot of the syscalls away from you and so
  • 27:03 - 27:09
    as an attacker, your goal is to call some
    syscalls that are restricted a really nice
  • 27:09 - 27:14
    example would be you want to map some
    executable memory for like a JIT emulator
  • 27:14 - 27:21
    so it's kind of a tricky situation because
    you're inside the sandbox you want to
  • 27:21 - 27:26
    break out you have to find bugs in like
    pretty restricted syscalls so I looked at
  • 27:26 - 27:32
    last year's talk here and like what had
    been done so far and it seemed like there
  • 27:32 - 27:37
    are a lot of attacks on that memory
    mapping but I didn't see much about the
  • 27:37 - 27:43
    sync primitives or anything related to use
    after free and i had just got a pretty bad
  • 27:43 - 27:47
    grade on my OS project because i had a lot
    of those so I knew this is a good place to
  • 27:47 - 27:56
    look so I noticed the design flaw when I
    was reversing the ref counting so it's not
  • 27:56 - 28:01
    so much that they couldn't possibly get
    this right but generally when you're
  • 28:01 - 28:06
    designing an API you want to make it
    really hard to abuse and this is just not
  • 28:06 - 28:11
    really true for how they do ref counting
    so I'll go ahead and bring these up yeah
  • 28:11 - 28:19
    so basically they whenever the user
    fetches a kernel object to perform some
  • 28:19 - 28:23
    operation on it meaning you call this
    syscall that does something using the
  • 28:23 - 28:30
    current object it does the correct inc ref
    and then dec ref for you but I was looking
  • 28:30 - 28:33
    at it and thinking well like a lot of
    times the kernel actually is using these
  • 28:33 - 28:38
    objects internally to do stuff so I mean
    I spelled it but like I mean I was like a
  • 28:38 - 28:42
    week I found like 3 use after frees and
    they're all following the same pattern.
  • 28:42 - 28:48
    The kernel's using an object internally
    without maintaining the reference count
  • 28:48 - 28:54
    correctly and then some people ask me like
    advice on kernel hacking maybe like at
  • 28:54 - 28:59
    home I definitely recommend looking here
    I'm sure that there's plenty more so the
  • 28:59 - 29:06
    one going to talk about today is the the
    timer object so this is a pretty simple
  • 29:06 - 29:12
    API with the kernel you can have it create
    a timer for you you can set the timer you
  • 29:12 - 29:18
    can wait on it it's like a normal
    synchronization primitive so like I said I
  • 29:18 - 29:21
    was looking for these use after frees
    I saw this I thought it's kind of
  • 29:21 - 29:27
    interesting that this one called pulse is
    here because what's happening with this
  • 29:27 - 29:35
    one is when you set the timer to pulse
    like every period it's signaling
  • 29:35 - 29:39
    everything that's waiting on it and then
    it like resets itself and then if you wait
  • 29:39 - 29:43
    on it the next period comes around you get
    a signal again and so was thinking like
  • 29:43 - 29:48
    it's definitely doing some stuff with this
    object internally that's like a bit more
  • 29:48 - 29:54
    complicated than some of the other modes
    and the other kernel objects so i looked
  • 29:54 - 30:00
    at how they did the pulse like you know
    every every second whatever, when it
  • 30:00 - 30:07
    pulses like what's actually getting
    executed and if you look here they do some
  • 30:07 - 30:11
    pretty good locking and then they signal
    and then what happens here is basically
  • 30:11 - 30:16
    when they signal they go through and
    everyone that was waiting gets rescheduled
  • 30:16 - 30:22
    - made runnable - and then at the end they
    reset the timer state and just say like
  • 30:22 - 30:28
    okay everyone that waits on this again has
    to wait for the next cycle so and then
  • 30:28 - 30:33
    this also looks pretty good like they
    they're locking the scheduler here this
  • 30:33 - 30:39
    would work but nothing is preventing you
    from just closing this from another call
  • 30:39 - 30:47
    so I have FASTHAX which is just 3 syscalls
    and that's it. That's the entire exploit
  • 30:47 - 30:51
    there's a lot of setup which we will get
    to but you just create the timer set it to
  • 30:51 - 30:58
    run really fast and then close the handle
    and then if it was pulsing and you closed
  • 30:58 - 31:04
    it it will use after free so what's nice
    about this is if you lose the race it's
  • 31:04 - 31:10
    just the timer is just on schedule you're
    fine and then it actually happens quite
  • 31:10 - 31:14
    often and I didn't even really
    specifically try to win this to like I
  • 31:14 - 31:19
    just.. Once it was within a second I don't
    worry about those parameters are probably
  • 31:19 - 31:29
    not optimal so we should look at how do we
    exploit this basically this is a little
  • 31:29 - 31:32
    bit of a more complicated view of it. I'll
    show a diagram in a second but this is
  • 31:32 - 31:38
    like where the use after free actually
    happens so like r7 is pointing to my timer
  • 31:38 - 31:43
    object and then it was freed before we
    reach this chunk here and then it's
  • 31:43 - 31:49
    loading r7 to r0, loading something from
    that and then branching to it so that's
  • 31:49 - 31:55
    like calling a use after free object. So,
    this is pretty exploitable on the 3DS
  • 31:55 - 32:04
    kernel because they use a slab heap to deal
    with allocating objects so this is the
  • 32:04 - 32:09
    normal situation when that first timer is
    allocated the vtable is pointing to the
  • 32:09 - 32:13
    you know the real KTimer vtable and then
    it wants to call that timer reset
  • 32:13 - 32:21
    function. It's totally fine but when we
    free it actually, that vtable pointer goes
  • 32:21 - 32:25
    to the next free timer object in the
    kernel so it's actually interpreting that
  • 32:25 - 32:32
    struct as a vtable and what's nice is it
    actually overlaps with the initial timer
  • 32:32 - 32:39
    value that we totally control and so it
    looks like okay we can just set the
  • 32:39 - 32:45
    initial timer value you know do this use
    after free, we're just calling user space
  • 32:45 - 32:53
    that's what I thought and then realized it
    wasn't that easy so because the race like
  • 32:53 - 32:57
    it because I was actually calling this is
    in a kernel thread we actually can't
  • 32:57 - 33:01
    guarantee that our user process is
    actually mapped in memory and in fact it's
  • 33:01 - 33:07
    on a different core so even if you open a
    process in the other core like ran a
  • 33:07 - 33:13
    thread there you can't get more than
    twenty-five percent of the time I think so
  • 33:13 - 33:18
    that's just super unstable also because
    it's a kernel thread we don't necessarily
  • 33:18 - 33:22
    want to crash it and we don't like crashes
    in general but this will just totally
  • 33:22 - 33:28
    break everything if the timer like sync
    thread dies so as long as we return to a
  • 33:28 - 33:34
    function do something cleanly, return it
    will be fine so it sounds like okay all we
  • 33:34 - 33:38
    have to do is find some kernel function we
    can call and we're done but there's
  • 33:38 - 33:44
    actually another issue and that's that
    kernel code is mapped at high addresses
  • 33:44 - 33:49
    and these are actually negative and that
    the set timer syscall actually checks if
  • 33:49 - 33:57
    your timer is negative so there's a pretty
    funny trick I found and that's that when
  • 33:57 - 34:01
    you set the timer you're saying like you
    know start I like one second from now
  • 34:01 - 34:07
    start pulsing obviously it's adding like
    the current time to the one second to know
  • 34:07 - 34:12
    like when do i trigger this timer so so
    SetTimer is the one that does that add for
  • 34:12 - 34:18
    you they don't check for overflow when
    installing it and timer schedule values
  • 34:18 - 34:26
    are signed which is also a bit weird so we
    can overflow and schedule into the past so
  • 34:26 - 34:33
    how this looks is that's my like
    disgusting set up call so what's happening
  • 34:33 - 34:39
    is like in the middle that's the start of
    the 3DS boot and then that range on the
  • 34:39 - 34:46
    right is what the 3DS will allow you to
    pass for your values for the initial and
  • 34:46 - 34:54
    like pulse period time and so what I do is
    I just put it right there at the end and
  • 34:54 - 35:00
    then it overflows and then on the next
    pulse I also control that and that's also
  • 35:00 - 35:06
    less than that range so then we can get it
    to line up on the kernel address we want
  • 35:06 - 35:13
    and so that's pretty good. Unfortunately,
    we're at the end like at this point is
  • 35:13 - 35:19
    pretty solid but there isn't like an
    obvious single thing we can call and it
  • 35:19 - 35:22
    seems like maybe you could race a bunch of
    times and call a bunch of different things
  • 35:22 - 35:26
    in the kernel and like you know that's a
    decent amount of control but because of
  • 35:26 - 35:33
    all this weird negative scheduling stuff
    it's actually pretty hard to do multiple
  • 35:33 - 35:37
    calls so I was trying to look for one
    thing that I can call that will give me
  • 35:37 - 35:47
    control and this is where it gets really
    tricky so if we look at how the memory
  • 35:47 - 35:54
    mapping on 3DS works in userspace you can
    access the FCRAM which is that first range
  • 35:54 - 36:01
    up there that's just where you know your
    heap goes there and then the kernel also
  • 36:01 - 36:09
    has a view of this heap it's you know a
    shared mapping so if we can write one of
  • 36:09 - 36:13
    those something in that range into the
    free pointer and allocate it, it actually
  • 36:13 - 36:20
    ends up in something we can see as the
    user so then I noticed this.. This is
  • 36:20 - 36:30
    actually a common instruction prefix in
    ARM so I jumped here and at this point
  • 36:30 - 36:36
    like we just did in C++, a vtable call on
    the use after free thing with one argument
  • 36:36 - 36:41
    so this means that r0 contains the address
    of the object and r1 contains the address
  • 36:41 - 36:50
    of where we just jumped to so that uh like
    B65C [0xFFF1B65C] is where r1 is pointing
  • 36:50 - 36:53
    so this is actually like some random
    linked lists lookup function but it's
  • 36:53 - 36:58
    actually looking down to the add
    instruction and loading it to r1 and then
  • 36:58 - 37:06
    we write that to the object and so at this
    point it looks like this it's pointing to
  • 37:06 - 37:11
    something in user space and then we just
    alloc two times we can look in user space
  • 37:11 - 37:17
    so they put the object there you control
    the vtable and from there it's pretty much
  • 37:17 - 37:26
    standard straightforward thing. So, there
    we go unintelligible userspace in kernel
  • 37:26 - 37:31
    and this is almost game over one more time
  • 37:31 - 37:39
    applause
  • 37:39 - 37:42
    derrek: So we've broken several parts of
  • 37:42 - 37:49
    the 3DS firmware including 3DS kernel and
    all software that's running on the
  • 37:49 - 37:55
    security processor what we haven't looked
    at yet are the 3DS bootroms and I'm
  • 37:55 - 38:04
    basically there's one bootrom for each
    processor for the ARM 11 and for the ARM 9
  • 38:04 - 38:11
    and I think there's probably, there are
    more bootroms in 3DS system-on-a-chip used
  • 38:11 - 38:18
    to for old Nintendo DS mode but we will
    focus on the 3DS bootroms here and what we
  • 38:18 - 38:28
    know is 3DS is somehow loading the
    firmware image from NAND flash and we also
  • 38:28 - 38:35
    know that the ARM9 bootrom does all the
    interesting stuff because only the ARM9
  • 38:35 - 38:44
    has access to the whole crypto hardware
    like the AES engine, RSA engine we also
  • 38:44 - 38:53
    know that the bootrom will initialize the
    secret keys for the AES key slots and yes
  • 38:53 - 39:01
    we would like to get those keys but um
    unfortunately the bootrom is disabled, it
  • 39:01 - 39:09
    disables itself before its launching of
    the firmware and 3DS bootroms also print
  • 39:09 - 39:16
    nice error screens like when the NAND is
    corrupted or something, it shows an error
  • 39:16 - 39:24
    screen so let's look how the bootroms are
    protected in detail and basically there
  • 39:24 - 39:31
    are two registers that we call
    CFG_SYSPROT9 and CFG_SYSPROT11 and the
  • 39:31 - 39:37
    bootrom writes to those registers and of
    course they are one shot you cannot
  • 39:37 - 39:44
    re-enable bootroms again because this is
    not the Wii U and basically when it's
  • 39:44 - 39:53
    disables the bootrom it only disables one
    half of it so what you get are two parts
  • 39:53 - 40:01
    of bootrom there's the unprotected part
    and protected part you can just dump the
  • 40:01 - 40:08
    unprotected part by taking over ARM9 from
    firmware but you can never see the
  • 40:08 - 40:14
    protected part and they were really clever
    and basically they put all the interesting
  • 40:14 - 40:20
    code in the protected part and if you look
    at the reset vector it just jumps directly
  • 40:20 - 40:26
    to protected part of the boot room so as
    you can't really figure out what is going
  • 40:26 - 40:32
    on when the 3DS is starting up but what
    you can do is you can look at the code
  • 40:32 - 40:41
    from the unprotected bootrom and who knows
    maybe we can find a bug so let's do this.
  • 40:41 - 40:47
    First of all of course there are no keys
    in in the unprotected bootrom, they put
  • 40:47 - 40:54
    all the keys in the protected part it's
    also mainly it's a lot of driver code.
  • 40:54 - 41:00
    Talks to some hardware like NAND flash,
    MMC, AES engine and also to SPI flash
  • 41:00 - 41:08
    which is kind of interesting because the
    SPI flash is some really tiny chip that is
  • 41:08 - 41:15
    soldered on the Wi-Fi socket and it's
    actually used for some Wi-Fi settings and
  • 41:15 - 41:21
    other user settings us by old Nintendo DS
    mode and yeah that's kind of interesting
  • 41:21 - 41:28
    uses the SPI flash and it also includes
    the ARM exception vector table and this is
  • 41:28 - 41:33
    actually just design that they have
    adopted from previous generations of the
  • 41:33 - 41:41
    Nintendo DS such as the DSi if you don't
    know ARM basically, you have something
  • 41:41 - 41:48
    that is called an exception vector table
    and this is located at this hardcoded
  • 41:48 - 41:56
    address in bootrom and basically every
    time when something weird happens or
  • 41:56 - 42:03
    something special on the CPU it will jump
    to those exception vectors like the reset
  • 42:03 - 42:09
    vector as we just so or when you're trying
    to read from an invalid address, it
  • 42:09 - 42:16
    returns to the prefetch abort or data
    abort vector and also when you receive an
  • 42:16 - 42:25
    interrupt it will jump to interrupt
    request vector so those are the exception
  • 42:25 - 42:30
    vectors and they're hardcoded in the
    bootrom and there's kind of a problem with
  • 42:30 - 42:38
    that because as a developer you don't want
    to put the exception in the routines in
  • 42:38 - 42:45
    the boot rom, you want to it'd be able to
    change the code right? So, what they do is
  • 42:45 - 42:54
    they just redirect all the exception
    execution flow from bootrom to another
  • 42:54 - 43:02
    jumptable that is located in ARM9 memory
    so it looks like this. What you can see
  • 43:02 - 43:07
    here are the bootrom vectors and it's
    basically just a jump instruction to the
  • 43:07 - 43:12
    RAM vectors and the RAM vectors are also
    just another jump instruction to the
  • 43:12 - 43:17
    actual firmware handler and this is so
    things look like when the firmware is
  • 43:17 - 43:26
    running but what about cold boot well on
    cold boot you get this and this looks
  • 43:26 - 43:33
    kinda interesting because you have the
    bootrom vectors that still point to ARM9
  • 43:33 - 43:40
    memory but since this is cold boot, the
    RAM is not initialized so this is
  • 43:40 - 43:45
    interesting but it is it's not really a
    bug because at some point the bootrom will
  • 43:45 - 43:54
    initialize those RAM vectors so but let's
    cheat a little bit here and say let's just
  • 43:54 - 43:59
    assume we could somehow trigger a really
    early exception even before the bootrom is
  • 43:59 - 44:09
    able to initialize the RAM vectors well
    probably it was just crash because on
  • 44:09 - 44:14
    exception it will just jump to
    uninitialized memory and there's probably
  • 44:14 - 44:22
    no valid instruction there so this is not
    very useful but there's a really nice
  • 44:22 - 44:28
    hardware flaw and we found this by just
    writing to some memory reboot, and see
  • 44:28 - 44:35
    what what happened basically we found out
    that some RAM is actually not cleared on
  • 44:35 - 44:42
    reboot and this also includes ARM9 so the
    basic idea is we can set up some custom
  • 44:42 - 44:50
    exception vectors in RAM that regenerate
    execution flow to some dumper code so when
  • 44:50 - 44:56
    we reboot we get this and this is really
    interesting because if you look at this
  • 44:56 - 45:01
    this means all we need to do now is
    trigger a really early exception and then
  • 45:01 - 45:10
    the bootrom will jump to our dumper code
    so, how can we trigger an exception? Well
  • 45:10 - 45:14
    if you look at here, the exception vector
    table again there are some exceptions that
  • 45:14 - 45:20
    we can trigger like because they are
    hardcoded like reset and they won't jump
  • 45:20 - 45:29
    to ARM9 memory and you also can't use the
    interrupt vector because interrupts are
  • 45:29 - 45:39
    disabled on reset and yeah this won't work
    so what's left is these 3 here interesting
  • 45:39 - 45:45
    exceptions and if you look at those and
    they normally don't happen right undefined
  • 45:45 - 45:51
    instruction is pretty rare and it
    shouldn't happen so I don't know about
  • 45:51 - 45:58
    this reminds me kind of like it's a really
    nice use case for doing for injection
  • 45:58 - 46:05
    again because you can corrupt registers
    and getting mutated instruction so it's
  • 46:05 - 46:11
    really likely that it will trigger an
    exception so this is the vector glitch
  • 46:11 - 46:17
    hack and basically we set up some vectors
    in RAM, trigger reboot then do some
  • 46:17 - 46:25
    glitching magic and then we reset again
    and let it boot up normally and hopefully
  • 46:25 - 46:32
    our dumper code got executed and just
    wrote a copy of the bootrom in memory so
  • 46:32 - 46:38
    we can just dump it. All this stuff is not
    very stable but it works for me.
  • 46:38 - 46:49
    applause
  • 46:49 - 46:58
    Wo okay we got the bootrom and Nintendo is
    losing a life there so before we look at
  • 46:58 - 47:09
    the bootrom I have a little problem for
    you and basically in early 2014 an FCC
  • 47:09 - 47:16
    document became public. There it is, and
    basically it says that Nintendo has changed
  • 47:16 - 47:21
    the CPU of the Nintendo 2DS and there's
    one really interesting sentence that
  • 47:21 - 47:27
    basically says, they have changed security
    function of the initial program loader
  • 47:27 - 47:33
    that is installed in each model so the
    initial program loader is probably bootrom
  • 47:33 - 47:42
    so obviously there must be some really
    huge bug in the bootrom, right? So so
  • 47:42 - 47:49
    that's it let's look at the bootrom.
    Basically there are some boot methods and
  • 47:49 - 47:53
    you can boot from NAND, that's what it
    normally does but alternatively you can
  • 47:53 - 48:01
    also boot from SPI flash which is the
    Wi-Fi flash and it will only boot firmware
  • 48:01 - 48:08
    images that are signed and encrypted
    there's no freaky development backdoor
  • 48:08 - 48:15
    that we can exploit it also uses two
    different sets of keys for NAND and non
  • 48:15 - 48:21
    NAND boot methods and also for our retail
    and dev mode so even when stuff gets
  • 48:21 - 48:28
    leaked you cannot use it on your retail
    console so let's do a small boot walk
  • 48:28 - 48:34
    through and it's pretty straightforward
    actually so the first thing it does is it
  • 48:34 - 48:42
    selects a boot device then it loads the
    firmware header and RSA signature from it
  • 48:42 - 48:51
    it's just one block and then it hashes the
    header and extract the hash from the
  • 48:51 - 48:58
    signature and compares it, so basically a
    basic signature verification header
  • 48:58 - 49:05
    verification and then assumes yeah the
    header is safe and then it starts loading
  • 49:05 - 49:13
    the firmware sections and the firmware
    images are pretty simple format and like
  • 49:13 - 49:20
    you have some entries in the header that
    tells you okay take the data from this
  • 49:20 - 49:27
    offset and there there's a section with
    the size load it to that address. It's
  • 49:27 - 49:33
    pretty simple so we know from Nintendos
    past that they like to mess up RSA
  • 49:33 - 49:42
    signature checks so let's look as how RSA
    is done on 3DS so for the 3DS firmware
  • 49:42 - 49:52
    they're using RSA signatures in the PKCS
    standard PKCS is basically a bunch of
  • 49:52 - 49:58
    standards that tell you how your
    signatures have to look like and they are
  • 49:58 - 50:11
    using the 2048-bit version of RSA which is
    safe and in the signature you have a SHA-2
  • 50:11 - 50:20
    hash and this is encoded using ASN.1 and
    ASN.1 it's some really complex structure
  • 50:20 - 50:26
    it's basically it's similar to the mp3
    structure so you have little chunks of
  • 50:26 - 50:31
    data and those chunks have little headers
    and the headers have tag bytes and length
  • 50:31 - 50:41
    bytes and basically this ASN.1 stuff is
    used to tell the parser which hashing
  • 50:41 - 50:51
    algorithm is used and well since the SHA-2
    hash is only 20 hex [0x20] bytes in size
  • 50:51 - 50:57
    you have some remaining space in the
    signature that you have to fill and PKCS
  • 50:57 - 51:02
    says you need a padding and this padding
    should be deterministic it should only
  • 51:02 - 51:08
    contain FF bytes so when you're trying to
    forge signatures it's it's really
  • 51:08 - 51:14
    difficult because of this padding that
    really long and when you compare the
  • 51:14 - 51:22
    signatures of different firmware images
    you'll actually notice that only the hash
  • 51:22 - 51:28
    will change and the rest of the data is
    always the same for all signatures but
  • 51:28 - 51:35
    well for some reason they decided to write
    a signature parser for this stuff so what
  • 51:35 - 51:46
    you get now is RSA the Nintendo way again
    so the first thing it does is it tries to
  • 51:46 - 51:53
    parse the padding and this part is totally
    messed up like there is a flag byte that
  • 51:53 - 51:59
    tells you if the padding should be checked
    and if it's one then it is checked it
  • 51:59 - 52:07
    should be all FF but but if it's two then
    it will just skip the padding and it also
  • 52:07 - 52:13
    has some really weak bounds checking it
    make sure that it will not when it's
  • 52:13 - 52:19
    passing the padding it make sure that it
    will not go out of bounds but they forget
  • 52:19 - 52:28
    to verify that the hash will actually fit
    in there as well so next thing they do is
  • 52:28 - 52:35
    parsing this really complicated ASN.1
    structure and this process is also really
  • 52:35 - 52:43
    simplified so we know ASN.1 has some
    length fields and there's no bounds
  • 52:43 - 52:53
    checking so eventually it will add the
    length to the current pointer in the
  • 52:53 - 53:02
    signature and then they stop parsing and
    say okay we parsed all the data and now
  • 53:02 - 53:09
    there should be the hash and yet they are
    not checking this length and this pointer
  • 53:09 - 53:18
    is used to do the hash comparison so all
    in all you can say it only checks a few
  • 53:18 - 53:23
    bytes in the signature because the padding
    parser is messed up and also the ASN.1
  • 53:23 - 53:29
    parser is really simplified so what we can
    do is we can bruteforce the perfect
  • 53:29 - 53:37
    signature where the final pointer when
    it's done parsing the padding and the
  • 53:37 - 53:46
    ASN.1 data that this final pointer matches
    the pointer of the calculated hash of
  • 53:46 - 53:57
    bootrom so what it does then this it does
    a mem compare [memory compare] with the
  • 53:57 - 54:05
    calculated hash and the calculated hash
    like and this never fails, right? So it
  • 54:05 - 54:10
    will always succeed and this is SIGHAX.
  • 54:10 - 54:18
    applause
  • 54:18 - 54:24
    So the SIGHAX is a bootrom exploit for 3DS
    and basically we can sign our own
  • 54:24 - 54:31
    firmwares and there are over 60 million
    vulnerable devices and basically in new
  • 54:31 - 54:37
    3DS and 2DS basically all models are
    affected and of course since this is the
  • 54:37 - 54:46
    bootrom, Nintendo can't fix it so that's
    very nice but that's one heart remaining
  • 54:46 - 54:55
    so something is missing what we haven't
    done yet is we haven't dumped the ARM11
  • 54:55 - 55:00
    bootrom. It's probably not really
    interesting but for sake of completeness
  • 55:00 - 55:08
    you would like to get it and in theory we
    can just do a vector glitch hack again
  • 55:08 - 55:13
    because it has the same flaw but know that
    we can sign our own firmwares let's try
  • 55:13 - 55:21
    something else so if you look at the
    unprotected part of the ARM11 bootrom you
  • 55:21 - 55:29
    can see there are a lot of references to
    ARM11 memory so maybe now that we can sign
  • 55:29 - 55:34
    our own firmwares and we can set up our
    own firmware sections maybe we can
  • 55:34 - 55:42
    overwrite some bootrom data so but they're
    the bootrom developers were kind of clever
  • 55:42 - 55:49
    and the ARM9 bootrom checks the firmware
    sections and they have some kind of
  • 55:49 - 55:58
    blacklist and unfortunately you can't just
    overwrite boot9 data sections sections but
  • 55:58 - 56:04
    for some reason they forgot to blacklist
    all the boot11 data regions so we can just
  • 56:04 - 56:12
    overwrite boot11 stack or the exception
    vectors and well you can dump the ARM11
  • 56:12 - 56:13
    bootrom.
  • 56:13 - 56:22
    applause
  • 56:22 - 56:30
    yeah that was pretty easy and now I get to
    tell you something, all this stuff about
  • 56:30 - 56:39
    the bootrom we did this in summer 2015 so
    we could have talked about this already
  • 56:39 - 56:46
    last year but since we are kind of
    friendly hackers we held this bug so long
  • 56:46 - 56:57
    so yeah Nintendo should be thankful and ok
    so that's it 3DS is pretty game over and
  • 56:57 - 57:02
    here's a picture of Nintendo Switch and
    our body is ready laughter
  • 57:02 - 57:16
    applause
  • 57:16 - 57:21
    Herald: Thank you very much there's about
    five minutes left for questions and are
  • 57:21 - 57:27
    there any questions from the internet?
    No no no okay?
  • 57:27 - 57:32
    Signal Angel: Yes there's actually one
    question from the internet and that is the
  • 57:32 - 57:42
    internet wants to know if we can get DSP
    code execution maybe sometime soon
  • 57:42 - 57:43
    Herald: Can you repeat the question?
  • 57:43 - 57:45
    yeah very hard to understand here
  • 57:45 - 57:51
    Signal Angel: Ok I'm the internet wants to
    know if we can get a DSP code execution?
  • 57:51 - 58:02
    derrek: Yes well the DSP of the 3DS runs
    its own firmware and that is included in
  • 58:02 - 58:10
    some kernel module and basically when you
    can sign your own firmware you can also
  • 58:10 - 58:22
    make it load another DSP firmware
    so yes you can do this
  • 58:22 - 58:25
    Herald: Ok people who are leaving please
    do so quietly and people entering please
  • 58:25 - 58:35
    do so quietly. There was a question on
    microphone 3 I think but no longer okay.
  • 58:35 - 58:38
    Does the internet have more questions?
  • 58:38 - 58:44
    Signal Angel: Yes it does. The internet
    wants to know if you or how you glitch the
  • 58:44 - 58:49
    Wii U to get execution
  • 58:49 - 58:57
    derrek: Well I don't want to worry how I
    did it in detail but there are some basic
  • 58:57 - 59:05
    fault injection attacks and my setup was
    I think kind of complicated you had to
  • 59:05 - 59:11
    modify a lot of stuff on the Wii U
    mainboard to get it to work so I guess you
  • 59:11 - 59:17
    have to figure out yourself, sorry.
  • 59:17 - 59:21
    Herald: Ok there's a question
    upstairs microphone five I think?
  • 59:21 - 59:30
    Mic 7: Seven but it's okay. Yeah well you
    said that you broke all the 2DS but
  • 59:30 - 59:37
    actually you showed that the 2DS changed
    in the boot process so did you verify that
  • 59:37 - 59:40
    that work for the first version as well
  • 59:40 - 59:47
    derrek: Yes so the new 3DS was released
    after the 2DS and the new 3DS is also
  • 59:47 - 59:55
    vulnerable and basically all the Nintendo
    2DS consoles are also also vulnerable as
  • 59:55 - 60:01
    well. Yes we did verify this and we don't
    really know what this FCC document is
  • 60:01 - 60:12
    about we got some really new 2DS from
    store and and basically yes, no difference
  • 60:12 - 60:16
    for the bootrom at all,
    so yes everything is vulnerable.
  • 60:16 - 60:18
    Mic 7: Nice to know, thanks.
  • 60:18 - 60:23
    derrek: ok
    applause
  • 60:23 - 60:26
    Herald: Final question from microphone 3?
  • 60:26 - 60:29
    Mic 3: Yeah just a fun question out of
    interest when you're going to buy such a
  • 60:29 - 60:34
    device do you also plan to play games on
    it? Or is it just going to check if the
  • 60:34 - 60:39
    other kernel works?
  • 60:39 - 60:43
    naehrwert: Personally for the
    Wii U, I own 0 games so
  • 60:43 - 60:44
    Mic 3: Great, thanks.
  • 60:44 - 60:50
    applause
  • 60:50 - 60:56
    I also didn't pirate any so i never
    played a game on my Wii U.
  • 60:56 - 61:02
    33c3 postroll music
  • 61:02 - 61:20
    subtitles created by c3subtitles.de
    in the year 2017. Join, and help us!
Title:
Nintendo Hacking 2016 (33c3)
Description:

more » « less
Video Language:
English
Duration:
01:01:20
  • Dear Subtitle Creators: Please use the Styleguide and the Howtos of c3subtitles:
    https://wiki.c3subtitles.de/en:postprocessing:contribute
    https://wiki.c3subtitles.de/en:styleguide
    Please correct it according to the stylguide.

  • Please use https://c3subtitles.de/talk/645/ to work on this talk.

English subtitles

Revisions