Back to skill

Security audit

interpretable-attribution

Security checks for vulnerabilities and agentic risk

Overview

The skill performs local attribution work, but it needs Review because it runs user-supplied Python predictor files as code and includes a broad local usage-learning module.

Install only if you understand that predictor files are executable Python programs. Use it with predictor files you wrote or audited, avoid sensitive data in learner notes or preferences, and consider disabling or removing the learner module unless you explicitly want local usage history stored.

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

Error
Location
scripts/attributor.py:125
Finding

Arbitrary Python Code Execution Through Untrusted Prediction Module Loading

Content
View full analysis

Vulnerability Details

File Location: scripts/attributor.py:125-126
Vulnerability Type: Arbitrary code execution through unrestricted dynamic evaluation
Risk Level: High

Vulnerable Code

python
ns = {}; exec(compile(open(a.predict, encoding="utf-8").read(), a.predict, "exec"), ns)
predict = ns["predict"]

Technical Analysis

The --predict command-line argument controls the path passed to open(). The application reads the entire selected Python file, compiles it, and executes it with exec() in the current process. Execution is not restricted to the expected predict(r) function: all top-level statements in the supplied file run immediately.

No source validation, capability restriction, sandbox, integrity check, or trust confirmation is applied. Consequently, a prediction module obtained from an untrusted source can execute arbitrary Python operations with the same operating-system identity and environment as the attribution process.

Attack Path

  1. An attacker creates or modifies a Python file that defines the expected predict function but also contains malicious top-level statements.
  2. The attacker persuades a user or automated Agent to use that file as the documented --predict input:
    bash
    python scripts/attributor.py --data d.json --predict malicious.py --instance i.json
    
  3. The application reads and executes the complete contents of malicious.py at line 125.
  4. The malicious statements execute before the attribution workflow calls predict.
  5. The file may still provide a legitimate-looking predict function and attribution output, concealing the side effects.

Impact Assessment

Successful exploitation provides arbitrary code execution with the privileges of the process running the Skill. Depending on that account's permissions and environment, an attacker could read or modify accessible files, obtain environment variables or locally available ...[truncated 224 chars]

Remediation
View remediation

Remediation Suggestions

  1. Prefer a declarative, non-executable model format rather than accepting arbitrary Python source files.
  2. If custom prediction logic is required, run it in a separate, disposable process with a narrow JSON input/output protocol.
  3. Apply operating-system sandboxing to that process, including a dedicated unprivileged identity, a read-only filesystem where possible, strict resource limits, and denied network access.
  4. Use an explicit allowlist for files or plugins and verify their cryptographic hashes or signatures before execution.
  5. Clearly warn users that Python prediction files are executable programs, not passive model data, and require explicit confirmation before loading untrusted files.
  6. Do not treat restricted exec() globals as a sufficient security boundary; Python evaluation requires process-level isolation for hostile code.
  7. Add a security test that supplies a prediction file with a top-level side effect and verifies that the main attribution process cannot execute that side effect.
Vulnerability Patterns
  • 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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (15)

Dangerous chain: exec() wrapping compile

Critical
Category
Dangerous Code Execution
Confidence
99% confidence
Finding

The program reads a Python file path from the user-controlled --predict argument, compiles its contents, and executes it with exec(). This is arbitrary code execution: any attacker who can influence that file or path can run OS commands, read secrets, or modify the environment with the privileges of the process.

Content

Scanner excerpt · scripts/attributor.py (reported line 125)May include surrounding context.

python
return selftest()
    if not (a.data and a.predict and a.instance):
        print("用法: attributor.py --data d.json --predict p.py --instance i.json [--label label]"); sys.exit(2)
    ns = {}; exec(compile(open(a.predict, encoding="utf-8").read(), a.predict, "exec"), ns)
    predict = ns["predict"]
    rows = json.load(open(a.data, encoding="utf-8"))
    inst = json.load(open(a.instance, encoding="utf-8"))

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

If the code truly lacks the advertised attribution features and instead performs undeclared persistence of usage logs, error patterns, user preferences, and self-optimization telemetry for arbitrary skills, then the skill is materially deceptive. Hidden logging and telemetry create confidentiality and trust risks, especially in a public skill, because users may expose sensitive datasets, model logic, or prompts under the assumption that the tool only performs local explainability analysis.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

If the code truly lacks the advertised attribution features and instead performs undeclared persistence of usage logs, error patterns, user preferences, and self-optimization telemetry for arbitrary skills, then the skill is materially deceptive. Hidden logging and telemetry create confidentiality and trust risks, especially in a public skill, because users may expose sensitive datasets, model logic, or prompts under the assumption that the tool only performs local explainability analysis.

Content

No source excerpt is available for this finding.

exec() call detected

High
Category
Dangerous Code Execution
Confidence
98% confidence
Finding

The exec() call executes dynamically supplied code derived from external input. In this skill, the feature is especially dangerous because the tool is explicitly designed to load arbitrary predictor logic, so the attack surface is not incidental but central to normal operation.

Content

Scanner excerpt · scripts/attributor.py (reported line 125)May include surrounding context.

python
return selftest()
    if not (a.data and a.predict and a.instance):
        print("用法: attributor.py --data d.json --predict p.py --instance i.json [--label label]"); sys.exit(2)
    ns = {}; exec(compile(open(a.predict, encoding="utf-8").read(), a.predict, "exec"), ns)
    predict = ns["predict"]
    rows = json.load(open(a.data, encoding="utf-8"))
    inst = json.load(open(a.instance, encoding="utf-8"))

Direct flow: open (file read) → exec (code execution)

High
Category
Data Flow
Confidence
99% confidence
Finding

This is a direct untrusted data flow from open(...).read() into exec(), which forms a classic file-to-code execution sink. Because the path is provided at runtime, an attacker can point the tool at any malicious Python file and obtain immediate code execution in the current process context.

Content

Scanner excerpt · scripts/attributor.py (reported line 125)May include surrounding context.

python
return selftest()
    if not (a.data and a.predict and a.instance):
        print("用法: attributor.py --data d.json --predict p.py --instance i.json [--label label]"); sys.exit(2)
    ns = {}; exec(compile(open(a.predict, encoding="utf-8").read(), a.predict, "exec"), ns)
    predict = ns["predict"]
    rows = json.load(open(a.data, encoding="utf-8"))
    inst = json.load(open(a.instance, encoding="utf-8"))

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The file implements a generic cross-skill telemetry and self-improvement module that is unrelated to an interpretable attribution engine, creating a clear scope mismatch. In practice, this broadens data collection and persistence across arbitrary skills, increasing the chance of unnecessary retention of operational metadata and user-derived information beyond the declared purpose.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
82% confidence
Finding

The skill declares executable behavior with file-write capability but does not declare any tool scope or permissions boundary. In an agent ecosystem, missing scope declarations can cause the skill to run with broader ambient authority than users or orchestrators expect, increasing the risk of unauthorized file modification or abuse through chained execution.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file’s user-facing natural-language description, usage guidance, and limitations are presented only in Chinese. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified or alternatives are offered.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest-level description and module docstring explicitly advertise a counterfactual capability ('最少特征反事实翻转'). However, in normal execution the CLI only computes global importance, local importance, and a rationale; counterfactual() is defined but never called from main(). This is a direct mismatch between claimed skill behavior and the actual exposed behavior.

Content

No source excerpt is available for this finding.

compile() call detected

Medium
Category
Dangerous Code Execution
Confidence
65% confidence
Finding

compile() creates code objects from strings. When combined with exec()/eval(), it enables obfuscated code execution.

Content

Scanner excerpt · scripts/attributor.py (reported line 125)May include surrounding context.

python
return selftest()
    if not (a.data and a.predict and a.instance):
        print("用法: attributor.py --data d.json --predict p.py --instance i.json [--label label]"); sys.exit(2)
    ns = {}; exec(compile(open(a.predict, encoding="utf-8").read(), a.predict, "exec"), ns)
    predict = ns["predict"]
    rows = json.load(open(a.data, encoding="utf-8"))
    inst = json.load(open(a.instance, encoding="utf-8"))

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The module advertises itself as a generic self-evolving system for any WorkBuddy skill, which contradicts the declared identity of this package as an interpretable attribution engine. This mismatch is dangerous because it signals hidden or non-essential behavior, making it harder for users and reviewers to understand what data is being collected and why.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The natural-language documentation, usage text, and later CLI-visible strings are presented exclusively in Chinese, with no language selection or opt-in. This can violate language/locale policy because the skill imposes one locale on all users rather than offering a choice or clearly limiting itself to a Chinese-only context.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code persistently stores arbitrary preferences, free-form notes, recent operations, and error histories to disk without any validation, minimization, or consent flow. Because notes and preferences can easily contain sensitive prompts, model inputs, filenames, or business context, this creates a privacy and data-governance risk that is not justified by the skill's stated attribution purpose.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The module writes user preferences and free-form notes to a persistent JSON file with no user-facing warning, consent prompt, or sensitivity guidance. Even if intended for convenience, silent local persistence can expose sensitive operational details to other local users, backups, or later unintended processing.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The argument parser description and printed status/output strings are all hardcoded in Chinese. Because these are user-visible runtime messages and no locale choice is offered, the script enforces a single language for interaction.

Content

No source excerpt is available for this finding.