CVE-2022-3997 - MonikaBrzica scm SQL Injection Vulnerability in upis_u_bazu.php File

A critical vulnerability, classified as CVE-2022-3997, has been discovered in MonikaBrzica scm. This vulnerability affects an unknown functionality within the upis_u_bazu.php file. By exploiting this vulnerability, an attacker can manipulate the email, lozinka (password), ime (name), or id argument, which could lead to an SQL injection attack. The concerning factor is that this vulnerability may be remotely exploited by an attacker. Vulnerability Database (VDB) identifier VDB-213698 has been assigned to this vulnerability, which has been publicly disclosed and can be used maliciously.

Below is a code snippet that demonstrates the vulnerable part of upis_u_bazu.php

<?php
// ...
$email = $_POST['email'];
$lozinka = $_POST['lozinka'];
$ime = $_POST['ime'];
$id = $_POST['id'];
// ...
$sql = "INSERT INTO users (email, lozinka, ime, id) VALUES ('".$email."', '".$lozinka."', '".$ime."', '".$id."')";
// ...
?>

Exploit Details

By exploiting the vulnerability in the upis_u_bazu.php file, an attacker can perform SQL injection to compromise the sensitive information stored within the MonikaBrzica scm system. The lack of proper input validation on the email, lozinka, ime, and id arguments allows the attacker to inject malicious SQL queries into the system.

An example of a crafted malicious request would be as follows

POST /upis_u_bazu.php HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: ...

email=test@example.com', 'testpassword', 'testname', '1'); DROP TABLE users; --
&lozinka=testpassword
&ime=testname
&id=1

The following are the original references for this vulnerability

1. CVE Details
2. VDB-213698 Vulnerability Summary
3. MonikaBrzica scm - Official Product Page

Mitigation

As a temporary measure, it is recommended to sanitize user inputs for email, lozinka, ime, and id arguments within the upis_u_bazu.php file. This can be done using prepared statements or parameterized queries, which will help safeguard against the SQL injection vulnerability.

Example of using prepared statements in PHP (MySQLi)

<?php
// ...
$email = $_POST['email'];
$lozinka = $_POST['lozinka'];
$ime = $_POST['ime'];
$id = $_POST['id'];
// ...
$stmt = $conn->prepare("INSERT INTO users (email, lozinka, ime, id) VALUES (?, ?, ?, ?)");
$stmt->bind_param("sssi", $email, $lozinka, $ime, $id);
$stmt->execute();
// ...
?>

In conclusion, users of MonikaBrzica scm are advised to closely monitor any updates and patches for this vulnerability. In the meantime, implementing proper input validation and sanitization can help protect against the exploitation of this vulnerability. As the exploit for this vulnerability has been publicly disclosed, immediate action to secure the affected system is highly recommended.

Timeline

Published on: 11/15/2022 17:15:00 UTC
Last modified on: 11/22/2022 13:29:00 UTC