Closed bobbingwide closed 4 months ago
I reproduced the example in a shortcode example for [bw_button]
and have implemented a fix in libs/bobbfunc.php
The vulnerability is associated with not dealing correctly with double quotes in the shortcode attribute content. With the specific example
[bw_link class=' " onmouseover=alert(5) ']
the code was generating another attribute after the class
attribute.
As you can see this contains JavaScript, which is run when the post has been published and viewed and the link hovered over.
Note: The JavaScript in the example is benign.
Rather than implement sanitization when the post is created - to trap an unscrupulous contributor -
we ensure that each attribute is escaped using esc_attr()
.
We can't change the kv()
function, since it may be used legitimately, so we change the relevant calls to kv()
in retlink()
$link .= kv( "class", esc_attr( $class ) );
$link .= kv( "id", esc_attr( $id ) );
the effect of esc_attr()
on " onmouseover=alert(5)
is to convert the double quote to an escaped character.
" onmouseover=alert(5)
These will be invalid CSS class names, but more importantly, the onmouseover
attribute is disabled.
Fixed in oik v4.12.0 and oik-bwtrace v3.4.7. See https://www.oik-plugins.com/shortcode_example/bw_button-security-fix-2/
Vulnerability Title: oik <= 4.10.3 - Authenticated (Contributor+) Stored Cross-Site Scripting via bw_button Shortcode CVE ID: CVE-2024-6391 CVSS Severity Score: 6.4 (Medium) CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:L/A:N Organization: Wordfence Vulnerability Researcher(s): Rafshanzani Suhada
Description The oik plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the plugin's bw_button shortcode in all versions up to, and including, 4.10.3 due to insufficient input sanitization and output escaping on user supplied attributes. This makes it possible for authenticated attackers, with contributor-level access and above, to inject arbitrary web scripts in pages that will execute whenever a user accesses an injected page.
Additional notes
While trying to reproduce a responsibly disclosed issue I encountered a Deprecated message.