I recently thought about something like this:
$sql = "SELECT password FROM users WHERE user = '" . $_POST["user"] . "'";
$result = mysql_query($sql);
if (myql_num_rows($result) != 1) {
//Error
}
$data = mysql_fetch_array($result);
if ($data["password"] == md5($_POST["password"])) {
//Welcome
} else {
//Error
}
Even though no parameterized querys or atleast escaping is used, I could not think of a proper sql injection with which you can get trough to the Welcome
point. You would somehow need to modify the returned password whose md5 value you can then just use as a password.
Any ideas if this is possible?