elttam/semgrep-rules

Java

246

77 commits

updated Sep 21, 2026

See the code

README

elttam's semgrep-rules

powered by semgrep r2c community slack

Welcome to elttam's public semgrep rules repository.

semgrep rules

We regularly develop rules during our code-assisted security audits and software security research. We will be frequently adding new rules and improving what's here for the semgrep community. We hope product security engineers and code auditors who use semgrep find these useful!

If you find any bugs, please raise a GitHub issue.

Getting started

This guide assumes you are familiar with Semgrep and have it already installed.

This repo has split the rules into two broard categories:

  1. rules/ -- Rules useful for developers or AppSec teams, these are generally vulnerabilities.
  2. rules-audit/ -- Rules useful for source code auditing, identifying intersting behaviour, and enumerating entrypoints, to augment manual source code review.

Test out this repo with the following command:

git clone https://github.com/elttam/semgrep-rules.git

To test out the rules, run:

semgrep --config semgrep-rules/rules semgrep-rules/rules/

To test out the audit focused rules, run:

semgrep --config semgrep-rules/rules-audit semgrep-rules/rules-audit/

Rules

These rules are focused on identifying vulnerabiltiies or other weaknesses.

Rule PathLanguageTechnologyDescription
generic/jsp-likely-xssGenericJSPDetect XSS with unsafe rendering in template
go/lang/security/audit/executable-symlinkGoPotential symlink takeover with os.Executable
go/lang/security/audit/sprintf-plain-stringGoSprintf unescaped control characters
go/lang/security/audit/uintptr-nonatomicGoNon-atomic use of converted uintptr
java/lang/security/audit/crypto/gcm-static-ivJavaFind GCM using same values for key and IV
java/lang/security/audit/crypto/randomstringutilsJavaApache CommonsFind RandomStringUtils using default java.util.Random, which is not suiatble for security
java/spring/security/audit/remoting/JavaSpringFind use of Spring Remoting
php/php-filter-chain-read-from-oraclePHPDetect possible PHP filter chain error based oracle
yaml/github-actions/security/save-stateYAMLGithub-ActionsFind use of unsafe and deprecated ::save-state
yaml/github-actions/security/set-outputYAMLGithub-ActionsFind use of unsafe and deprecated ::set-output
yaml/kubernetes/audit/network-policy-ingress-anyYAMLKubernetesFind container specs with NetworkPolicy with Ingress Permit ANY
yaml/kubernetes/audit/privileged-containerYAMLKubernetesFind container specs with security context privileged
yaml/kubernetes/security/allow-privileged-escalationYAMLKubernetesFind container specs, including init containers, allowing privilege escalation (allowPrivilegeEscalation)
yaml/kubernetes/security/no-security-contextYAMLKubernetesFind containers specs, with no security context, considers pod or container security context.
yaml/kubernetes/security/run-as-non-rootYAMLKubernetesFind container specs, allowing running as root (missing runAsNonRoot), considers pod and container security context PR
yaml/kubernetes/security/run-as-non-root-unsafe-valueYAMLKubernetesFind container specs, explicitly allowing running as root (runAsNonRoot: false), considers pod and container secuirity context PR

Audit Focused Rules

These rules are useful for aiding manual source code review by identifying interesting behaviour or enumerating entrypoints.

Rule PathLanguageTechnologyDescription
c/lang/security/audit/execCFind execution of processes
csharp/dotnet/security/audit/entrypoints/apsnet-controllerC#ASP.NETFind ASP.NET REST entrypoints
java/jackson/polymorphic-typingJavaJacksonFind polymorphic typing to aid in finding vulnerable Jackson deserialisation issues.
java/jackson/type-resolver-overrideJavaJacksonFind polymorphic typing using TypeResolveBuilder
java/jax-rs/security/audit/entrypoints/JavaJAX-RSFind JAX-RS REST entrypoints
java/lang/security/audit/processbuilderJavaFind execution of processes with ProcessBuilder
java/spring/security/audit/entrypoints/JavaSpringFind Spring REST entrypoints
java/struts2/security/audit/devmode/JavaStruts2Find the use of devMode
java/struts2/security/audit/dmi/JavaStruts2Find the use of Dynamic Method Invocation
java/struts2/security/audit/entrypoints/JavaStruts2Find Struts2 REST entrypoints
java/xstream/security/audit/fromxmlJavaXStreamFind use of XStream.fromXML(...)
kotlin/spark/security/audit/entrypoints/KotlinSparkFind Spark REST entrypoints
python/flask/security/audit/entrypoints/PythonFlaskFind Flask REST entrypoints
semgrep
semgrep-rules

Contributors

ben-elttam

56 commits

dependabot[bot]

15 commits

inkz

3 commits

daniel-elttam

2 commits

elttam/semgrep-rules

Java

246

77 commits

updated Sep 21, 2026

See the code

README

elttam's semgrep-rules

powered by semgrep r2c community slack

Welcome to elttam's public semgrep rules repository.

semgrep rules

We regularly develop rules during our code-assisted security audits and software security research. We will be frequently adding new rules and improving what's here for the semgrep community. We hope product security engineers and code auditors who use semgrep find these useful!

If you find any bugs, please raise a GitHub issue.

Getting started

This guide assumes you are familiar with Semgrep and have it already installed.

This repo has split the rules into two broard categories:

  1. rules/ -- Rules useful for developers or AppSec teams, these are generally vulnerabilities.
  2. rules-audit/ -- Rules useful for source code auditing, identifying intersting behaviour, and enumerating entrypoints, to augment manual source code review.

Test out this repo with the following command:

git clone https://github.com/elttam/semgrep-rules.git

To test out the rules, run:

semgrep --config semgrep-rules/rules semgrep-rules/rules/

To test out the audit focused rules, run:

semgrep --config semgrep-rules/rules-audit semgrep-rules/rules-audit/

Rules

These rules are focused on identifying vulnerabiltiies or other weaknesses.

Rule PathLanguageTechnologyDescription
generic/jsp-likely-xssGenericJSPDetect XSS with unsafe rendering in template
go/lang/security/audit/executable-symlinkGoPotential symlink takeover with os.Executable
go/lang/security/audit/sprintf-plain-stringGoSprintf unescaped control characters
go/lang/security/audit/uintptr-nonatomicGoNon-atomic use of converted uintptr
java/lang/security/audit/crypto/gcm-static-ivJavaFind GCM using same values for key and IV
java/lang/security/audit/crypto/randomstringutilsJavaApache CommonsFind RandomStringUtils using default java.util.Random, which is not suiatble for security
java/spring/security/audit/remoting/JavaSpringFind use of Spring Remoting
php/php-filter-chain-read-from-oraclePHPDetect possible PHP filter chain error based oracle
yaml/github-actions/security/save-stateYAMLGithub-ActionsFind use of unsafe and deprecated ::save-state
yaml/github-actions/security/set-outputYAMLGithub-ActionsFind use of unsafe and deprecated ::set-output
yaml/kubernetes/audit/network-policy-ingress-anyYAMLKubernetesFind container specs with NetworkPolicy with Ingress Permit ANY
yaml/kubernetes/audit/privileged-containerYAMLKubernetesFind container specs with security context privileged
yaml/kubernetes/security/allow-privileged-escalationYAMLKubernetesFind container specs, including init containers, allowing privilege escalation (allowPrivilegeEscalation)
yaml/kubernetes/security/no-security-contextYAMLKubernetesFind containers specs, with no security context, considers pod or container security context.
yaml/kubernetes/security/run-as-non-rootYAMLKubernetesFind container specs, allowing running as root (missing runAsNonRoot), considers pod and container security context PR
yaml/kubernetes/security/run-as-non-root-unsafe-valueYAMLKubernetesFind container specs, explicitly allowing running as root (runAsNonRoot: false), considers pod and container secuirity context PR

Audit Focused Rules

These rules are useful for aiding manual source code review by identifying interesting behaviour or enumerating entrypoints.

Rule PathLanguageTechnologyDescription
c/lang/security/audit/execCFind execution of processes
csharp/dotnet/security/audit/entrypoints/apsnet-controllerC#ASP.NETFind ASP.NET REST entrypoints
java/jackson/polymorphic-typingJavaJacksonFind polymorphic typing to aid in finding vulnerable Jackson deserialisation issues.
java/jackson/type-resolver-overrideJavaJacksonFind polymorphic typing using TypeResolveBuilder
java/jax-rs/security/audit/entrypoints/JavaJAX-RSFind JAX-RS REST entrypoints
java/lang/security/audit/processbuilderJavaFind execution of processes with ProcessBuilder
java/spring/security/audit/entrypoints/JavaSpringFind Spring REST entrypoints
java/struts2/security/audit/devmode/JavaStruts2Find the use of devMode
java/struts2/security/audit/dmi/JavaStruts2Find the use of Dynamic Method Invocation
java/struts2/security/audit/entrypoints/JavaStruts2Find Struts2 REST entrypoints
java/xstream/security/audit/fromxmlJavaXStreamFind use of XStream.fromXML(...)
kotlin/spark/security/audit/entrypoints/KotlinSparkFind Spark REST entrypoints
python/flask/security/audit/entrypoints/PythonFlaskFind Flask REST entrypoints
semgrep
semgrep-rules

Contributors

ben-elttam

56 commits

dependabot[bot]

15 commits

inkz

3 commits

daniel-elttam

2 commits

Languages

Java

64.9%

Go

14.1%

C

8.7%

JavaScript

3.5%

C#

2.6%

Python

2.2%

PHP

2.0%

TypeScript

1.1%