Page MenuHomePhabricator

CVE-2023-37251: GoogleAnalyticsMetrics extension - XSS
Closed, ResolvedPublicSecurity

Description

#googleanalyticstrackurl parser function in extension does not properly escape js in onclick handler and does not prevent using javascript urls.

Additionally it does not register external links in the parser (important for antispam).

Event Timeline

			return '<strong class="error">' .
				wfMessage( 'googleanalyticsmetrics-invalid-url' )->text() .
				'</strong>';

Doesn’t this need to be ->parse() or ->escaped() to prevent HTML injection from the googleanalyticsmetrics-invalid-url message?

			return '<strong class="error">' .
				wfMessage( 'googleanalyticsmetrics-invalid-url' )->text() .
				'</strong>';

Doesn’t this need to be ->parse() or ->escaped() to prevent HTML injection from the googleanalyticsmetrics-invalid-url message?

No, because parser functions (unlike tag extensions) return wikitext if you return a string from them. So the return value is interpreted as being wikitext and does all normal wikitext escaping.

@Mstyles Can this be added to next extension security supplement?

sbassett assigned this task to Bawolff.
sbassett triaged this task as Medium priority.
sbassett changed Author Affiliation from Other (Please specify in description) to Wikimedia Communities.
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 Medium.
Mstyles renamed this task from GoogleAnalyticsMetrics extension - XSS to CVE-2023-37251: GoogleAnalyticsMetrics extension - XSS.Jun 30 2023, 5:47 PM