🇰🇷 한글 설명
xml-crypto는 Node.js용 XML 디지털 서명 라이브러리로, 기본 설정에서 서명자의 권한을 검증하지 않아 공격자가 악의적인 인증서로 XML 문서를 재서명하고 KeyInfo 요소에 배치하여 검증을 우회할 수 있습니다. 공격자가 자신의 개인 키로 생성한 인증서를 제공하면 라이브러리가 이를 신뢰하여 위조된 서명이 검증되는 심각한 취약점입니다.
💡 쉬운 설명
XML 문서에 디지털 서명할 때, 누구의 서명인지 제대로 확인하지 않아서 나쁜 사람이 자신의 서명을 진짜처럼 속일 수 있습니다. 마치 다른 사람 도장을 가짜로 만들어서 붙이는 것과 같습니다.
🇺🇸 원문 (English)
xml-crypto is an xml digital signature and encryption library for Node.js. In affected versions the default configuration does not check authorization of the signer, it only checks the validity of the signature per section 3.2.2 of the w3 xmldsig-core-20080610 spec. As such, without additional validation steps, the default configuration allows a malicious actor to re-sign an XML document, place the certificate in a `<KeyInfo />` element, and pass `xml-crypto` default validation checks. As a result `xml-crypto` trusts by default any certificate provided via digitally signed XML document's `<KeyInfo />`. `xml-crypto` prefers to use any certificate provided via digitally signed XML document's `<KeyInfo />` even if library was configured to use specific certificate (`publicCert`) for signature verification purposes. An attacker can spoof signature verification by modifying XML document and replacing existing signature with signature generated with malicious private key (created by attacker) and by attaching that private key's certificate to `<KeyInfo />` element. This vulnerability is combination of changes introduced to `4.0.0` on pull request 301 / commit `c2b83f98` and has been addressed in version 6.0.0 with pull request 445 / commit `21201723d`. Users are advised to upgrade. Users unable to upgrade may either check the certificate extracted via `getCertFromKeyInfo` against trusted certificates before accepting the results of the validation or set `xml-crypto's getCertFromKeyInfo` to `() => undefined` forcing `xml-crypto` to use an explicitly configured `publicCert` or `privateKey` for signature verification.
📍 영향받는 시스템
xml-crypto 버전 4.0.0 ~ 5.x (Node.js)
⚔️ 공격 벡터
공격자가 XML 문서를 자신의 개인 키로 재서명하고 인증서를 <KeyInfo /> 요소에 삽입하여 서명 검증 우회
🛡️ 대응 방법
xml-crypto를 6.0.0 이상으로 업그레이드하거나, getCertFromKeyInfo에서 반환된 인증서를 신뢰할 수 있는 인증서와 검증
🔧 검증 코드
버전 6.0.0 이상이면 안전, 그 미만이면 업그레이드 필요
npm list xml-crypto 2>/dev/null | grep xml-crypto