# 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. - 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 3개의 Shoulder 탐지 규칙을 기반으로 한 XML External Entity (XXE) 예방 전략. ### Key Practices - Use denial of service ### Go Go's encoding/xml is safe by default; reject XML with DOCTYPE declarations as defense in depth ### JavaScript Disable external entity processing in XML parsers or use JSON instead of XML ### Python Use defusedxml instead of standard XML parsers for untrusted input ## Warning Signs - [HIGH] unsafe XML parsing that could allow XML External Entity (XXE) attacks - [HIGH] XML parsing with external entity processing enabled ## 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("