Skip to content

Conversation

@williballenthin
Copy link
Collaborator

@williballenthin williballenthin commented Aug 11, 2021

Implementation of ELF-related features, ref #699

adds:

  • OS features: os: windows, os: linux, os: macos, etc. at global scope (insn, bb, function, AND file scopes) closes detect OS from ELF file #724
  • file format features: format: pe, format: elf at file scope
  • arch features: arch: amd64 and arch: i386 at global scope
  • tests demonstrating feature extraction on ELF files

extractors are now expected to extract each of the above. implements these for the viv, smda, pefile, and ida extractors. documentation for these features is found in mandiant/capa-rules#443

breaking changes:

  • rename legacy term arch to bitness to make space for arch: feature

this means we'll need to do a major release (v3.0.0); however, the new features os, format, and arch also are breaking changes, so there's no getting around this.

does not attempt:

  • the meta.os key. this can be added subsequently in another PR.

demo

image

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add bug fixes, new features, breaking changes and anything else you think is worthwhile mentioning to the master (unreleased) section of CHANGELOG.md. If no CHANGELOG update is needed add the following to the PR description: [x] No CHANGELOG update needed

@github-actions github-actions bot dismissed their stale review August 11, 2021 21:10

CHANGELOG updated or no update needed, thanks! 😄

@williballenthin
Copy link
Collaborator Author

requesting initial review to ensure i'm on the right track and making sense.

@williballenthin

This comment has been minimized.

makes space for upcoming feature `arch: ` for things like i386/amd64/aarch64
@williballenthin williballenthin added the breaking-change introduces a breaking change that should be released in a major version label Aug 16, 2021
@williballenthin williballenthin added this to the v3.0.0 milestone Aug 16, 2021
@williballenthin
Copy link
Collaborator Author

williballenthin commented Aug 20, 2021

do we need to add a is_supported_arch function?
we should verify supported file types (and arch, see above) before firing the SMDA extractor
we will need to update output for the standalone tool

04cc94a

@williballenthin
Copy link
Collaborator Author

we should add OS to collected metadata and I would also vote we separate arch, bitness, and file format from the format key

1b9a6c3
image

@williballenthin
Copy link
Collaborator Author

williballenthin commented Aug 20, 2021

eventually we will want to implement file-scoped limitation checks for all supported file types similar to what we currently do with PE files

agree, though at the moment, i don't think we would have any file limitation rules that would fire on ELF binaries. i'd propose to implement the limitation check only once we have those rules, since we'll have to write even more new code to do the lightweight ELF feature extraction (and this PR is already big).

@williballenthin
Copy link
Collaborator Author

@mike-hunhoff items identified above are addressed. would you review those few commits? anything further you'd want done before merging?

Copy link
Collaborator

@mr-tz mr-tz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

impressive, thanks for the great work here!

Copy link
Collaborator

@mike-hunhoff mike-hunhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updates look good, thank you!

Copy link
Member

@Ana06 Ana06 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work!!! 🥇

@williballenthin
Copy link
Collaborator Author

williballenthin commented Aug 23, 2021

ugh viv ELF support seems like it might have been broken in v1.0.4?

https://github.com/fireeye/capa/runs/3404104636

#735

reported here vivisect/vivisect#443 fix here vivisect/vivisect#444

@williballenthin
Copy link
Collaborator Author

williballenthin commented Aug 24, 2021

this is ready to go

@williballenthin williballenthin merged commit d3573a5 into master Aug 24, 2021
@williballenthin williballenthin deleted the feature-701 branch August 24, 2021 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change introduces a breaking change that should be released in a major version enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

detect OS from ELF file

5 participants