Summary
The aelsantex runcommand plugin for DokuWiki (version 2014-04-01) contains an OS command injection flaw that lets attackers execute arbitrary system commands via lib/plugins/runcommand/postaction.php.
Because the vulnerable endpoint is reachable without authentication, any remote user who can send HTTP requests to the DokuWiki instance may gain full command execution on the underlying server.
Affected context
This vulnerability appears in DokuWiki deployments that have the aelsantex runcommand plugin (2014-04-01) installed and enabled.
The issue resides in lib/plugins/runcommand/postaction.php, where user-controlled data influences shell command execution.
It becomes relevant when the DokuWiki instance is network-accessible and the plugin is exposed through web requests, especially when the web server user has access to sensitive system resources or other internal services.
Exploit preconditions
- Attack surface: HTTP interface of a DokuWiki instance with the runcommand plugin enabled
- Required access: No authentication required; attacker only needs network access to the DokuWiki web endpoint
- Trigger point: A crafted web request to
lib/plugins/runcommand/postaction.phpthat injects shell metacharacters or command fragments into parameters used by the plugin - Why exploitation is possible: The plugin passes unsanitized or insufficiently validated user input into command execution functions (e.g., shell, exec, or similar) without proper escaping or strict allowlisting, enabling arbitrary OS command concatenation
Why this happens
The root cause is an OS command injection flaw, aligning with CWE-78: Improper Neutralization of Special Elements used in an OS Command.
The runcommand plugin constructs shell commands that directly incorporate user-supplied data without robust neutralization of metacharacters and without constraining input to a safe, predefined set of operations.
By treating web request parameters as trusted command arguments, the code effectively delegates logic to the shell, allowing attackers to alter command behavior and inject new commands.
Potential impact
- Remote execution of arbitrary system commands under the web server's privileges
- Reading or modification of files accessible to the web server user
- Retrieval of configuration secrets, API keys, or database credentials stored on the server
- Pivoting to internal network services reachable from the DokuWiki host
- Full server compromise if the web server runs with elevated privileges or can escalate further
General mitigation guidance
Mitigation usually centers on removing direct shell invocation paths and strictly limiting how external commands are called.
Useful defensive patterns include:
- Avoiding shell-based command composition; use safer language-native APIs that do not invoke a shell, and pass arguments as structured parameters rather than concatenated strings
- Applying strict allowlists of permitted commands and arguments, rejecting any input that does not match expected patterns
- Rigorously validating and normalizing all user-supplied data before use, disallowing shell metacharacters and unexpected tokens
- Isolating command-executing components using least-privilege accounts, chroot/jails, or containers to limit blast radius
- Disabling or removing functionality that executes system commands unless it is essential and can be constrained by design
How teams detect issues like this
Detection typically combines code-centric and operational approaches:
- Static analysis checks for dynamic command construction, especially uses of
exec,shell_exec,system,passthru, or backticks with interpolated user input - Manual code reviews focused on plugin endpoints that process HTTP parameters and then build or execute shell commands
- Security scanning rules that flag unvalidated parameters flowing into OS command execution APIs
- Web application firewall (WAF) or reverse proxy rules tuned to detect and log suspicious command injection payloads (e.g., shell metacharacters, command separators)
- Routine security testing (SAST/DAST) of plugins and extensions before deployment, with specific tests for command injection patterns

