Improved handling of export table for invalid export address and removed GandCrab workaround in GetProcAddress#1358
Conversation
|
Doesn't the check on line 551 help avoid this situation? |
|
The check on line 551 can fail if the export table exists, but is malformed. In that situation, the IMAGE_DIRECTORY_ENTRY_EXPORT attribute is present, but when pefile.full_load() is called, it can't parse the export table. Because of this, the DIRECTORY_ENTRY_EXPORT attribute never gets created, so Qiling crashes when it tries to access it. |
|
OK, then better document that just above that line (something like: "address a corner case where ...."), because it might look redundant for someone who is not familiar with that exact corner case. Also, please break the |
|
Ok, I've made the changes. |
|
@elicn are you ok with the updates |
|
@xwings, approved. |
|
Thanks, merged. |
Binaries with an invalid export address table cause Qiling to crash when attempting to load exports. This fix ensures that pefile has loaded the export table before attempting to parse the exports.
Additionally, the hook for GetProcAddress contains a workaround for GandCrab that returns 0 when looking for RtlComputeCrc32. This causes other emulated binaries using the RtlComputeCrc32 API to fail, which makes me think this workaround was included unintentionally.
Checklist
Which kind of PR do you create?
Coding convention?
Extra tests?
Changelog?
Target branch?
One last thing