Back to skill

Security audit

Social Case to Excel

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent research workflow, but it should be reviewed because its build and QA scripts execute matching Python files from shared /tmp paths.

Install only if you are comfortable reviewing and running the scripts manually. Use a private per-run working directory, replace /tmp wildcard Python execution with explicit reviewed file lists or JSON inputs, and do not run the workbook or QA builders on a shared machine where another user or process could create matching /tmp files. Keep ClaudeBaby tokens in the configured MCP store or environment and check generated reports for accidental credential leakage before sharing.

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/08_build_xlsx.py:52
Finding

Arbitrary Python Execution Through Shared Temporary-Directory Wildcards

Content
View full analysis

Vulnerability Details

File Location: scripts/08_build_xlsx.py, lines 52–62
Vulnerability Type: Execution of untrusted Python files from a shared temporary directory
Risk Level: High

Vulnerable Code

python
CASES = []
for f in sorted(glob.glob('/tmp/cb_rows*.py')):
    ns = {}
    exec(open(f, encoding='utf-8').read(), ns)
    CASES += ns.get('CASES', [])
print('CASES:', len(CASES), '| Unique tid:', len({c['tid'] for c in CASES}))

MAN = {}
POST = {}
for f in sorted(glob.glob('/tmp/tcb*.py')):
    ns = {}
    exec(open(f, encoding='utf-8').read(), ns)
    MAN.update(ns.get('MAN', {}))
    POST.update(ns.get('POST', {}))

Technical Analysis

The workbook builder discovers Python files using broad wildcard patterns in the system-wide /tmp directory and executes every matching file with exec(). It does not enforce an explicit file manifest, validate ownership or permissions, reject symbolic links, or verify that resolved paths belong to a private workspace.

Although the Skill documentation says to use only reviewed writing files, that requirement is not enforced in the execution path. On systems where /tmp is shared among users or processes, an independent local attacker can introduce an additional matching file. Its contents will then execute with the identity and privileges of the user running the Skill.

This is an exploitable coding flaw, not evidence that the packaged project itself contains an intentionally malicious payload.

Attack Path

  1. An attacker with access to the same host creates a file such as /tmp/cb_rows_attacker.py or /tmp/tcb_attacker.py.
  2. The file contains arbitrary Python statements and may optionally define the expected variables to avoid an immediate build failure.
  3. The victim follows the documented workflow and runs scripts/08_build_xlsx.py.
  4. glob.glob() includes the attacker-created file without distinguishing it from reviewed ...[truncated 839 chars]
Remediation
View remediation

Remediation Suggestions

  1. Replace executable Python data files with a non-executable format such as JSON and validate the parsed schema before use.
  2. Store all intermediate files in a private workspace created with mode 0700, rather than in the shared /tmp namespace.
  3. Replace wildcard discovery with an explicit manifest of files created and reviewed for the current run.
  4. Resolve each candidate with Path.resolve() and verify that it remains beneath the intended private workspace.
  5. Reject symbolic links and non-regular files, and verify that each file is owned by the current user and is not writable by group or others.
  6. If Python modules remain necessary, avoid unrestricted exec() and isolate execution in a sandboxed, least-privileged process with no unnecessary credentials or network access.
  7. Generate unpredictable per-run directories with secure APIs such as tempfile.TemporaryDirectory() and pass the workspace path explicitly through the build pipeline.
Vulnerability Patterns
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (115)

Dangerous chain: exec() wrapping compile

Critical
Category
Dangerous Code Execution
Confidence
95% confidence
Finding

The script reads Python source from disk and immediately executes it via compile()+exec(). Even though the path is locally constructed and intended for a self-test harness, any attacker who can modify or replace 05_screen.py gains arbitrary code execution when this test is run, and the execution occurs in-process with the current user's privileges.

Content

Scanner excerpt · scripts/qa/_selftest_reddit_source.py (reported line 183)May include surrounding context.

python
try:
    import contextlib
    with contextlib.redirect_stdout(buf):
        exec(compile(open(os.path.join(SC, '05_screen.py'), encoding='utf-8').read(), '05', 'exec'),
             {'__name__': 'not_main'})
    chk('05_screen 跑完并出了候选池', os.path.exists('/tmp/cbx_short2.json'))
except Exception as e:                                        # noqa: BLE001

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
89% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This finding explicitly references dynamic execution of local temporary Python files (exec /tmp/tcb1.py to /tmp/tcb6.py). Executing generated or temp-located Python is a classic arbitrary-code-execution hazard because any upstream corruption, path hijack, or unintended file write can change what runs; combined with shell, file, and possible network capabilities, the blast radius is significant.

Content

No source excerpt is available for this finding.