Summary
A code injection flaw in Kiamo before version 8.4 allows an authenticated administrator to execute arbitrary PHP code on the server.
When malicious PHP code is injected into server-side evaluated fields or configuration, it is processed by the application, leading to full server compromise within the Kiamo environment.
Affected context
This vulnerability occurs in Kiamo deployments running versions prior to 8.4 where administrative functionality accepts input that is ultimately evaluated or interpreted by the PHP runtime.
It is relevant in environments where:
- Administrative users can manage advanced settings, templates, or scripts
- The application dynamically builds or evaluates PHP-based logic from stored configuration or content
- There are multiple administrators, delegated admin roles, or potential admin account takeover paths (e.g., weak SSO, shared accounts)
Exploit preconditions
- Attack surface: Kiamo web-based administrative interface.
- Required access: Authenticated administrative credentials or the ability to act as an administrator (e.g., via compromised admin account).
- Trigger point: Submission or modification of data that is subsequently interpreted as PHP code (e.g., dynamic configuration, templates, or script-like fields).
- Why exploitation is possible: The application treats attacker-controlled input as executable PHP code, typically through functions or patterns that evaluate, include, or dynamically construct PHP without strict separation between data and code.
Why this happens
The root cause aligns with CWE-94: Improper Control of Generation of Code ('Code Injection').
Kiamo accepts input in an administrative context and later processes that input as PHP code, without enforcing strict separation of code and data or sufficiently constraining what can be supplied.
Common patterns that lead to this class of flaw include:
- Using dynamic evaluation mechanisms (such as eval-like behavior or dynamic includes) based on stored configuration or templates
- Constructing PHP code strings using unsanitized or weakly validated administrative input
- Allowing arbitrary PHP fragments or expressions to be persisted and then executed as part of the application logic
In abstract terms, the application exposes a code-generation or evaluation capability to administrators without robust safeguards, enabling arbitrary server-side code execution when misused or when admin accounts are compromised.
Potential impact
- Execution of arbitrary PHP code under the web server's privileges
- Reading or modification of application data, including sensitive customer or operational information
- Installation of webshells or backdoors on the server
- Pivoting to other internal systems reachable from the Kiamo host
- Disabling or tampering with logging and security controls
- Full takeover of the affected Kiamo instance and possible lateral movement within the infrastructure
General mitigation guidance
Effective mitigation focuses on removing or tightly constraining any path where user-supplied input can become executable code:
- Replace any dynamic evaluation of configuration or templates with static interpretation mechanisms that treat all input as data, not code.
- Introduce strict whitelisting and structured formats (e.g., JSON or domain-specific configuration languages) instead of free-form PHP or expression fields.
- Isolate any unavoidable dynamic behavior behind well-defined APIs that expose only a constrained set of safe operations, rather than arbitrary PHP.
- Apply robust input validation and encoding in administrative interfaces, ensuring that control characters, PHP tags, and code-like constructs cannot be stored in fields that affect runtime behavior.
- Run the application with least-privilege OS accounts and minimize filesystem and network privileges so that, if code execution occurs, the blast radius is reduced.
- Enforce strong authentication, multi-factor authentication (MFA), and tight control over administrative accounts to reduce the likelihood of admin account compromise.
How teams detect issues like this
Detection generally combines code-level analysis with runtime monitoring:
- Static analysis: Use SAST rules to flag dynamic PHP execution patterns (e.g., eval-like behavior, variable function calls, dynamic includes) where the source of the code string traces back to request data, configuration fields, or database content controlled from the admin UI.
- Code review: During manual reviews, examine administrative features that allow custom logic, templates, or expressions. Red flags include any feature describing "custom PHP," "advanced scripting," or "dynamic expressions" that are persisted and then executed.
- Security testing: Conduct focused penetration testing of admin features, attempting to inject benign test payloads into fields that affect rendering or behavior to see if they are interpreted as code in non-production environments.
- Runtime monitoring: Monitor for unusual PHP function usage, unexpected file creation in web directories, or outbound connections from the Kiamo host. Centralized logging and EDR solutions can help flag suspicious command execution patterns.

