Agent skill · security · yaklang
ghost-bits-cast-attack
Java "Ghost Bits" / Cast Attack playbook (Black Hat Asia 2026). Use when attacking Java services where 16-bit char is silently narrowed to 8-bit byte to bypass WAF/IDS for SQL injection, deserialization RCE, file upload (Webshell), path traversal, CRLF injection, request smuggling, and SMTP injection. Affects Tomcat, Spring, Jetty, Undertow, Vert.x, Jackson, Fastjson, Apache Commons BCEL, Apache HttpClient, Angus Mail, JDK HttpServer, Lettuce, Jodd, XMLWriter and re-enables many "patched" CVEs through WAF bypass.
Why this skill is useful
Provides a comprehensive playbook for exploiting Java's char to byte narrowing vulnerabilities, including specific payloads and attack patterns not commonly known.
What it needs
About 12k tokens when loaded. Last updated 2026-06-16. 1,563 stars on the source repository.
What this skill does
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 (@chunspringX). 0. RELATED ROUTING Ghost Bits is a bypass primitive that re-enables payloads from many other playbooks. Pair it with whichever attack family applies: waf-bypass-techniques — when a Java backend is suspected and WAF rules block the literal payload, this is the first technique to try beyond classic encoding. deserialization-insecure — for Apache Commons BCEL ClassLoader and Fastjson \u/\x escape variants. path-traversal-lfi — Spring, Jetty, Undertow, Vert.x URL decoding and %2> hex folding. upload-insecure-files — Tomcat RFC2231Utility filename Webshell upload. request-smuggling — Apache HttpClient <= 4.5.9 (HTTPCLIENT-1974/1978) header CRLF. crlf-injection — Angus Mail / Jakarta Mail SMTP injection and JDK HttpServer response splitting. sqli-sql-injection — Jackson charToHex table-lookup truncation hides SQL keywords inside Unicode escapes. Advanced Reference Load PAYLOADCOOKBOOK.md when you need: Full byte-to-Ghost-character lookup table covering every printable ASCII byte 0x20–0x7E and the most useful control bytes (0x00, 0x09, 0x0A, 0x0D). Per-component affected version matrix and patch identifiers. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills yaklang/ghost-bits-cast-attack