Fix URL sanitization bypass through formaction attributes#21446
Fix URL sanitization bypass through formaction attributes#21446metsw24-max wants to merge 1 commit into
Conversation
|
practically, when would formaction be dynamic? |
|
It is rarer than dynamic href/action, agreed. The argument isn't frequency, it's parity with a control you already ship. Glimmer already sanitizes dynamic A realistic dynamic case: a form whose submit target comes from server/config/CMS data rather than a literal — e.g. a configurable or multi-tenant form: where So I would frame this as closing a gap in the existing action sanitization rather than a brand-new exploit |
|
This work has been pulled in to #21442 thank you! |
This patch fixes a URL sanitization bypass involving the HTML
formactionattribute.The sanitizer currently protects URL-bearing attributes such as
actionfrom dangerous schemes includingjavascript:andvbscript:. However,formactionwas not included in the protected attribute set.Because
formactionoverrides a form'sactionduring submission, attacker-controlled values could bypass existing URL sanitization and execute script when a submit button is activated.Root Cause
The sanitizer denylist covered:
actionon<form>but omitted
formaction, even though it serves the same navigation purpose for submit controls.As a result, templates such as:
could emit dangerous URLs unchanged when
userInputcontained ajavascript:orvbscript:URL.Changes
formactionto the protected URL attribute list.BUTTONandINPUTto the protected element set since they are the only elements that honorformaction.formactionvalues.Security Impact
Before this change, a malicious value supplied to
formactioncould bypass the existing URL sanitization logic and execute script when a submit control was activated.After this change, dangerous schemes are sanitized using the same mechanism already applied to
action, ensuring consistent protection across form submission entry points.Verification
Verified against the transpiled sanitizer implementation.
Before
Dangerous URL emitted unchanged.
After
Dangerous URL is sanitized and blocked.
Regression testing confirmed no behavioral changes for existing protected attributes and elements, including:
<form action><a href><embed src>with supporteddata:URLsThe added integration tests validate the vulnerable path and prevent future regressions.