usd-2022-0011 | Stored XSS in Foswiki

Advisory ID: usd-2022-0011
Product: Foswiki
Affected Version: 2.1.7
Vulnerability Type: CWE-79: Improper Neutralization of Input During Web Page Generation
Security Risk: High
Vendor URL:
Vendor acknowledged vulnerability: Yes
Vendor Status: Fixed
Advisory Status: closed
Last Update: 2022-06-09


Foswiki is a free and open-source wiki application that allows collaborative editing and content management. It is written in Perl programming language.
The application allows users to add attachments to wiki pages and add comments to the files. 

Proof of Concept

The application does not properly validate user supplied input. A wiki user can inject javascript code into the comment field of an attachment.
This payload is executed whenever a user visits the page where is attachment is attached to.To reproduce the vulnerability, the "filecomment" POST parameter is set as follows: "filecomment=<img onerror="alert(document.domain)" src="X"/>"

In the following, an exemplary HTTP request is given:

POST /bin/rest/TopicInteractionPlugin/changeproperties HTTP/1.1
Host: localhost
Cookie: [...]



The payload is triggered, when a user is visiting a page where the file is attached:


It is recommended to treat all input on the website as potentially dangerous. Hence, all output that is dynamically generated based on user-controlled data should be encoded according to its context. The majority of programming languages support standard procedures for encoding meta characters. For example, PHP has the built-in function htmlspecialchars().



  • 2022-01-05: Vulnerability identified by Christian Pöschl
  • 2022-04-27: First contact request made to the vendor
  • 2022-05-05: Second contact request made to the vendor
  • 2022-06-09: Share vulnerability details with vendor
  • 2022-06-09: Fix released by vendor



This security vulnerability was found by Christian Pöschl of usd AG.