@@ -21,50 +21,50 @@ def asm_exitfunk(opts={})
21
21
22
22
when 'seh'
23
23
asm << %Q^
24
- mov ebx, #{ "0x%.8x" % Msf ::Payload ::Windows . exit_types [ 'seh' ] }
25
- push.i8 0 ; push the exit function parameter
26
- push ebx ; push the hash of the exit function
27
- call ebp ; SetUnhandledExceptionFilter(0)
28
- push.i8 0
29
- ret ; Return to NULL (crash)
30
- ^
24
+ mov ebx, 0x #{ Msf ::Payload ::Windows . exit_types [ 'seh' ] . to_s ( 16 ) }
25
+ push.i8 0 ; push the exit function parameter
26
+ push ebx ; push the hash of the exit function
27
+ call ebp ; SetUnhandledExceptionFilter(0)
28
+ push.i8 0
29
+ ret ; Return to NULL (crash)
30
+ ^
31
31
32
32
# On Windows Vista, Server 2008, and newer, it is not possible to call ExitThread
33
33
# on WoW64 processes, instead we need to call RtlExitUserThread. This stub will
34
34
# automatically generate the right code depending on the selected exit method.
35
35
36
36
when 'thread'
37
37
asm << %Q^
38
- mov ebx, #{ "0x%.8x" % Msf ::Payload ::Windows . exit_types [ 'thread' ] }
39
- push 0x9DBD95A6 ; hash( "kernel32.dll", "GetVersion" )
40
- call ebp ; GetVersion(); (AL will = major version and AH will = minor version)
41
- cmp al, 6 ; If we are not running on Windows Vista, 2008 or 7
42
- jl exitfunk_goodbye ; Then just call the exit function...
43
- cmp bl, 0xE0 ; If we are trying a call to kernel32.dll!ExitThread on Windows Vista, 2008 or 7...
44
- jne exitfunk_goodbye ;
45
- mov ebx, 0x6F721347 ; Then we substitute the EXITFUNK to that of ntdll.dll!RtlExitUserThread
46
- exitfunk_goodbye: ; We now perform the actual call to the exit function
47
- push.i8 0 ; push the exit function parameter
48
- push ebx ; push the hash of the exit function
49
- call ebp ; call ExitThread(0) || RtlExitUserThread(0)
50
- ^
38
+ mov ebx, 0x #{ Msf ::Payload ::Windows . exit_types [ 'thread' ] . to_s ( 16 ) }
39
+ push 0x9DBD95A6 ; hash( "kernel32.dll", "GetVersion" )
40
+ call ebp ; GetVersion(); (AL will = major version and AH will = minor version)
41
+ cmp al, 6 ; If we are not running on Windows Vista, 2008 or 7
42
+ jl exitfunk_goodbye ; Then just call the exit function...
43
+ cmp bl, 0xE0 ; If we are trying a call to kernel32.dll!ExitThread on Windows Vista, 2008 or 7...
44
+ jne exitfunk_goodbye ;
45
+ mov ebx, 0x6F721347 ; Then we substitute the EXITFUNK to that of ntdll.dll!RtlExitUserThread
46
+ exitfunk_goodbye: ; We now perform the actual call to the exit function
47
+ push.i8 0 ; push the exit function parameter
48
+ push ebx ; push the hash of the exit function
49
+ call ebp ; call ExitThread(0) || RtlExitUserThread(0)
50
+ ^
51
51
52
52
when 'process' , nil
53
53
asm << %Q^
54
- mov ebx, #{ "0x%.8x" % Msf ::Payload ::Windows . exit_types [ 'process' ] }
55
- push.i8 0 ; push the exit function parameter
56
- push ebx ; push the hash of the exit function
57
- call ebp ; ExitProcess(0)
58
- ^
54
+ mov ebx, 0x #{ Msf ::Payload ::Windows . exit_types [ 'process' ] . to_s ( 16 ) }
55
+ push.i8 0 ; push the exit function parameter
56
+ push ebx ; push the hash of the exit function
57
+ call ebp ; ExitProcess(0)
58
+ ^
59
59
60
60
when 'sleep'
61
61
asm << %Q^
62
- mov ebx, #{ "0x%.8x" % Rex ::Text . ror13_hash ( 'Sleep' ) }
63
- push 300000 ; 300 seconds
64
- push ebx ; push the hash of the function
65
- call ebp ; Sleep(300000)
66
- jmp exitfunk ; repeat
67
- ^
62
+ mov ebx, #{ Rex ::Text . block_api_hash ( 'kernel32.dll' , 'Sleep' ) }
63
+ push 300000 ; 300 seconds
64
+ push ebx ; push the hash of the function
65
+ call ebp ; Sleep(300000)
66
+ jmp exitfunk ; repeat
67
+ ^
68
68
else
69
69
# Do nothing and continue after the end of the shellcode
70
70
end
0 commit comments