Skip to content
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

Rework calculation of imphash to match pefile/yara #246

Closed
metthal opened this issue Mar 14, 2018 · 1 comment
Closed

Rework calculation of imphash to match pefile/yara #246

metthal opened this issue Mar 14, 2018 · 1 comment

Comments

@metthal
Copy link
Member

metthal commented Mar 14, 2018

Right now we calculate our own imphash which differs from the one generated by pefile or YARA.

The difference is in how we handle imports by ordinals. We just convert the ordinal to the number and append it to the hashed bytes, but both pefile and YARA create string ord<ordinal> [1]. On top of that, imports by ordinals from WS2_32, wsock2 and oleaut32 are translated into their names using lookup tables [2].

We should generate our imphash the same way as they do.

[1] https://github.com/VirusTotal/yara/blob/master/libyara/modules/pe_utils.c#L1926
[2] https://github.com/VirusTotal/yara/blob/master/libyara/modules/pe_utils.c#L357

@mbandzi
Copy link
Contributor

mbandzi commented Mar 14, 2018

Fixed in commit c1e94cb.

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

2 participants