Cross-site Scripting in btcpayserver/btcpayserver
Description
Cross-site Scripting in GitHub repository btcpayserver/btcpayserver prior to 1.8.3.
Affected products
1- Range: unspecified
Patches
0No patches discovered yet.
Vulnerability mechanics
Root cause
"Default Content Security Policy included 'unsafe-eval' in script-src, allowing arbitrary JavaScript execution via eval() on pages that did not require it."
Attack vector
An attacker who can inject a malicious script into a BTCPayServer page (e.g., via a stored XSS in the Crowdfund description field) would previously have been able to execute arbitrary JavaScript because the default Content Security Policy included `'unsafe-eval'`, which allows `eval()` and similar dynamic code execution. The CSP directive `script-src 'self' 'unsafe-eval'` [ref_id=1] meant that even if the attacker's payload was loaded from the same origin, they could use `eval()` to bypass other restrictions. The vulnerability is triggered by an attacker supplying crafted input that is later rendered in a page that still has `'unsafe-eval'` enabled (such as the Crowdfund public page, which calls `Csp.UnsafeEval()` [ref_id=1]).
Affected code
The patch modifies `BTCPayServer/Security/ContentSecurityPolicy.cs` (the `ContentSecurityPolicyAttribute` constructor) and `BTCPayServer.Abstractions/Security/ContentSecurityPolicy.cs` (adding the `UnsafeEval()` method). Several Razor views are also changed: the Crowdfund public view, the Crowdfund update page, the Pay Button page, the Point of Sale public layout and update page, and the main menu layout. The core change is removing `'unsafe-eval'` from the default `script-src` CSP directive and instead conditionally adding it only on pages that require Vue.js.
What the fix does
The patch removes `'unsafe-eval'` from the default `script-src` CSP directive in `ContentSecurityPolicyAttribute` [ref_id=1], changing it from `"'self' 'unsafe-eval'"` to `"'self'"`. A new `UnsafeEval()` method is added to `ContentSecurityPolicy` so that pages which genuinely need Vue.js (Crowdfund public view, Crowdfund update, Pay Button, Point of Sale pages) can opt-in to `'unsafe-eval'` [ref_id=1]. Additionally, the Crowdfund public view removes the `@Safe.Raw(Model.Description)` server-rendered description (which could introduce XSS) and relies solely on the client-side Vue binding `v-html="srvModel.description"`. The `v-pre` attribute is added to several static HTML elements to prevent Vue from processing them, reducing the attack surface.
Preconditions
- inputThe attacker must be able to inject malicious content (e.g., via the Crowdfund description field or another stored input) that gets rendered on a BTCPayServer page.
- configThe target page must be one that still has 'unsafe-eval' enabled (Crowdfund public view, Crowdfund update, Pay Button, or Point of Sale pages).
Generated on May 24, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
2News mentions
0No linked articles in our index yet.