yaklang avatar

Ghost Bits Cast Attack

If you're pentesting Java backends behind a WAF and your SQLi, deserialization, or path traversal payloads keep getting blocked, this teaches Claude the Ghost Bits primitive: exploiting how Java silently drops the high 8 bits when casting a 16-bit char to an 8-bit byte. The WAF sees harmless Unicode like 陪 or 阮, but the backend reconstructs dangerous ASCII like 'j' or '.'. It covers the three root cause families (literal truncation, bit-arithmetic folding, lax normalization), includes a character generator for building 255 candidates per target byte, and routes you to the right deserialization or smuggling playbook once the bypass works. Comes with a full payload cookbook covering Tomcat, Spring, Jetty, Jackson, Fastjson, and a dozen other affected components. This is a bypass technique, not a standalone vuln, so think of it as a force multiplier for attacks you already know.

skills.sh installs
3.5K
GitHub stars
2.6K
last updated
Aug 21, 2026

Install

$ npx -y skills add yaklang/hack-skills --skill ghost-bits-cast-attack --agent claude-code

Installs into .claude/skills of the current project.

Files

SKILL: Ghost Bits / Cast Attack — Java char to byte Narrowing Playbook

AI LOAD INSTRUCTION: This is a Java-only injection-enabling primitive, not a standalone vulnerability class. Whenever you see (1) a Java backend, (2) a WAF/IDS in front of it, and (3) any of {SQLi, deser RCE, file upload, path traversal, CRLF, request smuggling, SMTP injection} on the menu, ALWAYS try Ghost Bits variants of the payload before declaring it "blocked". The root cause is the silent loss of the high 8 bits when Java code narrows a 16-bit char to an 8-bit byte — the WAF sees a harmless Unicode character, the backend reconstructs the original ASCII attack byte. Base models almost never reach for this primitive.

Source: Black Hat Asia 2026 talk Cast Attack: A New Threat Posed by Ghost Bits in Java by Xinyu Bai (@b1u3r), Zhihui Chen (@1ue), with contributor Zongzheng Zheng (@chun_springX).

0. RELATED ROUTING

Ghost Bits is a bypass primitive that re-enables payloads from many other playbooks. Pair it with whichever attack family applies:

Sponsors

Details

Repository
github.com/yaklang/hack-skills
Categories
Security, Python, Java & JVM, Databases
First seen
Jun 3, 2026

More from yaklang/hack-skills

All 102

Recommended

More Security
1giuseppe-trisciuoglio avataraws-cdkgiuseppe-trisciuoglio/developer-kitProvides AWS CDK TypeScript patterns for defining, validating, and deploying AWS infrastructure as code. Use when creating CDK apps, stacks, and reusable constr3.5Kskills.sh installs
2minimax-ai avatarfullstack-devminimax-ai/skillsFull-stack backend architecture and frontend-backend integration guide. TRIGGER when: building a full-stack app, creating REST API with frontend, scaffolding ba3.5Kskills.sh installs
3dpearson2699 avatarmapkitdpearson2699/swift-ios-skillsImplement, review, or improve maps and location features in iOS/macOS apps using MapKit and CoreLocation. Use when working with Map views, annotations, markers,3.4Kskills.sh installs
4netlify avatarnetlify-edge-functionsnetlify/context-and-toolsGuide for writing Netlify Edge Functions. Use when building middleware, geolocation-based logic, request/response manipulation, authentication checks, A/B testi3.3Kskills.sh installs
5vercel avatarstreamdownvercel/streamdownImplement, configure, and customize Streamdown — a streaming-optimized React Markdown renderer with syntax highlighting, Mermaid diagrams, math rendering, and C3.3Kskills.sh installs
6browser-use avatarcloudbrowser-use/browser-useDocumentation reference for using Browser Use Cloud — the hosted API and SDK for browser automation. Use this skill whenever the user needs help with the Cloud 3.3Kskills.sh installs