CVE-2024-7420·PHP vulnerability
The Insert PHP Code Snippet plugin for WordPress is vulnerable to Cross-Site Request Forgery in all versions up to, and including, 1.3.6. This is due to missing or incorrect nonce validation in the /admin/snippets.php file. This makes it possible for unauthenticated attackers to activate/deactivate and delete code snippets via a forged request granted they can trick a site administrator into performing an action such as clicking on a link. CVE-2024-43275 appears to be a duplicate of this issue.
- Severity
- medium
- Software
- PHP
- Fixed in
- 1.3.7
- Published
- 2024-08-15
Affected versions
Until: 1.3.7
Fixed in: 1.3.7
How to fix this CVE
Update the Insert PHP Code Snippet WordPress plugin to version 1.3.7 or later to address a Cross-Site Request Forgery (CSRF) vulnerability in the admin snippets management interface. The vulnerability allows attackers to manipulate PHP code snippets through forged requests if a site administrator can be socially engineered into clicking a malicious link. Ensure your WordPress installation and all plugins are kept current as part of routine security maintenance.
sudo dnf update php php-common php-cli php-fpm -yDefensia detects this vulnerability
What an exploitation attempt looks like
Sample log line indicative of exploitation attempts:
POST|GET requests to /wp-admin/admin.php\?page=insert-php-code-snippet.*action=(activate|deactivate|delete) without corresponding nonce parameters or with mismatched nonce tokens in the request headers or POST bodyWAF mitigation (if patching is not yet possible)
Add this rule to your WAF to block exploitation attempts while you schedule the patch.
Implement a Web Application Firewall rule to require valid WordPress nonce tokens for all POST/GET requests targeting /wp-admin/admin.php?page=insert-php-code-snippet or /admin/snippets.php. Block requests lacking the _wpnonce parameter or containing invalid nonce values. Additionally, restrict access to WordPress admin endpoints to known administrator IP ranges where feasible.How to check if you are affected
- Step 1: Check the installed version of the Insert PHP Code Snippet plugin using WordPress admin dashboard: Navigate to Plugins > Installed Plugins and verify the version number displayed for 'Insert PHP Code Snippet'
- Step 2: Access your WordPress database and query the wp_options table for plugin active status: mysql -u root -p wordpress_db -e "SELECT option_value FROM wp_options WHERE option_name='active_plugins';" to confirm the plugin is active
- Step 3: Review WordPress admin logs and HTTP access logs for suspicious POST/GET requests to /wp-admin/admin.php or /admin/snippets.php originating from unknown sources or containing snippet manipulation parameters
- Step 4: Verify the fix by confirming the plugin version is 1.3.7 or higher and inspect the /wp-content/plugins/insert-php-code-snippet/admin/snippets.php file for nonce validation functions (check_admin_referer or wp_verify_nonce calls)
FAQ
What is CVE-2024-7420?
CVE-2024-7420 is a Cross-Site Request Forgery vulnerability in the Insert PHP Code Snippet WordPress plugin versions up to 1.3.6. The vulnerability exists due to missing nonce validation in the admin interface, allowing unauthenticated attackers to enable, disable, or delete PHP code snippets if a WordPress administrator is tricked into clicking a malicious link.
Is CVE-2024-7420 being actively exploited?
No, CVE-2024-7420 is not listed on the CISA Known Exploited Vulnerabilities (KEV) catalog and no public exploits have been disclosed, though the vulnerability should still be remediated to prevent opportunistic attacks.
What versions of PHP are affected by CVE-2024-7420?
CVE-2024-7420 affects the Insert PHP Code Snippet WordPress plugin in versions up to and including 1.3.6. The vulnerability is patched in version 1.3.7 and later.
How do I check if my server is vulnerable to CVE-2024-7420?
Log into your WordPress admin panel, navigate to Plugins > Installed Plugins, and locate 'Insert PHP Code Snippet'. If the version displayed is 1.3.6 or earlier, your site is vulnerable. You can also run: wp plugin list --field=name,version | grep insert-php-code-snippet using WP-CLI if installed.
Does Defensia detect CVE-2024-7420?
Yes — Defensia's CVE advisory scanner compares installed WordPress plugin versions against the NVD database. If the Insert PHP Code Snippet plugin is installed on a monitored server, CVE-2024-7420 will appear in your dashboard with remediation steps.
Related PHP CVEs
References
- https://plugins.trac.wordpress.org/browser/insert-php-code-snippet/trunk/admin/snippets.php#L28
- https://plugins.trac.wordpress.org/changeset/3134787/insert-php-code-snippet/trunk/admin/snippets.php
- https://www.wordfence.com/threat-intel/vulnerabilities/id/88001f3c-f5cc-4051-a713-788014e2241a?source=cve
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2024-7420. Free for 1 server.
Get started free