Back to skill

Security audit

bioinfo-style

Security checks for vulnerabilities and agentic risk

Overview

This bioinformatics skill is mostly coherent, but it asks agents to run local scripts and installs, and its helper script can write logs outside the intended directory.

Review this skill before installing if you expect a guidance-only assistant. Use it only in a project directory where generated scripts, logs, and Conda/Mamba environment changes are acceptable; avoid passing arbitrary step names to scripts/run_step.sh unless it is hardened first.

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/run_step.sh:8
Finding

Path Traversal and Unsafe Shell Argument Expansion in Step Runner

Content
View full analysis
<脚本文件>" echo "示例: bash run_step.sh qc 01_qc.sh" exit 1 fi if [ ! -f "$SCRIPT" ]; then echo "错误: 脚本 $SCRIPT 不存在" exit 1 fi echo "[$(date '+%Y-%m-%d %H:%M:%S')] 开始执行: $SCRIPT" | tee $LOG_FILE echo "[$(date '+%Y-%m-%d %H:%M:%S')] 日志: $LOG_FILE" | tee -a $LOG_FILE set -e bash $SCRIPT 2>&1 | tee -a $LOG_FILE ``` ### Technical Analysis The script accepts `STEP_NAME` from its first positional argument and directly incorporates it into `LOG_FILE`: ```bash LOG_FILE="${LOG_DIR}/${STEP_NAME}.log" ``` No validation prevents directory separators, `..` traversal components, or other unsafe path content. Consequently, a value such as `../../target` produces `logs/../../target.log`. The first `tee` invocation opens the resulting path without append mode and therefore truncates an existing writable file before writing the initial status message. The script also uses `$SCRIPT` and `$LOG_FILE` without quotation when invoking `bash` and `tee`. Shell expansion therefore applies word splitting and pathname expansion. This can make the command operate on multiple arguments or paths rather than the single file that was validated. It does not, by itself, reinterpret shell metacharacters embedded in the variable as new shell syntax, but it can still cause unintended script selection, additional arguments, or multiple log destinations. The vulnerability is reachable by anyone able to invoke this wrapper with attacker-controlled arguments. Exploitation occurs with the privileges of the account running the Skill. ### Attack Path 1. The attacker identifies a wri ...[truncated 1767 chars]
Remediation
View remediation
&2 exit 1 fi ``` 2. Quote every variable used as a shell argument and use `--` to terminate utility options: ```bash mkdir -p -- "$LOG_DIR" bash -- "$SCRIPT" 2>&1 | tee -a -- "$LOG_FILE" ``` 3. Canonicalize the log directory and verify that the final destination remains inside it before opening the file. 4. Reject pre-existing symbolic links as log destinations where practical. For stronger protection, create log files using a mechanism that performs atomic creation and disallows symlink following. 5. Use strict shell behavior and preserve pipeline error handling explicitly: ```bash set -euo pipefail ``` 6. A hardened implementation could begin as follows: ```bash #!/usr/bin/env bash set -euo pipefail STEP_NAME=${1:-step} SCRIPT=${2:-} LOG_DIR="logs" if [[ ! "$STEP_NAME" =~ ^[A-Za-z0-9._-]+$ ]]; then printf 'Invalid step name\n' >&2 exit 1 fi if [[ -z "$SCRIPT" || ! -f "$SCRIPT" ]]; then printf 'Invalid script file: %s\n' "$SCRIPT" >&2 exit 1 fi mkdir -p -- "$LOG_DIR" LOG_FILE="${LOG_DIR}/${STEP_NAME}.log" printf '[%s] Starting: %s\n' "$(date '+%Y-%m-%d %H:%M:%S')" "$SCRIPT" | tee -- "$LOG_FILE" bash -- "$SCRIPT" 2>&1 | tee -a -- "$LOG_FILE" ``` 7. Add regression tests covering traversal strings, absolute-looking paths, whitespace, wildcard characters, option-like values, and symbolic-link destinations. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (9)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest description says the skill activates for '任何需要调用成熟生信工具而非编写Python/R算法代码的分析任务', which is a very broad natural-language trigger with unclear boundaries. This can overlap with many ordinary analysis requests and does not provide exclusion conditions or negative examples to constrain invocation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill explicitly instructs creation of environments, package installation, script generation, and shell execution without any user-facing confirmation or warning about filesystem and system changes. In practice, this can lead to unexpected command execution, package installation, data processing, or modification of the working environment when the user may have only requested guidance.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

This markdown file is natural-language instructional content, and it consistently forces a single language/locale experience for users. The policy explicitly flags language or locale constraints when the skill does not provide user opt-in or justify the restriction as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This shell script includes its title, usage text, examples, and runtime messages entirely in Chinese, which imposes a specific language on users without opt-in. Under the policy, forced language or locale without user choice or a justified regional constraint is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The natural-language description and headings are written entirely in Chinese and present the workflow as the default operating mode, with no indication that users may choose another language. This may violate language/locale policy if the organization requires not forcing a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The '关键规则' section explicitly requires every step to be written as a .sh script and recorded to the logs/ directory. However, the concrete examples only create and run scripts such as 01_qc.sh, 02_alignment.sh, and 04_enrichment.sh directly, with no redirection, tee, or log file handling, so the documented intent is not reflected in the actual workflow shown.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

Sourcing ~/.bashrc executes arbitrary shell commands from a user-controlled startup file before analysis begins, which can trigger unintended code execution, environment poisoning, or aliases/functions that change tool behavior. In a skill that then runs many shell commands on user data, this increases the chance of unsafe side effects and undermines the claim that raw data handling is controlled and reproducible.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The file content, headings, and usage descriptions are all presented in Chinese, with no indication that users may request another language or that the document is intended only for a Chinese-language audience. Per the policy check, forcing a specific language without user opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

This markdown file provides executable mamba create and mamba install commands that will modify the user's local environment and install many packages, but it does not include any warning or note that running them will create or alter a Conda environment. Under the markdown-specific warning criterion, environment-affecting behavior should be disclosed when it could affect user system state.

Content

No source excerpt is available for this finding.