Back to skill

Security audit

Docker Optimizer

Security checks for vulnerabilities and agentic risk

Overview

This is a Dockerfile optimization guide skill with purpose-aligned examples and no evidence of hidden execution, exfiltration, persistence, or destructive host behavior.

Install only if you want an agent to help rewrite or review Dockerfiles. Treat generated Dockerfile changes as production-impacting code: review base image swaps, user/permission changes, health checks, exposed ports, package removals, and secret handling, then build and test before deploying.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • 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 (36)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% 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 · DOCKER_PATTERNS.md (reported line 163)May include surrounding context.

git
curl &&
apt-get clean &&
rm -rf /var/lib/apt/lists/*

Everything in one layer, cleanup works

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% 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 · DOCKER_PATTERNS.md (reported line 163)May include surrounding context.

git
curl &&
apt-get clean &&
rm -rf /var/lib/apt/lists/*

Everything in one layer, cleanup works

text

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · DOCKER_PATTERNS.md (reported line 318)May include surrounding context.

md
npm-debug.log
.git
.gitignore
.env
.env.local
*.md
.vscode

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · DOCKER_PATTERNS.md (reported line 320)May include surrounding context.

md
npm-debug.log
.git
.gitignore
.env
.env.local
*.md
.vscode

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · DOCKER_PATTERNS.md (reported line 325)May include surrounding context.

md
npm-debug.log
.git
.gitignore
.env
.env.local
*.md
.vscode

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · DOCKER_PATTERNS.md (reported line 330)May include surrounding context.

md
npm-debug.log
.git
.gitignore
.env
.env.local
*.md
.vscode

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · DOCKER_PATTERNS.md (reported line 655)May include surrounding context.

md
npm-debug.log
.git
.gitignore
.env
.env.local
*.md
.vscode

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
npm-debug.log
.git
.gitignore
.env
.env.local
*.md
.vscode

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
npm-debug.log
.git
.gitignore
.env
.env.local
*.md
.vscode

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · DOCKER_PATTERNS.md (reported line 656)May include surrounding context.

md
.git
.gitignore
.env
.env.local
*.md
.vscode
.idea

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
.git
.gitignore
.env
.env.local
*.md
.vscode
.idea

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

Secret Mounts

dockerfile
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc \
    npm install

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

Secret Mounts

dockerfile
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc \
    npm install

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.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill is broadly framed as automatically analyzing and optimizing Dockerfiles without clear trigger constraints, safety boundaries, or scope checks. In an agent setting, this can cause the skill to activate on loosely related requests and generate invasive or risky modifications to build artifacts, increasing the chance of unsafe changes being proposed or applied.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill lacks a prominent warning that generated optimizations may alter runtime behavior, compatibility, observability, package availability, libc behavior, port binding, health checks, or debugging workflows. Because the skill recommends aggressive changes like Alpine, scratch, distroless, non-root users, and production server swaps, users may adopt changes that break applications or silently weaken operational assumptions.

Content

No source excerpt is available for this finding.

Internal Network Request

Medium
Category
Server-Side Request Forgery
Confidence
70% confidence
Finding

Code issues a request to a loopback, link-local, or private-range host. This can reach internal services not meant to be exposed and is a common SSRF pivot.

Content

Scanner excerpt · DOCKER_PATTERNS.md (reported line 517)May include surrounding context.

md
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s \
  CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health').read()"

# Run with gunicorn for production
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "4", "app:app"]

Internal Network Request

Medium
Category
Server-Side Request Forgery
Confidence
70% confidence
Finding

Code issues a request to a loopback, link-local, or private-range host. This can reach internal services not meant to be exposed and is a common SSRF pivot.

Content

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

md
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s \
  CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health').read()"

# Run with gunicorn for production
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "4", "app:app"]

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

md
WORKDIR /app

# Don't run as root
RUN addgroup -g 1001 -S nodejs && \
    adduser -S nextjs -u 1001

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 · DOCKER_PATTERNS.md (reported line 376)May include surrounding context.

md
apt-get install -y --no-install-recommends \
      build-essential \
      gcc && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /app

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 · DOCKER_PATTERNS.md (reported line 385)May include surrounding context.

md
apt-get install -y --no-install-recommends \
      build-essential \
      gcc && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /app

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 · DOCKER_PATTERNS.md (reported line 447)May include surrounding context.

md
apt-get install -y --no-install-recommends \
      build-essential \
      gcc && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /app

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 · DOCKER_PATTERNS.md (reported line 731)May include surrounding context.

md
apt-get install -y --no-install-recommends \
      build-essential \
      gcc && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /app

Static analysis

No suspicious patterns detected.