DoR@Hee의 끄적끄적

webhacking.kr 53번 본문

WarGame/WebHacking.kr

webhacking.kr 53번

DoR@Hee 2019. 3. 1. 22:42


문제 첫화면


printf("hello world");

echo "hello world";

System.out.println("hello world");



index.phps를 보도록 하자 




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
<html>
<head>
<title>Challenge 53</title>
</head>
<body>
hello world
<br><br><br>
<?
if(time()<1260615600exit();
 
$hidden_table="????";
 
if($_GET[answer]==$hidden_table)
{
@solve();
exit();
}
 
if(eregi("union",$_GET[val])) exit();
if(eregi("select",$_GET[val])) exit();
if(eregi("from",$_GET[val])) exit();
if(eregi("/",$_GET[val])) exit();
if(eregi("\*",$_GET[val])) exit();
if(eregi("#",$_GET[val])) exit();
if(eregi("-",$_GET[val])) exit();
if(eregi(",",$_GET[val])) exit();
if(eregi("=",$_GET[val])) exit();
if(eregi("!",$_GET[val])) exit();
if(eregi("\|",$_GET[val])) exit();
if(eregi("by",$_GET[val])) exit();
 
 
$f=@mysql_fetch_array(mysql_query("select test1 from $hidden_table where test2=$_GET[val]"));
 
echo($f[0]);
 
if($f)
{
echo("<br><br><form method=get action=index.php>challenge53 TABLE NAME : <input type=text name=answer size=50><input type=submit></form>");
}
 
?>
 
<!-- index.phps -->
</body>
</html>
cs



$hidden_table를 알아야하는게 문제이다.


infromation_schema에서 table이름을 알 수있는대 

단 여기서 union, select from 도 필터링하고 있기 때문에 불가능 할꺼 같다.


또한 

select test1 from $hidden_table where test2=$_GET[val]

index?val=값이 들어가야 값에 따른 

<input type=text name=answer size=50><input type=submit></form>


answer input이 나온다.




1 입력 시 test


2 입력 시 guest


3 입력 시 admin

4 입력 시 zombie 5는 x


계속해서 검색을 하는도중 도저히 모르겠어서 일단 또 다른 hint를 찾아보았다.


procedure analyse() 을 사용하여 문제를 푸는 방식이다.






이렇게 쿼리를 입력하면은 



이렇게 나온다.


여기서 

webhacking.Chal12NGe_53_TabLE_zz.test1


webhacking. 은 db이름

.test1 은 칼럼명이다





val = 3 인 admin페이지에 table명을 입력하면 성공은 한다






여기서 좀 더 알아보기 위해서 


test table를 생성하고 




쿼리문을 이용해서 

procedure analyse()를 확인 해본 결과

테이블명 값 등등이 나온다.


단 procedure analyse()은 mysql에서만 사용이 가능하다.









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

webhacking.kr 54번  (0) 2019.03.04
webhacking.kr 52번  (0) 2019.03.01
webhacking.kr 51번  (0) 2019.03.01
webhacking.kr 50번  (0) 2019.02.27
webhacking.kr 49번  (0) 2019.02.27
Comments