Back to skill

Security audit

Cohere Translator

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent Cohere-based translator, but users should review it because file contents are uploaded to Cohere and the API key is passed through command-line process arguments.

Install only if you are comfortable sending the translated text or files to Cohere. Do not use it for secrets, regulated data, or confidential files without approval, and prefer COHERE_API_KEY over --api-key while recognizing the current curl implementation can still expose the key to local process inspection.

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
scripts/translate.py:184
Finding
Cohere API Key Exposed Through Process Command-Line Arguments## Vulnerability Details **File Location**: `scripts/translate.py:184-190` **Vulnerability Type**: Credential exposure through child-process arguments **Risk Level**: Medium ### Vulnerable Code ```python result = subprocess.run( ["curl", "-s", "--request", "POST", API_URL, "--header", "accept: application/json", "--header", "content-type: application/json", "--header", f"Authorization: bearer {api_key}", "--data", json.dumps(payload)], capture_output=True, text=True, timeout=120 ) ``` The related CLI option at `scripts/translate.py:363-364` also allows the key to be supplied directly as a Python process argument: ```python parser.add_argument("--api-key", default=None, help="Cohere API key (or set COHERE_API_KEY env var)") ``` ### Technical Analysis The script interpolates the Cohere API key into curl's argument vector as an HTTP authorization header. Consequently, even when the credential originates from the `COHERE_API_KEY` environment variable, it becomes part of the curl child process's command-line arguments. Depending on operating-system process visibility and hardening settings, another local user or process may be able to inspect these arguments through process-listing utilities, process-monitoring software, audit telemetry, or process metadata exposed by the operating system. The optional `--api-key` interface creates an additional exposure path because the credential may appear in the Python process arguments, shell history, terminal logs, job-control records, and endpoint monitoring data. ### Attack Path 1. A victim starts a translation using a valid Cohere API key. 2. The script launches curl and places `Authorization: bearer <API_KEY>` in its argument vector. 3. While curl is running, a local attacker or compromised monitoring process with sufficient process-inspection access captures the command-line arguments. 4. Alternatively, if the victim uses `--api-key`, the attacker retrieves t ...[truncated 938 chars]
Remediation
## Remediation Suggestions 1. Replace the curl subprocess with an in-process HTTPS client so the authorization header is transmitted without placing it in a child process's argument vector. A standard-library implementation using `urllib.request` would preserve the project's no-external-Python-dependencies design. 2. Remove or deprecate the `--api-key` option. Prefer a protected environment variable, operating-system credential store, or non-echoing interactive prompt. 3. If curl must remain, avoid passing credentials through argv. Supply sensitive curl configuration through a protected mechanism such as a mode-`0600` temporary configuration file, then delete it reliably in a `finally` block. Avoid leaving credentials in ordinary temporary files. 4. Ensure exceptions and diagnostics never include authorization headers or raw credentials. 5. Document that API keys must not be entered directly on the command line and recommend short-lived or narrowly scoped credentials where the provider supports them. 6. Rotate any credential that may already have been exposed through process logs, shell history, or monitoring telemetry.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (15)

External Script Fetching

High
Category
Supply Chain
Content
# Clone or copy the skill into your OpenClaw workspace
cp -r cohere-translator ~/.openclaw/workspace/skills/

# No Python dependencies needed — uses only stdlib + curl
```

## Setup
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The README promotes a 'file mode' where users may assume the agent or local script handles content privately, but it does not clearly warn that the file contents are sent to Cohere's external API for processing. This can lead users to upload sensitive documents, source code, credentials, or regulated data without informed consent, creating confidentiality and compliance risk.

External Transmission

Medium
Category
Data Exfiltration
Content
The script sends a chat completion request to Cohere's API:

```
POST https://api.cohere.ai/v2/chat
Authorization: Bearer $COHERE_API_KEY
{
  "model": "command-a-translate-08-2025",
Confidence
91% confidence
Finding
The skill explicitly sends user-provided text to Cohere's remote API, which is an external data transmission boundary. In a translation skill this behavior is expected, but it is still security-relevant because any supplied content may leave the local environment and be exposed to third-party processing, logging, or retention.

External Transmission

Medium
Category
Data Exfiltration
Content
### Basic Request (curl)
```bash
curl -X POST https://api.cohere.ai/v2/chat \
  -H "Authorization: bearer $COHERE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Natural-Language Policy Violations

Medium
Confidence
88% confidence
Finding
The practical guideline defines `target_language="Japanese"` as the default and hardcodes the user prompt pattern around translating into the chosen target, while the surrounding document repeatedly centers Japanese as the assumed destination language. For a general translation skill, this can amount to a locale/language preference being imposed by default rather than explicitly selected by the user.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill strongly encourages 'file mode' and emphasizes token savings, but it does not clearly warn users that the file contents are transmitted to Cohere's external API for processing. This can cause users to send sensitive local documents under the mistaken impression that only local file handling occurs because the wording focuses on bypassing the agent rather than disclosing third-party data transfer.

External Transmission

Medium
Category
Data Exfiltration
Content
import time
import re

API_URL = "https://api.cohere.ai/v2/chat"
MODEL = "command-a-translate-08-2025"

LANGUAGES = {
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
import time
import re

API_URL = "https://api.cohere.ai/v2/chat"
MODEL = "command-a-translate-08-2025"

LANGUAGES = {
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
import time
import re

API_URL = "https://api.cohere.ai/v2/chat"
MODEL = "command-a-translate-08-2025"

LANGUAGES = {
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
"""Single API call with retry on rate limit."""
    max_retries = 3
    for attempt in range(max_retries):
        result = subprocess.run(
            ["curl", "-s", "--request", "POST", API_URL,
             "--header", "accept: application/json",
             "--header", "content-type: application/json",
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Tainted flow: 'api_key' from os.environ.get (line 228, credential/environment) → subprocess.run (code execution)

Medium
Category
Data Flow
Content
"""Single API call with retry on rate limit."""
    max_retries = 3
    for attempt in range(max_retries):
        result = subprocess.run(
            ["curl", "-s", "--request", "POST", API_URL,
             "--header", "accept: application/json",
             "--header", "content-type: application/json",
Confidence
65% confidence
Finding
Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
This skill reads arbitrary file contents and sends them to an external translation API, but the interface does not present a strong, explicit warning about third-party disclosure. In a security-sensitive environment, that can lead to accidental leakage of proprietary, regulated, or secret material because users may treat translation as a local transformation.

Context-Inappropriate Capability

Medium
Confidence
86% confidence
Finding
Allowing an arbitrary --system-prompt changes the tool from a constrained translator into a general-purpose instruction relay to an external LLM. In an agent-skill setting, that can enable prompt injection, policy bypass, or exfiltration of sensitive input under the guise of translation, especially if upstream users assume deterministic translation behavior.

Intent-Code Divergence

Low
Confidence
93% confidence
Finding
The documentation/commentary says file mode 'bypasses agent context entirely,' which can mislead users into thinking file contents are not exposed externally. In reality, the file contents are still sent to Cohere's API, creating a data-disclosure risk if users process sensitive files based on that wording.

Intent-Code Divergence

Low
Confidence
90% confidence
Finding
The inline comment claims the input modes are mutually exclusive in practice, but the parser configuration allows both `text` and `--file` simultaneously, and execution silently prioritizes file mode. This is an active contradiction between the code comment and actual behavior, not merely incomplete documentation.

Static analysis

No suspicious patterns detected.