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

Addition of C/C++ Semgrep ruleset #929

Closed
neutrinoguy opened this issue Dec 1, 2023 · 6 comments · Fixed by #1022
Closed

Addition of C/C++ Semgrep ruleset #929

neutrinoguy opened this issue Dec 1, 2023 · 6 comments · Fixed by #1022
Assignees
Labels
AI-assissted firmware analysis Core modules (Sxx) The core scanning modules (Sxx modules) EMBA enhancement New feature or request help wanted Extra attention is needed Research stale

Comments

@neutrinoguy
Copy link

Is your feature request related to a problem? Please describe.
Can we add below released semgrep rules to EMBA if the original author is okay with it ?

https://github.com/0xdea/semgrep-rules

Additional reference: Blog

Describe the solution you'd like
Addition of above rules in current EMBA semgrep repository.

Describe alternatives you've considered
NA

Priority issue
Are you already a [Sponsor]? - N

Additional context
NA

Thanks

@m-1-k-3 m-1-k-3 added enhancement New feature or request Core modules (Sxx) The core scanning modules (Sxx modules) EMBA labels Dec 1, 2023
@m-1-k-3
Copy link
Member

m-1-k-3 commented Dec 1, 2023

Do you have a firmware where these rules will provide value?

@neutrinoguy
Copy link
Author

neutrinoguy commented Dec 6, 2023

Hello @m-1-k-3 ,

I don't have a firmware at this point in time. But the author of these rules has an excellent blog showing its application on closed source binaries.

https://security.humanativaspa.it/automating-binary-vulnerability-discovery-with-ghidra-and-semgrep/

Here he suggests to use an additional GHIDRA script to extract all pseudo code generated by decompiler and run this rules on them.

https://github.com/0xdea/ghidra-scripts/blob/main/Haruspex.java

I think this can apply to any given firmware and be used on possibly all first party binaries discovered in firmware during EMBA analysis.

Alternatively ghidra decompiler is already present in radare2 to help automate it maybe.

Your thoughts around this ?

Thanks

@m-1-k-3
Copy link
Member

m-1-k-3 commented Dec 6, 2023

This looks very interesting and similar to our idea around module s19 where we already created some pseudo code with r2. Nevertheless, our testing with semgrep and gpt on this pseudo code was not that successful. Probably the code generated by Ghidra is better for further automated analysis. As we have Ghidra and semgrep already in place in our EMBA container we can directly start to poke around with it on how to get best results out of it. This will take some time as we are currently quite busy. If you can support in this area it would be really great.

Copy link

This issue is stale because it has been open for 28 days with no activity.

@neutrinoguy
Copy link
Author

Great to see this has been implemented in EMBA now. Nice work @m-1-k-3

Can't wait to see what it discovers 🤩

@m-1-k-3
Copy link
Member

m-1-k-3 commented Feb 17, 2024

Check it out and give me feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI-assissted firmware analysis Core modules (Sxx) The core scanning modules (Sxx modules) EMBA enhancement New feature or request help wanted Extra attention is needed Research stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants