정보보안(구버전)/ bWAPP 2019. 2. 25. 16:09

웹 해킹 bWAPP - 114. A10 - Unvalidated Redirects & Forwards(2)

 

 

본 내용은 교육 과정에서 필요한 실습 목적으로 구성된 것이며, 혹시라도 개인적인 용도 및 악의적인 목적으로 사용할 경우, 법적 책임은 본인에게 있다는 것을 알려드립니다. 

 

 

1. Unvalidated Redirects & Forwards

 

 - OWASP Top10 A10 - 검증되지 않은 리다이렉트 및 포워드

 - 검증 과정 없이 리다이렉션을 실시하는 환경에서 발생하는 취약점이다.
 - Ex) 피싱 사이트, 다운로드 유도 및 악의적일 파일 실행, 악성코드 감염

 

 

 

2. Unvalidated Redirects & Forwards(1)

 

 - 이 시나리오는 항목을 선택하여 페이지를 이동할 경우, 리다이렉트 되는 URL 주소를 변경하여 다른 사이트로

   접근하도록 하는 내용이다.

 

  

Ex1) Unvalidated Redirects & Forwards(2) 이해

 

 

보안 레벨 선택 및 시나리오 선택

 

 

 

Intercept -> 'Intercept is on' 으로 변경 실시

 

 

 

'here' 클릭

 

 

 

버프슈트 Intercept 내용 확인

 

 

 

114-0. 리다이렉트 URL 주소-1.txt

 기존 리다이렉트 URL을 리다이렉트 주소로 변경 실시

GET /bWAPP/unvalidated_redir_fwd_2.php?ReturnUrl=portal.php HTTP/1.1

 

 

GET /bWAPP/unvalidated_redir_fwd_2.php?ReturnUrl=https://net123.tistory.com/556 HTTP/1.1

 

Host: 192.168.20.205

User-Agent: Mozilla/5.0 (Linux; Android 7.0; PLUS Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Mobile Safari/537.36

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

Referer: http://192.168.20.205/bWAPP/unvalidated_redir_fwd_2.php

Cookie: PHPSESSID=a3bb9c151fabe0539c59e451a0568374; security_level=0

Connection: close

Upgrade-Insecure-Requests: 1

 

 

 

 

 리다이렉트 URL 변경 확인 -> 'Forward' 버튼 클릭

 

 

 

리다이렉트 응답 및 Location 확인 -> 'Intercept is on'를 클릭하여 off 실시

 

 

 

'Intercept is off' 확인

 

 

 

net123 블로그로 리다이렉트 확인

 

  

 

 

Ex2) 'unvalidated_redir_fwd_2.php' 파일 내용 확인

 

bee@bee-box:/var/www/bWAPP$ ls -l unvalidated_redir_fwd_2.php
-rw-rw-r-- 1 root www-data 5479 2014-11-02 23:52 unvalidated_redir_fwd_2.php

bee@bee-box:/var/www/bWAPP$ vi unvalidated_redir_fwd_2.php

~ 중간 생략 ~

 


include("selections.php");

 

if(isset($_REQUEST["ReturnUrl"]) && ($_COOKIE["security_level"] == "1" || $_COOKIE["security_level"] == "2"))
{

 

    header("Location: portal.php");

    exit;

 

}

 

if(isset($_REQUEST["ReturnUrl"]) && ($_COOKIE["security_level"] != "1" && $_COOKIE["security_level"] != "2"))
{

 

    // Debugging
    // echo $_REQUEST["url"];

 

    header("Location: " . $_REQUEST["ReturnUrl"]);

 

    exit;

}

 

?>
 

:q!

 

 

 

 

Ex3) 보안 레벨 'High' 변경

 

 

보안 레벨 및 시나리오 선택

 

 

 

Intercept -> 'Intercept is on' 으로 변경 실시

 

 

'here' 클릭

 

 

 

버프슈트 Intercept 내용 확인

 

 

 

114-1. 리다이렉트 URL 주소-2.txt

기존 리다이렉트 URL을 리다이렉트 주소로 변경 실시

GET /bWAPP/unvalidated_redir_fwd_2.php?ReturnUrl=portal.php HTTP/1.1

 

GET /bWAPP/unvalidated_redir_fwd_2.php?ReturnUrl=https://net123.tistory.com/556 HTTP/1.1

 

Host: 192.168.20.205

User-Agent: Mozilla/5.0 (Linux; Android 7.0; PLUS Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.98 Mobile Safari/537.36

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

Referer: http://192.168.20.205/bWAPP/unvalidated_redir_fwd_2.php

Cookie: PHPSESSID=a3bb9c151fabe0539c59e451a0568374; security_level=2

Connection: close

Upgrade-Insecure-Requests: 1 

 

 

 

리다이렉트 URL 변경 확인 -> 'Forward' 버튼 클릭

 

 

 

리다이렉트 응답 및 Location 확인 -> 'Intercept is on'를 클릭하여 off 실시

 

 

 

'Intercept is off' 확인

 

 

 

리다이렉트 실패

('potal.php' 페이지로 리다이텍트 됨)

 

 

 

[유튜브] 동영상 강의 링크 (구독! 좋아요!!!)

 

웹해킹 114. A10 - bWAPP Unvalidated Redirects & Forwards(2)   https://youtu.be/SM0DMRavTks

Posted by 김정우 강사(카카오톡 : kim10322)
,


Q