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

debug/buildinfo: build info not found in PE binaries #53071

Open
stevemk14ebr opened this issue May 25, 2022 · 4 comments · May be fixed by #53162
Open

debug/buildinfo: build info not found in PE binaries #53071

stevemk14ebr opened this issue May 25, 2022 · 4 comments · May be fixed by #53162
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@stevemk14ebr
Copy link
Contributor

What version of Go are you using (go version)?

1.18

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

PE go binary, any host OS

What did you do?

The go buildinfo tool fails to locate the build info because the bit test here is wrong

sect.Characteristics&^IMAGE_SCN_ALIGN_32BYTES == IMAGE_SCN_CNT_INITIALIZED_DATA|IMAGE_SCN_MEM_READ|IMAGE_SCN_MEM_WRITE {
. When the .data section characteristics flags are value 0xC0500040.

image

What did you expect to see?

The .data section to be found.

What did you see instead?

The .data section is not found and the PE is seen as malformed by the buildinfo command, and information extraction fails.

@seankhliao
Copy link
Member

how were these binaries built?

@stevemk14ebr
Copy link
Contributor Author

stevemk14ebr commented May 25, 2022

with the go build tool - then potentially modified by an obfuscator, this is an in the wild binary it's not one I created. Example binary: https://www.mediafire.com/file/3sukf6j3lfwk5tt/go_gimphash_windows.7z/file. I tested and opened a PR that fixes this.

@seankhliao seankhliao changed the title affected/package: BuildInfo debug/buildinfo: build info not found in PE binaries May 25, 2022
@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 25, 2022
@gopherbot
Copy link

Change https://go.dev/cl/408534 mentions this issue: debug/buildinfo: fix buildinfo data section location on elf and pe

@gopherbot
Copy link

Change https://go.dev/cl/409534 mentions this issue: debug/buildinfo: fix buildinfo data section location on elf and pe

@seankhliao seankhliao added this to the Unplanned milestone Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
3 participants