High severityC#Insecure DeserializationHIGH confidence
Binaryformatter
BinaryFormatter is used to deserialize data.
Standards mapping
- OWASP Top 10
- A08:2021 - Software and Data Integrity Failures
- OWASP ASVS
- V5.5.3 (L1)
Vulnerable vs. safe
Flagged by this check
return formatter.Deserialize(stream);Passes - the safe pattern
return System.Text.Json.JsonSerializer.Deserialize<object>(json);Why it matters & how to fix it
BinaryFormatter is used to deserialize data. BinaryFormatter is insecure by design and deserializing untrusted input leads to remote code execution (CWE-502); it is obsolete and removed in modern .NET. Replace it with a contract-based serializer such as System.Text.Json or a DataContractSerializer over a known, restricted type set.
References
Rule ID integsec.csharp.deserialization.binaryformatter - engine: Opengrep - license: MIT - Copyright (c) IntegSec Inc.
TurboPentest runs this check automatically
Connect a GitHub repo and this check runs on every white-box pentest - AI-validated and reported with proof, from $99 per target.
Start a pentestRelated checks
- JavaScript / TypeScript - Insecure DeserializationNode Serialize Unserialize
- JavaScript / TypeScript - Insecure DeserializationYAML Unsafe Load
- Python - Insecure DeserializationJsonpickle Decode
- Python - Insecure DeserializationPickle Load
- Python - Insecure DeserializationYAML Unsafe Load
- Java - Insecure DeserializationJackson Default Typing