Skip to content
vetkitChecksChangelogDocumentation

vetkit.csharp.deserialization.binary-formatter

Data is deserialized with BinaryFormatter, SoapFormatter, NetDataContractSerializer, LosFormatter or ObjectStateFormatter. These formatters instantiate attacker-chosen types and lead to remote code execution on untrusted input; Microsoft states they cannot be made safe.

Last updated:

Suite: Security

csharp

Data is deserialized with BinaryFormatter, SoapFormatter, NetDataContractSerializer, LosFormatter or ObjectStateFormatter. These formatters instantiate attacker-chosen types and lead to remote code execution on untrusted input; Microsoft states they cannot be made safe.

Category: SECURITY · Engine rule severity: ERROR

How to fix it

Switch to System.Text.Json, XmlSerializer or DataContractSerializer with a fixed set of known types. See Microsoft's BinaryFormatter migration guide.

References

Source: packages/engine/rules/sast/csharp.yml.

Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.