🇰🇷 한글 설명
C++11 단일 파일 헤더 전용 크로스 플랫폼 HTTP/HTTPS 라이브러리인 cpp-httplib에서 버전 0.30.0 이전까지 사용자 제공 헤더에서 CR 및 LF 문자를 확인하지 않아 공격자가 추가 헤더를 추가하거나 요청 본문을 예기치 않게 수정하고 SSRF 공격을 유발할 수 있는 취약점
💡 쉬운 설명
cpp-httplib 라이브러리의 취약점으로 인해 공격자가 요청 헤더를 조작하여 추가 헤더를 삽입하거나 요청 본문을 변경할 수 있으며, 이는 SSRF 공격을 포함한 다양한 보안 문제를 일으킬 수 있습니다. 이 취약점은 버전 0.30.0 이전의 라이브러리에서 발생합니다.
🇺🇸 원문 (English)
cpp-httplib is a C++11 single-file header-only cross platform HTTP/HTTPS library. Prior to version 0.30.0, the ``write_headers`` function does not check for CR & LF characters in user supplied headers, allowing untrusted header value to escape header lines.
This vulnerability allows attackers to add extra headers, modify request body unexpectedly & trigger an SSRF attack. When combined with a server that supports http1.1 pipelining (springboot, python twisted etc), this can be used for server side request forgery (SSRF). Version 0.30.0 fixes this issue.
📍 영향받는 시스템
cpp-httplib 버전 0.30.0 이전
⚔️ 공격 벡터
공격자가 사용자 제공 헤더에서 CR 및 LF 문자를 삽입하여 헤더를 탈출하고 추가 헤더를 삽입하거나 요청 본문을 변경
🛡️ 대응 방법
cpp-httplib 라이브러리를 버전 0.30.0 이상으로 업데이트하여 취약점을 해결
🔧 검증 코드
로컬 Python 환경에서 cpp-httplib 라이브러리의 버전을 확인하여 취약점 여부를 판단합니다. Python이 설치되어 있고, cpp-httplib 라이브러리가 설치되어 있어야 합니다. 코드를 실행하면 라이브러리 버전이 0.30.0 미만일 경우 '취약', 0.30.0 이상일 경우 '양호'를 출력합니다.
python -c "import pkg_resources; print('취약' if pkg_resources.get_distribution('cpp-httplib').version < '0.30.0' else '양호')"