Back to skill

Security audit

daily-work-diary

Security checks for vulnerabilities and agentic risk

Overview

The scanners report a skill with scripts that call external services and handle credentials, including a confirmed concern about API keys in command-line arguments; the verdict is suspicious, with incomplete evidence because two referenced local paths were missing.

Consider the suspicious verdict and credential-handling concern before installing. The scan reports one confirmed risk involving API keys in command-line arguments, while other credential-flow findings are uncertain. Coverage was partial because two referenced local paths were missing, so the evidence does not establish that the skill is safe.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (6)

Tainted flow: 'req' from os.environ (line 399, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/upload_to_kb.py (reported line 407)May include surrounding context.

python
)
    
    # 发送请求
    with urllib.request.urlopen(req) as response:
        return response.read().decode('utf-8')

# --- 原有的 upload_file.py 函数 ---

Skill declares no tool scope ('permissions' or 'allowed-tools') but code capabilities were detected: env, network, shell.

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
95% confidence
Finding

The curl invocation places the API key directly in subprocess command-line arguments. On systems that expose process arguments to other users or collect them in monitoring logs, this can disclose credentials and enable unauthorized API access; using an argument list prevents shell injection but does not protect these secrets.

Content

Scanner excerpt · scripts/archive_diary.py (reported line 41)May include surrounding context.

python
def api(path, body):
    """IMA OpenAPI 调用。必须用 curl 子进程:Python urllib 会因 header 大小写规范化被 403。"""
    p = subprocess.run(
        ["curl", "-s", "-X", "POST", BASE + path,
         "-H", "ima-openapi-clientid: " + CLIENT,
         "-H", "ima-openapi-apikey: " + APIKEY,

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

Medium
Category
Data Flow
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.

Content

Scanner excerpt · scripts/archive_diary.py (reported line 41)May include surrounding context.

python
def api(path, body):
    """IMA OpenAPI 调用。必须用 curl 子进程:Python urllib 会因 header 大小写规范化被 403。"""
    p = subprocess.run(
        ["curl", "-s", "-X", "POST", BASE + path,
         "-H", "ima-openapi-clientid: " + CLIENT,
         "-H", "ima-openapi-apikey: " + APIKEY,

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/archive_diary.py (reported line 68)May include surrounding context.

python
def get_cos_key(path):
    p = subprocess.run(["ima_cos_util", "-f", path], capture_output=True, text=True)
    out = (p.stdout or "").strip()
    return out.splitlines()[-1].strip() if out else ""

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/archive_diary.py (reported line 146)May include surrounding context.

python
return {"ok": True, "mode": "exists_would_skip" if dry_run else "exists_skip"}
    if dry_run:
        return {"ok": True, "mode": "would_upload"}
    p = subprocess.run(
        ["python3", os.path.join(HERE, "upload_to_kb.py"),
         "--file-path", path, "--knowledge-base-id", kb_id, "--folder-id", folder_id],
        capture_output=True, text=True,