Opened 7 weeks ago
Last modified 5 weeks ago
#65574 new defect (bug)
Unsafe usage of href attribute in wp-admin/js/common.js
| Reported by: | Rudloff | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Security | Version: | 7.0 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | administration |
Description
(This was initially reported privately as a security issue but it was considered not a core vulnerability.
I still think it is worth hardening so I am reporting it as a bug.)
wp-admin/js/common.js passes the value of the href attribute to $() without sanitizing it:
panel = $( link.attr('href') );
This is dangerous because $() accepts both a selector or raw HTML.
In theory, this could be exploited if an attacker can inject basic HTML in the admin. (But core does not provide a way to exploit this, it would need to be chained with an HTML injection vulnerability).
For example this payload would trigger the problem if it can be inserted anywhere in the admin:
<div class="contextual-help-tabs"><a href="<img src=x onerror=alert()>">Click me!</a></div>
Change History (1)
This ticket was mentioned in PR #12579 on WordPress/wordpress-develop by @sainathpoojary.
5 weeks ago
#1
- Keywords has-patch added
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
The contextual help tab click handler passed the raw
hrefattribute to jQuery's$(), which accepts both CSS selectors and raw HTML.Fix: Use
aria-controlswith the$( '#' + id )pattern, the same convention used elsewhere in the same file and across admin JS (privacy-tools.js,site-health.js).Trac ticket: #65574