Insecure JSON Deserialization
Overview
While JSON itself does not execute code, certain JSON library configurations allow attackers to instantiate arbitrary classes through type metadata embedded in JSON. The most notable example is Jackson's enableDefaultTyping() which was responsible for multiple critical CVEs.
Remediation
- Jackson: Never use
enableDefaultTyping(), use@JsonTypeInfowith explicit subtypes - Newtonsoft.Json: Avoid
TypeNameHandling.All - Validate and whitelist expected types before deserialization