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

[Warning] RCE in WebsiteGuide v0.2 #12

Open
Leeyangee opened this issue Jul 1, 2023 · 0 comments
Open

[Warning] RCE in WebsiteGuide v0.2 #12

Leeyangee opened this issue Jul 1, 2023 · 0 comments

Comments

@Leeyangee
Copy link

Leeyangee commented Jul 1, 2023

Vulnerability Product:WebsiteGuide v0.2
Vulnerability version: 0.2
Vulnerability type: Remote Command Execute
Vulnerability Details:
Vulnerability location: Image Upload

the variable "save_path" in /websiteapp/views.py -> IconViewSet.post method, does not check the name of file user upload ,
causes "../../" such path is available
and does not check binary of the image
causes user could upload image, pycode, html and stuff
image
Insecure image upload could cover the original code , causes Remote Command Execute

payload : https://github.com/Leeyangee/leeya_bug/blob/main/..1..1views.py
the payload is original code at /websiteapp/views.py but add a simple function os.system() to verify rce
(this is just a simple payload , It downloading index.html from http://www.bing.com , in order to verifying the vulnerability)

Firstly , Add a website in "分组管理"
image

After built , visit http://localhost:8000/admin/website
click navigator "网址管理", and click "替换图标"
image
and click "上传图标" choose the payload (or the image you wanna upload in normal situation)
finally click "确定" to upload

in the whole period of uploading , listening network

After upload the payload , you are able to observe the HTTP request that you just uploaded in burpsuite
Send it to the repeater and replace filename ..1..1views.py to ../../views.py
image
image

and finally , click Send , send the payload you had just modified
then you can find that the original code /websiteapp/views.py has changed from
image
to
image
that means you just changed the pycode and could causes RCE vulnerability

just visit the website page to trigger the api /api/icon, you can find the index.html downloaded from http://www.bing.com at the path /websiteapp/
image

proved RCE

by above method, you can upload your file to every file in website or cover every file in website

discovered by leeya_bug

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