Skip to content

A collection of my Semgrep rules to facilitate vulnerability research.

License

Notifications You must be signed in to change notification settings

EMBA-support-repos/semgrep-rules-0xdea

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

semgrep-rules

test

"The attack surface is the vulnerability. Finding a bug there is just a detail."

-- Mark Dowd

"Some details are more important than others."

-- Fedor G. Pikus

A collection of my Semgrep rules to facilitate vulnerability research.

Program in C

Blog posts

See also

Setup and usage instructions

  1. Install Semgrep.
  2. Clone this GitHub repo.
  3. To use these rules, run:
# high priority scan (quick wins)
semgrep --severity ERROR --config semgrep-rules/rules /path/to/source
# high and medium priority scan (recommended)
semgrep --severity ERROR --severity WARNING --config semgrep-rules/rules /path/to/source
# full scan (might include marginal findings and more false positives)
semgrep --config semgrep-rules/rules /path/to/source

For a better streamlined experience, I recommend saving Semgrep scan output in SARIF format and using SARIF Explorer in VS code:

semgrep --sarif --sarif-output=/path/to/source/SEMGREP.sarif --config semgrep-rules/rules /path/to/source
code /path/to/source # then open the SEMGREP.sarif file in VS code with SARIF Explorer 

See also the included SARIF output example.

Compatibility

  • Tested with Semgrep CLI 1.142.0

TODO

  • Additional --time benchmarking against real-world code to spot slow rules in need of optimization.
  • Improve overall accuracy and reduce false positives, without missing potential hot spots in code.
  • Add new checks in the existing rules and add new rules where needed.
  • Implement dedicated kernel rules (Linux, BSD, macOS, etc.).
  • Port the rules to the Semgrep pro engine, which allows for inter-file and inter-function analysis.
  • Implement taint mode where suitable to improve rules with dataflow analysis.

Rules

C/C++

buffer overflows

integer overflows

format strings

memory management

command injection

race conditions

privilege management

denial of service

  • regex-dos. Regular expression that may exhibit exponential runtime and lead to ReDoS.

miscellaneous

Generic

miscellaneous

  • bad-words. Keywords and comments that suggest the presence of bugs.

About

A collection of my Semgrep rules to facilitate vulnerability research.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 98.0%
  • C++ 2.0%