Skip to content
SKVLENTPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

JSBench

An on-device JavaScript console for iOS security research. JSBench runs JavaScriptCore scripts inside the app and exposes a fixed set of native bindings, so a test can be driven from a shell without rebuilding the app.

The app is intended for a developer-signed device that you own. It uses private frameworks and is not distributed through the App Store.

Features

  • Console with a script pane, an output pane, and an editable offline mode.
  • Server mode with an HTTP control surface on port 8080.
  • JavaScriptCore runtime with native bindings for memory, images, PDF, media, IOKit objects, and IOSurfaces.
  • Fault guard for SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGTRAP, and SIGABRT. A fault is recorded and the script fails; the process survives.
  • Journal of every run in Documents/last-script.js and state.json, with fault records in Documents/crash.log.
  • Settings with the server switch, author links, repository link, app version/build/bundle, and device details.

Requirements

  • An iPhone or iPad running iOS 26 or newer (verified on iOS 27.0.1).
  • A developer certificate and a provisioning profile that allow the app to run on your device. Developer Mode must be enabled.
  • Xcode 26 or newer for the standard build, or a Swift toolchain with an iPhoneOS SDK (see the Linux section).
  • Optional: Python 3 and pymobiledevice3 for install/launch from a host.

Build

macOS with Xcode

./build.sh

The script compiles the C, Objective-C, and Swift sources with clang and swiftc from the active Xcode, copies the icon and Info.plist, and writes build/JSBench.app.

To sign during the build:

CODESIGN_IDENTITY="Apple Development: Your Name (TEAMID)" ./build.sh

To include entitlements, copy the example and pass it explicitly:

cp JSBench.entitlements.example JSBench.entitlements
# edit the App Group and optional HID entitlement for your profile
CODESIGN_IDENTITY="Apple Development: Your Name (TEAMID)" \
  ENTITLEMENTS="$PWD/JSBench.entitlements" ./build.sh

Some bindings need capabilities that a personal profile may not grant:

  • the App Group used by the container tests;
  • com.apple.developer.hid.virtual.device for the virtual HID path.

The app still builds and runs without them; the affected tests fail at runtime.

Sources/Info.plist uses the bundle identifier com.SKVLENT.JSBench. To install on your own device with your own provisioning profile, change CFBundleIdentifier to an identifier registered in that profile. If you use the App Group tests, change the group in JSBench.entitlements to one from your profile as well.

Linux with a Swift toolchain and an iOS SDK

build.sh also accepts explicit tool paths, for example the xtool/Darwin SDK artifactbundle layout:

SDK=/path/to/iPhoneOS.sdk \
SWIFTC=/path/to/swiftc \
CLANG=/path/to/clang \
TOOLCHAIN_RESOURCES=/path/to/swift/resources \
./build.sh

Useful environment overrides: OUT, MIN_IOS (default 26.0), CODESIGN_IDENTITY, ENTITLEMENTS.

Install

Install the built app with Xcode's Devices and Simulators window, or from a host:

python3 -m pymobiledevice3 apps install build/JSBench.app
python3 -m pymobiledevice3 launch com.SKVLENT.JSBench

ios-deploy works as well:

ios-deploy --bundle build/JSBench.app

Use

Open the app and switch Settings → Connection → Server on. The console shows the device address and the token.

Send a script:

curl -X POST \
  --data-binary 'log("hello from JSBench"); log(1 + 2);' \
  "http://<device-ip>:8080/exec?token=jsbench-remote"

In offline mode the editor is local; use Run to execute the current script.

HTTP API

Request Result
POST /exec?token=… run the request body as JavaScript, return its output
GET /status?token=… version, build, device, uptime
GET /state?token=… current activity and journal
GET /file?name=crash.log&token=… crash.log, state.json, last-script.js, session-*.log
GET /log?token=… recent console log
GET /mode?set=offline|server&token=… switch mode
GET /quit?token=… exit the app
GET /media?name=media-*&token=… serve a file from Documents or tmp

The default token is jsbench-remote. Change RemoteControl.token in Sources/RemoteControl.swift before building if the device is on a shared network.

JavaScript bindings

Core helpers:

log(value)                 append to the output
sleep(milliseconds)        wait
now()                      seconds since the epoch
http(url)                  request a URL, report status and length
mmap(address, size)        map a page at a fixed address
memset(address, byte, n)   fill memory
dump(address, size)        hex dump
read64(address)            read a 64-bit value
write64(address, value)    write a 64-bit value
pdf(base64, width, height) render a PDF and count painted pixels
pdfpixels(base64, w, h)    render a PDF and hash the output

The remaining bindings cover image decoding, video encode/decode, AudioToolbox, IOKit, IOSurface, XPC, HID, and the memory/allocator probes in Sources/SPTM. They are registered in Sources/JSBench.swift; inspect that file for the exact names and signatures.

Repository layout

Sources/            Swift, C, and Objective-C sources
Sources/SPTM/       native probe sources used by the bindings
Sources/Icons/      app icons
Sources/Info.plist  bundle metadata
build.sh            clang/swiftc build script
JSBench.entitlements.example  signing entitlements template
LICENSE             MIT license

Notes

  • JSBench is a test bench, not a jailbreak. It does not install a package manager or modify the system.
  • The app contains code that exercises private APIs. Use it only on devices you own, and only where you are allowed to run such tests.
  • The HTTP server has no transport security. Keep it on a trusted local network and change the token for any shared environment.

Credits

The probe sources include ports of prior research; the file headers identify the originals.

  • Sources/IPCUAF.c — port of the AstraSaw v3 fileport race.
  • Sources/SPTM/entry_isurf_uaf.m — port of the _pack_rust505 IOSurface UAF harness.

Author

License

MIT. See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages