CVE-nu11-13-091721
Vulnerability PHPapp code validate.phpand structure also
<?php
require_once 'conn.php';
$username = $_POST['username'];
$password = $_POST['password'];
$query = $conn->query("SELECT * FROM `admin` WHERE `username` = '$username' && `password` = '$password'") or die(mysqli_error());
$validate = $query->num_rows;
$fetch = $query->fetch_array();
if($validate > 0){
echo "Success";
session_start();
$_SESSION['admin_id'] = $fetch['admin_id'];
}else{
echo "Error";
}Simple fix.
-
-
- WARNING: THIS IS
NOT FIXOF THE PROBLEM, Just an example =)
- WARNING: THIS IS
-
<?php
require_once 'conn.php';
$username = $_POST['username'];
$password = $_POST['password'];
$query = $conn->query("SELECT * FROM `admin` WHERE `username` = ('$username') && `password` = '$password'") or die(mysqli_error());
$validate = $query->num_rows;
$fetch = $query->fetch_array();
if($validate > 0){
echo "Success";
session_start();
$_SESSION['admin_id'] = $fetch['admin_id'];
}else{
echo "Error";
}Description:
The Simple Membership System using PHP and AJAX is vulnerable to remote SQL-Injection-Bypass-Authentication for the admin account/XSS-Stored PWNED. remote SQL-Injection-Bypass-Authentication: https://portswigger.net/support/using-sql-injection-to-bypass-authentication. The parameters (username and password) from the login form is not protected correctly and there is no security and escaping from malicious payloads. When the user will sending a malicious query or malicious payload to the MySQL server for login to the admin account on the system, he can bypass the login credentials and take control of this account. And the second time he can be adding a payload by using XSS-Stored
BR
- [+] @nu11secur1ty System Administrator - Infrastructure and Penetration Testing Engineer
