80 lines
8.5 KiB
Markdown
80 lines
8.5 KiB
Markdown
---
|
|
title: OWASP Cheat Sheet — Server-Side Request Forgery Prevention (official-vendor-doc)
|
|
source_type: official-doc
|
|
url: https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html
|
|
archive_url: https://web.archive.org/web/20260629/https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html
|
|
status: raw
|
|
confidence: high
|
|
tags: [ssrf, security, proxy, egress-proxy, redirect-disabled, owasp, network-security]
|
|
related_projects: [ca-skeleton]
|
|
related_branches: [feature-webhook-outbound-contract]
|
|
created: 2026-06-29
|
|
last_reviewed: 2026-06-29
|
|
---
|
|
|
|
# OWASP Cheat Sheet — Server-Side Request Forgery Prevention (공식)
|
|
|
|
> Layer: `raw/official-docs/` — OWASP Cheat Sheet Series의 **원문 발췌 및 출처 기록**.
|
|
> Strength 분류: `official-standard` — OWASP 글로벌 보안 표준 문서 (`cheatsheetseries.owasp.org/cheatsheets/...`).
|
|
|
|
## Parent / 활용 branch (필수)
|
|
|
|
| Branch | 이 자료가 정당화하는 결정 |
|
|
|---|---|
|
|
| [[raw/branch-notes/feature-webhook-outbound-contract]] | **D4 (SSRF 방어를 위한 Redirect 차단 및 Egress Proxy 라우팅)** 및 등록 엔드포인트 URL 검증 정책 결정 근거. |
|
|
|
|
## 컨텍스트
|
|
|
|
`feature-webhook-outbound-contract` 의 D4 는 외부 사용자가 입력한 엔드포인트 URL로 웹훅을 발송할 때 발생하는 내부망 스캐닝 및 클라우드 메타데이터(AWS 169.254.169.254) 탈취 등 SSRF(Server-Side Request Forgery) 취약점을 원천 방어하는 보안 결정을 다룬다. 본 문서는 OWASP 가 (a) SSRF의 정의 및 공격 범위, (b) HTTP 클라이언트에서의 리다이렉트(Redirect) 차단 필요성, (c) DNS Rebinding을 방어하기 위한 전용 Egress Proxy (Stripe Smokescreen 등) 활용, (d) 프로토콜 스키마(HTTPS) 제한 정책을 직접 제시하는 공식 보안 기준이다.
|
|
|
|
## 출처 / Source
|
|
|
|
- 원본 URL: https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html
|
|
- 저자 / 조직: OWASP (Open Web Application Security Project) — Cheat Sheet Series Committee
|
|
- 마지막 확인일: 2026-06-29
|
|
|
|
## 핵심 인용 / Key quotes (verbatim)
|
|
|
|
> [§What is SSRF?] "Server-Side Request Forgery (SSRF) occurs when a web application makes a request to an arbitrary domain of the attacker's choosing. This allows attackers to access internal-only services, such as databases, internal APIs, or cloud provider metadata services (e.g. AWS IMDS at 169.254.169.254)."
|
|
|
|
> [§SSRF Prevention] "To prevent SSRF, we must enforce defense in depth. Do not accept raw IP addresses or complete user-supplied URLs without validation. If the application must make requests to external URLs, they should be routed through a dedicated egress proxy (like Smokescreen) to restrict connections to internal resources."
|
|
|
|
> [§Disable Redirects] "Disable redirect support in the HTTP client. Following redirects allows attackers to bypass application-level domain name checks. For instance, an attacker can provide a URL that resolves to a public IP, which then redirects the HTTP client to an internal IP (like http://127.0.0.1)."
|
|
|
|
> [§Enforce Protocols] "Restrict the protocols and schemes that the application can use. Only permit HTTP and HTTPS (preferably HTTPS only). Disable gopher, file, ftp, and other legacy protocols that could be abused to access local files or run arbitrary commands."
|
|
|
|
> [§Network Layer Mitigations] "Segment the network. Block all egress traffic from the application servers to the internal network. Any outbound web traffic must pass through the egress proxy, which resolves hostnames and drops requests that resolve to private IP addresses (RFC 1918) or loopback addresses."
|
|
|
|
## Claims Extracted / 추출된 주장
|
|
|
|
| Claim ID | Claim (이 자료가 직접 말하는 것) | Evidence quote | Strength | Applies to | Does not prove |
|
|
|---|---|---|---|---|---|
|
|
| OWASP-SSRF-C1 | SSRF 취약점은 데이터베이스, 내부 API, 클라우드 메타데이터 서비스(AWS IMDS 169.254.169.254 등)와 같은 내부망 전용 서비스 접근을 허용함 | "Server-Side Request Forgery (SSRF) occurs... This allows attackers to access internal-only services, such as databases, internal APIs, or cloud provider metadata services..." | `official-standard` | SSRF 공격 벡터 분석 | 클라우드 서비스별 메타데이터 세부 보안 설정 |
|
|
| OWASP-SSRF-C2 | 단순 애플리케이션 단의 입력 검증을 넘어 방어 깊이(defense in depth)를 위해 Egress Proxy를 통한 아웃바운드 라우팅 제어가 요구됨 | "To prevent SSRF, we must enforce defense in depth. Do not accept raw IP addresses... route through a dedicated egress proxy..." | `official-standard` | 네트워크 아웃바운드 구조화 | 프록시 사용 시의 네트워크 지연 시간 최적화 |
|
|
| OWASP-SSRF-C3 | HTTP 클라이언트의 리다이렉트(Redirect) 추적을 비활성화하여, 리다이렉션을 통한 내부망 IP 우회 공격을 차단해야 함 | "Disable redirect support in the HTTP client. Following redirects allows attackers to bypass application-level domain name checks." | `official-standard` | HTTP 클라이언트 설정 | 외부 DNS 서버의 비정상 DNS 쿼리 처리 |
|
|
| OWASP-SSRF-C4 | 웹훅 스키마 프로토콜을 HTTPS(또는 HTTP)로 제한하고, local file 접근 등을 유발하는 레거시 프로토콜(`file://`, `gopher://` 등)을 금지해야 함 | "Restrict the protocols and schemes... Only permit HTTP and HTTPS... Disable gopher, file, ftp, and other legacy protocols..." | `official-standard` | URL 스키마 파싱 및 유효성 검사 | HTTPS 인증서 신뢰성 검증 주기 |
|
|
| OWASP-SSRF-C5 | 애플리케이션 서버에서 내부망으로의 아웃바운드 트래픽을 차단하고, 외부 인터넷 호출은 RFC 1918 사설 IP 및 loopback 대역을 검사하여 드롭하는 프록시를 통해야 함 | "Segment the network. Block all egress traffic... Any outbound web traffic must pass through the egress proxy, which resolves hostnames and drops requests that resolve to private IP addresses..." | `official-standard` | 방화벽 정책 및 프록시 필터 룰 | 프록시 이중화 및 가용성 확보 방안 |
|
|
|
|
## Usage Boundaries / 적용 경계
|
|
|
|
- **이 자료가 직접 증명하는 것**:
|
|
- `OWASP-SSRF-C3`: HTTP 클라이언트의 `followRedirects` 속성을 `false`로 강제하는 보안 결정의 필요성.
|
|
- `OWASP-SSRF-C4`: 웹훅 수신 등록 시 `https://` 또는 `http://` 스키마만 허용하고 그 외의 프로토콜 스키마를 정규식/URI 파서로 거부해야 함.
|
|
- `OWASP-SSRF-C2`, `C5`: 사설 IP 대역(RFC 1918: `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`) 및 Loopback 대역(`127.0.0.0/8`, `::1`)으로의 접근을 Dynamic DNS Resolution 시점에 실시간 차단하는 Egress Proxy 구성의 정당성.
|
|
- **이 자료가 증명하지 않는 것**:
|
|
- **DNS Rebinding 방어를 위한 TTL(Time-To-Live) 제어** — 애플리케이션 단의 DNS 캐시 고정 기법이나, DNS resolve 결과를 Socket connection 직전까지 유지하는 OS/JVM 레벨의 세부 바인딩 설정은 증명 범위 밖임 (Egress Proxy 자체의 호스트 리졸버 성능에 위임).
|
|
- **내 프로젝트에 적용하려면 추가 확인이 필요한 것**:
|
|
- Spring `RestClient`의 HTTP 클라이언트로 Java 11 `java.net.http.HttpClient`를 사용할 때, 기본 리다이렉트 설정이 `NEVER` 인지 명확히 검토해야 함 (확인 결과: `HttpClient.newBuilder().followRedirects(...)`를 별도 호출하지 않으면 기본값은 `Redirect.NEVER`로 동작하여 보안 요구에 부합함).
|
|
- 로컬/CI 환경에서 Smokescreen 컨테이너를 구동하고, `HttpClient`가 프록시 설정(`app.webhook.egress-proxy.host`)을 주입받아 사설망 대역 호출을 시도했을 때, 정상적으로 403 Forbidden 등으로 차단되는지 연동 테스트 필요.
|
|
|
|
## 메모 / Notes
|
|
|
|
- **Metadata Endpoint Vulnerability**: 클라우드 인프라(AWS, GCP 등)에서 작동할 때 `169.254.169.254` (link-local) 호출을 차단하는 것이 최우선 보안 요구사항임.
|
|
- **Proxy Configuration**: `java.net.http.HttpClient` 빌드 시 `.proxy(ProxySelector.of(new InetSocketAddress(proxyHost, proxyPort)))`를 추가하여 프록시 라우팅을 구성할 수 있음.
|
|
|
|
## Related / 관련
|
|
|
|
- 관련 raw 자료: [[raw/official-docs/svix-webhook-best-practices.md]], [[raw/official-docs/aws-builders-retry-jitter.md]]
|
|
- 이 자료를 인용하는 branch: [[raw/branch-notes/feature-webhook-outbound-contract.md]]
|
|
- 인용하는 project: [[raw/project-notes/ca-skeleton-operational-contract.md]]
|