Opened 13 hours ago
#66870 new defect (bug)
Potential KSES bypass in Interactivity API
| Reported by: | Rudloff | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Interactivity API | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
(This was initially reported privately as a security issue but it was closed because it can't lead to XSS on modern browsers.)
The data attributes of the interactivity API can be used to bypass KSES and set attribute values that should not be allowed.
If this HTML is inserted on a page that loads the @wordpress/interactivity script:
<!-- Data URIs are not allowed by KSES. -->
<div data-wp-interactive="kses-test" data-wp-context="{"u":"data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg=="}"> <a data-wp-bind--href="context.u" href="#">clic</a></div>
<!-- This CSS is not allowed by safecss_filter_attr(). -->
<div data-wp-interactive="kses-test" data-wp-context="{"u":"color: rgb( 100, 100, 100 )"}"> <a data-wp-bind--style="context.u" href="#">clic</a></div>
It will be converted to this HTML:
<a data-wp-bind--href="context.u" href="data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==">clic</a>
<a data-wp-bind--style="context.u" href="#" style="color: rgb(100, 100, 100);">clic</a>
This could allow a user to insert attributes they should not be allowed to use.
The impact is limited because modern browsers don't allow top level navigation to data URIs or scripts in CSS.
Note:
See TracTickets
for help on using tickets.