Skip to content

[SECURITY] Multiple SQL Injection Vulnerabilities + Plaintext Password Storage (CVE Candidate) #7

Description

Security Vulnerability Report: SQL Injection + Plaintext Password Storage

Severity: Critical (CVSS v3.1: 9.8)
CWE: CWE-89 (SQL Injection), CWE-256 (Plaintext Password Storage)
Affected Repository: sarin32/Blood-Bank-Management-System-DBMS


Vulnerability 1: SQL Injection in Search Person

File: searchPerson.php

Vulnerable Code:

$pid = $_POST['pid'];
$sql = "select * from Person where p_id = '$pid'";
$result = mysqli_query($con, $sql);

The $pid parameter is taken directly from POST input with no sanitization whatsoever.

Proof of Concept:

POST /searchPerson.php

pid=1' UNION SELECT 1,username,password,4,5,6,7 FROM User-- -

Result: Dumps all usernames and passwords from the User table.


Vulnerability 2: SQL Injection in Add Person

File: addPerson.php

Vulnerable Code:

$name = $_POST['name'];
$phone = $_POST['phone'];
$gender = $_POST['gender'];
$dob = $_POST['dob'];
$blood_group = $_POST['blood_group'];
$address = $_POST['address'];
$med_issues = $_POST['med_issues'];

$sql = "insert into Person (p_name,p_phone, p_dob, p_address, p_gender, p_blood_group, p_med_issues)
        values('$name', '$phone', '$dob', '$address', '$gender', '$blood_group', '$med_issues')";

All 7 POST parameters are unsanitized and directly concatenated into the INSERT query.


Vulnerability 3: SQL Injection in Add User

File: addUser.php

Vulnerable Code:

$super_pwd = $_POST['super_pwd'];
$usr_name = $_POST['usr_name'];

$sql = "select * from User where username = 'SuperAdmin' and password = '$super_pwd'";
// ...
$sql = "select * from User where username = '$usr_name'";

Both $super_pwd and $usr_name are unsanitized. An attacker can bypass the SuperAdmin password check.

Proof of Concept (SuperAdmin bypass):

POST /addUser.php

super_pwd=' OR '1'='1&usr_name=hacker&usr_pwd=hacker123&usr_cnfrm_pwd=hacker123

Result: New admin user created without knowing the SuperAdmin password.


Vulnerability 4: Plaintext Password Storage

File: login.php

Vulnerable Code:

$sql = "select * from user where username = '$username' and password = '$password'";

Passwords are stored and compared in plaintext (no hashing). If the database is compromised via SQL injection, all user passwords are immediately exposed.

The code comment itself acknowledges the issue:

// prevents little sql injection possibilities(not prevented fully)
$username = stripcslashes($_POST['user']);
$username = mysqli_real_escape_string($con, $username);
$password = stripcslashes($_POST['pass']);
$password = mysqli_real_escape_string($con, $password);

Note: stripcslashes() is not a security function and provides no protection.


Impact

Vulnerability Severity Impact
searchPerson.php SQLi Critical Full database extraction
addPerson.php SQLi Critical Data manipulation, DB extraction
addUser.php SQLi Critical Unauthorized admin account creation
Plaintext passwords High All user passwords exposed on breach

Remediation

1. Use Prepared Statements for all queries:

// VULNERABLE:
$pid = $_POST['pid'];
$sql = "select * from Person where p_id = '$pid'";

// SECURE:
$stmt = $con->prepare("SELECT * FROM Person WHERE p_id = ?");
$stmt->bind_param("s", $pid);
$stmt->execute();
$result = $stmt->get_result();

2. Hash passwords with bcrypt:

// When storing password:
$hashed = password_hash($password, PASSWORD_BCRYPT);

// When verifying:
if (password_verify($input_password, $stored_hash)) {
    // login success
}

CVE Disclosure

I am submitting a CVE request to MITRE for these vulnerabilities. This issue serves as the responsible disclosure record.

Timeline:

  • 2026-06-19: Discovered and reported to maintainer
  • 2026-09-19: Public disclosure (90-day window)

Please patch at your earliest convenience.


Reported by a security researcher following OWASP responsible disclosure guidelines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions