🇰🇷 한글 설명
esaml 및 그 포크 버전에서 발생하는 XML 외부 엔티티(XXE) 취약점으로, 공격자가 조작된 SAML 메시지를 통해 로컬 파일을 읽거나 SSRF를 수행할 수 있습니다. Erlang/OTP 27 미만 버전의 Xmerl은 엔티티 확장을 기본적으로 허용하므로, 서명 검증 전 단계에서 파일 내용이 로그나 에러 메시지를 통해 노출될 수 있습니다.
💡 쉬운 설명
해커가 특수하게 만든 XML 문서를 보내면, 서버가 이 문서를 읽는 과정에서 서버 내부의 중요한 비밀 파일을 몰래 읽어낼 수 있는 보안 약점입니다. 비록 인증 과정에서 차단되더라도, 읽어온 파일 내용이 에러 기록 등에 남을 수 있어 위험합니다.
🇺🇸 원문 (English)
XML External Entity (XXE) vulnerability in esaml (and its forks) allows an attacker to cause the system to read local files and incorporate their contents into processed SAML documents, and potentially perform SSRF via crafted SAML messages.
esaml parses attacker-controlled SAML messages using xmerl_scan:string/2 before signature verification without disabling XML entity expansion. On Erlang/OTP versions before 27, Xmerl allows entities by default, enabling pre-signature XXE attacks. An attacker can cause the host to read local files (e.g., Kubernetes-mounted secrets) into the SAML document. If the attacker is not a trusted SAML SP, signature verification will fail and the document is discarded, but file contents may still be exposed through logs or error messages.
This issue affects all versions of esaml, including forks by arekinath, handnot2, and dropbox. Users running on Erlang/OTP 27 or later are not affected due to Xmerl defaulting to entities disabled.
📍 영향받는 시스템
esaml (arekinath, handnot2, dropbox 포크 포함) 및 Erlang/OTP 27 미만 버전
⚔️ 공격 벡터
조작된 XML 엔티티가 포함된 SAML 메시지를 전송하여 서버의 로컬 파일 읽기 또는 SSRF 유도
🛡️ 대응 방법
Erlang/OTP 27 이상 버전으로 업그레이드하거나, XML 파싱 시 엔티티 확장을 비활성화하도록 설정 변경
🔧 검증 코드
명령어 결과가 'Vulnerable'이면 취약한 버전이며, 'Safe'이면 안전한 버전입니다.
erl -eval 'io:format("~s\n", [OTP_VERSION]), halt().' -noshell | grep -E '^[0-9]+' | awk -F. '{if ($1 < 27) print "Vulnerable"; else print "Safe"}'