
Bilingual PoC and technical analysis of CVE-2026-105950, a Formwork CMS formaction URI sanitizer bypass enabling stored XSS, with reproducible vulnerable/patched Docker tests.
formaction URI sanitizer bypassEnglish | Português do Brasil
Proof of concept and technical analysis for a stored cross-site scripting vulnerability in Formwork CMS. The vulnerability was discovered and responsibly disclosed by Fernando Viana (capivara-research).
This repository is organized as a learning path: understand the bug, reproduce the sanitizer bypass safely, compare vulnerable and fixed behavior, and only then study the end-to-end impact.
| Item | Detail |
|---|---|
| Vulnerability | Stored XSS through a URI-sanitizer bypass |
| Weakness | CWE-79 |
| Attack surface | formaction on an allowed HTML element |
| Attacker | Authenticated page editor |
| Victim action | Click the crafted form control |
| Security boundary | HtmlSanitizer / DomSanitizer::sanitizeNodeAttribute() |
| Default exposure | Raw HTML in Markdown must be enabled |
| Upstream severity | Medium, CVSS 3.1 5.4 |
| Fix | Upgrade to 2.3.13 or later |
Official CVE record: CVE-2026-105950
Formwork's HTML sanitizer allowed the URI-valued formaction attribute but, in versions through 2.3.12, did not include it in the set of attributes subjected to URI-scheme validation. Consequently, an authenticated content editor could store a javascript: URI when raw HTML in Markdown fields was enabled. A victim clicking the crafted button caused attacker-controlled JavaScript to run in the Formwork origin.
| Product | Affected | Fixed |
|---|---|---|
getformwork/formwork | 2.0.0–2.3.12 | 2.3.13 |
pages.content.allowHtml is enabled (disabled by default).formaction appeared in HtmlReference::ALLOWED_ATTRIBUTES, but was absent from HtmlReference::URI_ATTRIBUTES. DomSanitizer::sanitizeNodeAttribute() only applied URI-scheme validation to attributes in the latter list, allowing the dangerous value to survive sanitization.
The distinction matters:
| List | Question answered | Vulnerable behavior |
|---|---|---|
ALLOWED_ATTRIBUTES | “May this attribute remain in the HTML?” | Yes, formaction was allowed. |
URI_ATTRIBUTES | “Must this value be checked as a URI?” | No, formaction was missing. |
| Allowed URI schemes | “Is the URI scheme safe?” | Never reached for formaction. |
formaction overrides the destination of the surrounding form for the specific submit control. Browsers also interpret the javascript: scheme as executable code. The sanitizer therefore had to validate both facts together; allowing the attribute without classifying it as URI-bearing created the bypass.
editor-controlled Markdown
-> Markdown parser with raw HTML enabled
-> HtmlSanitizer
-> formaction is allowed but not URI-validated
-> persistent page HTML
-> victim click
-> JavaScript executes in the site origin
<button
id="trigger"
formaction="javascript:void(document.getElementById('result').textContent='FORMWORK_XSS_EXECUTED')">
Trigger PoC
</button>
| Fragment | Purpose |
|---|---|
<button> | Creates the user-interactive form control. |
formaction= | Selects a submission target for this button. |
javascript: | Asks the browser to evaluate script instead of navigating to HTTP(S). |
void(...) | Prevents the expression result from replacing the document. |
textContent=... | Provides visible, non-exfiltrating proof of execution. |
The basic payload deliberately does not read cookies, make network requests, or alter server-side state.
Use only in a disposable, authorized lab. The payload changes text in the current page and does not exfiltrate data.
Save the contents of payloads/basic.md in a Formwork page on version 2.3.12 with raw HTML enabled, publish it, then click Trigger PoC.
Expected vulnerable result:
FORMWORK_XSS_EXECUTED
The standalone sanitizer reproducer can be run from an extracted Formwork tree:
php poc.php /path/to/formwork-2.3.12
Expected result on 2.3.12:
[VULNERABLE] javascript: URI survived sanitization
On 2.3.13 or newer, the dangerous attribute is removed and the script reports [PATCHED].
Docker is optional, but removes host dependency differences. The version is explicit so readers can compare the same test against both sides of the patch:
# Vulnerable control: expected to print [VULNERABLE] and exit 1
docker build --build-arg FORMWORK_VERSION=2.3.12 -t cve-2026-105950:vulnerable .
docker run --rm cve-2026-105950:vulnerable
# Patched control: expected to print [PATCHED] and exit 0
docker build --build-arg FORMWORK_VERSION=2.3.13 -t cve-2026-105950:patched .
docker run --rm cve-2026-105950:patched
Why test both versions? A single positive result can be caused by a flawed harness. Reusing the same input and runner against the first fixed release makes the upstream patch the only intended variable.
| Output | Exit code | Meaning |
|---|---|---|
[VULNERABLE] | 1 | The dangerous URI survived sanitization. |
[PATCHED] | 0 | The dangerous URI was removed or neutralized. |
| Usage/error message | 2 | The test environment is incomplete or the path is wrong. |
The same-origin XSS was previously validated in an isolated local installation with a real Chromium click. In that test, JavaScript used the administrator's authenticated browser session to fetch the user-management page, obtain its CSRF token, and submit Formwork's real new-user form. The application persisted a new account with the admin role even though the attacking editor did not have panel.users.create permission.
The laboratory-only payload is included at payloads/admin-chain.md. It creates a persistent administrator account and must never be used outside a disposable authorized environment.
HttpOnly do not stop this chainHttpOnly prevents JavaScript from directly reading the session cookie, but the browser still attaches it to same-origin requests.This does not mean those controls are ineffective; it shows why preventing same-origin script execution remains essential.