Security researchers from Patchstack have discovered that the ‘Advanced Custom Fields’ and ‘Advanced Custom Fields Pro’ WordPress plugins, with a total of 2 million active installs, are vulnerable to cross-site scripting (XSS) attacks.
The reflected XSS vulnerability, which has been assigned the identifier CVE-2023-30777, could enable an unauthenticated attacker to steal sensitive information and elevate their privileges on an impacted WordPress site. This vulnerability could be triggered on a default installation or configuration of the plugin and could only be triggered from logged-in users with access to the plugin.
The vulnerability in the plugins was identified on May 2, 2023, and was discovered by Patchstack’s researcher Rafie Muhammad. The vulnerability was associated with the ‘admin_body_class’ function handler, which failed to properly sanitize the output value of a hook that filters the CSS classes for the main body tag in the admin area of WordPress sites.
The attacker can leverage an unsafe direct code concatenation on the plugin’s code to add harmful code (DOM XSS payloads) in its components, which will pass to the final product, a class string.
The plugin’s developer was notified of the issue upon Patchstack’s discovery and subsequently released a security update on May 4, 2023, in version 6.1.6. The flaw was fixed by implementing a new function named ‘esc_attr’ that properly sanitizes the output value of the admin_body_class hook, hence, preventing the XSS. All users of ‘Advanced Custom Fields’ and ‘Advanced Custom Fields Pro’ are advised to upgrade to version 6.1.6 or later as soon as possible.
However, based on WordPress.org download stats, 72.1% of the plugin’s users are still using versions below 6.1, which are vulnerable to XSS and other known flaws.
XSS vulnerabilities are a common security risk for websites and can result in data theft, cookie theft, session hijacking, and other malicious activities. Website owners are advised to keep their plugins up to date and to implement other security measures, such as web application firewalls, to help mitigate XSS attacks.
Additionally, users are encouraged to practice safe browsing habits and to be cautious when clicking on links or downloading files from unknown sources.