Summary
OpenKM 6.3.12 exposes a remote code execution issue in its administrative scripting interface, allowing arbitrary Java/BeanShell code to be evaluated through the /admin/Scripting endpoint.
An authenticated administrator, or an attacker who compromises such an account, can submit malicious scripts with action=Evaluate to execute operating system commands in the context of the OpenKM application server.
Affected context
The vulnerability occurs in OpenKM 6.3.12 deployments that enable or expose the /admin/Scripting endpoint to administrative users.
The issue manifests when the application accepts arbitrary Java/BeanShell script content and evaluates it with high privileges as part of admin operations.
It is most relevant in environments where:
- Administrative credentials are shared, weak, or reused
- The admin interface is reachable from broader networks
- The application server account has significant filesystem or OS-level privileges
Exploit preconditions
- Attack surface: HTTP(S) interface, specifically the
/admin/Scriptingendpoint. - Required access: Valid authenticated administrator-level account, or equivalent control over such a session.
- Trigger point: Sending a request containing malicious script content with the
action=Evaluateparameter to the scripting endpoint. - Why exploitation is possible: The scripting engine directly evaluates supplied scripts without sufficient restriction or sandboxing, allowing arbitrary Java/BeanShell execution that can in turn invoke OS-level commands.
Why this happens
This issue is rooted in CWE-94: Improper Control of Generation of Code ('Code Injection').
The application provides an administrative feature that evaluates user-supplied Java/BeanShell scripts for management or automation tasks.
Because the feature does not sufficiently constrain what code can be run, or apply robust sandboxing or allow-listing, it effectively grants full execution of arbitrary code to anyone who can invoke it.
The unsafe pattern is treating dynamic, user-provided script content as trusted and executing it with application-server privileges, rather than limiting it to controlled, predefined operations.
Potential impact
- Arbitrary OS command execution under the OpenKM application server account
- Full compromise of the OpenKM instance, including documents and configuration
- Deployment of persistent backdoors or web shells within the application environment
- Lateral movement to other systems accessible from the compromised server
- Exposure or tampering of sensitive data stored or processed by OpenKM
General mitigation guidance
Mitigation typically focuses on constraining or eliminating dynamic code evaluation in administrative interfaces and tightening trust boundaries around scripting.
Common defensive patterns include:
- Disabling or strictly limiting script-evaluation features in production environments where they are not essential
- Replacing general-purpose script execution with narrowly scoped, parameterized administrative operations
- Applying strong sandboxing or allow-lists to any remaining scripting capabilities, restricting accessible classes, APIs, and commands
- Enforcing strict authentication and authorization policies, including unique admin accounts, MFA, and minimal privilege for administrative roles
- Segregating the admin interface onto dedicated, restricted networks and limiting access via network controls
- Running the application server under an OS account with minimal filesystem and system-level privileges
How teams detect issues like this
Detection approaches often combine code-level review with runtime monitoring:
- Static analysis and code review:
- Flag any use of dynamic evaluation APIs (e.g., BeanShell, scripting engines, reflection) that consume user-supplied content
- Review administrative tools for generic "script" or "evaluate" functions exposed over HTTP
- Check that any scripting interfaces enforce strong authorization and use sandboxing or allow-listing
- Runtime and log monitoring:
- Log and inspect usage of the
/admin/Scriptingendpoint, especially invocations ofaction=Evaluate - Monitor for unusual script patterns, access frequency, or access from atypical IP ranges
- Correlate application logs with OS-level command execution and process creation on the application host
- Policy enforcement:
- Apply secure development policies discouraging unrestricted code eval in web-exposed endpoints
- Integrate automated security scanning into CI/CD to surface dynamic code execution patterns early

