Exetools

Exetools (https://forum.exetools.com/index.php)
-   General Discussion (https://forum.exetools.com/forumdisplay.php?f=2)
-   -   How to identify the address where the test is done? (https://forum.exetools.com/showthread.php?t=17974)

byvs 10-23-2016 21:50

How to identify the address where the test is done?
 
Hello guys
I need help please
When you change a string the process ends.
How to identify the address where the test is done?
The string is "uLme" in the address 007B3AD8 in ulme.exe file

FILE: http://www113.zippyshare.com/v/oenVyf9Q/file.html

Thank you for your help.

PS: sorry, I could not post the REQUESTS

t3xc0d3 10-24-2016 00:41

You can set a read/write hardware breakpoint to obtain the location that reads/writes the string.

Another possibility is a pure static approach: searching for xrefs in the code. Doing that, you will see that 0x7B31B6 loads the data location into eax and then calls 0x40A748.

byvs 10-24-2016 02:57

And how do I stop this test and change the string?

bongos_man 10-24-2016 04:59

assuming the program is otherwise unprotected and will not try to prevent or detect it, write a loader which injects a dll into the target process's memory and patches bytes in the appropriate place to call a function in your dll that changes the string however you wish. there are lots of tutorials on code injection, here are some good ones:

Three Ways to Inject Your Code into Another Process
A More Complete DLL Injection Solution Using CreateRemoteThread
Code Injection - A Generic Approach for 32bit and 64bit Versions
InjLib - A library that implements remote code injection for all Windows versions

byvs 10-24-2016 05:37

Quote:

Originally Posted by bongos_man (Post 107491)
assuming the program is otherwise unprotected and will not try to prevent or detect it, write a loader which injects a dll into the target process's memory and patches bytes in the appropriate place to call a function in your dll that changes the string however you wish. there are lots of tutorials on code injection, here are some good ones:

Three Ways to Inject Your Code into Another Process
A More Complete DLL Injection Solution Using CreateRemoteThread
Code Injection - A Generic Approach for 32bit and 64bit Versions
InjLib - A library that implements remote code injection for all Windows versions

But in practice how do I stop this test and change the string? :confused::confused:

bongos_man 10-24-2016 06:14

i didn't have a chance to look at your exe, but say a target calls strcmp and then does something based its result. your loader (which injects a dll with your code) can use WriteProcessMemory to patch the call to strcmp (in your target) to instead call the function in your dll. your function can then modify the string and return strcmp(s1, s2). the tutorials show you how can calculate the address of the dll function so that you can patch the call with the right address.

byvs 10-24-2016 06:30

Quote:

Originally Posted by bongos_man (Post 107494)
i didn't have a chance to look at your exe, but say a target calls strcmp and then does something based its result. your loader (which injects a dll with your code) can use WriteProcessMemory to patch the call to strcmp (in your target) to instead call the function in your dll. your function can then modify the string and return strcmp(s1, s2). the tutorials show you how can calculate the address of the dll function so that you can patch the call with the right address.

For those who know it is easy, but for a layman is complicated.:(:confused::o

bongos_man 10-24-2016 08:00

here is sample loader and dll code for you, i tried to put it in the thread but exetools forum kept giving errors.

https://gist.github.com/anonymous/0f8bdbcc6e0bc2bb835ebe55713b41de

byvs 10-24-2016 08:13

Quote:

Originally Posted by bongos_man (Post 107496)
here is sample loader and dll code for you, i tried to put it in the thread but exetools forum kept giving errors.

https://gist.github.com/anonymous/0f8bdbcc6e0bc2bb835ebe55713b41de


What to do with it?:confused::confused::confused:

mcp 10-24-2016 15:12

HW breakpoints won't help you if the program performs self-checksums in memory. What you really want to do is diff runtime traces:
1) Record a trace of running the unmodified binary
2) Record a trace of running the modified binary
3) See where they differ. This yields one (possibly many) program location which does "the check(s)".

As for collecting traces, use your favourite debugger (x64dbg, ollydbg, IDA) or dynamic binary instrumentation tool (DynamoRIO, PIN).

byvs 10-24-2016 22:11

Quote:

Originally Posted by bongos_man (Post 107498)
at 0x7B31BB, the function is called with the address of your string in eax. you want to patch this call to instead call a function in your dll. add a function to your dll like this:

Code:

void __declspec(naked) patchstring() {
  __asm {
    ; modify string here somehow
    ; but be careful to preserve registers
    ; because your target looks like it uses fastcall

    ; now call old func at 0x7B31BB
    jmp 0xBB31BB ; 0x400000 + 0x7B31BB
  }
}

and in the DllMain, replace the bytes from 0x7B31BC to 0x7B31BF with the address of that function (read the tuts for more info). don't replace the 0xE8 at 0x7B31BB because that is the beginning of the call opcode ;]

@bongos_man
Thank you my friend,
I will replace the value FF bytes by 88 bytes. It worked, but not 100%
0xE88875C5FF to 0xE88875C588
it is?:confused::confused:

bongos_man 10-25-2016 02:37

sorry, i was very, very drunk. ignore everything i said.

try this: https://gist.github.com/anonymous/9068570079dd3550015caeb19026d5f8

byvs 10-25-2016 04:16

Quote:

Originally Posted by bongos_man (Post 107510)
sorry, i was very, very drunk. ignore everything i said.

try this: https://gist.github.com/anonymous/9068570079dd3550015caeb19026d5f8

Sorry, I do not know what to do with it!:confused:

bongos_man 10-25-2016 08:40

compile main.c as an exe and loader.c as a dll/shared library, then run:
Code:

main yourprogram loader.dll
if you don't know very much c or assembly, you will need to learn them better in order to become a good reverse engineer.


All times are GMT +8. The time now is 18:17.

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