Skip to content

Repeated memory write callbacks #1627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
archercreat opened this issue May 25, 2022 · 4 comments
Closed

Repeated memory write callbacks #1627

archercreat opened this issue May 25, 2022 · 4 comments

Comments

@archercreat
Copy link

Hello. While tracking memory writes in heavily packed executable to some memory region I've found that in some cases the callback is triggered once for 8 byte write and at the same time 8 times for 1 byte write.
Unfortunately I cannot reproduce this behavior on simple example, so maybe someone could point on what is the possible error might be.
Example trace:

write size, value, disassembly
size: 8 value: 0xfffffffffffff7ff 0x1400cd26d: mov      qword ptr [r10], r11
size: 1 value: 0x00000000000000ff 0x1400cd26d: mov      qword ptr [r10], r11
size: 1 value: 0x00000000000000f7 0x1400cd26d: mov      qword ptr [r10], r11
size: 1 value: 0x00000000000000ff 0x1400cd26d: mov      qword ptr [r10], r11
size: 1 value: 0x00000000000000ff 0x1400cd26d: mov      qword ptr [r10], r11
size: 1 value: 0x00000000000000ff 0x1400cd26d: mov      qword ptr [r10], r11
size: 1 value: 0x00000000000000ff 0x1400cd26d: mov      qword ptr [r10], r11
size: 1 value: 0x00000000000000ff 0x1400cd26d: mov      qword ptr [r10], r11
size: 1 value: 0x00000000000000ff 0x1400cd26d: mov      qword ptr [r10], r11
size: 8 value: 0xffffffff000165a1 0x140007fad: push     rdi
size: 4 value: 0x00000000fffcb99d 0x140007fae: xor      dword ptr [rsp], eax
size: 8 value: 0x00000001400aae62 0x14009194e: push     rbx

You can see that only size: 8 value: 0xfffffffffffff7ff 0x1400cd26d: mov qword ptr [r10], r11 should be present but for some reason it triggers callback 8 more times.

@wtdcode
Copy link
Member

wtdcode commented May 25, 2022 via email

@archercreat
Copy link
Author

@wtdcode thanks for the response! Indeed, the address is unaligned in all those cases. For example 0x2ede is the write address from example above. I did expect to see 1 write callback for mov qword ptr [mem], reg but I guess I need to handle this case as well.

@rhelmot
Copy link
Contributor

rhelmot commented Jul 13, 2022

Hi, I ran into this issue as well. The problem isn't that the write gets split up byte-by-byte, the problem is that we see a HOOK_MEM callback for the whole word and then another for each individual byte. This is a problem if you are expecting to see a certain sequence of writes - we can hack around the byte-by-byte behavior, but we can't hack around duplication.

@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants