コンテンツへスキップ
uencoder

Insecure Deserialization Prevention リファレンス

リファレンス 用 insecure deserialization vulnerabilities および prevention で various languages.

Vulnerability Mechanism

Insecure deserialization occurs when untrusted data is deserialized into objects, potentially executing attacker-controlled code. Java (ObjectInputStream), Python (pickle), PHP (unserialize), and .NET (BinaryFormatter) are vulnerable. Gadget chains in common libraries enable code execution from crafted payloads. The attack does not require the application to explicitly call dangerous methods; the deserialization process itself triggers them via magic methods (readObject, __wakeup).

Java
ObjectInputStream
readObject gadgets
Python
pickle.loads
__reduce__
PHP
unserialize
__wakeup/__destruct

Prevention

Avoid deserializing untrusted data entirely; use JSON or other data-only formats. If unavoidable, use allowlist-based deserialization (Java ObjectInputFilter, .NET DataContractSerializer with known types). Implement integrity checks (HMAC) on serialized data before deserialization. Monitor and log deserialization events. Keep libraries updated to reduce available gadget chains. Language-specific hardened alternatives: Java SerializationFilter, Python json, PHP json_decode.

avoid
Use JSON instead
data-only formats
allowlist
Known types only
ObjectInputFilter
integrity
HMAC before deserialize
verify signature

関連ツール

参考链接