Nintendo Switch 2 jailbroken with help from OpenAI Codex: how ns2jb works
A security researcher has released ns2jb, a software only jailbreak for the Nintendo Switch 2 that was found and packaged with heavy help from OpenAI's Codex coding agent. It starts in an old Switch 1 programming game, climbs into the console's file system service and ends with a modded Mario Kart World. Here is how the exploit chain works, what the AI actually did and why the limits matter.

The Nintendo Switch 2 has its first public jailbreak, and an AI coding agent did a surprising share of the work. Security researcher Sammy Hajhamid, known online as pepsipu, released a software only exploit called ns2jb that lets the console run homebrew code, back up save files and mod games. To show it off, he had OpenAI's Codex mod Mario Kart World, the Switch 2's flagship racer, so that characters like Cinnamoroll and the red Angry Bird could join the grid.
Hajhamid described the full exploit chain in a detailed post on his blog dated 18 October 2026 and published the code in the ns2jb repository on GitLab. The Verge and Ars Technica picked up the story on 22 October. To his knowledge, it is the first exploit of its kind for the console, which launched in June 2025.
The short version
- ns2jb is a software only, tethered jailbreak. It needs no modchip, but it has to be run again after every restart of the console.
- The entry point is SmileBASIC 4, an old Switch 1 programming game that still runs on the Switch 2 through backward compatibility.
- Codex found a 32 bit integer overflow in the SmileBASIC interpreter that gives read and write access to the game's own memory.
- From there, the chain abuses a buffer overflow in the Switch 2 file system service, called fs, and ends with native code running with the permissions of system modules.
- Hajhamid says the jailbreak itself took about two weeks of substantial effort. The Mario Kart World mod was, in his words, vibecoded in a single day.
- It works on system software 23.0.1, the current version at the time of release, but it stays in userland. There is no kernel access and no custom firmware yet.
A harness that let the AI hold the controller
The most striking part of the project is not a single bug but the setup around it. Before writing any exploit code, Hajhamid built a harness that let Codex operate a Switch 1 and a Switch 2 almost on its own.
Two JetKVM devices did the heavy lifting. They are small remote control boxes that can send keyboard and controller input over USB and capture the screen over HDMI. With them, Codex could press buttons, type into games and see what happened on the display. The last missing piece was the power button. A crashed Switch 2 needs a physical press to restart, so Hajhamid bought a Bluetooth light switch flicker, the kind of gadget that flips a wall switch from a phone app, and mounted it so that its lever presses the console's power button.

That closed the loop. An agent could try an idea, watch the console crash, power cycle it and try again, for hours, without a human sitting next to it. Hajhamid also ran several Codex instances in parallel on different targets, for example one on the Switch 2 web browser and one on SmileBASIC on the Switch 1.
He is careful not to oversell it. His blog joked that the prompt was "set a goal to jailbreak the switch 2. make no mistakes", then added an edit after readers took it literally. He did set Codex a goal of getting user level code execution, but that alone did not succeed. The final chain mixes the agent's findings with his own research and decisions.
Step one: an old BASIC game
Console hackers like to start in the web browser, because browsers are huge, complex and often have known bugs. Codex went there first too, and used a known WebKit bug loaded through a custom Wi Fi captive portal to hijack control flow. But the Switch 2 browser is well hardened. It uses execute only memory, pointer authentication and control flow integrity checks, which together make it very hard to turn a browser bug into useful system calls. Hajhamid let that agent keep going as a side bet. It never succeeded.
His alternative was to target Switch 1 games, which run on the Switch 2 but were built for older hardware without pointer authentication. Because the security of the original Switch was broken years ago, their code can also be decrypted and read. He picked SmileBASIC, a programming environment that already fell once on the 3DS in 2016, in an exploit known as smilehax.
The bug Codex found is a classic. When a program removes items from an array, the interpreter checks that the start position plus the number of items does not exceed the array length. But the sum is a 32 bit number that can wrap around and become negative, which passes the check. The following memory copy then pulls in eight bytes that sit just before the array. Those bytes happen to hold a pointer to the array itself, and after the copy the interpreter treats that pointer as the length of a string. The result is a string with an enormous length, which can be used to read and write memory far outside its bounds. A single line of BASIC is enough to trigger it, and the game even prints an "Out of memory" error while the damage is already done.

Step two: into the file system service
Memory access inside one game is not a jailbreak. The next goal was a system module, one of the background services that run the console. Several Codex instances were set loose on that question and mostly looked at the audio and local wireless services, which have had bugs before, as well as the graphics driver.
Hajhamid chose a different target himself: fs, the built in file system service. It has a lot of code, it probably resembles the Switch 1 version, and it is the module that serves decrypted program code to the rest of the system. That made it valuable even as a stepping stone.
The bug was in path normalization. When a path contains a parent directory component with a backslash, fs copies it into a temporary buffer of 0x301 bytes without checking the length first. A longer path overflows the buffer. Codex then found a good victim object next to it, a cache entry used for buffered file access, and turned the overflow into arbitrary read and write inside fs. With that, the exploit can mark its own process as having full permission, dump internal storage and copy the code of other system modules for offline analysis.
Step three: fooling the loader
To run real homebrew, you need to execute your own native code. On the Switch 2, every program comes with a signed metadata file that fixes its permissions, and the loader checks two signatures before starting it. On paper, that chain is cryptographically sound.
In practice, it depends on fs serving the real files. With full control over fs memory, ns2jb can let the loader check the genuine, correctly signed metadata and header, then swap in a different main executable at exactly the right moment. To get the timing right, the exploit replaces the handle that fs waits on for the loader's messages with an event that the SmileBASIC side controls. The loader is satisfied, and the console starts code it never approved.
Because the metadata of any system module can be copied this way, the exploit can launch its own code with the permissions of the ro module, which is allowed to map executable memory. That code then patches fs itself. The end result is native code execution as any ordinary system module and as the built in fs module.
What it can and cannot do
The capabilities are real. According to Hajhamid, ns2jb allows homebrew, reverse engineering and modding of Switch 2 games, backing up save files and access to most of the console's peripherals. The modded Mario Kart World is the public proof.

The limits are just as clear:
- It is tethered. Every reboot wipes it, and you start again from SmileBASIC.
- It needs a specific setup. The repository README lists SmileBASIC 4.4.9, system software 23.0.1, Node.js 22 or newer on a macOS or Linux computer on the same network, and more than 20 MiB of free space in the SmileBASIC save.
- It is fragile. The README says the demo passed on the third fresh boot in a physical test on 21 October. The first two attempts stopped at validation checks.
- It stays in userland. As Ars Technica notes, it falls well short of the kernel level control that would give full ownership of the hardware.
- It is probably short lived. SmileBASIC 4 has already been delisted from the Switch eShop, and a firmware update will most likely close the bugs.
That is very different from the unpatchable Switch 1 exploit of 2018, which lived in the boot ROM of the chip and forced Nintendo to revise the hardware. ns2jb is a software problem with a software fix.
The AI part, honestly
It is tempting to read this as "AI hacked the Switch 2". That is not what happened. A skilled researcher designed the strategy, picked the targets that worked and built a clever physical harness. Codex did a large share of the grinding: exploring targets, finding the integer overflow, building memory primitives and packaging the release. The repository README even opens with a dry thank you to Codex for packaging the exploits, adding that the author has not read the distributed package.
The interesting shift is speed and scale. Several agents worked in parallel, each with its own console and a way to recover from crashes, so dead ends got explored faster and cheaper than one person could manage. The Verge points out that this could mark the start of a run of Switch 2 exploits, especially if other modders use AI the same way. Ars Technica reports that people in the hacking community are already teasing similar exploits through other games.
Why it matters beyond gaming
Consoles are among the most locked down consumer devices on the market. Nintendo uses pointer authentication, control flow integrity, execute only memory and signed code, the same defense layers found in modern phones. ns2jb did not break those layers head on. It went around them through an old, less hardened app and a logic gap between two system services.
That pattern is not specific to Nintendo. Every platform carries legacy code, compatibility layers and services that trust each other. AI agents that can test ideas around the clock make those weak edges cheaper to find. The same goes for defenders: the harness idea works just as well for a security team that wants to fuzz its own device before attackers do.
Our take
This is a fun story with a serious core. The modded Mario Kart World with Cinnamoroll and an Angry Bird will get the clicks, but the real news is the workflow: a researcher wired a console to an AI agent, gave it hands, eyes and a power button, and let it work in parallel on several attack paths. The result is not fully automatic, and the jailbreak itself is limited and likely to be patched soon. But the time from launch to first public exploit for a hardened console just got shorter, and AI helped. Expect both console makers and hackers to adopt the same tools, and expect the next round of this old cat and mouse game to move faster.
Sources: Sammy Hajhamid: ns2jb blog post, ns2jb repository on GitLab, The Verge: Someone hacked the Switch 2 by using an old game and AI, Ars Technica: Switch 2 security takes a hit as hackers unlock homebrew access.
Source: pepsipu.com