Insecure deserialization and object-injection across Java, PHP, Python, .NET, Ruby and Node.js. Identify serialized data, detect the format, build or adapt gadget chains (ysoserial family), and escalate to RCE. Covers viewState, Java serialization, PHP object injection, Python pickle, .NET BinaryFormatter/Json.NET, and Node prototype/gadget abuse. Use when the app round-trips serialized objects.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Web Deserialization?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/anandjogawade-web-deserialization)
---
name: web-deserialization
description: Insecure deserialization and object-injection across Java, PHP, Python, .NET, Ruby and Node.js. Identify serialized data, detect the format, build or adapt gadget chains (ysoserial family), and escalate to RCE. Covers viewState, Java serialization, PHP object injection, Python pickle, .NET BinaryFormatter/Json.NET, and Node prototype/gadget abuse. Use when the app round-trips serialized objects.
---
# Insecure Deserialization / Object Injection
When an app deserializes attacker-controllable data into objects, crafted input can instantiate dangerous objects and trigger gadget chains ending in RCE. First find the serialized blob and its format, then apply the language-specific gadget approach.
## Trigger phrases
`deserialization, insecure deserialization, object injection, gadget chain, ysoserial, pickle, viewstate, java serialized, php unserialize, binaryformatter, marshal`
## 1. Find & fingerprint serialized data
Look in cookies, hidden fields, API bodies, caches, message queues, and file uploads for:
- **Java:** base64 beginning `rO0AB...` (hex `ac ed 00 05`); `Content-Type: application/x-java-serialized-object`.
- **PHP:** `O:8:"ClassName":...`, `a:2:{...}` patterns (from `serialize()`).
- **Python pickle:** base64 that decodes to opcodes (`\x80\x04...`), or `__reduce__`-friendly inputs; also `PyYAML` and `jsonpickle`.
- **.NET:** base64 `AAEAAAD/////` (BinaryFormatter), `__VIEWSTATE`, Json.NET `$type`, `LosFormatter`, `NetDataContractSerializer`.
- **Ruby:** Marshal (`\x04\x08`), YAML.
- **Node:** `node-serialize` (`_$$ND_FUNC$$_`), funcster, serialized objects in JWT/cookies, prototype-pollution sinks.
## 2. Confirm processing
Tamper the blob minimally and watch for parse errors / behavior change. For blind cases, use a gadget that performs a DNS/HTTP callback (OAST) or a time delay to confirm execution before attempting full RCE.
## 3. Language-specific exploitation
- **Java:** enumerate classpath libraries (Commons-Collections, Spring, Groovy, etc.) from errors/deps (→ `vulnerable-components`). Generate payloads with **ysoserial** matching an available gadget (`CommonsCollections1-7`, `Spring1/2`, `Groovy1`, `URLDNS` for detection). Deliver via the identified sink. For RMI/JMX/LDAP log4shell-style JNDI, consider `JNDI`/`JRMP` listeners. Confirm with `URLDNS` first (pure OAST, no RCE) then escalate.
- **PHP object injection:** find a class with useful magic methods (`__wakeup`, `__destruct`, `__toString`, `__call`) in the codebase (white-box) or known framework POP chains (Laravel, Symfony, Monolog, Guzzle via **phpggc**). Craft the serialized object to drive a POP chain to file write/RCE. Watch for `__wakeup` bypass (property-count mismatch) and `phar://` deserialization triggers.
- **Python pickle:** `__reduce__` returning `(os.system, ("id",))` → RCE on `pickle.loads`. Also `yaml.load` (unsafe) `!!python/object/apply:os.system`. Confirm with callback first.
- **.NET:** use **ysoserial.net** gadgets (`TypeConfuseDelegate`, `ActivitySurrogateSelector`, etc.) for BinaryFormatter/LosFormatter; Json.NET `$type` to instantiate dangerous types; **ViewState** — if the MAC is disabled or the machineKey is known/leaked, forge a ViewState payload (ysoserial.net `ViewState` plugin) for RCE.
- **Ruby:** Marshal/`YAML.load` universal gadget chains to RCE.
- **Node:** `node-serialize` IIFE RCE (`_$$ND_FUNC$$_function(){...}()`); unsafe `eval`/`Function` sinks; prototype pollution as an object-injection cousin (→ `web-client-side` for client side; server-side PP can reach RCE via gadget).
## 4. ViewState (ASP.NET) specifics
- Check if `__VIEWSTATE` MAC is enabled. If `EnableViewStateMac=false` or the `machineKey` (validationKey/decryptionKey) is leaked (web.config disclosure, default keys, source leak), forge a signed ViewState → RCE. Tools: ysoserial.net, `viewgen`.
## 5. Escalate
Any gadget RCE ⇒ reverse shell, read secrets, pivot. If only object injection without a ready RCE chain, use it for file read/write, SSRF (`phar`/URL gadgets), auth bypass, or DoS as applicable — then keep hunting a chain.
## Safety & evidence
- Prefer detection-only gadgets (URLDNS/OAST/time) to confirm before running intrusive RCE, especially on production.
- Capture the serialized payload, the gadget used, and proof of execution (callback log or command output). See `${CLAUDE_PLUGIN_ROOT}/payloads/deserialization.md`.