trailofbits / trailofbits/pe-parse

Error 9: Bad magic for valid .exe

Open
#201 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
911
Forks
171
PR merge metrics
No merged PRs in 30d

Description

Hi, I'm getting the following error when parsing the a .exe file - unfortunately I can't attach it here as the data is sensitive

The file can be opened via CFF Explorer without any problems

ErrString: Bad magic
ErrLoc: ParsePEFromBuffer:2528
Err: 9

⚠️ - we are performing static analysis on suspicious binaries and the attached file may not be safe to execute, therefore I have renamed it to .bin and zipped it into a password protected file - the password is donotexec.

It seems pe-parse can't get the nameSection form nameVA

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at ParsePEFromBuffer around line 2528 and trace how the section name is obtained from nameVA. Reproduce the failure with a comparable valid .exe, then confirm that the parser no longer reports Err 9: Bad magic for valid PE files.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
reverse-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.