Page MenuHomePhabricator

CVE-2026-103445: Stored XSS through PageForms #autoedit redirect links
Closed, ResolvedPublicSecurity

Description

From a report to security@

# Stored XSS through PageForms `#autoedit` redirect links

## Summary

PageForms accepts the `redirect` parameter of the `#autoedit` parser
function and places it directly into the `href` attribute of a
generated anchor. A user who can edit an ordinary page can therefore
publish a `javascript:` URL. A visitor who clicks the generated
auto-edit link executes attacker-controlled JavaScript in the wiki
origin.

## Affected code

`extensions/PageForms/includes/parserfunctions/PFAutoEdit.php` assigns
the parser-function `redirect` value to `$linkToPage` and passes it to
`Html::rawElement( 'a', ... )` without URL-scheme validation. The same
value is used for the generated link branch at approximately lines
143–168 in the audited checkout.

## Security impact

Stored same-origin XSS. The attacker needs ordinary page-edit
permission. The victim only needs to view the page and click the
rendered auto-edit link. JavaScript executes with the wiki origin and
can act as the victim, subject to the site’s existing browser
controls.

## Reproduction

1. As an ordinary editor, save a page containing the PoC in `poc.md`.
2. View the page while logged in to the local MediaWiki instance.
3. Click `Trigger`.
4. The page body receives the `data-pf-autoedit` attribute, proving
JavaScript execution from the generated link.

## Expected behavior

`redirect` should be restricted to a safe internal destination or
emitted through a URL sanitizer that rejects executable schemes. If an
external destination is intended, it should be validated and handled
as an explicit external URL rather than copied into a raw anchor.


===== PROOF OF CONCEPT =====

# PageForms `#autoedit` redirect XSS PoC

Save this wikitext in an ordinary editable page:

```text
{{#autoedit:link text=Trigger|link type=link|target=Main
Page|redirect=javascript:document.body.setAttribute('data-pf-autoedit','PF_AUTOEDIT_REDIRECT_TEST')}}

When a visitor clicks Trigger, the generated anchor navigates to the
JavaScript URL and sets:

text
data-pf-autoedit=PF_AUTOEDIT_REDIRECT_TEST

The local validation used the same payload through a real NormalUser
edit and a Chromium mouse click.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript


(Please either apply properly using git am or just ask me to upload it to gerrit, thanks)

Please upload it to Gerrit, thanks!

Change #1329683 had a related patch set uploaded (by SomeRandomDeveloper; author: SomeRandomDeveloper):

[mediawiki/extensions/PageForms@master] SECURITY: Sanitize autoedit redirect URLs

https://gerrit.wikimedia.org/r/1329683

Change #1329683 merged by jenkins-bot:

[mediawiki/extensions/PageForms@master] SECURITY: Sanitize autoedit redirect URLs

https://gerrit.wikimedia.org/r/1329683

sbassett triaged this task as Low priority.
sbassett removed a project: Patch-For-Review.

Change #1346126 had a related patch set uploaded (by SBassett; author: SomeRandomDeveloper):

[mediawiki/extensions/PageForms@REL1_46] SECURITY: Sanitize autoedit redirect URLs

https://gerrit.wikimedia.org/r/1346126

Change #1346127 had a related patch set uploaded (by SBassett; author: SomeRandomDeveloper):

[mediawiki/extensions/PageForms@REL1_45] SECURITY: Sanitize autoedit redirect URLs

https://gerrit.wikimedia.org/r/1346127

Change #1346131 had a related patch set uploaded (by SBassett; author: SomeRandomDeveloper):

[mediawiki/extensions/PageForms@REL1_43] SECURITY: Sanitize autoedit redirect URLs

https://gerrit.wikimedia.org/r/1346131

Change #1346127 merged by jenkins-bot:

[mediawiki/extensions/PageForms@REL1_45] SECURITY: Sanitize autoedit redirect URLs

https://gerrit.wikimedia.org/r/1346127

Change #1346131 merged by jenkins-bot:

[mediawiki/extensions/PageForms@REL1_43] SECURITY: Sanitize autoedit redirect URLs

https://gerrit.wikimedia.org/r/1346131

Change #1346126 merged by jenkins-bot:

[mediawiki/extensions/PageForms@REL1_46] SECURITY: Sanitize autoedit redirect URLs

https://gerrit.wikimedia.org/r/1346126

sbassett renamed this task from Stored XSS through PageForms #autoedit redirect links to CVE-2026-103445: Stored XSS through PageForms #autoedit redirect links.Sep 30 2026, 5:05 PM
sbassett changed Author Affiliation from N/A to Other (Please specify in description).
sbassett removed a project: Patch-For-Review.
sbassett changed the visibility from "Custom Policy" to "Public (No Login Required)".
sbassett changed the edit policy from "Custom Policy" to "All Users".
sbassett changed Risk Rating from N/A to Low.

@Yaron_Koren any idea on when there will be a new tag?

@YvarRavy - sorry for the delay. This fix is already contained in version 6.0.11 of Page Forms, no?

@Yaron_Koren Excuses. i see it now somehow i've missed this. thanks for the reply