Skip to content

Instantly share code, notes, and snippets.

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

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

Project

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

Vulnerability

/booklist.php - $subcatid paremeter.

Description

The SQL Injection vulnerability exists in diretory /booklist.php where this function query the subcatid 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).

	$cat=$_GET['subcatid'];
	
	$totalq="select count(*) \"total\" from book where b_subcat='$cat'";
	
	$totalres=mysqli_query($conn,$totalq) or die("Can't Execute Query...");
	$totalrow=mysqli_fetch_assoc($totalres);

PoC

Enumerate all databases with sqlmap: image

Get OS-shell and execute command: image

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