DoR@Hee의 끄적끄적

webhacking.kr 50번 본문

WarGame/WebHacking.kr

webhacking.kr 50번

DoR@Hee 2019. 2. 27. 16:41


문제 첫화면 이 문제 역시 유사하다.(45번문제)




힌트를 보도록 하자.


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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<html>
<head>
<title>Challenge 50</title>
</head>
<body>
<h1>SQL INJECTION</h1>
<form method=get action=index.php>
id : <input name=id value='guest'><br>
pw : <input name=pw value='guest'><br>
<input type=submit>&nbsp;&nbsp;&nbsp;<input type=reset>
</form>
<?
if(time()<1258110000exit();
?>
<!-- index.phps -->
 
<?
if($_GET[id] && $_GET[pw])
{
 
$_GET[id]=mb_convert_encoding($_GET[id],'utf-8','euc-kr');
 
 
foreach($_GET as $ck)
{
if(eregi("from",$ck)) exit();
if(eregi("pw",$ck)) exit();
if(eregi("\(",$ck)) exit();
if(eregi("\)",$ck)) exit();
if(eregi(" ",$ck)) exit();
if(eregi("%",$ck)) exit();
if(eregi("=",$ck)) exit();
if(eregi(">",$ck)) exit();
if(eregi("<",$ck)) exit();
if(eregi("@",$ck)) exit();
}
 
 
if(eregi("union",$_GET[id])) exit();
 
$data=@mysql_fetch_array(mysql_query("select lv from members where id='$_GET[id]' and pw=md5('$_GET[pw]')"));
 
 
if($data)
{
if($data[0]=="1"echo("level : 1<br><br>");
if($data[0]=="2"echo("level : 2<br><br>");
 
if($data[0]=="3")
{
@solve();
}
 
 
if(!$data)
{
echo("Wrong");
}
 
}
 
?>
 
<br><br><br>
<center>Thanks to <a href=http://webhacking.kr/index.php?mode=information&id=hahah>hahah</a></center>
<br><br><br>
</body>
</html>
cs


이 문제 역시 46번 문제와 상당히 비슷한 문제이기 때문에 자세한 소스코드 분석은 생략

하지만 이 문제에서 가장 중요한 부분은 

if(eregi("union",$_GET[id])) exit();


이 부분이다. 


id 부분에만 union문을 필터링 하고있으며, pw에는 필터링 하고있지않다. 


http://webhacking.kr/challenge/web/web-25/index.php?id=%aa%27/*&pw=*/union%0


그걸 중심으로 SQL우회문을 작성했다. 

근데

여기까지는 아무 문제 없는대


http://webhacking.kr/challenge/web/web-25/index.php?id=%aa%27/*&pw=*/union%0aselect


select문만 추가하면 에러가 발생한다 오류인 문제 같다


에러


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

webhacking.kr 52번  (0) 2019.03.01
webhacking.kr 51번  (0) 2019.03.01
webhacking.kr 49번  (0) 2019.02.27
webhacking.kr 48번  (0) 2019.02.27
webhacking.kr 47번  (0) 2019.02.26
Comments