High severityRubyInjectionHIGH confidence
OS Command Injection Interpolation
A shell command is built by interpolating/concatenating a string and run via system/exec/backticks/%x/Open3, enabling OS command injection (CWE-78).
Standards mapping
- CWE
- CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
- OWASP Top 10
- A03:2021 - Injection
- OWASP ASVS
- V5.3.8 (L1)
Vulnerable vs. safe
Flagged by this check
system("tar -czf backup.tar #{archive_name}")Passes - the safe pattern
system("tar", "-czf", "backup.tar", archive_name)Why it matters & how to fix it
A shell command is built by interpolating/concatenating a string and run via system/exec/backticks/%x/Open3, enabling OS command injection (CWE-78). Pass an argv array (system("cmd", arg)) instead of a formatted string so arguments are never shell-parsed.
References
Rule ID integsec-ruby-os-command-injection-interpolation - engine: Opengrep - license: MIT - Copyright (c) IntegSec Inc.
TurboPentest runs this check automatically
Connect a GitHub repo and this check runs on every white-box pentest - AI-validated and reported with proof, from $99 per target.
Start a pentestRelated checks
- JavaScript / TypeScript - InjectionCode Injection Tainted Input
- JavaScript / TypeScript - InjectionEval Dynamic Argument
- JavaScript / TypeScript - InjectionNoSQL Query From Request
- JavaScript / TypeScript - InjectionNoSQL Where Operator
- JavaScript / TypeScript - InjectionOS Command Injection Tainted Input
- JavaScript / TypeScript - InjectionSQL Injection String Concatenation