Skip to content

Instantly share code, notes, and snippets.

@th4s1s
Created January 2, 2025 18:43
Show Gist options
  • Save th4s1s/832bc65fadd7d49894f68a75f834c7f3 to your computer and use it in GitHub Desktop.
Save th4s1s/832bc65fadd7d49894f68a75f834c7f3 to your computer and use it in GitHub Desktop.

Online Shoe Store Using PHP has SQL Injection vulnerability via $id paremeter in /details2.php.

Project

https://code-projects.org/online-shoe-store-using-php-source-code/

Vulnerability

/details2.php - $id paremeter.

Description

The SQL Injection vulnerability exists in diretory /details2.php where this function query the product 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
  if(isset($_GET['id'])){
  $id = $_GET['id'];
  $query = $conn->query("SELECT * FROM product WHERE product_id = '$id' ");
  $row = $query->fetch_array();
?>

PoC

Enumerate all databases with sqlmap: image

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