[high] semgrep: All deserializes type information from its input, so data from outside can run code (CWE-502). #601

Closed
opened 2026-11-03 19:26:24 +00:00 by pruefwerk · 1 comment
Member

high Finding

Scanner: semgrep
Severity: high
Rule: cra-ai-20-csharp-unsafe-deserialization
CWE: CWE-502

Description

All deserializes type information from its input, so data from outside can run code (CWE-502). Use a serializer bound to known types (System.Text.Json, DataContractSerializer, JSON.NET with TypeNameHandling.None).

Location

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

Code

            var settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All };

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

## high Finding **Scanner:** semgrep **Severity:** high **Rule:** cra-ai-20-csharp-unsafe-deserialization **CWE:** CWE-502 ### Description All deserializes type information from its input, so data from outside can run code (CWE-502). Use a serializer bound to known types (System.Text.Json, DataContractSerializer, JSON.NET with TypeNameHandling.None). ### Location **File:** `compliance-agent/rules/cra_semgrep_csharp.cs` (line 99) ### Code ``` var settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All }; ``` --- *Fingerprint:* `ab69b9460ef291ad5b7b4964eb745e43d7181a889045f7a28d38c2ba669393fa` *Generated by compliance-scanner* [Open in Prüfwerk / In Prüfwerk öffnen](https://pruefwerk.breakpilot.com/findings?target=6ae9aa2160f5d8045fc570a7)
pruefwerk added the severity:highpruefwerkcra:annex-i labels 2026-11-03 19:26:24 +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#601