🇰🇷 한글 설명
Node.js용 HTTP 요청 로거인 morgan 1.12.1 미만 버전에서 escapeLogField() 함수가 큰따옴표를 제대로 이스케이프하지 않는 취약점이 발견되었습니다. 공격자가 User-Agent나 Referer 헤더와 같이 로그에 기록되는 값을 조작할 경우, 로그 파싱 과정에서 필드 경계를 무너뜨려 로그 데이터를 위조할 수 있습니다. 이는 로그 분석 시스템이 공격자가 삽입한 텍스트를 정상적인 데이터 필드로 오인하게 만듭니다.
💡 쉬운 설명
로그를 기록할 때 사용하는 프로그램이 특정 특수문자(큰따옴표)를 제대로 처리하지 못하는 문제입니다. 공격자가 가짜 정보를 섞어 보내면, 로그 기록이 엉뚱하게 남아서 마치 정상적인 접속인 것처럼 속일 수 있습니다.
🇺🇸 원문 (English)
morgan is an HTTP request logger middleware for Node.js. In versions before 1.12.1, its escapeLogField() function does not escape the double quote character, which delimits the quoted fields of the Apache combined log format that morgan emits. An unauthenticated remote attacker who controls a value written to a quoted field, such as the User-Agent or Referer header, can include a double quote to close that field early, so a log consumer that parses the log by field position reads attacker-supplied text as the following field. In the built-in formats this makes the recorded value differ from the value that was sent, and in custom formats that quote an attacker-controlled token before a server-controlled one it can forge values such as the response status. No newline is injected, so record separation stays intact. The issue is fixed in morgan 1.12.1, which escapes the double quote. Users should upgrade to morgan 1.12.1 or later.
📍 영향받는 시스템
morgan versions before 1.12.1
⚔️ 공격 벡터
User-Agent 또는 Referer 헤더에 큰따옴표를 포함시켜 로그 필드 구조를 조작하는 원격 공격
🛡️ 대응 방법
morgan 버전을 1.12.1 이상으로 업그레이드하십시오.
🔧 검증 코드
출력된 morgan의 버전이 1.12.1 미만인지 확인하십시오.
npm list morgan | grep morgan