GHSA-jpw8-42g9-g437:
Python 취약성 분석 및 완화
Summary
HARP forwards every proxied request through one shared HTTP client whose cookie jar is enabled. Cookies set by an upstream are stored by the proxy and sent with later requests from other clients, so one user can be sent upstream with another user's session.
Impact
Affects deployments where an upstream sets cookies (for example, session cookies after a login) and more than one client uses the same HARP instance. No HARP configuration is needed to trigger it: the default configuration is vulnerable.
- Any later request that arrives with no
Cookieheader is sent upstream with the most recently stored cookies for that domain. Its sender then acts as the user who set them. An unauthenticated attacker can take over a session just by sending cookieless requests. Legitimate clients can also end up acting as another user without knowing it. - Cookies are matched by domain, not port. They therefore also reach other HARP endpoints whose upstream is on the same host, and sibling hosts when the cookie carries a
Domainattribute. - Requests that carry their own
Cookieheader are forwarded unchanged and are not affected.
Patches
Fixed in 0.11.1 and 0.12.0. The proxy's HTTP client no longer stores cookies. Cookie and Set-Cookie headers are still relayed between clients and upstreams as-is.
Workarounds
No configuration option disables the cookie jar. Until you can upgrade:
- do not proxy upstreams that use cookie-based sessions through a HARP instance shared by several users, or
- make sure every client request carries a
Cookieheader (the stored cookies are only added to requests that have none), and - restart HARP to clear any cookies it has already stored.
Details
The http_client service (harp_apps/http_client/services.yml) builds an httpx.AsyncClient with its default cookie jar, and one instance serves the whole process. httpx stores every Set-Cookie header from a response in that jar. harp_apps/proxy/adapters.py builds each upstream request with http_client.build_request(), which merges the jar into the request and adds a Cookie header whenever the incoming request has none.
PoC
- Run an upstream on 127.0.0.1:4700 that answers
/login/<user>withSet-Cookie: session=<user>and echoes back theCookieheader it receives. - Start HARP:
harp-proxy server --endpoint up=4701:http://127.0.0.1:4700/ - Victim logs in:
curl -i http://127.0.0.1:4701/login/alice(response carriesSet-Cookie: session=alice) - Another client, with no cookie:
curl http://127.0.0.1:4701/whoami. The upstream receivesCookie: session=alice.
근원: 네비디(NVD)
관련 Python 취약점:
무료 취약성 평가
클라우드 보안 태세를 벤치마킹합니다
9개의 보안 도메인에서 클라우드 보안 관행을 평가하여 위험 수준을 벤치마킹하고 방어의 허점을 식별합니다.
추가 Wiz 리소스
맞춤형 데모 받기
맞춤형 데모 신청하기
"내가 본 최고의 사용자 경험은 클라우드 워크로드에 대한 완전한 가시성을 제공합니다."
"Wiz는 클라우드 환경에서 무슨 일이 일어나고 있는지 볼 수 있는 단일 창을 제공합니다."
"우리는 Wiz가 무언가를 중요한 것으로 식별하면 실제로 중요하다는 것을 알고 있습니다."