Exetools (https://forum.exetools.com/index.php)
-   Community Tools (https://forum.exetools.com/forumdisplay.php?f=47)
-   -   Safengine Olly scripts (https://forum.exetools.com/showthread.php?t=19173)

CodeCracker 03-13-2019 20:15

Safengine Olly scripts
1 Attachment(s)
Safengine_OEP_finder.txt and SafeEngine_ThunksFixer.txt: two Olly scripts;
First load the target and run Safengine_OEP_finder.txt - this will lead to OEP;
After that load SafeEngine_ThunksFixer.txt script: this will fix instructions involving import table thunks;
Currently I have no way to fix emulated imports (the import table).
SafeEngine_ThunksFixer.txt still has a bug: it randomly crashes when executing some SafeEngine code: NOT always crashes!

carlitos 03-13-2019 22:20

CodeCracker could be possible external link please?

CodeCracker 03-13-2019 23:31

External download link

Originally Posted by carlitos (Post 116644)
CodeCracker could be possible external link please?


Stingered 03-14-2019 06:36


Originally Posted by CodeCracker (Post 116645)

Interesting. I ask for an external link (not this specific thread) and my post gets flagged and deleted...

Apuromafo 03-14-2019 09:32


Originally Posted by Stingered (Post 116647)
Interesting. I ask for an external link (not this specific thread) and my post gets flagged and deleted...

only if author of post say there is private, is the thing...

BR, Apuromafo

CodeCracker 04-03-2019 20:17

1 Attachment(s)
I found a way to kill import table redirection!

Breakpoint on write to code section (.text section) doesn't work on some cases
At this point we can watch how imports are restored!
Next will check for Import Redirection magic jump: that jump should jump
The script may log more then one jump location: obviously only one location is right
First that sheet gets the kernel32.GetModuleHandleA RVA = B741 (41B70000)
Export table address: 7C802C2C 41 B7 00 00
So set breakpoint on read to 7C802C2C, after breakpoint and continue execution (step in)
you will see that will compare ndll base address with kernel32.GetModuleHandleA
The jump after should jump and imports will be no more redirected (clean import table)!

ahmadmansoor 04-03-2019 22:16

My friend, Can you provide us with a sample(unpackme)?
Thanks for nice work.

CodeCracker 04-06-2019 16:36

Can't find any unpackme on this board; only on tuts4you:

CodeCracker 04-15-2019 01:51


magicjump5: 004D30FB
magicjump5 may be wrong!
magicjump2: 004D28E4
JumpDestination: 004D28C8 | Entry address
magicjump2: 004D3349
JumpDestination: 004D3308 | Entry address
magicjump2: 004D80BB
JumpDestination: 004D80D7 | Entry address
magicjump2: 004D81DC
JumpDestination: 004D81F8 | Entry address
magicjump2: 004DA58A
JumpDestination: 004DA54C | Entry address
magicjump2: 004DB025
JumpDestination: 004DB056 | Entry address
magicjump2: 004DB9C9
JumpDestination: 004DB9AE | Entry address
magicjump2: 0054A8FD
JumpDestination: 0054A903

Unfortunately none of those address are not the magic jump (sorry)!

Log data, item 1
Message=ImportTableAddress: 00464000

First time gets the kernel32.GetModuleHandleA RVA = B741 (41B70000)
Export table address: 7C802C2C 41 B7 00 00
so set breakpoint on read to address 7C802C2C
You will should lead here:
004FDA29 . 5E POP ESI ; kernel32.7C80262C
// Step in needed:
004FDBF3 > \3BFE CMP EDI, ESI ; kernel32.7C80262C
004FDBF5 . 8D6424 04 LEA ESP, DWORD PTR SS:[ESP+0x4]
004FDBF9 ^ 0F82 00F9FFFF JB 004FD4FF
// No, is not this magic jump since is not the ntdll base address!

After step in a lot:
004A5D18 > \4A DEC EDX ; kernel32.7C807C3B
004A5D1B . 3BD0 CMP EDX, EAX
004A5D1D . 60 PUSHAD
004A5D1E . E9 B5760500 JMP 004FD3D8

At 004A5D19 get the ntdll base address in edx

004FD3D8 > \8D6424 20 LEA ESP, DWORD PTR SS:[ESP+0x20]
004FD3DC .^ 0F83 C088FAFF JNB 004A5CA2
This is the magic jump which should be changed to jump! And now we have clean import table!

Is still hard for me to automatize things!

CodeCracker 04-15-2019 20:42

MagicJump finder (IAT redirection Finder)
1 Attachment(s)
A nice update:
I was able to code a good MagicJump finder (IAT redirection Finder) - attached.
Now the problem is that the old script Safengine_OEP_finder.txt won't be able to reach OEP
since the IAT fixing stuff is done late!
So you still got to patch that address (MagicJump) manually.

carlitos 04-15-2019 22:49

CodeCracker possibility of external link?

possibility you check my dll and give me any clue?


CodeCracker 04-16-2019 17:05

Dll unpacking is a bit harder since you got to rebuild relocations: you got to unpack the dll twice.
As for your dll: it seems I am even unable to load it on Olly, from where you got this dll anyway?

carlitos 04-16-2019 18:04

@CodeCracker thanks for your reply.
How can I PM you?

0xall0c 04-19-2019 05:34

you can patch the dll to load at fixed base address that way after the dump, relocation wont be loaded and the dll will be loaded at the same address!

Chuck954 04-19-2019 09:50

You can also use windows xp in a virtual box. Unless you need a newer os or x64, the base address usually loads at the same spot each time with xp. Makes it easier that way to keep dlls at same base address.

All times are GMT +8. The time now is 11:47.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX