SQL Injection Code Sample Run

This commit is contained in:
Michael Hohn
2024-12-03 14:32:14 -08:00
committed by =Michael Hohn
parent 75ed1f7b00
commit a2466b0a2d
7 changed files with 315 additions and 111 deletions

21
SqlInjection-sink.ql Normal file
View File

@@ -0,0 +1,21 @@
/**
* @name SQLI Vulnerability
* @description Using untrusted strings in a sql query allows sql injection attacks.
* @kind problem
* @id workshop/sqlivulnerable
* @problem.severity warning
*/
import csharp
/*
* 2. Identify the /sink/ part of the
* : var command = new SqliteCommand(query, connection))
* expression, the =query= argument.
*/
from ObjectCreation oc, Expr queryArg
where
oc.getObjectType().getName() = "SqliteCommand" and
oc.getArgument(0) = queryArg
select queryArg, "Sink identified: " + queryArg.toString()