UNPKG

mcp-server-semgrep

Version:

MCP Server for Semgrep Integration - static code analysis with AI

66 lines (65 loc) 1.42 kB
rules: - id: script-engine-injection message: >- Detected potential code injection using ScriptEngine. Ensure user-controlled data cannot enter '.eval()', otherwise, this is a code injection vulnerability. metadata: cwe: - "CWE-94: Improper Control of Generation of Code ('Code Injection')" owasp: - A03:2021 - Injection source-rule-url: https://find-sec-bugs.github.io/bugs.htm#SCRIPT_ENGINE_INJECTION category: security technology: - java references: - https://owasp.org/Top10/A03_2021-Injection cwe2022-top25: true subcategory: - audit likelihood: LOW impact: LOW confidence: LOW severity: WARNING languages: [java] patterns: - pattern-either: - pattern-inside: | class $CLASS { ... ScriptEngine $SE; ... } - pattern-inside: | class $CLASS { ... ScriptEngine $SE = ...; ... } - pattern-inside: | $X $METHOD(...) { ... ScriptEngine $SE = ...; ... } - pattern: | $X $METHOD(...) { ... $SE.eval(...); ... } - pattern-not: | $X $METHOD(...) { ... $SE.eval("..."); ... } - pattern-not: | $X $METHOD(...) { ... String $S = "..."; ... $SE.eval($S); ... }