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

pefile.py failed to load PE binary with bogus section.SizeOfRawData #381

Open
peta909 opened this issue Sep 13, 2023 · 1 comment
Open
Assignees

Comments

@peta909
Copy link

peta909 commented Sep 13, 2023

Hi,
I recently came across a binary with its section.SizeOfRawData have a bogus value which is much larger than its actual value.
This result in pefile loading the binary wrongly.
at pefile/pefile.py line 6290
if ( srd > len(self.__data__) or prd > len(self.__data__) or srd + prd > len(self.__data__) or VirtualAddress_adj >= max_virtual_address ): continue

I had to comment out 2 lines of the above code with "srd" for the binary to be loaded correctly. The same binary was loaded correctly in IDA Pro and Pe-bear.

@erocarrera erocarrera self-assigned this Sep 13, 2023
@erocarrera
Copy link
Owner

Hi, when you say "loaded correctly", what is the end result you expect?
The line is part of the code of the get_memory_mapped_image() method. The large section.SizeOfRawData imply the section will be skipped and its data not added to the simulated "memory mapped image", what would be the behavior you expect, to add any available data for the section to the result? that would seem feasible.

Would it be possible to provide the file or its hash, if available through a service such as VirusTotal?

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

No branches or pull requests

2 participants