WordPress Plugin Admin Bar & Dashboard Access Control Version: 1.2.8 - "Dashboard Redirect" field Stored Cross-Site Scripting (XSS)

Exploit Author: Rachit Arora Analysis Author: www.bubbleslearn.ir Category: WebApps Language: JavaScript Published Date: 2024-02-28
# Exploit Title:  WordPress Plugin Admin Bar & Dashboard Access Control Version: 1.2.8 - "Dashboard Redirect" field  Stored Cross-Site Scripting (XSS)
# Google Dork: NA
# Date: 28/10/2023
# Exploit Author: Rachit Arora
# Vendor Homepage: 
# Software Link:  https://wordpress.org/plugins/admin-bar-dashboard-control/
# Version: 1.2.8
# Category: Web Application
# Tested on: Windows
# CVE : 2023-47184


1. Install WordPress (latest)

2. Install and activate Admin Bar & Dashboard Access Control.

3. Navigate to "Admin Bar & Dash"  >> Under Dashboard Access and in the "Dashboard Redirect" enter the payload into the input field.

"onfocusin=alert``+autofocus>
"onfocusin=alert`document.domain`+autofocus>

4. You will observe that the payload successfully got stored  and when you are triggering the same functionality in that time JavaScript payload is executing successfully and we are getting a pop-up.


WordPress Plugin Admin Bar & Dashboard Access Control: Stored XSS Vulnerability in Version 1.2.8

Security vulnerabilities in WordPress plugins can have far-reaching consequences, especially when they affect core administrative functions. One such critical flaw was recently discovered in the Admin Bar & Dashboard Access Control plugin, specifically in version 1.2.8. This vulnerability, identified as CVE-2023-47184, exposes users to stored Cross-Site Scripting (XSS) attacks through the Dashboard Redirect field. This article explores the nature of the exploit, its implications, and best practices for mitigation.

Understanding Stored XSS in WordPress Plugins

Stored XSS occurs when malicious scripts are permanently saved on a server—typically within a database—then executed whenever the data is retrieved and rendered. Unlike reflected XSS, which requires user interaction to trigger, stored XSS persists and can affect multiple users over time.

In the context of WordPress, plugins that manage admin access, redirect logic, or user preferences often store data in the database. If input validation and sanitization are missing, attackers can inject malicious JavaScript code into fields like Dashboard Redirect, which is then executed in the browser when the page loads.

Exploit Details: CVE-2023-47184

According to the exploit author, Rachit Arora, the vulnerability exists in the Dashboard Redirect field within the plugin’s admin interface. This field allows administrators to define a custom URL for redirecting users after login or access. However, the plugin fails to sanitize or escape user input, enabling the storage of malicious scripts.


onfocusin=alert``+autofocus

This payload exploits the onfocusin event handler—though not widely supported—by triggering a JavaScript alert when the input field receives focus. The use of backticks (`) and the autofocus attribute ensures the script executes immediately upon rendering.


onfocusin=alert`document.domain`+autofocus

A more advanced variant uses document.domain to retrieve the current domain, which can be leveraged in further attacks, such as cookie theft or session hijacking.

Attack Scenario and Impact

Here’s how the exploit unfolds:

  • Admin user installs and activates the plugin.
  • Navigates to Admin Bar & Dash → Dashboard Access → Dashboard Redirect.
  • Enters the malicious payload into the redirect field.
  • Save the configuration.
  • Upon accessing the dashboard (or any page that triggers the redirect), the browser executes the script.

Result: A pop-up alert appears, confirming the successful execution of the XSS payload. This demonstrates that the script is not only stored but also dynamically executed.

From a security perspective, this is dangerous because:

  • Attackers can steal session cookies.
  • Inject phishing forms.
  • Redirect users to malicious sites.
  • Compromise the entire admin environment.

Why This Plugin Is Vulnerable

The root cause lies in the absence of proper input sanitization. WordPress provides built-in functions like esc_attr(), esc_html(), and wp_kses() to prevent XSS. However, the plugin developer failed to use these functions when saving or displaying the Dashboard Redirect field.

For example, if the plugin code includes:


$redirect_url = $_POST['dashboard_redirect'];
update_option('admin_bar_dashboard_redirect', $redirect_url);

Without sanitization, this directly stores user input into the database. When the redirect URL is later output in HTML, it becomes a vector for XSS.

Corrected Code Example

To prevent this vulnerability, developers must sanitize input before storage and output. Here’s the recommended fix:


$redirect_url = sanitize_text_field($_POST['dashboard_redirect']);
update_option('admin_bar_dashboard_redirect', $redirect_url);

Additionally, when rendering the redirect URL in the frontend or admin interface:


echo esc_attr(get_option('admin_bar_dashboard_redirect'));

This ensures that any potentially harmful characters are escaped, preventing script execution.

Security Best Practices for WordPress Plugin Developers

Developers should follow these guidelines to avoid similar vulnerabilities:

  • Always sanitize user input using WordPress-sanitization functions.
  • Validate data types—ensure URLs are properly formatted.
  • Use wp_kses() for HTML content when allowed.
  • Escape output with esc_html(), esc_attr(), or esc_url().
  • Implement Content Security Policy (CSP) headers to block unauthorized scripts.

Recommendations for WordPress Site Administrators

Site owners should take immediate action:

  • Update the plugin to the latest version, if a patch is available.
  • Disable or remove the plugin if no update is forthcoming.
  • Monitor logs for unexpected redirects or script behavior.
  • Use security plugins like Wordfence or Sucuri to detect malicious code.
  • Regularly audit plugins for known vulnerabilities.

Conclusion

The CVE-2023-47184 vulnerability in Admin Bar & Dashboard Access Control version 1.2.8 serves as a stark reminder of the importance of input validation and output escaping in WordPress plugin development. Stored XSS attacks can lead to full compromise of admin panels and user data.

Security is not a one-time task—it requires continuous vigilance. Developers must adopt secure coding practices, while administrators must stay informed and proactive in managing their plugin ecosystem.