Skip to content

Instantly share code, notes, and snippets.

@th4s1s
Last active January 6, 2025 08:39
Show Gist options
  • Save th4s1s/b30a06e83b98ddcbc69b9038c145d8cd to your computer and use it in GitHub Desktop.
Save th4s1s/b30a06e83b98ddcbc69b9038c145d8cd to your computer and use it in GitHub Desktop.

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

Project

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

Vulnerability

/search_result.php - $s paremeter.

Description

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

  require('includes/config.php');
  session_start();

  $search=$_GET['s'];
  $query="select *from book where b_nm like '%$search%'";

  $res=mysqli_query($conn,$query) or die("Can't Execute Query...");
?>

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