Back to skill

Security audit

Docker核心操作免费版

Security checks for vulnerabilities and agentic risk

Overview

This Docker helper is mostly a command guide, but it gives agents execution authority and includes deletion, network-exposed, and weak-credential examples without enough guardrails.

Review this skill before installing if your agent can execute commands. Use it only in a development environment, require confirmation before any docker rm, docker rmi, or prune command, replace example passwords, bind databases to localhost or a private Docker network, and prefer pinned image versions or digests.

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
SKILL.md:110
Finding

Hardcoded Weak PostgreSQL Credential in a Host-Exposed Container

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:110
Vulnerability Type: Hardcoded weak credential and unsafe database exposure
Risk Level: Medium

Vulnerable Code:

bash
# Database container
docker run -d --name postgres -e POSTGRES_PASSWORD=secret -v postgres-data:/var/lib/postgresql/data -p 5432:5432 postgres:15

Technical Analysis

The documented command configures PostgreSQL with the predictable password secret and publishes the database port using -p 5432:5432. Docker normally publishes such a port on the host's available interfaces unless a specific bind address is supplied. Consequently, the database may be reachable from other systems depending on host firewall and network configuration.

The password is also supplied directly in the command line. It may remain in shell history and can be recovered through container configuration inspection by users or processes with sufficient local Docker access. Because the documentation presents this as a ready-to-run workflow, users may execute it without replacing the example credential or constraining network exposure.

Attack Path

  1. A user executes the documented command without changing the password or port mapping.
  2. Docker starts PostgreSQL with POSTGRES_PASSWORD=secret and publishes TCP port 5432 on the host.
  3. An attacker identifies a network path to the host's published PostgreSQL port.
  4. The attacker connects using the PostgreSQL account initialized by the image and the documented password secret.
  5. If authentication succeeds, the attacker accesses or modifies databases according to that account's PostgreSQL privileges.

A local attacker with adequate access to shell history, Docker metadata, or container inspection may alternatively recover the plaintext credential and use it to authenticate.

Impact Assessment

Successful exploitation could permit unauthorized PostgreSQL access with the privileges of the initializ ...[truncated 418 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the literal password and require a strong, independently generated credential.

  2. Avoid passing secrets directly on the command line. Use a protected environment file with restrictive permissions, the image's supported secret-file mechanism, or a container secret manager.

  3. For local development, bind the published port to loopback only:

    bash
    docker run -d \
      --name postgres \
      --env-file .postgres.env \
      -v postgres-data:/var/lib/postgresql/data \
      -p 127.0.0.1:5432:5432 \
      postgres:15
    
  4. Ensure .postgres.env is permission-restricted and excluded from version control.

  5. If host access is unnecessary, do not publish port 5432; connect through a private Docker network instead.

  6. Add an explicit warning that example credentials must never be reused in production.

  7. Apply host firewall restrictions and limit database access to trusted clients.

  8. Prefer pinning the image to an approved immutable digest for reproducible deployment.

Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (9)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill advertises broad applicability for Docker-related development scenarios and includes the 'exec' tool, which can cause the agent to over-activate on loosely related prompts and generate or run operational commands in real environments. Broad activation scope increases the chance of unsafe command execution, especially when paired with generic natural-language requests and insufficient guardrails.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The documentation includes destructive commands such as 'docker rm', 'docker container prune', 'docker rmi', and 'docker image prune' without prominent warnings, scope explanations, or confirmation guidance. In an agent context with 'exec' capability, users may follow or trigger these commands and unintentionally delete containers, images, or related state, causing outages or data loss.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
75% confidence
Finding

Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
75% confidence
Finding

Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
75% confidence
Finding

Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
98% confidence
Finding

Using 'docker pull nginx:latest' relies on a mutable tag, so future pulls may retrieve different image contents than originally tested. This increases supply-chain risk, makes builds non-reproducible, and can silently introduce vulnerable or unexpected software into the environment.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
75% confidence
Finding

Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
75% confidence
Finding

Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

Low
Category
Tool Misuse
Confidence
15% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · SKILL.md (reported line 107)May include surrounding context.

bash
# 开发容器
docker run -it --rm -v $(pwd):/app -w /app -p 3000:3000 node:18 npm run dev
# ...
# 数据库容器
docker run -d --name postgres -e POSTGRES_PASSWORD=secret -v postgres-data:/var/lib/postgresql/data -p 5432:5432 postgres:15

Static analysis

No suspicious patterns detected.