High severityC#InjectionMEDIUM confidence
SQL String Concatenation
A SQL query string is assembled with concatenation, string interpolation, or string.Format on a runtime value (CWE-89).
Standards mapping
- OWASP Top 10
- A03:2021 - Injection
- OWASP ASVS
- V5.3.4 (L1)
Vulnerable vs. safe
Flagged by this check
var cmd = new SqlCommand("SELECT * FROM T ORDER BY " + sortColumn, null);Passes - the safe pattern
var cmd = new SqlCommand("SELECT * FROM T ORDER BY Name", null);Why it matters & how to fix it
A SQL query string is assembled with concatenation, string interpolation, or string.Format on a runtime value (CWE-89). This is a frequent source of SQL injection even when the input currently looks trusted. Replace it with a parameterized command (SqlParameter / '@name' placeholders) or pass parameters to FromSqlRaw/ExecuteSqlRaw.
References
Rule ID integsec.csharp.injection.sql-string-concat - 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