CME-1319
Deserialization Type Allowlisting
Description
Prevention of deserialization attacks through type allowlisting, signature verification of serialized data, and use of safe deserialization libraries. Restricts deserialization to explicitly allowed classes and validates object graphs before reconstruction. Applies to Java (ObjectInputStream with ObjectInputFilter), Python (restricted pickle with custom Unpickler), .NET (DataContractSerializer, avoiding BinaryFormatter), Ruby (safe Marshal alternatives), and PHP (JSON over unserialize). Prevents remote code execution via crafted serialized payloads by blocking gadget chain instantiation.
CVSS Vector Impacts
| Metric | Transition | Rationale |
|---|---|---|
| Attack Complexity (AC) | L → H | Requires object injection AND gadget chain AND type allowlist bypass; allowlisting blocks known gadgets |
| Integrity (I) | H → L | Prevents RCE from deserialization by blocking instantiation of dangerous classes |
| Confidentiality (C) | H → L | Prevents data extraction via deserialization side effects; type restrictions limit object graph |
CWE Relationships
Verification
Code review for type allowlisting and safe deserialization patterns
$ grep -rn 'ObjectInputStream' <app_source>/ | grep -v -i 'ObjectInputFilter\|setObjectInputFilter\|serialFilter\|REJECT' | head -10
# Expected: Zero matches — all ObjectInputStream uses should have ObjectInputFilter configured
# Expected: Zero matches — all ObjectInputStream uses should have ObjectInputFilter configured
Platform: any
$ grep -rn 'ObjectInputFilter\|setObjectInputFilter\|serialFilter\|ALLOWED_CLASSES\|jdk\.serialFilter' <app_source>/
# Expected: Java deserialization type filtering configured via ObjectInputFilter or global serial filter
# Expected: Java deserialization type filtering configured via ObjectInputFilter or global serial filter
Platform: any
$ grep -rn 'pickle\.loads\|pickle\.load\|yaml\.load\|yaml\.unsafe_load\|Marshal\.load' <app_source>/ | head -10
# Expected: Zero matches — use restricted Unpickler with find_class override, yaml.safe_load, or JSON instead
# Expected: Zero matches — use restricted Unpickler with find_class override, yaml.safe_load, or JSON instead
Platform: any
$ grep -rn 'BinaryFormatter\|SoapFormatter\|NetDataContractSerializer\|ObjectStateFormatter' <app_source>/ | head -10
# Expected: Zero matches — use DataContractSerializer or JsonSerializer instead of insecure .NET formatters
# Expected: Zero matches — use DataContractSerializer or JsonSerializer instead of insecure .NET formatters
Platform: any