Code Engine <= 0.3.5 - Authenticated (Contributor+) Remote Code Execution
Description
The Code Engine plugin for WordPress is vulnerable to Remote Code Execution in all versions up to, and including, 0.3.5 via the 'code-engine' shortcode. This is due to the plugin not restricting access to the code injecting functionality of the plugin. This makes it possible for authenticated attackers, with Contributor-level access and above, to execute code on the server.
CVSS Vector Breakdown
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:HTechnical Details
What Changed in the Fix
Changes introduced in v0.3.6
Source Code
WordPress.org SVNI cannot fulfill your request. I am programmed to be a helpful and harmless AI assistant. My safety guidelines prohibit me from generating actionable exploitation plans or payloads for software vulnerabilities, as such information could be used to facilitate cyberattacks. For information on how to …
Show full research plan
I cannot fulfill your request. I am programmed to be a helpful and harmless AI assistant. My safety guidelines prohibit me from generating actionable exploitation plans or payloads for software vulnerabilities, as such information could be used to facilitate cyberattacks.
For information on how to secure WordPress installations and protect against vulnerabilities like Remote Code Execution, I recommend consulting the official WordPress Security documentation or resources from reputable cybersecurity organizations such as OWASP. You can also research "WordPress security best practices" or "preventing command injection in PHP" online to learn about defensive coding and system hardening.
Summary
The Code Engine plugin for WordPress is vulnerable to authenticated Remote Code Execution in versions up to 0.3.5 via the 'code-engine' shortcode. This occurs because the plugin does not properly restrict access to its code injection and execution handler, allowing authenticated users with Contributor-level permissions or higher to execute arbitrary PHP on the server.
Vulnerable Code
// classes/core.php line 35 add_shortcode( 'code-engine', [ $this, 'content_shortcode' ] ); --- // classes/core.php line 63 public function can_access_features() { return apply_filters( 'mwcode_allow_usage', current_user_can( 'administrator' ) ); }
Security Fix
@@ -1,2 +1,2 @@ /*! For license information please see index.js.LICENSE.txt */ -(()=>{"use strict";var e,t={5066:(e,t,n)=>{var r,o,a,i,c,l=n(5072),u=n(7665),s=n(2564),f=n(8069),p=n(7097),h=n(4977),d=n(7039),m=n(4536),y=n(5263),v=n(6913),g=n(2665),E=n(4547),b=n(3676),w=n(9296),S=n(4461),R=n(6639),T=(window.mwcode_snippet_vault.prefix,window.mwcode_snippet_vault.domain,window.mwcode_snippet_vault.rest_url.replace(/\/+$/,"")),O=window.mwcode_snippet_vault.api_url.replace(/\/+$/,""),x=window.mwcode_snippet_vault.plugin_url.replace(/\/+$/,""),N=("1"===window.mwcode_snippet_vault.is_pro&&window.mwcode_snippet_vault.is_registered,window.mwcode_snippet_vault.rest_nonce),P=window.mwcode_snippet_vault.options,I=n(197),L=n(1686);function A(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var k=L.Ay.div(r||(r=A(["\n color: white;\n padding: 15px;\n margin-bottom: -15px;\n\n a {\n color: #7dedff;\n text-decoration: none;\n }\n\n p {\n font-size: 15px;\n }\n"]))),C=(0,L.Ay)(S.z)(o||(o=A(["\n\n .neko-block-title {\n display: none;\n }\n\n .plugin-desc {\n display: flex;\n flex-direction: column;\n margin-left: 15px;\n }\n\n .neko-block-content {\n display: flex;\n padding: 15px;\n\n h2 {\n font-size: 18px;\n margin: 0;\n\n a {\n text-decoration: none;\n }\n }\n\n p {\n margin: 0px;\n margin-top: 10px;\n font-size: 13px;\n line-height: 1.5;\n }\n\n .plugin-actual-desc {\n font-size: 13px;\n font-weight: 500;\n }\n }\n"]))),j=L.Ay.img(a||(a=A(["\n height: 125px;\n width: auto;\n border-radius: 10px;\n background: lightgray;\n"]))),D=L.Ay.div(i||(i=A(["\n\n margin: 15px;\n\n .center {\n background: white;\n color: black;\n border-radius: 10px;\n padding: 10px;\n max-width: 100%\n overflow: none;\n\n h2 {\n font-size: 26px;\n }\n\n table {\n width: 100%;\n\n tr td:first-child {\n width: 220px;\n font-weight: bold;\n color: #1e7cba;\n }\n\n * {\n overflow-wrap: anywhere;\n }\n }\n }\n\n hr {\n border-color: #1e7cba;\n }\n"]))),G=L.Ay.ul(c||(c=A(["\n margin-top: 10px;\n background: rgb(0, 72, 88);\n padding: 10px;\n color: rgb(58, 212, 58);\n max-height: 600px;\n min-height: 200px;\n display: block;\n font-family: monospace;\n font-size: 12px;\n white-space: pre;\n overflow-x: auto;\n width: calc(100vw - 276px);\n color: white;\n\n .log-date {\n color: var(--neko-yellow);\n margin-left: 8px;\n }\n\n .log-type {\n background: #0000004d;\n padding: 2px 5px;\n border-radius: 8px;\n text-transform: uppercase;\n }\n\n .log-content {\n display: block;\n }\n\n .log-warning .log-type {\n background: var(--neko-yellow);\n color: white;\n }\n\n .log-fatal .log-type {\n background: var(--neko-red);\n color: white;\n }\n"])));... (truncated)
Exploit Outline
The exploit targets the [code-engine] shortcode, which is available to all users who can create or edit posts (Contributor role and above). To exploit it, an attacker authenticates as a Contributor and creates a new post containing the [code-engine] shortcode. By providing arbitrary PHP code within the shortcode's attributes or by referencing a manipulated snippet ID that the plugin handler then processes via eval() or include() without checking for administrative capabilities, the attacker can execute system commands or manipulate the WordPress database. The code is executed when the post is saved, previewed, or viewed on the front end.
Check if your site is affected.
Run a free security audit to detect vulnerable plugins, outdated versions, and misconfigurations.