Reflected XSS vulnerability with full CSP bypass in Nextcloud installations using recommended bundle
A reflected XSS vulnerability exists in the richdocumentscode app's proxy.php, which fails to apply Nextcloud's CSP. An attacker can craft a URL that executes JavaScript in the victim's browser, leading to account takeover.
Originally disclosed on HackerOne
- Triaged in 20 hours
- Fixed in 2 months
- Disclosed after 2 months
Summary by the program
Security advisory at https://github.com/CollaboraOnline/online/security/advisories/GHSA-rqj2-2c2x-gjmm
The report
Summary:
The vulnerability report describes a reflected XSS vulnerability with full CSP bypass in Nextcloud installations using the recommended bundle. The vulnerability can be exploited to perform a trivial account takeover attack.
Steps To Reproduce:
Setup Nextcloud
Download the latest Nextcloud release from Docker and run it on port 80:
docker run -d -p 80:80 nextcloud:latest
Open http://localhost in your browser and enter your chosen admin username and password. On the next screen install all recommended apps. The standard "Nextcloud Office" here will result in installing the vulnerable richdocumentscode application (see HubBundle.php):

Exploitation
Open the following URL in your (or the victims) browser (the payload needs some extra encoding):
There is a full CSP bypass as the proxy.php from the default shipped "richdocumentscode" is not using a regular Nextcloud controller but plain PHP code:

Root cause
- Collabora Online is generating HTML documents using insecure string concatenation. (code pointer)
- The included
proxy.phpinside the "richdocumentscode" is not applying any of the default CSP policies of Nextcloud, as it is running on the same origin this can be used for a trivial account take over attack. (code pointer)
Impact
The vulnerability allows attackers to inject malicious code into web pages, which can be executed in the context of the victim's browser session. This means that an attacker can steal sensitive data, such as login credentials or personal information, or perform unauthorized actions on behalf of the victim, such as modifying or deleting data.
In this specific case, the vulnerability allows for a trivial account takeover attack. An attacker can exploit the vulnerability to inject code into the victim's browser session, allowing the attacker to take over the victim's account without their knowledge or consent. This can lead to unauthorized access to sensitive information and data, as well as the ability to perform actions on behalf of the victim.
Furthermore, the fact that the vulnerability bypasses the Content Security Policy (CSP) makes it more dangerous, as CSP is an important security mechanism used to prevent cross-site scripting attacks. By bypassing CSP, attackers can circumvent the security measures put in place by the web application and execute their malicious code.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the proxy.php script in the richdocumentscode app does not apply Nextcloud's default Content Security Policy and reflects user input without proper encoding.
Impact
An attacker could steal sensitive data or perform unauthorized actions, leading to a trivial account takeover, as the CSP bypass allows execution of malicious code.
What the attacker needed
Nextcloud with recommended apps installed; victim clicks a crafted link
How it was found
- Set up a Nextcloud instance using the official Docker image.
- Install all recommended apps, including Nextcloud Office (richdocumentscode).
- Open the crafted URL in a browser to trigger the XSS.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This is a cross-site scripting (XSS) bug where a malicious link can run code in a victim's browser. Because the vulnerable page lacks the usual security policy (CSP), the code can steal the victim's session and take over their account.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.