Back to skill

Security audit

Infra As Code

Security checks for vulnerabilities and agentic risk

Overview

This is a straightforward infrastructure-as-code reference skill, but users should treat its deploy and teardown examples as live cloud changes.

Install only if you want agent help with cloud IaC. Before running any generated command, verify the target account, region, workspace, and stack; run Terraform plan, CloudFormation change sets, or Pulumi preview first; avoid copying destroy/delete commands blindly; pin container images; and do not put real secrets directly in shell commands.

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)

T08 · Insecure Dependencies

Warning
Location
SKILL.md:223
Finding

Unpinned Container Image Executed During Privileged Instance Bootstrap

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 223-229
Vulnerability Type: Untrusted or mutable third-party container dependency
Risk Level: Medium

hcl
user_data = <<-EOF
  #!/bin/bash
  apt-get update
  apt-get install -y docker.io
  systemctl start docker
  docker run -d -p 80:8080 ${var.docker_image}
EOF

Technical Analysis

The EC2 bootstrap script installs Docker and immediately executes the image supplied through ${var.docker_image}. The example does not require an immutable image digest, approved registry, signature verification, or provenance validation. A tag such as latest or another mutable version can therefore resolve to different image contents after the infrastructure configuration has been reviewed.

The container also runs with Docker's default root user unless the image defines another user. No runtime restrictions are specified, such as capability removal, a read-only root filesystem, resource limits, or restricted access to the instance metadata service. Although container root does not automatically equal host root, a malicious image can attack exposed kernel or runtime vulnerabilities and access network services or cloud metadata available to the instance.

Attack Path

  1. A deployment uses a mutable image tag, or an attacker gains control of the referenced registry repository or image-selection variable.
  2. The attacker replaces the tag's contents or supplies a malicious ${var.docker_image} value.
  3. Terraform provisions or reprovisions the EC2 instance and executes the user_data script as root.
  4. Docker retrieves the currently resolved image without digest or signature verification.
  5. The malicious image starts automatically and executes attacker-controlled code inside the instance environment.
  6. The code can probe the instance metadata service, internal network, mounted data, container runtime, and kernel for credentials or escalation opp ...[truncated 522 chars]
Remediation
View remediation

Remediation Suggestions

  • Restrict images to explicitly approved registries and repositories.
  • Pin every production image by immutable digest, for example registry.example/app@sha256:..., rather than relying only on a mutable tag.
  • Verify image signatures and provenance before deployment, using a mechanism such as Sigstore Cosign or an equivalent registry admission policy.
  • Scan images for malware, known vulnerabilities, embedded credentials, and prohibited packages in CI.
  • Run the application as a dedicated non-root user and enforce that requirement in both the image and runtime configuration.
  • Drop unnecessary Linux capabilities, enable no-new-privileges, use a read-only root filesystem where possible, and set CPU and memory limits.
  • Require IMDSv2, limit metadata hop access where appropriate, and attach only a least-privilege IAM instance profile.
  • Prefer a controlled image deployment mechanism that records and validates the expected digest before the instance starts it.

T09 · Insecure Skill Coding Practices

Note
Location
SKILL.md:649
Finding

Plaintext Secret Supplied as a Command-Line Argument

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, line 649
Vulnerability Type: Plaintext credential exposure through command history and process arguments
Risk Level: Low

bash
pulumi config set --secret dbPassword 'my-secret-pass'

Technical Analysis

Pulumi encrypts a secret after it is stored in stack configuration, but this command initially supplies the plaintext password as a shell command-line argument. The command can consequently be retained in shell history. Depending on operating-system permissions and process-inspection controls, the argument may also be observable in process metadata while the command is running.

The literal my-secret-pass is demonstrative rather than a confirmed production credential, but the example encourages users to replace it inline with a real secret. Encryption at rest in Pulumi configuration does not protect the earlier plaintext exposure at the shell boundary.

Attack Path

  1. A user copies the example and replaces my-secret-pass with an actual database password.
  2. The interactive shell records the complete command in its history file, or process-monitoring software captures the argument.
  3. Another local user, support process, backup system, terminal logger, or compromised account obtains access to that history or telemetry.
  4. The plaintext database credential is recovered.
  5. The attacker authenticates to any database or related service where the credential remains valid and is reachable.

Impact Assessment

Exploitation discloses the configured database password. The resulting privileges are limited to those assigned to the affected database account, but may include reading, modifying, or deleting application data and executing database operations. Reuse of the same password across environments or services would increase the compromise scope.

Remediation
View remediation

Remediation Suggestions

  • Do not place real secrets directly in command-line arguments.

  • Use Pulumi's interactive secret prompt by omitting the plaintext value where supported:

    bash
    pulumi config set --secret dbPassword
    
  • Prefer retrieving deployment credentials from an approved secrets manager and injecting them through a protected CI/CD integration.

  • Prevent CI logs, shell tracing, terminal recording, and diagnostic output from printing secret values.

  • Review and sanitize shell history if a secret has already been entered inline, then rotate the exposed credential.

  • Use unique, randomly generated credentials for each environment and grant the associated database account only the permissions required by the application.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (5)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The quick-start workflow presents terraform apply and terraform destroy adjacent to safe commands without a prominent warning that they will modify or delete live infrastructure. In an agent skill, concise command snippets are likely to be reused verbatim, increasing the chance of accidental destructive execution against real environments.

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.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The environment-specific apply example automates workspace selection and immediately runs terraform apply -var-file=... with no warning that it performs live changes. This is dangerous because it lowers friction for deploying to the wrong environment, especially when copied into scripts or agent actions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The CloudFormation commands include create, update, and delete operations on live stacks without explicit nearby warnings about their effects. In a skill intended to guide automation, this can lead users or agents to execute high-impact changes directly in production accounts without adequate review.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The Pulumi workflow lists pulumi up and pulumi destroy as routine commands without clearly distinguishing them from preview-only operations. Because Pulumi executes real resource mutations, omission of a warning increases the risk of accidental deployment or teardown when the snippet is copied blindly.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.