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

Ghidra: Capa Explorer UI Integration #1786

Merged
merged 47 commits into from
Jan 31, 2024
Merged

Ghidra: Capa Explorer UI Integration #1786

merged 47 commits into from
Jan 31, 2024

Conversation

colton-gabertan
Copy link
Collaborator

Checklist

  • No CHANGELOG update needed
  • No new tests needed
  • No documentation update needed

Capa Explorer: Ghidra Backend

This PR revives the project from #1734 to implement capa results with the Ghidra UI.

image

Description

The UI integration will parse the json output from capa's analysis and create namespaces, labels, function tags, and bookmarks within the Ghidra UI. Namespaces tightly correlate with the way that the capa rules are defined, and the linked labels for each namespace represents the feature/ description pulled from the matched rule. Function tags hold each matched capability within its scope.

Furthermore, depending on how the rule is written, information such as parameters and their corresponding names are displayed. For example:

image

PUSH 0x80000000 as a parameter is identified as the GENERIC_READ flag passed to CreateFileA

Mitre ATT&CK Framework mappings exist only in the bookmarks created, and are only labelled at the function scope, since they are broad and encompass many tactics/techniques.

@colton-gabertan colton-gabertan self-assigned this Sep 11, 2023
@colton-gabertan colton-gabertan added the ghidra Related to Ghidra integration label Sep 11, 2023
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.

Wow, this looks amazing! Thanks, I've noted a few things on a glance. I hope Mike and others can give this a more thorough look and test it on a few samples.

Would you mind adding a (short) README analogous to https://github.com/mandiant/capa/blob/master/capa/ida/plugin/README.md?

capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Show resolved Hide resolved
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.

Great work @colton-gabertan - this is looking great! I've left comments and questions for your review. I also mirror @mr-tz 's request to add a README. Please re-request my review when you have finished 🚀

capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
@mike-hunhoff
Copy link
Collaborator

Also, @colton-gabertan it looks like the submodules have fallen out of sync. Please re-sync when you get a chance.

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.

Good work @colton-gabertan ! I've left additional comments for your review. Please re-request my review when you've finished and let me know if you have any questions along the way.

capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
@mike-hunhoff mike-hunhoff added this to the v7.0 milestone Jan 9, 2024
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.

@colton-gabertan nice work - I've left another round of changes. Please re-request my review when you've addressed them 🚀

capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
capa/ghidra/capa_explorer.py Outdated Show resolved Hide resolved
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.

These latest changes are awesome @colton-gabertan ! The capa results are much easier to identify and follow now. The only item left before we get this merged is updating the Ghidra README to include a small section that explains how to use and interpreter the results of this script. Once that's done we'll get this merged 🚀 🚀

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.

Great work @colton-gabertan ! I've left suggestions for your review. Please address these suggestions and resolve the merge conflict. Re-request my review when you're done and we'll get this merged 🚀 (I'll handle the CLA issue when it's time to merge).

capa/ghidra/README.md Outdated Show resolved Hide resolved
capa/ghidra/README.md Outdated Show resolved Hide resolved
capa/ghidra/README.md Outdated Show resolved Hide resolved
capa/ghidra/README.md Outdated Show resolved Hide resolved
capa/ghidra/README.md Outdated Show resolved Hide resolved
capa/ghidra/README.md Outdated Show resolved Hide resolved
capa/ghidra/README.md Outdated Show resolved Hide resolved
capa/ghidra/README.md Outdated Show resolved Hide resolved
capa/ghidra/README.md Outdated Show resolved Hide resolved
capa/ghidra/README.md Outdated Show resolved Hide resolved
colton-gabertan and others added 12 commits January 30, 2024 14:36
Co-authored-by: Mike Hunhoff <[email protected]>
Co-authored-by: Mike Hunhoff <[email protected]>
Co-authored-by: Mike Hunhoff <[email protected]>
Co-authored-by: Mike Hunhoff <[email protected]>
Co-authored-by: Mike Hunhoff <[email protected]>
Co-authored-by: Mike Hunhoff <[email protected]>
Co-authored-by: Mike Hunhoff <[email protected]>
Co-authored-by: Mike Hunhoff <[email protected]>
Co-authored-by: Mike Hunhoff <[email protected]>
Co-authored-by: Mike Hunhoff <[email protected]>
colton-gabertan and others added 2 commits January 30, 2024 15:08
Co-authored-by: Mike Hunhoff <[email protected]>
Co-authored-by: Mike Hunhoff <[email protected]>
@mike-hunhoff mike-hunhoff merged commit 3e4479e into master Jan 31, 2024
17 of 18 checks passed
@mike-hunhoff mike-hunhoff deleted the fix-1734 branch January 31, 2024 05:58
@mr-tz
Copy link
Collaborator

mr-tz commented Jan 31, 2024

Great work, Colton and Mike! Thank you!

@mr-tz mr-tz mentioned this pull request Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ghidra Related to Ghidra integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants