🇰🇷 한글 설명
@koa/cors npm 패키지 5.0.0 미만 버전에서 허용된 오리진이 지정되지 않을 경우, 요청의 오리진을 그대로 Access-Control-Allow-Origin 헤더에 반환하는 취약점이 발견되었습니다. 이 동작은 브라우저의 핵심 보안 정책인 동일 출처 정책(SOP)을 무력화하여 심각한 보안 위협을 초래할 수 있습니다.
💡 쉬운 설명
웹사이트가 아무 곳에서나 데이터를 가져갈 수 있도록 문을 활짝 열어두는 것과 같습니다. 이로 인해 해커가 만든 가짜 사이트가 사용자의 중요한 정보를 몰래 빼갈 수 있습니다.
🇺🇸 원문 (English)
@koa/cors npm provides Cross-Origin Resource Sharing (CORS) for koa, a web framework for Node.js. Prior to version 5.0.0, the middleware operates in a way that if an allowed origin is not provided, it will return an `Access-Control-Allow-Origin` header with the value of the origin from the request. This behavior completely disables one of the most crucial elements of browsers - the Same Origin Policy (SOP), this could cause a very serious security threat to the users of this middleware. If such behavior is expected, for instance, when middleware is used exclusively for prototypes and not for production applications, it should be heavily emphasized in the documentation along with an indication of the risks associated with such behavior, as many users may not be aware of it. Version 5.0.0 fixes this vulnerability.
📍 영향받는 시스템
@koa/cors npm 패키지 5.0.0 미만 버전
⚔️ 공격 벡터
악의적인 사이트에서 사용자의 브라우저를 통해 대상 서버로 요청을 보내 데이터를 탈취하는 방식
🛡️ 대응 방법
@koa/cors 패키지를 5.0.0 이상의 최신 버전으로 업데이트
🔧 검증 코드
출력된 버전 번호가 5.0.0 미만인지 확인