🇰🇷 한글 설명
Scrapy 프레임워크에서 HttpAuthMiddleware를 사용할 경우, 설정된 인증 정보가 robots.txt 요청이나 리다이렉트된 대상 등 모든 요청에 노출될 수 있는 취약점입니다. 이를 방지하기 위해 Scrapy 2.5.1 이상으로 업그레이드하거나 http_auth_domain 속성을 사용하여 인증 허용 도메인을 제한해야 합니다.
💡 쉬운 설명
웹사이트 정보를 수집하는 프로그램이 로그인 정보를 모든 사이트에 무심코 전달하여 비밀번호가 유출될 수 있는 문제입니다. 특정 사이트에서만 로그인 정보를 사용하도록 설정을 변경하거나 프로그램을 최신 버전으로 업데이트해야 합니다.
🇺🇸 원문 (English)
Scrapy is a high-level web crawling and scraping framework for Python. If you use `HttpAuthMiddleware` (i.e. the `http_user` and `http_pass` spider attributes) for HTTP authentication, all requests will expose your credentials to the request target. This includes requests generated by Scrapy components, such as `robots.txt` requests sent by Scrapy when the `ROBOTSTXT_OBEY` setting is set to `True`, or as requests reached through redirects. Upgrade to Scrapy 2.5.1 and use the new `http_auth_domain` spider attribute to control which domains are allowed to receive the configured HTTP authentication credentials. If you are using Scrapy 1.8 or a lower version, and upgrading to Scrapy 2.5.1 is not an option, you may upgrade to Scrapy 1.8.1 instead. If you cannot upgrade, set your HTTP authentication credentials on a per-request basis, using for example the `w3lib.http.basic_auth_header` function to convert your credentials into a value that you can assign to the `Authorization` header of your request, instead of defining your credentials globally using `HttpAuthMiddleware`.
📍 영향받는 시스템
Scrapy 2.5.1 미만 버전 (1.8.1 미만 버전 포함)
⚔️ 공격 벡터
리다이렉트 또는 robots.txt 요청을 통해 인증 정보가 의도치 않은 외부 도메인으로 전송됨
🛡️ 대응 방법
Scrapy를 2.5.1 이상으로 업그레이드하거나, http_auth_domain 속성을 설정하여 인증 범위를 제한함
🔧 검증 코드
출력된 Scrapy 버전이 2.5.1 미만인지 확인합니다.
pip show scrapy 2>/dev/null | grep Version