mcp-server-semgrep
Version:
MCP Server for Semgrep Integration - static code analysis with AI
43 lines (42 loc) • 1.02 kB
YAML
rules:
- id: java-reverse-shell
patterns:
- pattern-either:
- pattern: |
Socket $S=new Socket(...);
...
InputStream $SI = $S.getInputStream();
...
while(!$S.isClosed())
{
...
while($SI.available()>0)$PO.write($SI.read());
...
$SO.flush();
...
}
- pattern-inside: |
Process $P=new ProcessBuilder(...).redirectErrorStream(true).start();
...
$P.destroy();
message: Semgrep found potential reverse shell behavior
severity: WARNING
metadata:
cwe:
- "CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')"
category: security
technology: [java]
owasp:
- A01:2017 - Injection
- A03:2021 - Injection
references:
- https://owasp.org/Top10/A03_2021-Injection
cwe2022-top25: true
cwe2021-top25: true
subcategory:
- audit
likelihood: LOW
impact: HIGH
confidence: LOW
languages:
- java