CivSwitch README

项目的 README,来自 github.com/Gezine/CivSwitch。合并为一个 markdown 文件:README.md。

CivSwitch

XSS toolchain for the Switch 1 edition of Civilization 7.
Only the 1.0.0 version of the game in physical cartridge is supported.

Every switch 1/2 firmware 20.x.x and up to current version (23.0.1) should work.

Tested at Switch 1 fw 22.5.0, Switch 2 fw 20.4.0 and 23.0.1

Two components:

Layout

core.js at the root is the shared payload both components build from, and send_js.py at the root sends any payload to a running loader.

Workflow

Video Tutorial from switch2hacks reddit

  1. Build + flash the loader UF2 (see PicoSwitch/README.md).

    On the Switch, go to "System" menu and change system language to English(US).
    Go to "Controllers & Accessories" menu and change USB Keyboard to English(US).

    These are required to type "English" letters (code) using USB keyboard.
    (Higher fw might not need to change system language as they support typing english without language change)

    NOTE for JP-only Switch2 :

    1. If you have another Switch, you can connect the two consoles via local wireless multiplayer and plug the Pico on the other device, allowing it to send the payload over the network.
    2. Use jis builds of pico uf2 firmware and enable english input at on screen keyboard settings.

    Connect to Internet using 90DNS to block Nintendo servers. (WARNING : YOU MUST READ 90DNS INSTRUCTION CAREFULLY, IF NOT GAME WILL BE LOCKED)

    Then launch game and navigate main menu -> MULTIPLAYER -> WIRELESS -> CREATE GAME -> HOST LOBBY -> CHAT then plug the Pico in (in docked mode, focus the chat box first to receive Pico input).

    The Pico types the chat XSS (~87 lines, ~20 min); the Remote JS Loader comes up on the console (TCP :9026) for that session.

  2. Install the persistent boot trigger from the PC: python installer-creator/install.py <console-ip> — uploads the save template, splices the compressed payload into it on-console, wipes save:/saves/Single/, and writes the trigger.

  3. From then on, every boot: main menu -> Load Game -> the payload runs from savedata (and if the payload is the loader, :9026 is up at boot — and survives console sleep/wake).

  4. You can revert system language after installer finished.

Sending payloads (send_js.py)

python send_js.py <console-ip> [port] file.js

Sends a JS file as-is to the Remote JS Loader (default port 9026), then prints the log output the console streams back (read until close or timeout).

Build (Pico firmware)

On Ubuntu 24.04:

sudo apt install -y git build-essential cmake ninja-build gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib python3 nodejs npm
git clone --branch 2.3.1 --depth 1 --recurse-submodules --shallow-submodules https://github.com/raspberrypi/pico-sdk.git ~/pico-sdk
export PICO_SDK_PATH=$HOME/pico-sdk
cd PicoSwitch
npm install                    # terser for compress.js
./build_all.sh                 # payload + all four variants: pico1/pico2 x us/jis

Credits

CivSwitch (Gezine/CivSwitch)

正在搜索数据库…

这是什么?CivSwitch 是一套漏洞利用工具链,它利用实体卡带版《文明7》聊天功能中的 XSS 漏洞,在 Nintendo Switch 上实现用户态代码执行,让你能够在主机上运行任意 JavaScript 载荷。
这只是软件,还是还需要额外的硬件?它分为两部分:PicoSwitch 是运行在树莓派 Pico(RP2040/RP2350)上的固件,充当 USB 键盘宏,把漏洞利用载荷输入到游戏内的聊天框中;installer-creator 是一个 Python 工具,会向存档数据中写入持久化的启动触发器,使漏洞利用在重启后依然有效。
我到底该怎么运行这个漏洞利用?将加载器固件刷入 Pico,把 Switch 的系统语言和 USB 键盘都设为 English(US),通过 90DNS 连接网络,然后在 Civ7 多人无线主机大厅中打开聊天,插上 Pico,让它自动输入聊天载荷;之后在电脑上运行 python installer-creator/install.py,使漏洞利用实现开机持久化。
除了游戏本身,我还需要准备什么?一张实体《文明7》卡带,游戏版本为 1.0.0;一块刷入了 PicoSwitch 的树莓派 Pico;一台装有 Python 的电脑,用于运行 sendjs.py 和 install.py;如果需要自行编译固件,还需要 Ubuntu 24.04。
这个能在所有 Switch 或所有 Civ7 版本上运行吗?仅支持 1.0.0 版实体卡带的 Civ7,不过理论上应可在 Switch 1 和 Switch 2 的 20.x.x 至当前 23.0.1 系统固件上运行(仅在少数特定版本上测试过)。每次会话中将载荷输入聊天大约需要 15 分钟。
安装程序完成后会发生什么?install.py 会上传一个存档模板,在主机上将压缩后的载荷嵌入其中,清空 save:/saves/Single/,并写入启动触发器,因此之后每次开机加载该存档时都会再次运行载荷。如果载荷是加载器,TCP 端口 9026 的服务器会自动重新启动,甚至能在主机休眠和唤醒后保持运行。
sendjs.py 有什么作用?它会把任意 JavaScript 载荷文件原样通过 TCP 端口 9026 发送给已在运行的 Remote JS Loader,并打印出主机回传的日志输出。
为什么要修改系统语言并屏蔽任天堂的服务器?USB HID 宏是针对 English(US) 键盘布局调校的,以确保输入正确;而 90DNS 会屏蔽任天堂的服务器,使主机在设置漏洞利用期间无法回传信息,也无法接收更新补丁。
漏洞利用代码来自哪里?JS 漏洞利用核心基于 Netflix-N-Hack 的 inject.js 以及 ufm42 的一个分支开发,PicoSwitch 固件则基于 Element2424 的 Pico-Switch-Controller。
作者
Gezine
大小
1 MB
星标
755
时长
17天
提交 · 90 天