img tag GET request CSRF
The oldest CSRF: img.src to a state-changing GET endpoint sends cookies along.
Behavior by sandbox policy
| Policy | Expected result |
|---|---|
| No sandbox | works |
sandbox="allow-scripts" | works |
sandbox="" (strictest) | works |
Embed snippet
This snippet uses the dedicated embed page. Paste it into your own service and check rendering or blocking behavior.
<iframe src="https://xss-playground.com/embed/csrf-image?lang=en" title="XSS Playground - img tag GET request CSRF" width="600" height="420" loading="lazy" referrerpolicy="strict-origin-when-cross-origin"></iframe>
실행
// 로그 없음
해설
- 가장 오래된 CSRF 형태.
<img src="https://target/action?a=b">한 줄로 사용자 쿠키와 함께 GET 요청이 날아갑니다. - sandbox 가 빈 값이어도 img 요청은 갑니다. 진짜 막으려면 CSP
img-src또는 HTML 렌더링 단계에서 img 태그 src 호스트 검증이 필요합니다. - 타깃이 SameSite=Lax 쿠키를 쓴다면 cross-site GET 으로는 쿠키가 안 붙어 CSRF 영향은 거의 없습니다. 다만 IP 노출, 트래킹 픽셀, internal-only 엔드포인트 핑 정도는 여전히 가능합니다.
- 참고: 많은 에디터와 CMS 는 img 태그를 일반적으로 허용하므로, 이 공격면을 막으려면 host allowlist 또는 CSP 가 필요합니다.