jailbreaking the switch 2 ns2jb is a software-only jailbreak of the switch 2 for the current latest firmware 23.0.1 October 21, 2026 cs Introduction You can get a copy of the exploit from the https://gitlab.com/pepsipu/ns2jb repository. ns2jb is a software-only, tethered jailbreak for the Switch 2. It allows running arbitrary native code as any ordinary sysmodule, and as the built-in fs sysmodule. This lets us run homebrew, reverse engineer and mod Switch 2 games, back up save files off the Switch, and access most of the Switch 2’s peripherals through MMIO. To my knowledge, it’s the first such exploit for the Switch 2.
To demonstrate the capabilities of this jailbreak, Codex modded a Switch 2 exclusive, Mario Kart World. Thanks to my friends in https://dabney.caltech.edu/ who helped me choose characters to add and playtest the game. /_astro/mario-kart-race-2-1080p.BwDXiEuM.mp4 /_astro/mario-kart-race-1-1080p.CVfktJqK.mp4 ▶ 0:09 ▶ 0:05 cinnamoroll, red, and tole tole racing This post will be on how I found the bugs and developed the jailbreak. I hope it can be a useful example of how researchers can use AI for security work. Setup The very first thing I did was set up a harness around the Switch 1 and 2 so Codex could, ideally, jailbreak the Switch 2 without me: “set a goal to jailbreak the switch 2. make no mistakes”#user-content-fn-prompt The JetKVMs allow Codex to send controller inputs to the Switches over USB and receive video output over HDMI.
We also need a way to press the power button—when the Switch 2 crashes, it needs a button press to restart. That’s what the Bluetooth light switch flicker from Amazon is for. When the lever comes down, it presses the power button. Once the power button is fully pressed, the rest of the lever’s torque lifts the mechanism. /_astro/switch-flicker.C39jYOwd.mp4 The harness’s first target was initial code execution on the Switch 2, so I spun up an agent with this goal.
Unfortunately, it was not successful. Getting code execution Codex picked the browser engine, WebKit, accessible via custom WiFi captive portal. Code execution through the browser WebKit is a popular target for console jailbreaks, so this choice is unsurprising. Codex claims to have arbitrary read/write and “native control-flow hijack”: However, this approach—swapping one NativeExecutable object for another—only allows us to call existing native JavaScript functions.
We’d like to call arbitrary functions, not just Math.expm1 and XMLHttpRequest.prototype.send! For example, arbitrary function calls would allow us to make custom IPC calls. That’d allow us to interact with microkernel services (“sysmodules” on the Switch). Compromising one is how we’d run homebrew, mod games, download saves, etc.
Although arbitrary read/write in a browser usually allows calling arbitrary function, in this case, I think Codex is stuck in a local minimum. Why? WebKit has execute-only memory, or XOM, so even with ARW, we don’t know where a gadget that could perform arbitrary IPC calls is. Even if we did, perhaps by parsing relocation data, it’s not clear how we’d construct a signed pointer for it because of PAC.
And even if we could, with some signing gadget, it’s not clear how we’d call this pointer, since CFI type-checks most call sites. Explaining this, the goal resumes and Codex looks for ways to bypass these mitigations. It’s a side bet; it may succeed#user-content-fn-webkit-result, but let’s be real: the accessibility of WebKit and the Nintendo BBP reward have probably incentivized many before me to look here#user-content-fn-webkit. While that runs, let’s explore other options.
Code execution through Switch 1 games My idea was to target Switch 1 games, for three reasons: The code is compiled by developers. It’s less likely we’ll need to deal with PAC and CFI, especially because the Switch 1 https://developer.arm.com/-/media/Arm%20Developer%20Community/PDF/Learn%20the%20Architecture/Understanding%20the%20Armv8.x%20extensions.pdf#page=10. Since the Switch 1 root of trust is owned, we can decrypt the game and read its code. My Switch 2 is occupied by the WebKit agent, so I can work in parallel by writing the exploit on my Switch 1.
Civilization VII Maybe we can still get the upsides of the browser attack surface—orchestrating from JavaScript, using existing n-days, etc—while avoiding the downsides of WebKit mitigations? We could do this by finding a Switch 1 game that embeds a browser, like Electron. My idea was inspired by this https://blog.electrovolt.io/posts/discord-rce/ I saw at DEFCON a few years ago. If we found an XSS vulnerability in the game, we could pwn the JavaScript engine for native code execution.
I found a framework, https://coherent-labs.com/products/coherent-gameface/, that embeds V8. Coherent Labs lists games using Coherent Gameface, so it was easy to spawn agents to look for bugs. One found an XSS in https://www.nintendo.com/us/store/products/sid-meiers-civilization-vii-switch/ in player chat. I decided not to release this bug with my initial post, because of its impact on PC players, reporting the Civilization VII bug to 2K on October 19th instead.
After releasing ns2jb, I discussed the bug with PS5 jailbreak developer https://x.com/gezine_dev, who had independently reached the same approach#user-content-fn-tweet. We agreed I’d keep the details private until he released https://github.com/Gezine/CivSwitch on November 1st. This is another useful entrypoint, since there’s a physical cartridge. For ns2jb, I released it with another game, SmileBASIC.
SmileBASIC https://www.nintendo.com/us/store/products/smilebasic-4-switch/ has been pwned before, in https://plutooo.github.io/smilehax, for userspace code execution on the 3DS. It’s a giant C++ codebase; surely, if there was an exploitable memory corruption in the BASIC interpreter, there can be another. Codex found a useful 32-bit integer overflow in the interpreter. When removing items from an array, the interpreter checked position + count <= array.length, but the sum could wrap and become negative.
To fill the gap created by removing elements, it’s supposed to shift the remaining elements left, like so: memmove( backing + position * 8, // start of the gap backing + (position + count) * 8, // elements after the gap (length - position) * 8 // bytes to copy ); Say we have a string array R of length 4, and we run REMOVE R,&H60000000,&H3FFFFFFF. position + count wraps to 0x9fffffff. As a negative signed 32-bit integer, it’s less than array.length. The multiplications by 8 also wrap, so we end up performing memmove(backing, backing - 8, 32), pulling the previous 8 bytes into the array. The command does report an Out of memory error, but it doesn’t matter, since the copy has happened already.
This is useful because the 8 bytes preceding any array in SmileBASIC contain a pointer to the array itself! After the REMOVE, operations on R[0] will treat the array backing as if it were a string. Since a pointer occupies what would be the length field of R[0], the string length is enormous, and we can perform reads and writes out of bounds. We read and write to memory by copying to and from substrings of R[0].
After some time, my agent used this to get ROP. Getting sysmodule ARW Okay, now we need to compromise a more privileged process. We’re interested in https://switchbrew.org/wiki/Switch_System_Flaws#System_Modules and https://switchbrew.org/wiki/Switch_System_Flaws#BootImagePackage_System_Modules. Which sysmodule should we pursue?
We don’t have their code, so it’s unclear which sysmodules have which privileges. I gave a few Codex instances the goal of getting sysmodule code execution. Most chose to focus on https://switchbrew.org/wiki/Audio_services and https://switchbrew.org/wiki/LDN_services, likely because they’ve https://switchbrew.org/wiki/Switch_System_Flaws before. Codex also looked at the https://switchbrew.org/wiki/NV_services, potentially because GPU drivers are generally fruitful?
The fs sysmodule In the meantime, I started looking at the built-in fs sysmodule, because: The Switch 1 code shows that it’s https://switchbrew.org/wiki/Filesystem_services#fsp-ldr. There’s a lot of code. It’s probably similar to the fs module in the Switch 1, since the filesystem API didn’t change very much. The first reason is the most attractive to me.
Even if we can’t get a useful jailbreak from fs, we can at least decrypt some of the other sysmodules so Codex can find bugs in them. Buffer overflow with path normalization An https://switchbrew.org/wiki/Filesystem_services#IFileSystem has an IPC command, https://switchbrew.org/wiki/Filesystem_services#GetEntryType. This takes a path string, normalized with Path::Normalize. Paths containing a parent-directory component with a backslash, like /..\, call into a helper that allocates a temporary heap buffer of 0x301 bytes.
Our path is copied in, but it can be larger than the buffer, causing a buffer overflow. lol We’ll need a good victim allocation to overflow into. Codex found that the BlockCacheBufferedStorage object allocates cache entries for its files: struct nn::fssystem::BlockCacheBufferedStorage::CacheEntry { nn::fssystem::BlockCacheBufferedStorage::AccessRange m_Range; bool m_IsValid; bool m_IsWriteBack; bool m_IsCached; bool m_IsFlushing; __int16 m_Age; __int64 m_Handle; unsigned __int64 m_MemoryAddress; unsigned __int64 m_MemorySize; }; If that entry has its dirty bit set, reads and writes to the file follow a pointer to cached data. We can hijack the cache entry for arbitrary read/write#user-content-fn-rw-stability. From here, I scanned through memory to find SmileBASIC’s connection object and set the https://switchbrew.org/wiki/Filesystem_services#Permissions:~:text=If%20the%20processID%20is%20%3C%3D%206%20%28which%20happens%20only%20for%20built%2Din%20sysmodules%29%2C%20it%20will%20use%20a%20hardcoded%20registration%20data%2E%20The%20default%20mask%20in%20this%20case%20is%200x8000000000000000%2E.
Now, my process has “FullPermission”, meaning I can perform privileged filesystem actions. I dumped internal storage and all ordinary sysmodule code, so Codex could perform offline analysis and I could understand where to go next. Getting code execution as any ordinary sysmodule ARW in fs alone isn’t useful enough for end users. It allows us to interact with most files on the system, but for users, homebrew and modding typically rely on executing our own native code.
For researchers, fs’s restrictions prevent it from accessing other hardware it doesn’t use. The dumps indicate the built-in sysmodule ldr and ordinary sysmodule ro can map executable memory#user-content-fn-encrypted-code into other processes, but they don’t have large attack surfaces for memory corruption. Reusing the fs Service Manager session My agent was attempting to get code execution by using ARW to force fs to export its Service Manager session to SmileBASIC, so that it can talk to ro and ldr directly. It’s essentially converted the ARW to https://switchbrew.org/wiki/Switch_System_Flaws#:~:text=Service%20access%20control%20bypass%20%28sm%3Ah%2C%20smhax%2C%20probably%20other%20names%29.
Since fs is a built-in sysmodule, Service Manager skips ACL checks for its session, allowing us to talk to any service. Even with the SM session, it needs a seperate bug in ro or ldr. I let it run as another side bet; the small attack surface makes this part tricky, but if it finds a useful bug, we’ll have code execution. In the meantime, let’s explore another direction. smhax doesn’t take advantage of fs’s existing privileges, since any compromised built-in sysmodule bypasses Session Manager’s ACL checks.
What special privileges does fs have? Tricking ldr into loading our code Let’s revisit that first point about fs serving decrypted code. What’s the intended functionality of this interface? fs provides https://switchbrew.org/wiki/Filesystem_services#OpenCodeFileSystem through https://switchbrew.org/wiki/Filesystem_services#fsp-ldr—a ser
Texto de pepsipu.com tal como lo publicó, leído de su página y mostrado aquí con el formato de El Autómata. El original, en pepsipu.com · Volver a la noticia de El Autómata