[high] devskim: BinaryFormatter, SoapFormatter, NetDataContractSerializer, LosFormatter and ObjectStateFormatter reconstruct arbitrary types named in the payload, which allows an attacker who controls the input to run code. ADM.10010 approves only Syst… #884

Closed
opened 2026-11-05 16:54:46 +00:00 by pruefwerk · 1 comment
Member

high Finding

Scanner: devskim
Severity: high
Rule: DS425070
CWE: CWE-502
CRA: cra-ai-20 — Automatisierte Sicherheitstests (Annex I)

Description

Do not deserialize untrusted data.

Do not deserialize untrusted data.: BinaryFormatter, SoapFormatter, NetDataContractSerializer, LosFormatter and ObjectStateFormatter reconstruct arbitrary types named in the payload, which allows an attacker who controls the input to run code. ADM.10010 approves only System.Text.Json, XmlSerializer, DataContractSerializer, DataContractJsonSerializer, Newtonsoft.Json and protobuf.

Location

File: compliance-agent/rules/cra_semgrep_csharp.cs (line 93)

Code

            var ndcs = new NetDataContractSerializer();

Remediation

Use System.Text.Json or another approved serializer. BinaryFormatter is obsolete and was removed in .NET 9.


Fingerprint: ed34d4638693b133c83d7c7256e616f1f5f12efc8e39e699a021a9f398402bbb
Generated by compliance-scanner
Open in Prüfwerk / In Prüfwerk öffnen

## high Finding **Scanner:** devskim **Severity:** high **Rule:** DS425070 **CWE:** CWE-502 **CRA:** cra-ai-20 — Automatisierte Sicherheitstests (Annex I) ### Description Do not deserialize untrusted data. Do not deserialize untrusted data.: BinaryFormatter, SoapFormatter, NetDataContractSerializer, LosFormatter and ObjectStateFormatter reconstruct arbitrary types named in the payload, which allows an attacker who controls the input to run code. ADM.10010 approves only System.Text.Json, XmlSerializer, DataContractSerializer, DataContractJsonSerializer, Newtonsoft.Json and protobuf. ### Location **File:** `compliance-agent/rules/cra_semgrep_csharp.cs` (line 93) ### Code ``` var ndcs = new NetDataContractSerializer(); ``` ### Remediation Use System.Text.Json or another approved serializer. BinaryFormatter is obsolete and was removed in .NET 9. --- *Fingerprint:* `ed34d4638693b133c83d7c7256e616f1f5f12efc8e39e699a021a9f398402bbb` *Generated by compliance-scanner* [Open in Prüfwerk / In Prüfwerk öffnen](https://pruefwerk.breakpilot.com/findings?target=6ae9aa2160f5d8045fc570a7)
pruefwerk added the severity:highcra:annex-ipruefwerk labels 2026-11-05 16:54:46 +00:00
Author
Member

Prüfwerk: Die Datei liegt in Testdaten (z. B. fixtures/ oder testdata/), die von der Prüfung ausgenommen sind.

The file lies in test data (such as fixtures/ or testdata/), which is left out of the scan.

**Prüfwerk:** Die Datei liegt in Testdaten (z. B. fixtures/ oder testdata/), die von der Prüfung ausgenommen sind. The file lies in test data (such as fixtures/ or testdata/), which is left out of the scan.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#884