From bf3c141f3c318b45b1f43d962623587ac26a92a2 Mon Sep 17 00:00:00 2001 From: Marcin Zelent Date: Wed, 30 May 2018 16:53:50 +0200 Subject: Added SQL injection example --- sql-injection/index.html | 25 +++++++++++++++++++++++++ sql-injection/login.php | 23 +++++++++++++++++++++++ sql-injection/users.db | Bin 0 -> 8192 bytes 3 files changed, 48 insertions(+) create mode 100644 sql-injection/index.html create mode 100644 sql-injection/login.php create mode 100644 sql-injection/users.db (limited to 'sql-injection') diff --git a/sql-injection/index.html b/sql-injection/index.html new file mode 100644 index 0000000..d3e760b --- /dev/null +++ b/sql-injection/index.html @@ -0,0 +1,25 @@ + + + + Login page + + + + +

Login

+
+
+
+ +
+ + diff --git a/sql-injection/login.php b/sql-injection/login.php new file mode 100644 index 0000000..826c38c --- /dev/null +++ b/sql-injection/login.php @@ -0,0 +1,23 @@ +open('users.db'); + } + } + + if(isset($_POST['email'], $_POST['pass'])) + { + $email = $_POST['email']; + $pass = $_POST['pass']; + + $db = new MyDB(); + + $sql = 'SELECT * FROM Users WHERE email=\''.$email.'\' AND password=\''.$pass.'\''; + + $ret = $db->query($sql); + while($row = $ret->fetchArray(SQLITE3_ASSOC)) { + echo 'Logged in as '.$row['email'].'
'; + } + $db->close(); + } +?> diff --git a/sql-injection/users.db b/sql-injection/users.db new file mode 100644 index 0000000..9ddf64e Binary files /dev/null and b/sql-injection/users.db differ -- cgit v1.2.3