Skip to content

Instantly share code, notes, and snippets.

@th4s1s
Created January 6, 2025 01:33
Show Gist options
  • Save th4s1s/782f2e19784f48bb80e4d658a49bd680 to your computer and use it in GitHub Desktop.
Save th4s1s/782f2e19784f48bb80e4d658a49bd680 to your computer and use it in GitHub Desktop.

Online Book Shop Using PHP has SQL Injection vulnerability via $id paremeter in /detail.php.

Project

https://code-projects.org/online-book-shop-using-php-source-code/

Vulnerability

/detail.php - $id paremeter.

Description

The SQL Injection vulnerability exists in diretory /detail.php where this function query the id parameter into the SQL statement without any restriction, validation or sanitization. An attacker could exploit this vulnerability to get unauthorized access to the server database, or even perform Remote Code Execution (RCE).

<?php session_start();
	require('includes/config.php');
	
	$id=$_GET['id'];
	
	$q="select * from book where b_id=$id";
	
	$res=mysqli_query($conn,$q) or die("Can't Execute Query..");
	$row=mysqli_fetch_assoc($res);
?>

PoC

Enumerate all databases with sqlmap: image

Get OS-shell and execute command: image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment