# Improper Restriction of XML External Entity Reference (CWE-611) The product processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output. **Stack:** Go - Prevalence: मध्यम 3 भाषाएँ कवर की गईं - Impact: उच्च 3 उच्च गंभीरता वाले नियम - Prevention: प्रलेखित 3 फिक्स उदाहरण **OWASP:** Security Misconfiguration (A05:2021-Security Misconfiguration) - #5 ## Description XML External Entity (XXE) attacks exploit features of XML parsers to read local files, perform server-side request forgery, or cause denial of service. ## Prevention 1 Shoulder डिटेक्शन नियमों पर आधारित XML External Entity (XXE) के लिए रोकथाम रणनीतियाँ। ### Go Go's encoding/xml is safe by default; reject XML with DOCTYPE declarations as defense in depth ## Consequences - एप्लिकेशन डेटा पढ़ना - फ़ाइलें या डायरेक्टरीज़ पढ़ना - DoS ## Mitigations - XML पार्सरों में बाहरी एंटिटी प्रसंस्करण को निष्क्रिय करें - जब संभव हो, JSON जैसे कम जटिल डेटा प्रारूपों का उपयोग करें - XML इनपुट को सत्यापित और सैनिटाइज़ करें ## Detection - Total rules: 3 - Languages: go, javascript, typescript, python ## Rules by Language ### Go (1 rules) - **XML External Entity (XXE) Injection** [HIGH]: User-controlled XML parsed without disabling external entities. - Remediation: Go's encoding/xml is safe by default. Reject XML with DOCTYPE declarations. ```go if bytes.Contains(body, []byte("