External XML entities are a feature of XML parsers that allow documents to contain references
to
other documents or data. This feature can be abused to read files, communicate with external
hosts,
exfiltrate data, or cause a Denial of Service (DoS).
XML parsers and document loaders must be configured to not resolve entities. This can be done
by:
Ensuring you are running a version of .NET Framework greater than 4.5.2 (released in 2014).
Using XDocument which disables entity resolution and is generally safe from DoS.
Setting XmlDocument's XmlResolver to null.
Example of safely loading an XML file using XmlDocument:
XmlDocument document = new XmlDocument();
document.XmlResolver = null;
document.Load("users.xml");
## medium Finding
**Scanner:** semgrep
**Severity:** medium
**Rule:** gitlab-csharp_injection_rule-XmlDocumentXXEInjection
**CWE:** CWE-611
**CRA:** cra-ai-20 — Automatisierte Sicherheitstests (Annex I)
### Description
External XML entities are a feature of XML parsers that allow documents to contain references
to
other documents or data. This feature can be abused to read files, communicate with external
hosts,
exfiltrate data, or cause a Denial of Service (DoS).
XML parsers and document loaders must be configured to not resolve entities. This can be done
by:
- Ensuring you are running a version of .NET Framework greater than 4.5.2 (released in 2014).
- Using `XDocument` which disables entity resolution and is generally safe from DoS.
- Setting `XmlDocument`'s `XmlResolver` to null.
Example of safely loading an XML file using `XmlDocument`:
```
XmlDocument document = new XmlDocument();
document.XmlResolver = null;
document.Load("users.xml");
```
For more information on XML security, see OWASP's guide:
https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html#net
### Location
**File:** `compliance-agent/rules/cra_semgrep_csharp.cs` (line 121)
### Code
```
doc2.Load(file);
```
### Remediation
None
---
*Fingerprint:* `98c68c47030d7c4a757d8babf380b99a89bc51565e3dd77766445cee29067d21`
*Generated by compliance-scanner*
[Open in Prüfwerk / In Prüfwerk öffnen](https://pruefwerk.breakpilot.com/findings?target=6ae9aa2160f5d8045fc570a7)
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.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
medium Finding
Scanner: semgrep
Severity: medium
Rule: gitlab-csharp_injection_rule-XmlDocumentXXEInjection
CWE: CWE-611
CRA: cra-ai-20 — Automatisierte Sicherheitstests (Annex I)
Description
External XML entities are a feature of XML parsers that allow documents to contain references
to
other documents or data. This feature can be abused to read files, communicate with external
hosts,
exfiltrate data, or cause a Denial of Service (DoS).
XML parsers and document loaders must be configured to not resolve entities. This can be done
by:
XDocumentwhich disables entity resolution and is generally safe from DoS.XmlDocument'sXmlResolverto null.Example of safely loading an XML file using
XmlDocument:For more information on XML security, see OWASP's guide:
https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html#net
Location
File:
compliance-agent/rules/cra_semgrep_csharp.cs(line 121)Code
Remediation
None
Fingerprint:
98c68c47030d7c4a757d8babf380b99a89bc51565e3dd77766445cee29067d21Generated by compliance-scanner
Open in Prüfwerk / In Prüfwerk öffnen
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.