UNPKG

mcp-server-semgrep

Version:

MCP Server for Semgrep Integration - static code analysis with AI

137 lines (136 loc) 3.18 kB
rules: - id: el-injection 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#EL_INJECTION category: security technology: - java references: - https://owasp.org/Top10/A03_2021-Injection cwe2022-top25: true subcategory: - audit likelihood: LOW impact: HIGH confidence: LOW message: >- An expression is built with a dynamic value. The source of the value(s) should be verified to avoid that unfiltered values fall into this risky code evaluation. severity: WARNING languages: [java] patterns: - pattern-either: - pattern: | class $CLASS { ... ExpressionFactory $EF; ... $X $METHOD(...) { ... $EF.createValueExpression($CTX,$INPUT,...); ... } ... } - pattern: | class $CLASS { ... ExpressionFactory $EF = ...; ... $X $METHOD(...) { ... $EF.createValueExpression($CTX,$INPUT,...); ... } ... } - pattern: | $X $METHOD(...) { ... ExpressionFactory $EF = ...; ... $EF.createValueExpression($CTX,$INPUT,...); ... } - pattern: | $X $METHOD(...,ExpressionFactory $EF,...) { ... $EF.createValueExpression($CTX,$INPUT,...); ... } - pattern: | class $CLASS { ... ExpressionFactory $EF; ... $X $METHOD(...) { ... $EF.createMethodExpression($CTX,$INPUT,...); ... } ... } - pattern: | class $CLASS { ... ExpressionFactory $EF = ...; ... $X $METHOD(...) { ... $EF.createMethodExpression($CTX,$INPUT,...); ... } ... } - pattern: | $X $METHOD(...) { ... ExpressionFactory $EF = ...; ... $EF.createMethodExpression($CTX,$INPUT,...); ... } - pattern: | $X $METHOD(...,ExpressionFactory $EF,...) { ... $EF.createMethodExpression($CTX,$INPUT,...); ... } - pattern: | $X $METHOD(String $INPUT, ...) { ... $OBJECT.buildConstraintViolationWithTemplate($INPUT, ...); ... } - pattern-not: | $X $METHOD(...) { ... $EF.createValueExpression($CTX,"...",...); ... } - pattern-not: | $X $METHOD(...) { ... String $S = "..."; ... $EF.createValueExpression($CTX,$S,...); ... } - pattern-not: | $X $METHOD(...) { ... $EF.createMethodExpression($CTX,"...",...); ... } - pattern-not: | $X $METHOD(...) { ... String $S = "..."; ... $EF.createMethodExpression($CTX,$S,...); ... }