Last active
August 31, 2018 11:55
-
-
Save CoditCompany/4e0a3d2d3a55e4d89edaffd846823ba0 to your computer and use it in GitHub Desktop.
Automating SQL Injection Discovery with FSec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let getOrderIdsForName name = | |
use con = new SqlConnection "my-connection-string" | |
con.Open () | |
let sql = "SELECT OrderId FROM Orders WHERE Client = " + name | |
use cmd = new SqlCommand (sql, con) | |
cmd.CommandType <- CommandType.Text | |
let rdr = cmd.ExecuteReader () | |
seq { while rdr.Read () do | |
yield rdr.["OrderId"] |> string } | |
[<Property>] | |
let ``discover SQL injection`` () = | |
FSec.sqlInject | |
|> Arb.fromGen | |
|> Prop.forAll <| | |
(getOrderIdsForName >> ignore) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment