medium CVSS 5.8

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 -y

Defensia 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 body

WAF 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

  1. 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'
  2. 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
  3. 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
  4. 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

CVE-2025-47916CVSS 10Invision Community 5.0.0 before 5.0.7 allows remote code execution via crafted template strings to themeeditor.php. The issue lies within the themeeditor controller (file: /applications/core/modules/front/system/themeeditor.php), where a protected method named customCss can be invoked by unauthenticated users. This method passes the value of the content parameter to the Theme::makeProcessFunction() method; hence it is evaluated by the template engine. Accordingly, this can be exploited by unauthenticated attackers to inject and execute arbitrary PHP code by providing crafted template strings.
CVE-2026-28289CVSS 10FreeScout is a free help desk and shared inbox built with PHP's Laravel framework. A patch bypass vulnerability for CVE-2026-27636 in FreeScout 1.8.206 and earlier allows any authenticated user with file upload permissions to achieve Remote Code Execution (RCE) on the server by uploading a malicious .htaccess file using a zero-width space character prefix to bypass the security check. The vulnerability exists in the sanitizeUploadedFileName() function in app/Http/Helper.php. The function contains a Time-of-Check to Time-of-Use (TOCTOU) flaw where the dot-prefix check occurs before sanitization removes invisible characters. This vulnerability is fixed in 1.8.207.
CVE-2025-46348CVSS 10YesWiki is a wiki system written in PHP. Prior to version 4.5.4, the request to commence a site backup can be performed and downloaded without authentication. The archives are created with a predictable filename, so a malicious user could create and download an archive without being authenticated. This could result in a malicious attacker making numerous requests to create archives and fill up the file system, or by downloading the archive which contains sensitive site information. This issue has been patched in version 4.5.4.
CVE-2026-39337CVSS 10ChurchCRM is an open-source church management system. Prior to 7.1.0, critical pre-authentication remote code execution vulnerability in ChurchCRM's setup wizard allows unauthenticated attackers to inject arbitrary PHP code during the initial installation process, leading to complete server compromise. The "$dbPassword" variable is not sanitized. This vulnerability exists due to an incomplete fix for CVE-2025-62521. This vulnerability is fixed in 7.1.0.
CVE-2025-25174CVSS 10Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion') vulnerability in beeteam368 BeeTeam368 Extensions beeteam368-extensions allows PHP Local File Inclusion.This issue affects BeeTeam368 Extensions: from n/a through <= 1.9.4.

References

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