Back to skill

Security audit

Python Auto Dev

Security checks for vulnerabilities and agentic risk

Overview

The skill is a disclosed Python automation workflow, but its scripts contain unsafe command and source generation paths that can turn normal testing or profiling into unintended code execution.

Review this skill before installing. It is not showing hidden exfiltration or persistence, but it should only be used in a disposable or tightly scoped workspace with non-sensitive environment variables. Avoid running it on untrusted specs, filenames, paths, or code until command invocation and generated-source handling are fixed, and pin dependencies for controlled environments.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (5)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/run_tests.py:23
Finding

OS Command Injection in the Test Runner

Content
View full analysis
tuple[int, str, str]: """ Activate conda environment and run a command. Returns (return_code, stdout, stderr) """ # Build command to activate conda env and run the command # Note: Path has no spaces, so no quoting needed conda_activate_cmd = f'call {DEFAULT_CONDA_PATH} activate {DEFAULT_ENV}' full_cmd = f"{conda_activate_cmd} && {' '.join(command)}" # Run via cmd.exe proc = subprocess.run( ["cmd.exe", "/c", full_cmd], capture_output=True, text=True, cwd=PROJECT_DIR, env=os.environ.copy() ) return proc.returncode, proc.stdout, proc.stderr ``` The untrusted test path reaches this helper as follows: ```python test_path = Path(test_dir) if not test_path.exists(): return {"error": f"Test directory not found: {test_dir}"} cmd = ["pytest", str(test_path), "-v", "--tb=short"] if junit_xml: cmd.extend(["--junit-xml", junit_xml]) returncode, stdout, stderr = activate_conda_and_run(cmd) ``` ### Technical Analysis The script initially represents the pytest invocation as an argument list, but then destroys the argument boundaries by joining the list into a single string: ```python ' '.join(command) ``` The resulting string is passed to `cmd.exe /c`, which interprets shell control characters such as `&`, `&&`, `|`, redirection operators, parentheses, and environment-variable expansions. The value supplied through `--test-dir` is included without shell quoting or escaping. Checking that the directory exists does not neutralize this issue because Windows filenames can contain some command-shell metacharacters, including `&`. An attacker able to create or reference a suitably named directo ...[truncated 1235 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/optimize_code.py:25
Finding

OS Command Injection in Profiling and Code-Quality Operations

Content
View full analysis
tuple[int, str, str]: """Activate conda environment and run a command.""" if cwd is None: cwd = PROJECT_DIR # Note: Path has no spaces, so no quoting needed conda_activate_cmd = f'call {DEFAULT_CONDA_PATH} activate {DEFAULT_ENV}' full_cmd = f"{conda_activate_cmd} && {' '.join(command)}" proc = subprocess.run( ["cmd.exe", "/c", full_cmd], capture_output=True, text=True, cwd=cwd, env=os.environ.copy() ) return proc.returncode, proc.stdout, proc.stderr ``` User-controlled paths are passed to this helper in multiple locations: ```python cmd = ["python", "-m", "cProfile", "-o", profile_output, str(code_file)] returncode, stdout, stderr = activate_conda_and_run(cmd) ``` ```python cmd = ["pylint", str(code_file), "--output-format=json"] returncode, stdout, stderr = activate_conda_and_run(cmd) ``` ```python cmd = ["flake8", str(code_file), "--format=json"] returncode, stdout, stderr = activate_conda_and_run(cmd) ``` ### Technical Analysis The `--code` and `--profile` command-line values are incorporated into an argument list but later concatenated into a single unquoted shell command. Because the result is executed through `cmd.exe /c`, shell metacharacters in either path are interpreted as command syntax rather than literal filename characters. The code-file existence check is insufficient because it only confirms that the supplied path exists. It does not quote the path, enforce a trusted directory, or prevent a crafted filename from carrying command-shell syntax. The profile output is also attacker-controlled and does not need to exist before use, creatin ...[truncated 1346 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/generate_code.py:77
Finding

Python Source Injection Through the Code-Generation Specification

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/create_tests.py:78
Finding

Generated-Test Source Injection Through an Unvalidated Module Filename

Content
View full analysis
.py)") args = parser.parse_args() code_path = Path(args.code) if not code_path.exists(): print(f"Error: Code file not found: {code_path}") sys.exit(1) analysis = analyze_code(str(code_path)) ``` The generated source is then written to a test file: ```python test_code = generate_test_code(analysis) with open(output_path, 'w', encoding='utf-8') as f: f.write(test_code) ``` ### Technical Analysis `Path(...).stem` is not guaranteed to be a valid Python identifier. The value is inserted after the `import` keyword without validation or encoding. A crafted filename can therefore introduce statement separators and additional Python expressions into the generated test module. The source file itself only needs to exist and contain syntax accepted by `ast.parse()`. The filename is independently used to construct executable test source. When pytest collects the generated test, all injected top-level statements execute. ### Attack Path 1. An attacker creates a valid Python source file with a crafted filename whose stem contains Python statement syntax. 2. The attacker passes that file through `create_tests.py --code`. 3. `analyze_code()` parses the file and reco ...[truncated 805 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
references/script-usage.md:157
Finding

Unpinned Third-Party Dependency Installation

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (18)

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/optimize_code.py (reported line 39)May include surrounding context.

python
capture_output=True,
        text=True,
        cwd=PROJECT_DIR,
        env=os.environ.copy()
    )

    return proc.returncode, proc.stdout, proc.stderr

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/run_tests.py (reported line 39)May include surrounding context.

python
capture_output=True,
        text=True,
        cwd=PROJECT_DIR,
        env=os.environ.copy()
    )

    return proc.returncode, proc.stdout, proc.stderr

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/run_tests.py (reported line 66)May include surrounding context.

python
capture_output=True,
        text=True,
        cwd=PROJECT_DIR,
        env=os.environ.copy()
    )

    return proc.returncode, proc.stdout, proc.stderr

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill is framed to activate for very broad Python coding tasks, which increases the chance it will be invoked in situations where automatic code generation, test execution, file creation, and modification are unnecessary or risky. Because the skill bundles end-to-end execution and patching behavior, overbroad triggering expands the attack surface and can lead to unintended filesystem changes or execution of generated code in response to generic requests.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill description presents automated generation, testing, debugging, and optimization without prominently warning that it will write files, create tests, and may patch code automatically. This can mislead operators into invoking it as if it were advisory-only, increasing the risk of unintended modifications to local projects and execution-related side effects in the configured workspace.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The debug_code.py section states --output is a path for patched code at L090, which indicates the tool can emit modified code. This conflicts with the note at L104 saying it 'Does not auto-patch for safety,' creating an intent-level contradiction about whether code modification occurs.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The top-level docstring and usage text present the tool as one that can suggest fixes or apply patches. However, later logic only analyzes failures and, even when an output path is supplied, prints that automatic patching is disabled for safety and performs no patch write, creating a direct contradiction between documentation and actual behavior.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The CLI help for --output says it is an output file for patched code and implies the original may be overwritten if a patch is applied. In practice, the code never calls apply_patch, never writes modified code to either the output path or the original file, and instead prints that automatic patching is disabled.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The script persists a debug report to a fixed project directory and includes raw traceback data plus analysis derived from user-supplied code/test artifacts. Tracebacks and related debugging context can contain sensitive file paths, secrets, tokens, environment details, or proprietary code context, causing unintended local data exposure or retention.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module docstring frames the script as optimizing code through profiling and quality checks, which suggests analysis behavior. However, the profiling path at L66-L68 actually runs the supplied Python file via python -m cProfile, meaning the target code is executed and can have arbitrary side effects. This is a meaningful intent mismatch because 'check/analyze' wording understates that the script will execute untrusted code.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
96% confidence
Finding

The script builds a shell command string with ' && '.join(command) and runs it through cmd.exe /c, which makes any attacker-controlled element in command subject to Windows shell parsing. Because code_path ultimately flows into command and is not safely quoted or passed as argv directly, a crafted filename containing shell metacharacters could trigger command injection and arbitrary command execution.

Content

Scanner excerpt · scripts/optimize_code.py (reported line 34)May include surrounding context.

python
conda_activate_cmd = f'call {DEFAULT_CONDA_PATH} activate {DEFAULT_ENV}'
    full_cmd = f"{conda_activate_cmd} && {' '.join(command)}"

    proc = subprocess.run(
        ["cmd.exe", "/c", full_cmd],
        capture_output=True,
        text=True,

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Profiling a user-supplied Python file executes that file with the full privileges and environment of the current user. In an agent-skill context, this is more dangerous because users may treat the tool as analysis-only, while --run-profile actually runs potentially untrusted code that can read files, make network calls, or modify the system.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code explicitly performs shell execution by concatenating command parts into a cmd.exe string. In this context the script accepts user-supplied paths and then runs pytest, so shell parsing of those values can turn a normal test run into arbitrary command execution.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
96% confidence
Finding

The script builds a single cmd.exe command string from argument-derived values and executes it through the Windows shell. Because shell metacharacters are interpreted by cmd.exe, a crafted test path, report path, or other command element could lead to command injection and arbitrary command execution in the context of the user running the script.

Content

Scanner excerpt · scripts/run_tests.py (reported line 34)May include surrounding context.

python
full_cmd = f"{conda_activate_cmd} && {' '.join(command)}"

    # Run via cmd.exe
    proc = subprocess.run(
        ["cmd.exe", "/c", full_cmd],
        capture_output=True,
        text=True,

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The run_tests docstring states that code_dir is 'added to PYTHONPATH', and lines L066-L069 build a modified env dict accordingly. However, that env is never passed into the subprocess; activate_conda_and_run uses a fresh os.environ.copy() at L039, so the documented behavior does not occur.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

This code performs filesystem writes later in the script, but the top-level docstring and usage block only say it will 'create unit tests' for a given file without clearly disclosing that it writes an output file and may create directories. For a code file, file-writing behavior should have some visible disclosure via comments, docstring, or user-facing messaging before the operation occurs.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The script writes a JSON report to a user-specified or auto-generated path, which is a file-write operation affecting the local filesystem. The final print confirms the location after the fact, but there is no prior warning, prompt, or explanatory comment highlighting that the tool creates report files and directories.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This code performs a file write to a user-supplied or auto-generated path. While it prints the report path after writing, there is no prior disclosure in the CLI help or module documentation that running the script will create a report file and may overwrite an existing file at the provided location.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.