Back to skill

Security audit

OpenKM Document Management

Security checks for vulnerabilities and agentic risk

Overview

This OpenKM integration appears coherent and not deceptive, but it can change or delete repository data using reusable credentials without built-in safeguards or HTTPS enforcement.

Review before installing in any real OpenKM environment. Use a least-privileged account, require HTTPS for OPENKM_BASE_URL, avoid admin-style credentials, and require explicit human confirmation before delete, restore, workflow, metadata, move, rename, checkin, or upload-version operations. Treat downloads as local file writes that may overwrite the chosen path.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
openkm_cli.py:15
Finding

OpenKM Basic Authentication Credentials May Be Transmitted over Cleartext HTTP

Content
View full analysis

Vulnerability Details

File Location: openkm_cli.py:15-18, 26-30
Vulnerability Type: Insecure transport of reusable credentials and sensitive repository data
Risk Level: Medium

Vulnerable Code

python
class OpenKMClient:
    def __init__(self, base_url, username, password, debug=False):
        if base_url.rstrip("/").endswith("/OpenKM"):
            raise OpenKMError("OPENKM_BASE_URL must NOT end with /OpenKM")
        self.base_url = base_url.rstrip("/")
        self.auth = HTTPBasicAuth(username, password)
        self.debug = debug

    def _req(self, method, endpoint, **kw):
        url = self.base_url + endpoint
        self._dbg(f"{method} {url}")
        r = requests.request(method, url, auth=self.auth, timeout=30, **kw)
        self._dbg(f"→ {r.status_code} {r.text[:200]}")
        return r

Technical Analysis

The client accepts OPENKM_BASE_URL without validating or enforcing its URL scheme. The only constructor validation rejects a base URL ending in /OpenKM; an http:// URL remains valid.

Every REST request then uses HTTPBasicAuth, which sends a reusable Base64-encoded username and password in the Authorization header. Base64 is not encryption. If the configured endpoint uses HTTP rather than HTTPS, an attacker with network visibility can read the credentials directly. Document uploads, downloaded content, metadata, search results, and workflow information may also be observed or modified in transit.

The documentation presents an HTTPS URL as an example but does not enforce HTTPS in code or explicitly prohibit unencrypted HTTP.

Attack Path

  1. An operator or automated Agent configures OPENKM_BASE_URL with an http:// OpenKM endpoint.
  2. The CLI reads OPENKM_USERNAME and OPENKM_PASSWORD and constructs an HTTPBasicAuth object.
  3. The operator invokes any CLI command that calls _req().
  4. The request sends the Basic Authentication header ...[truncated 1028 chars]
Remediation
View remediation

Remediation Suggestions

  1. Parse OPENKM_BASE_URL with urllib.parse.urlparse and require the https scheme before constructing the client or sending credentials.
  2. Reject missing, malformed, protocol-relative, and unencrypted URLs with a clear error message.
  3. If HTTP is necessary for isolated local development, require an explicit opt-in such as OPENKM_ALLOW_INSECURE_HTTP=1. Prefer limiting this exception to loopback hosts and emit a prominent warning.
  4. Update SKILL.md and README.txt to state that HTTPS is mandatory in production because Basic Authentication does not protect credentials without TLS.
  5. Preserve TLS certificate verification and do not introduce verify=False. If a private certificate authority is used, support an explicit CA bundle instead.
  6. Use a least-privileged OpenKM service account rather than an administrative account, and rotate credentials that may previously have been used over HTTP.
  7. Consider token-based or short-lived authentication if supported by the deployed OpenKM environment.

Example scheme enforcement:

python
from urllib.parse import urlparse

parsed = urlparse(base_url)
if parsed.scheme != "https":
    raise OpenKMError("OPENKM_BASE_URL must use HTTPS")
if not parsed.netloc:
    raise OpenKMError("OPENKM_BASE_URL must be an absolute URL")
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (11)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · SKILL.md (reported line 215)May include surrounding context.

md
- `PUT /document/setProperties` - Update title/description
- `PUT /document/move` - Move document
- `PUT /document/rename` - Rename document
- `DELETE /document/delete` - Delete document

**Versioning:**
- `GET /document/getVersionHistory` - Get version history

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · SKILL.md (reported line 224)May include surrounding context.

md
**Properties/Metadata:**
- `POST /property/addKeyword` - Add keyword
- `DELETE /property/removeKeyword` - Remove keyword
- `POST /property/addCategory` - Add category
- `DELETE /property/removeCategory` - Remove category

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · SKILL.md (reported line 226)May include surrounding context.

md
- `POST /property/addKeyword` - Add keyword
- `DELETE /property/removeKeyword` - Remove keyword
- `POST /property/addCategory` - Add category
- `DELETE /property/removeCategory` - Remove category

**Search:**
- `GET /search/find` - General search with filters

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The README enumerates many callable operations but does not state when they should be invoked, who is authorized to invoke them, or what confirmation/guardrails apply. In an agent skill context, ambiguous trigger scope increases the chance that an LLM or automation invokes sensitive actions like delete, move, restore-version, start-workflow, or assign-task from loosely related prompts, causing unintended state changes in the external OpenKM system.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The README exposes destructive and data-affecting capabilities such as upload, move, rename, delete, set-properties, restore-version, complete-task, and assign-task without any warning about permanence, audit implications, or need for verification. In a document-management integration, this is dangerous because an agent may alter or remove enterprise records, metadata, workflow state, or historical versions based on mistaken or malicious prompts, leading to data loss, integrity issues, and business process disruption.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill declares network and environment-variable requirements but does not constrain tool scope with explicit permissions or allowed-tools. In an agent setting, this increases the chance that the model can invoke broader shell/network capabilities than necessary, exposing OpenKM credentials and enabling unintended remote actions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill documents a delete operation with no warning, confirmation, or guidance to verify the target before execution. In an agent workflow, this can lead to accidental or prompt-induced permanent document deletion in a production DMS.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The restore-version command changes persistent document state and may replace current content, yet the skill omits any warning about overwrite risk or downstream workflow effects. This makes accidental rollback or malicious prompt steering more likely in a document-management environment.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The delete method performs a remote document deletion via HTTP DELETE, but the code provides no confirmation prompt, no user-facing log/print, and no warning comment or docstring about the destructive effect. In this CLI context, deletion is safety-critical and users are not explicitly alerted before the action executes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The restore_version method performs a state-changing rollback to an earlier version, which can materially affect document integrity, but the code does not include a confirmation prompt, visible warning, or explanatory disclosure to the user. This makes a potentially irreversible or disruptive action easy to trigger without adequate notice.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The download method writes response data directly to a user-specified local path, which can overwrite local files, but there is no confirmation, warning, or user-facing message describing this behavior. Although downloading is expected functionality, the file write itself is safety-relevant and lacks visible disclosure in the code.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.