- Jaimin Gohel
The Open Web Application Security Project (OWASP) is a not-for-profit group that helps organizations develop, purchase, and maintain software application that can be trusted.
OWASP Top 10 Application Security Risks
Zap proxy
Mutillidae
Injection flaws, such as SQL, NoSQL, OS, and LDAP injection, occur when untrusted data is sent to an interpreter as part of a command or query. The attacker's hostile data can trick the interpreter into executing unintended commands or accessing data without proper authorization.
<?php
mysql_query(“select * from users where name = ‘“.$_POST[‘name’].”’ AND
password = ‘“.$_POST[‘password’].”’) ?>
name = ‘ or 1=1 – ← there is a space after the SQL comment
SQLi: SELECT * from users where name = '' or 1=1 -- AND password = '' ← always true
<?php
/* create a prepared statement */
if ($stmt = $mysqli->prepare("SELECT * from users where name=? AND password=?")) {
/* bind parameters for markers */
$stmt->bind_param("ss", $name,$password);
/* execute query */
$stmt->execute();
/* bind result variables */
$stmt->bind_result($details);
/* fetch value */
$stmt->fetch();
/* close statement */
$stmt->close();
}