UNPKG

mcp-server-semgrep

Version:

MCP Server for Semgrep Integration - static code analysis with AI

94 lines (93 loc) 2.42 kB
rules: - id: os-command-injection severity: ERROR languages: - csharp 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: - .net confidence: LOW cwe2022-top25: true cwe2021-top25: true subcategory: - audit likelihood: LOW impact: HIGH message: >- The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component. patterns: - pattern-inside: | using System.Diagnostics; ... - pattern-inside: | public $T $F(..., $ARG, ...) { ... } - pattern-either: - patterns: - pattern: | Process.Start($ARG, ...); - focus-metavariable: $ARG - patterns: - pattern-inside: | Process $PROC = new Process(); ... - pattern-either: - pattern-inside: | $PROC.StartInfo.FileName = $ARG; ... - pattern-inside: | $PROC.StartInfo.Arguments = <... $ARG ...>; ... - pattern: | $PROC.Start(); - patterns: - patterns: - pattern-inside: | ProcessStartInfo $PSINFO = new ProcessStartInfo() { ... }; ... - pattern-either: - pattern-inside: | FileName = $ARG; ... - pattern-inside: | Arguments = <... $ARG ...>; ... - pattern: | Process.Start($PSINFO); - focus-metavariable: $PSINFO - patterns: - pattern-inside: | Process $PROC = new Process() { StartInfo = new ProcessStartInfo() { ... } }; ... - pattern-either: - pattern-inside: | FileName = $ARG; ... - pattern-inside: | Arguments = $ARG; ... - pattern: | $PROC.Start();