Back to skill

Security audit

Molecular Docking AutoDock

Security checks for vulnerabilities and agentic risk

Overview

This molecular docking skill has a coherent purpose, but crafted file paths could make its script run unintended shell commands, so it needs review before installation.

Install only in an isolated, unprivileged environment or container, and do not run it on file paths or output directories supplied by untrusted users until the shell=True calls are replaced with safe argument-list subprocess calls and paths are constrained. Prefer pinned dependencies and verify the P2Rank download before use.

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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/molecular_docking.py:45
Finding

OS Command Injection Through User-Controlled File and Directory Paths

Content
View full analysis

Vulnerability Details

File Location: scripts/molecular_docking.py, lines 45-46, 90-91, 146-147, and 171-172
Vulnerability Type: Shell command injection
Risk Level: High

Vulnerable Code

python
temp_pdb = os.path.join(self.output_dir, "protein_no_water.pdb")
io.save(temp_pdb, NonWaterAndStandardSelect())

cmd = f"obabel {temp_pdb} -O {self.prepared_pdbqt} -xr -h --partialcharge gasteiger"
subprocess.run(cmd, shell=True, check=True, capture_output=True)
python
p2rank_output = os.path.join(self.output_dir, "p2rank_output")
os.makedirs(p2rank_output, exist_ok=True)
cmd = f"prank predict -f {self.protein_pdb} -o {p2rank_output}"
subprocess.run(cmd, shell=True, check=True, capture_output=True)
python
cmd = f"vina --config {config_file}"
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
python
ligand_pdb = os.path.join(self.output_dir, f"ligand_mode_{i+1}.pdb")
cmd = f"obabel {self.docking_pdbqt} -O {ligand_pdb} -m -f {i+1} -l {i+1}"
subprocess.run(cmd, shell=True, check=True, capture_output=True)

Technical Analysis

The script constructs shell command strings by directly interpolating paths derived from command-line arguments. In particular:

  • self.output_dir originates from the user-controlled --output_dir argument.
  • self.protein_pdb originates from the user-controlled --protein argument.
  • config_file, prepared_pdbqt, p2rank_output, and docking_pdbqt are derived from those paths.

These strings are passed to subprocess.run(..., shell=True). Consequently, shell metacharacters such as semicolons, command substitutions, redirections, pipes, and comment characters are interpreted by the operating-system shell rather than treated as literal filename characters.

No shell is required for any of these operations. obabel, prank, and vina can all be invoked directly with an argument list. Using a shell ther ...[truncated 2268 chars]

Remediation
View remediation

Remediation Suggestions

  1. Replace every shell command string with a fixed argument list and leave shell disabled:

    python
    subprocess.run(
        [
            "obabel",
            temp_pdb,
            "-O",
            self.prepared_pdbqt,
            "-xr",
            "-h",
            "--partialcharge",
            "gasteiger",
        ],
        check=True,
        capture_output=True,
        text=True,
    )
    
    python
    subprocess.run(
        ["prank", "predict", "-f", self.protein_pdb, "-o", p2rank_output],
        check=True,
        capture_output=True,
        text=True,
    )
    
    python
    result = subprocess.run(
        ["vina", "--config", config_file],
        check=True,
        capture_output=True,
        text=True,
    )
    
    python
    subprocess.run(
        [
            "obabel",
            self.docking_pdbqt,
            "-O",
            ligand_pdb,
            "-m",
            "-f",
            str(i + 1),
            "-l",
            str(i + 1),
        ],
        check=True,
        capture_output=True,
        text=True,
    )
    
  2. Resolve paths with pathlib.Path.resolve() and enforce an approved workspace root if the deployment model does not require arbitrary filesystem locations.

  3. Reject output directories that are files, symlinks to unauthorized locations, or outside the permitted workspace.

  4. Validate that the input protein is a regular file with an expected extension and impose reasonable file-size limits before parsing it.

  5. Run docking tools under a dedicated, unprivileged account or sandbox with:

    • No access to unrelated user files or credentials.
    • Restricted outbound network access.
    • CPU, memory, process, and storage limits.
    • A dedicated temporary and output directory.
  6. Add regression tests using paths containing spaces and shell metacharacters to verify that th ...[truncated 74 chars]

T08 · Insecure Dependencies

Warning
Location
SKILL.md:14
Finding

Unverified and Unpinned Third-Party Dependency Installation

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 14-21
Vulnerability Type: Insecure dependency acquisition and supply-chain integrity weakness
Risk Level: Medium

Vulnerable Code

bash
conda install -c conda-forge autodock-vina pymol-open-source rdkit openbabel
pip install meeko biopython
bash
# Install the p2rank pocket-prediction tool
wget https://github.com/rdk/p2rank/releases/download/2.4/p2rank_2.4.tar.gz
tar -xzf p2rank_2.4.tar.gz && export PATH=$PATH:$(pwd)/p2rank_2.4

Technical Analysis

The installation instructions retrieve packages and an executable tool without verifying cryptographic integrity:

  • The Conda and pip dependencies are not pinned to exact versions or artifact hashes.
  • The downloaded P2Rank archive is not checked against an expected SHA-256 digest or a trusted signature.
  • The extracted P2Rank directory is added to PATH, after which the Python script invokes prank.
  • The archive is extracted directly into the current directory rather than a controlled staging directory.

HTTPS protects transport in ordinary circumstances, but it does not establish that the artifact remains identical to the one reviewed. A compromised hosting account, release pipeline, package registry, dependency account, or maliciously replaced artifact could supply different executable content.

Adding an extracted directory to PATH also expands the executable trust boundary. If that directory contains an unexpected prank executable, or if extraction occurs in an attacker-influenced location, the subsequent pocket-prediction operation can execute attacker-controlled code.

P2Rank is only required for text-based pocket prediction, so downloading and trusting this executable is not necessary when the user provides explicit pocket coordinates. Installation should remain optional and should not occur automatically during ordinary docking.

Attack Path

A represe ...[truncated 1808 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin every dependency to a reviewed version. Use a Conda environment file and a hash-locked Python requirements file rather than unconstrained installation commands.

  2. Publish an expected SHA-256 digest for the P2Rank archive and verify it before extraction:

    bash
    wget -O p2rank_2.4.tar.gz \
      https://github.com/rdk/p2rank/releases/download/2.4/p2rank_2.4.tar.gz
    
    echo "EXPECTED_SHA256  p2rank_2.4.tar.gz" | sha256sum --check --strict
    

    The placeholder must be replaced with a digest obtained through a trusted, independently verified channel.

  3. Prefer a signed release and verify the signature against a pinned maintainer key where the upstream project provides signatures.

  4. Download into a newly created staging directory, inspect archive members, and reject absolute paths, parent-directory traversal, symlinks, and unexpected executable files before extraction.

  5. Install the tool into an explicit application directory and invoke it by its validated absolute path. Do not prepend a relative extraction directory to PATH.

  6. Keep P2Rank installation optional. When explicit pocket coordinates are supplied, the Skill should neither download nor execute P2Rank.

  7. Perform installation in an isolated, unprivileged environment or container. Do not install these packages as root or into a shared system Python/Conda environment.

  8. Generate and retain a software bill of materials, review transitive dependencies, and use automated vulnerability and provenance checks in the release process.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (17)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
99% confidence
Finding

This is a classic tool-parameter abuse issue: user-influenced filesystem paths are embedded directly into a shell command. In an agent skill context, this is especially dangerous because user-supplied parameters may come from untrusted prompts or upstream tools, turning a scientific workflow into a shell execution primitive.

Content

Scanner excerpt · scripts/molecular_docking.py (reported line 40)May include surrounding context.

python
# Step 2: Convert to PDBQT with AutoDock Tools script or obabel
        cmd = f"obabel {temp_pdb} -O {self.prepared_pdbqt} -xr -h --partialcharge gasteiger"
        subprocess.run(cmd, shell=True, check=True, capture_output=True)
        os.remove(temp_pdb)
        return self.prepared_pdbqt

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
99% confidence
Finding

The pocket prediction step exposes a direct command injection path through the protein filename and output directory parameters. In this skill context, free-form user inputs and file paths are expected, which increases the danger because an attacker can disguise payloads as normal scientific inputs.

Content

Scanner excerpt · scripts/molecular_docking.py (reported line 90)May include surrounding context.

python
p2rank_output = os.path.join(self.output_dir, "p2rank_output")
        os.makedirs(p2rank_output, exist_ok=True)
        cmd = f"prank predict -f {self.protein_pdb} -o {p2rank_output}"
        subprocess.run(cmd, shell=True, check=True, capture_output=True)
        
        # Read top pocket result
        predict_file = os.path.join(p2rank_output, os.path.basename(self.protein_pdb).replace(".pdb", "_predictions.csv"))

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

Although the command string is shorter, it still routes a user-influenced path through a shell. In an automated agent environment, even indirect path control can be enough for exploitation, making this a meaningful abuse vector if output_dir can contain shell metacharacters.

Content

Scanner excerpt · scripts/molecular_docking.py (reported line 139)May include surrounding context.

python
# Run VINA
        cmd = f"vina --config {config_file}"
        result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
        if result.returncode != 0:
            raise RuntimeError(f"VINA docking failed: {result.stderr}")

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

The result export step again turns user-influenced paths into shell syntax, enabling arbitrary command execution late in the workflow. Because this occurs after docking, it may be overlooked operationally, but it still gives an attacker a reliable execution point.

Content

Scanner excerpt · scripts/molecular_docking.py (reported line 162)May include surrounding context.

python
for i in range(self.num_modes):
            ligand_pdb = os.path.join(self.output_dir, f"ligand_mode_{i+1}.pdb")
            cmd = f"obabel {self.docking_pdbqt} -O {ligand_pdb} -m -f {i+1} -l {i+1}"
            subprocess.run(cmd, shell=True, check=True, capture_output=True)
            ligand_pdbs.append(ligand_pdb)
        
        # Combine protein and top ligand into complex PDB

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill documents shell execution, file reads, and file writes, but does not declare any explicit tool scope or permission boundaries. In an agent environment, this creates an over-privileged or ambiguously privileged execution model where the runtime may grant broader access than users expect, increasing the risk of unsafe filesystem access or command execution.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill automatically removes water molecules and non-standard residues during protein preprocessing without prominently warning the user that this can materially change the biological system being modeled. In molecular docking, such silent transformation can invalidate scientific results, omit critical cofactors or bound waters, and lead users to trust altered outputs without informed consent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script builds and runs shell commands using user-supplied or user-controlled paths such as the protein file and output directory. Although the code comments describe the step, there is no user-facing warning or confirmation that external executables will be invoked via the shell on those inputs.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
98% confidence
Finding

This command is built with string interpolation and executed with shell=True, while temp_pdb and prepared_pdbqt derive from user-controllable paths via output_dir. An attacker can supply shell metacharacters in paths and achieve command injection, causing arbitrary command execution under the privileges of the process.

Content

Scanner excerpt · scripts/molecular_docking.py (reported line 40)May include surrounding context.

python
# Step 2: Convert to PDBQT with AutoDock Tools script or obabel
        cmd = f"obabel {temp_pdb} -O {self.prepared_pdbqt} -xr -h --partialcharge gasteiger"
        subprocess.run(cmd, shell=True, check=True, capture_output=True)
        os.remove(temp_pdb)
        return self.prepared_pdbqt

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest says the skill supports a pocket 'text description or coordinate range' as input, which implies the textual description will be used to specify the pocket. In the code, any non-coordinate text triggers an external pocket-prediction run and the returned docking box is simply the top predicted pocket, so the user's textual pocket description is not semantically honored.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

When the pocket description is not in coordinate form, the script automatically runs the external p2rank tool. A print statement appears only at execution time, but the CLI help and overall workflow description do not warn users that free-text pocket input causes an additional external analysis step and output generation.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
99% confidence
Finding

The prank command interpolates self.protein_pdb and p2rank_output into a shell command and executes it with shell=True. Because protein_pdb comes directly from CLI input and output_dir is user-influenced, crafted values can inject additional shell commands and lead to arbitrary code execution.

Content

Scanner excerpt · scripts/molecular_docking.py (reported line 90)May include surrounding context.

python
p2rank_output = os.path.join(self.output_dir, "p2rank_output")
        os.makedirs(p2rank_output, exist_ok=True)
        cmd = f"prank predict -f {self.protein_pdb} -o {p2rank_output}"
        subprocess.run(cmd, shell=True, check=True, capture_output=True)
        
        # Read top pocket result
        predict_file = os.path.join(p2rank_output, os.path.basename(self.protein_pdb).replace(".pdb", "_predictions.csv"))

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

The script invokes AutoDock VINA and writes both a config file and a docking log to disk. While there is a progress print for the workflow step, there is no explicit warning in the CLI help or documentation that external binaries will be executed and output files created in the chosen directory.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
72% confidence
Finding

This specific shell command uses a generated config_file path under output_dir, so it is still influenced by user input and executed through a shell. While the injection surface is narrower than direct user-supplied command fragments, a malicious output_dir containing shell metacharacters could still alter command execution.

Content

Scanner excerpt · scripts/molecular_docking.py (reported line 139)May include surrounding context.

python
# Run VINA
        cmd = f"vina --config {config_file}"
        result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
        if result.returncode != 0:
            raise RuntimeError(f"VINA docking failed: {result.stderr}")

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The export phase invokes obabel and writes several files, including ligand_mode_*.pdb, docked_complex_top1.pdb, and docking_scores.txt. Although success messages are printed after completion, users are not clearly warned beforehand about the extent of file generation and external tool invocation.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
96% confidence
Finding

The obabel export command concatenates self.docking_pdbqt and ligand_pdb into a shell command. Since these paths are derived from output_dir, a hostile path can inject shell syntax and execute arbitrary commands during result export.

Content

Scanner excerpt · scripts/molecular_docking.py (reported line 162)May include surrounding context.

python
for i in range(self.num_modes):
            ligand_pdb = os.path.join(self.output_dir, f"ligand_mode_{i+1}.pdb")
            cmd = f"obabel {self.docking_pdbqt} -O {ligand_pdb} -m -f {i+1} -l {i+1}"
            subprocess.run(cmd, shell=True, check=True, capture_output=True)
            ligand_pdbs.append(ligand_pdb)
        
        # Combine protein and top ligand into complex PDB

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The manifest description and primary heading use Chinese, and the file does not indicate that the skill supports multiple languages or that Chinese is a required locale for a specific region or compliance context. Under the policy, 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
88% confidence
Finding

The script deletes the generated temporary protein_no_water.pdb file as part of processing. There is no user-facing message, confirmation, or CLI documentation warning that intermediate files will be removed automatically.

Content

No source excerpt is available for this finding.