Return value and follow args #70
Replies: 2 comments 12 replies
-
|
Hi @maxspl ! Sorry for the delayed response. You did a good work, feel free to send me a pull request and I will merge it. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you for your contribution @maxspl ! But there is one problem that I noticed. There is HeapFree called: The above fragment looks correct at the first glance, but when you look closer you may notice that the Arg[2] that was displayed does not belong to this call of HeapFree - it is a leftover of the call traced earlier. This is after the function finished, so the memory at this address may be reused by anything else. We should not be tracking the changes in it at this point. BTW, just to be clear - I refactored the code a bit, to improve maintainability, but this problem occurs in the original version as well. Full tracelog: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I tried to add these two options in a fork:
1. Log return value of syscall and function call
Enabled in the
.inifile usingLOG_RETURN_VALUE.I'v used this logic:
CheckIfFunctionReturned. If one of the instructions after the call is the return one, it indicates we're at the function return.MonitorFunctionArgsandIPOINT_AFTER, but it doesn't work for some functions.SyscallCalledAfter.Output Example
2. Follow the args and return value
Enabled in the
.inifile viaFOLLOW_ARGS_RETURNThe goal is to track args and returns (if they are valid pointers) of all calls to detect any change (ex: log the first bytes of the allocated memory by VirtualAlloc when filled).
This is done like that :
The output looks like this for a new value pointed to by an arg :
The output looks like this for a new value pointed to by a return pointer:
I plan to add another feature that will enrich the tracking of args and return values: PE and shellcode detection, memory extraction etc.
I hope all this is understandable, but before making a PR, I wanted to submit the idea here and find out if it might be possible to integrate these additions. The changes can be found on this fork (cf. the last two commits): https://github.com/maxspl/tiny_tracer.
Thanks in advance :)
Beta Was this translation helpful? Give feedback.
All reactions