/

CVE-2021-47778

Severity:

HIGH RISK

(7.2)

Code Injection in GetSimple CMS My SMTP Contact Plugin

CVE-2021-47778

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution

Severity:

HIGH RISK

(7.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

The My SMTP Contact Plugin for GetSimple CMS version 1.1.2 contains a PHP code injection vulnerability that allows arbitrary PHP code to be stored in plugin configuration parameters.

When an authenticated administrator supplies crafted configuration values, the plugin may execute this code on the server, resulting in remote code execution within the web application's context.

Affected context

This vulnerability occurs in GetSimple CMS installations that have the My SMTP Contact Plugin version 1.1.2 installed and enabled.

It manifests where plugin configuration values are accepted from the web interface, stored, and later evaluated or executed as PHP without proper validation or escaping.

The risk is present when administrator-level accounts are available and plugin settings directly or indirectly influence executable PHP code paths.

Exploit preconditions

  • Attack surface: Web-based administration interface of GetSimple CMS.
  • Required access: Authenticated administrator (or an attacker who has compromised an admin account).
  • Trigger point: Saving malicious code into the plugin's configuration fields and later invoking code paths that interpret or execute those configuration values as PHP.
  • Why exploitation is possible: The plugin treats configuration parameters as trusted input and uses them in a context where PHP evaluation or dynamic inclusion occurs without sanitization, escaping, or strict separation of code and data.

Why this happens

The root cause aligns with CWE-94: Improper Control of Generation of Code ('Code Injection').

The plugin appears to embed user-controlled configuration values into PHP execution contexts (such as eval, dynamic function calls, or interpreted templates) without ensuring they remain data-only.

By not enforcing strict boundaries between configuration data and executable code, the plugin allows an attacker with configuration write access to introduce arbitrary PHP statements that the application subsequently runs on the server.

Potential impact

  • Execution of arbitrary PHP code on the server within the web server's privilege context.
  • Reading or modification of CMS content, configuration files, and plugin data.
  • Theft of sensitive information such as database credentials or API keys accessible to the application.
  • Installation of backdoors, web shells, or further malware to maintain persistent access.
  • Use of the compromised server as a pivot point for attacks on internal systems or users.

General mitigation guidance

Effective mitigation focuses on preventing configuration values from ever being interpreted as executable code and reducing the blast radius of any compromise.

Recommended defensive patterns include:

  • Avoid using dynamic code evaluation functions (e.g., eval) or runtime code generation in plugin logic; treat all configuration as data-only.
  • If dynamic behavior is needed, implement a strict, declarative configuration format (e.g., whitelisted options or templates with limited, non-executable placeholders).
  • Enforce robust validation of configuration fields, allowing only expected formats (such as booleans, predefined strings, or constrained patterns).
  • Apply output encoding when configuration values are rendered, ensuring they are never passed into PHP interpreters or concatenated into code.
  • Run the web server and CMS with least-privilege OS accounts and restrict file system permissions to limit the damage of any code execution.
  • Apply strong administrative account controls, including unique accounts, strong authentication, and session management to reduce the chance of admin takeover.

How teams detect issues like this

Detection generally involves a combination of code-level analysis and operational monitoring.

Useful strategies include:

  • Static analysis and manual review of plugin code to identify use of dynamic evaluation functions (e.g., eval, create_function, assert with strings, dynamic include/require) that incorporate configuration values.
  • Search for patterns where $_POST or other request data are written to configuration storage and later used in executable contexts.
  • Implement application-level logging that records changes to plugin configuration, with alerting on unusual or unexpected updates.
  • Deploy file integrity monitoring on plugin and CMS directories to spot new or modified PHP files that might indicate a successful injection or web shell installation.
  • Use security scanners or WAF rules tuned to flag suspicious PHP code fragments if they appear in administrative form submissions.

Sources

SourceLink
get-simple.infoget-simple.info
github.comgithub.com/GetSimpleCMS/GetSimpleCMS
github.comgithub.com/boku7/gsSMTP-Csrf2Xss2RCE/
exploit-db.comexploit-db.com/exploits/49774
vulncheck.comvulncheck.com/advisories/getsimple-cms-my-smtp-contact-plugin-php-code-injection

Frequently asked

questions

Yes, if the administrative interface is accessible over the network and an attacker can authenticate as an administrator or compromise an admin account, the vulnerability can be exploited remotely.

The described issue requires access to plugin configuration parameters, which are typically restricted to authenticated administrators. An attacker would need valid admin credentials or a way to hijack an existing admin session.

The safest pattern is to completely remove any dynamic evaluation of configuration values and ensure that configuration is always treated as non-executable data, backed by strict validation and whitelisting of acceptable values.

Developers can prevent similar issues by avoiding runtime code generation, using parameterized and declarative configuration mechanisms, applying rigorous input validation, and incorporating security-focused code reviews and static analysis into their development and release processes.

Find out what's already
exploitable in your codebase.