UNPKG

mcp-server-semgrep

Version:

MCP Server for Semgrep Integration - static code analysis with AI

72 lines (71 loc) 2.17 kB
rules: - id: os-system-injection languages: - python severity: ERROR message: >- User data detected in os.system. This could be vulnerable to a command injection and should be avoided. If this must be done, use the 'subprocess' module instead and pass the arguments as a list. metadata: cwe: - "CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')" owasp: - A01:2017 - Injection - A03:2021 - Injection references: - https://owasp.org/www-community/attacks/Command_Injection category: security technology: - flask cwe2022-top25: true cwe2021-top25: true subcategory: - audit likelihood: MEDIUM impact: HIGH confidence: MEDIUM pattern-either: - patterns: - pattern: os.system(...) - pattern-either: - pattern-inside: | @$APP.route($ROUTE, ...) def $FUNC(..., $ROUTEVAR, ...): ... os.system(..., <... $ROUTEVAR ...>, ...) - pattern-inside: | @$APP.route($ROUTE, ...) def $FUNC(..., $ROUTEVAR, ...): ... $INTERM = <... $ROUTEVAR ...> ... os.system(..., <... $INTERM ...>, ...) - pattern: os.system(..., <... flask.request.$W.get(...) ...>, ...) - pattern: os.system(..., <... flask.request.$W[...] ...>, ...) - pattern: os.system(..., <... flask.request.$W(...) ...>, ...) - pattern: os.system(..., <... flask.request.$W ...>, ...) - patterns: - pattern-inside: | $INTERM = <... flask.request.$W.get(...) ...> ... os.system(<... $INTERM ...>) - pattern: os.system(...) - patterns: - pattern-inside: | $INTERM = <... flask.request.$W[...] ...> ... os.system(<... $INTERM ...>) - pattern: os.system(...) - patterns: - pattern-inside: | $INTERM = <... flask.request.$W(...) ...> ... os.system(<... $INTERM ...>) - pattern: os.system(...) - patterns: - pattern-inside: | $INTERM = <... flask.request.$W ...> ... os.system(<... $INTERM ...>) - pattern: os.system(...)