/

CVE-2026-42785

Severity:

HIGH RISK

(7.2)

Code Injection / Dynamic Code Evaluation in OpenKM Admin

CVE-2026-42785

Deferred

Vulnerability type

Category:

Code Injection / Dynamic Code Evaluation

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

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/Scripting endpoint.
  • 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=Evaluate parameter 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/Scripting endpoint, especially invocations of action=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

Sources

SourceLink
github.comgithub.com/terrasystemlabs/Exploits/tree/main/OpenKM-Exploits
github.comgithub.com/terrasystemlabs/Exploits/tree/main/OpenKM-Exploits/nuclei-templates/openkm-remote-code-execution
hub.docker.comhub.docker.com/r/openkm/openkm-ce
terrasystemlabs.comterrasystemlabs.com/post?slug=openkm-zero-day-vulnerabilities-terra-system-labs
exploit-db.comexploit-db.com/exploits/52520
openkm.comopenkm.com/
vulncheck.comvulncheck.com/advisories/openkm-remote-code-execution-via-administrative-scripting

Frequently asked

questions

Yes, if the /admin/Scripting endpoint is reachable over the network and an attacker can authenticate as an administrator, they can exploit it remotely by sending crafted requests with malicious scripts.

Exploitation requires authenticated administrative access, or control over an existing admin session.

Compromised admin credentials, weak passwords, or session hijacking can all provide the necessary access.

The safest pattern is to remove or disable generic script-evaluation functionality from network-exposed interfaces.

If scripting is absolutely required, it should be heavily restricted through sandboxing, allow-listing of permitted operations, and strong access controls.

Avoid designs that evaluate arbitrary user-supplied code or scripts; prefer predefined, parameterized administrative operations.

When dynamic behavior is needed, enforce strict constraints, validate inputs rigorously, and subject administrative features to dedicated security review and automated scanning for dynamic code execution patterns.

Find out what's already
exploitable in your codebase.