CVE-2023-6821
Executive Summary
CVE-2023-6821 is a directory listing vulnerability in the Error Log Viewer by BestWebSoft WordPress plugin, affecting versions prior to 1.1.3. This flaw allows unauthenticated remote attackers to list and read PHP error log files stored on the server, potentially exposing sensitive information such as database credentials, file paths, and internal server configurations. The vulnerability is classified as a CWE-548: Exposure of Information Through Directory Listing and is trivial to exploit, requiring no authentication or special privileges. Given the widespread use of WordPress and the plugin's purpose (viewing error logs), this issue poses a significant information disclosure risk, especially in shared hosting environments.
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 a WordPress plugin distributed via the official WordPress plugin repository. Users who installed the plugin from the WordPress dashboard or via direct download are affected. The plugin is not distributed via NPM, PyPI, Go, or Ruby ecosystems. The supply chain risk is limited to the plugin's update mechanism; users must manually update or rely on WordPress's automatic update feature to receive the patched version (1.1.3).
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: 5.3 (Medium)
- Attack Vector: Network (AV:N) – Exploitable remotely.
- Attack Complexity: Low (AC:L) – No special conditions required.
- Privileges Required: None (PR:N) – Unauthenticated access.
- User Interaction: None (UI:N) – No user action needed.
- Scope: Unchanged (S:U) – Vulnerability does not affect other components.
- Confidentiality Impact: Low (C:L) – Limited information disclosure (log files).
- Integrity Impact: None (I:N) – No data modification.
- Availability Impact: None (A:N) – No denial of service.
Threat Level: Medium. While the CVSS score is moderate, the ease of exploitation and potential for sensitive data leakage (e.g., database credentials, stack traces) elevates the real-world risk, especially in production environments.
Deep Dive & Mechanics
The Error Log Viewer by BestWebSoft plugin provides a WordPress admin interface to view PHP error logs. The vulnerability stems from the plugin's failure to restrict directory listing on the log storage directory. By default, the plugin stores logs in a publicly accessible directory (e.g., /wp-content/uploads/error-log-viewer/). Without proper access controls, an unauthenticated attacker can directly browse to this directory and list all files, including PHP error logs.
Root Cause: The plugin does not implement an index.php file or .htaccess rules to prevent directory listing. Additionally, it fails to verify user capabilities before serving log files.
Attack Flow:
- Attacker identifies a WordPress site running the vulnerable plugin.
- Attacker navigates to
/wp-content/uploads/error-log-viewer/(or similar path). - The web server returns a directory listing showing all log files (e.g.,
error.log,debug.log). - Attacker clicks on a log file to download or view its contents.
- Log files may contain sensitive data such as database connection strings, API keys, file paths, or user information.
Affected Component: The plugin's file serving mechanism does not enforce authentication or authorization checks.
Vulnerable vs. Patched Code
Vulnerable Code (version < 1.1.3): The plugin likely used a simple file read function without access control. For example:
// Vulnerable: No capability check
function elv_read_log() {
$log_file = $_GET['file'];
if (file_exists($log_file)) {
readfile($log_file);
}
}
Patched Code (version 1.1.3):
The patched version adds a capability check and restricts access to authenticated users with appropriate roles (e.g., manage_options).
// Patched: Added capability check
function elv_read_log() {
if (!current_user_can('manage_options')) {
wp_die('Unauthorized');
}
$log_file = $_GET['file'];
// Additional sanitization and path validation
$allowed_dir = WP_CONTENT_DIR . '/uploads/error-log-viewer/';
$real_path = realpath($log_file);
if (strpos($real_path, $allowed_dir) !== 0) {
wp_die('Invalid file');
}
if (file_exists($log_file)) {
readfile($log_file);
}
}
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A WordPress site with the Error Log Viewer plugin (version < 1.1.3) installed and activated.
- The plugin's log directory must be accessible via the web.
Exploitation Steps:
- Identify the plugin's log directory: Common paths include
/wp-content/uploads/error-log-viewer/or/wp-content/plugins/error-log-viewer/logs/. - Access the directory listing: Use a web browser or curl:
curl -v http://target.com/wp-content/uploads/error-log-viewer/ - List files: The server will return an HTML directory listing. Look for files like
error.log,debug.log, orphp_errors.log. - Download a log file: Click on a file or use curl:
curl -O http://target.com/wp-content/uploads/error-log-viewer/error.log - Extract sensitive information: Search for patterns like
password,DB_USER,DB_PASSWORD,API_KEY, or stack traces.
Example Output:
[01-Jan-2023 12:00:00 UTC] PHP Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'db_user'@'localhost' (using password: SuperSecret123) in /var/www/html/wp-includes/wp-db.php:123
Blue Team (Detection & Hardening)
Detection:
- Monitor web server logs for requests to
/wp-content/uploads/error-log-viewer/or similar paths. - Look for HTTP 200 responses with directory listings (e.g.,
Index of /wp-content/uploads/error-log-viewer). - Alert on unusual file downloads from the plugin's directory.
Hardening:
- Immediate: Update the plugin to version 1.1.3 or later.
- Mitigation (if patching is delayed):
- Add an
index.phpfile to the log directory to prevent directory listing:<?php // Silence is golden. - Add
.htaccessrules to deny access:<FilesMatch "\.(log)$"> Order allow,deny Deny from all </FilesMatch> Options -Indexes - Move the log directory outside the web root (if possible).
- Add an
- Monitoring: Implement file integrity monitoring (FIM) on the log directory.
Indicators of Compromise (IOCs)
- Network IOCs:
- HTTP GET requests to
/wp-content/uploads/error-log-viewer/or/wp-content/plugins/error-log-viewer/logs/. - User-Agent strings indicating automated scanning (e.g.,
curl,python-requests,Go-http-client).
- HTTP GET requests to
- File IOCs:
- Presence of log files in the plugin's directory (e.g.,
error.log,debug.log). - Unauthorized access to log files (check file access times).
- Presence of log files in the plugin's directory (e.g.,
- Behavioral IOCs:
- Multiple requests to the same directory from a single IP.
- Downloading of
.logfiles from the plugin's directory.
Detection Engineering
YARA Rule
rule CVE_2023_6821_Error_Log_Viewer_Directory_Listing {
meta:
description = "Detects directory listing of Error Log Viewer plugin log directory"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2023-6821"
hash = "d41d8cd98f00b204e9800998ecf8427e"
strings:
$dir_listing = "Index of /wp-content/uploads/error-log-viewer"
$log_file = ".log"
condition:
$dir_listing or (uint16(0) == 0x4D5A and $log_file)
}
Sigma Rule
title: CVE-2023-6821 Error Log Viewer Directory Listing
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects attempts to list or access log files from the Error Log Viewer plugin
author: Valters IT
date: 2025-04-10
references:
- https://nvd.nist.gov/vuln/detail/CVE-2023-6821
logsource:
category: webserver
product: apache
service: access_log
detection:
selection:
cs-uri-stem:
- "/wp-content/uploads/error-log-viewer/*"
- "/wp-content/plugins/error-log-viewer/logs/*"
sc-status: 200
condition: selection
falsepositives:
- Legitimate admin access (if authenticated)
level: medium
tags:
- attack.t1083
- cve.2023.6821
Suricata Rule
alert http any any -> $EXTERNAL_NET any (msg:"CVE-2023-6821 Error Log Viewer Directory Listing Attempt"; flow:to_server,established; content:"GET"; http_method; content:"/wp-content/uploads/error-log-viewer/"; http_uri; nocase; content:"200"; http_server_body; pcre:"/Index of \/wp-content\/uploads\/error-log-viewer/"; classtype:attempted-recon; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Update the plugin: Upgrade to version 1.1.3 or later from the WordPress plugin repository.
- Verify update: Check that the plugin version is >= 1.1.3 in the WordPress admin dashboard.
Long-Term Mitigations:
- Web Application Firewall (WAF): Block requests to
/wp-content/uploads/error-log-viewer/from unauthenticated users. - File Permissions: Ensure log directories have restrictive permissions (e.g., 750) and are owned by the web server user.
- Disable Directory Listing: Add
Options -Indexesto the Apache configuration or use equivalent Nginx directives. - Monitor Plugin Updates: Subscribe to security advisories for WordPress plugins.
Workaround (if patching is not possible):
- Manually add an
index.phpfile to the log directory with the following content:<?php // Silence is golden. - Add
.htaccessfile with:Order deny,allow Deny from all
Valters IT – Securing digital frontiers.
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.