1. Redirect 취약점이란?
Redirect 취약점은 웹 어플리케이션 내에 리다이렉트 기능을 활용하여 페이지를 반환할 때
반환되는 페이지를 악의적인 사이트로 변경하여 강제로 리다이렉트가 가능한 취약점을 말한다.
리다이렉트 취약점이 발견될 경우, 공격자는 리다이렉트 가능한 URL을 활용하여
사용자 정보 탈취에 활용 가능한 피싱 공격을 수행할 수 있다.
OWASP juice shop에서 발견한 리다이렉트 취약점과 이를 해결하는 대응방안을 같이 알아보자
2. 취약점 예시
OWASP juice shop의 개발자 도구에서 redirect 파라미터를 검색하면 다음과 같이
웹 사이트 내에 redirect 기능이 활성화된 주소들이 있는 것을 볼 수 있다.
전부 찾아보면 다음과 같이 GET 방식으로 /redirect 하위에 to 파라미터로
특정 URL 이동이 가능하도록 작성된 것을 볼 수 있다.

http://127.0.0.1:3000/redirect?to=https://github.com/juice-shop/juice-shop
http://127.0.0.1:3000/redirect?to=https://blockchain.info/address/1AbKfgvw9psQ41NbLi8kufDQTezwG8DRZm
http://127.0.0.1:3000/redirect?to=https://explorer.dash.org/address/Xr556RzuwX6hg5EGpkybbv5RanJoZN17kW
http://127.0.0.1:3000/redirect?to=https://etherscan.io/address/0x0f933ab9fcaaa782d0279c300d73750e1311eae6
http://127.0.0.1:3000/redirect?to=http://shop.spreadshirt.com/juiceshop
http://127.0.0.1:3000/redirect?to=https://www.stickeryou.com/products/owasp-juice-shop/794
http://127.0.0.1:3000/redirect?to=http://leanpub.com/juice-shop

문제는 리다이렉트가 가능할 경우, 현재 도메인 내부에서 리다이렉트가 이뤄지지 않고
타 사이트로 리다이렉트가 가능할 경우 문제가 발생한다.
위와 같이 타 도메인의 사이트로 이동하는 것이 문제인데
소스코드 내에 없는 사이트로도 이동가능하도록 bypass를 시도해보았다.
구글 페이지 URL을 입력하여 리다이렉트가 가능하도록 bypass를 시도하면
다음과 같이 구글 페이지로 자동 리다이렉트가 되는 것을 볼 수 있다.
http://127.0.0.1:3000/redirect?to=https://www.google.co.kr?redirect=http://shop.spreadshirt.com/juiceshop

여기서는 테스트 상 구글 메인 페이지로 리다이렉트 시켰지만
만약 해당 사이트가 특정 로그인을 요구하거나 사용자 정보를 입력하는 페이지일 경우
해당 URL을 피싱사이트로 활용할 가능성이 크며
이로 인해 개인정보, 사용자 정보, 민감정보가 노출될 수 있다.
3. 조치방안
Redirect 기능을 사용해야만 한다면 조치 시 필수요소
- 사용자가 입력한 URL 주소를 검증로직 삽입 or
- 리다이렉트 시 서버 측에서 해당 URL에 대한 ID, token 정보를 검증
export const redirectAllowlist = new Set([
'https://github.com/juice-shop/juice-shop',
'https://blockchain.info/address/1AbKfgvw9psQ41NbLi8kufDQTezwG8DRZm',
'https://explorer.dash.org/address/Xr556RzuwX6hg5EGpkybbv5RanJoZN17kW',
'https://etherscan.io/address/0x0f933ab9fcaaa782d0279c300d73750e1311eae6',
'http://shop.spreadshirt.com/juiceshop',
'http://shop.spreadshirt.de/juiceshop',
'https://www.stickeryou.com/products/owasp-juice-shop/794',
'http://leanpub.com/juice-shop'
])
export const isRedirectAllowed = (url: string) => {
let allowed = false
for (const allowedUrl of redirectAllowlist) {
allowed = allowed || url.includes(allowedUrl)
allowed = allowed || url === allowedUrl // redirectAllowlist와 입력된 url 비교 검증로직 추가
}
return allowed
}
- Java
Java의 경우 다음과 redirect 되는 URL의 값을 검증 없이 받아올 경우 취약점이 발생한다.
response.sendRedirect(request.getParameter("url"));
HTTP request에 전달하는 파라미터의 값을 검증하는 로직을 삽입하거나
최상위 도메인을 하드코딩하여 변조하더라도
해당 도메인 안에서만 리다이렉트 되도록 수정해야 한다.
response.sendRedirect("http://www.mysite.com");
출처
https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html
Unvalidated Redirects and Forwards - OWASP Cheat Sheet Series
Unvalidated Redirects and Forwards Cheat Sheet Introduction Unvalidated redirects and forwards are possible when a web application accepts untrusted input that could cause the web application to redirect the request to a URL contained within untrusted inpu
cheatsheetseries.owasp.org
'취약점 진단' 카테고리의 다른 글
| OWASP Juice Shop [SQL Injection] (0) | 2025.12.11 |
|---|---|
| OWASP Juice Shop Mass Assignment (0) | 2025.12.11 |
| OWASP Juice Shop [정보누출 취약점] (0) | 2025.12.11 |
| Docker 사용법 (0) | 2025.12.11 |
