Back to skill

Security audit

Trivy Security Scanner

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent Trivy security-scanning skill with no hidden or deceptive behavior, though users should scope scans carefully and be aware of external enrichment and CI hardening risks.

Install only if you are comfortable letting Trivy inspect the targets you provide, including potential secret findings. In sensitive projects, avoid shared /tmp report paths, approve any EPSS/KEV lookups before sending CVE lists externally, and pin any copied CI actions to immutable versions.

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

Error
Location
SKILL.md:264
Finding

Mutable GitHub Action Reference Creates a CI Supply-Chain Risk

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, line 264
Vulnerability Type: Unpinned third-party CI dependency
Risk Level: High

Vulnerable Code:

yaml
- name: Trivy vulnerability scan
  uses: aquasecurity/trivy-action@master
  with:
    image-ref: ${{ env.IMAGE }}
    format: 'sarif'
    output: 'trivy-results.sarif'
    severity: 'CRITICAL,HIGH'
    exit-code: '1'
    ignore-unfixed: true
    trivyignores: '.trivyignore.yaml'

Technical Analysis

The GitHub Actions example references aquasecurity/trivy-action through the mutable master branch. A branch reference does not identify an immutable, previously reviewed version of the action. Its effective implementation may change whenever the upstream branch is updated.

If the upstream repository, maintainer account, or branch-protection process is compromised, an attacker could replace the referenced action code. Workflows that subsequently use this recommendation would automatically execute the modified code in their GitHub Actions runner.

This is a supply-chain weakness rather than evidence that the current upstream action is malicious.

Attack Path

  1. A user copies the recommended workflow into a repository.
  2. The upstream action repository or a maintainer account is compromised.
  3. An attacker modifies the commit referenced by the master branch.
  4. The repository triggers the workflow through a push, pull request, schedule, or manual invocation.
  5. GitHub Actions downloads and executes the attacker-controlled action.
  6. The malicious action accesses available source files, workflow credentials, artifacts, network resources, or other permissions granted to the runner.

Impact Assessment

Successful exploitation permits arbitrary code execution in the CI runner under the workflow's security context. Depending on workflow permissions and GitHub environment configuration, the attacker could:

  • Read or modi ...[truncated 527 chars]
Remediation
View remediation

Remediation Suggestions

Pin the action to a reviewed, immutable full commit SHA rather than a branch or mutable tag:

yaml
- name: Trivy vulnerability scan
  uses: aquasecurity/trivy-action@FULL_REVIEWED_COMMIT_SHA
  with:
    image-ref: ${{ env.IMAGE }}
    format: 'sarif'
    output: 'trivy-results.sarif'
    severity: 'CRITICAL,HIGH'
    exit-code: '1'
    ignore-unfixed: true
    trivyignores: '.trivyignore.yaml'

Additional hardening should include:

  • Verify the selected commit against an official upstream release.
  • Review action changes before updating the pinned SHA.
  • Use Dependabot or Renovate to propose controlled action updates.
  • Grant the workflow only the minimum required permissions.
  • Avoid exposing deployment or signing secrets to scanning jobs.
  • Prefer GitHub-hosted isolated runners where practical.
  • Apply environment approval controls to privileged release operations.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:67
Finding

Predictable Files in Shared Temporary Directory

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 67-88
Vulnerability Type: Unsafe temporary-file handling
Risk Level: Medium

Vulnerable Code:

bash
trivy image --format json --output /tmp/trivy-image.json \
  --severity CRITICAL,HIGH,MEDIUM \
  --vuln-type os,library \
  --scanners vuln,secret,misconfig \
  --list-all-pkgs \
  registry.example.com/api:v2.3.1

trivy fs --format json --output /tmp/trivy-fs.json \
  --severity CRITICAL,HIGH,MEDIUM \
  --scanners vuln,secret,misconfig,license \
  --list-all-pkgs \
  /path/to/project

trivy config --format json --output /tmp/trivy-iac.json \
  --severity CRITICAL,HIGH,MEDIUM \
  /path/to/terraform

Technical Analysis

The documented commands write scan results to fixed, predictable names under the shared /tmp directory. Concurrent scans can overwrite each other's results or cause later parsing commands to consume output from the wrong scan.

Secret-scanning output can contain sensitive findings, including file paths and detected secret material. If resulting file permissions are not sufficiently restrictive, another local user may be able to read those results.

On systems where local protections or the application's file-opening behavior do not safely reject symbolic links, a local attacker may also pre-create a predictable path as a symbolic link or other filesystem object. This can potentially redirect writes or interfere with scan execution. The precise overwrite behavior depends on Trivy, operating-system protections, ownership checks, and filesystem configuration.

Attack Path

  1. An attacker with local access predicts one of the documented filenames, such as /tmp/trivy-fs.json.
  2. Before the scan starts, the attacker creates that path, replaces it between operations, or monitors it for creation.
  3. The privileged or higher-trust user runs the documented Trivy command.
  4. Depending on local permissions and file ...[truncated 1281 chars]
Remediation
View remediation

Remediation Suggestions

Create a private, uniquely named temporary directory and enforce owner-only permissions:

bash
set -euo pipefail
umask 077

TRIVY_TMP_DIR="$(mktemp -d)"
trap 'rm -rf -- "$TRIVY_TMP_DIR"' EXIT

IMAGE_RESULT="$TRIVY_TMP_DIR/trivy-image.json"

trivy image --format json --output "$IMAGE_RESULT" \
  --severity CRITICAL,HIGH,MEDIUM \
  --vuln-type os,library \
  --scanners vuln,secret,misconfig \
  --list-all-pkgs \
  registry.example.com/api:v2.3.1

jq '...' "$IMAGE_RESULT"

Apply the same pattern to filesystem and IaC results. In addition:

  • Do not run the scanner as root unless the target requires elevated access.
  • Verify that the temporary directory and result files are owned by the current user.
  • Reject unexpected symbolic links or non-regular output files.
  • Keep result files only as long as required.
  • Store retained reports in a protected artifact location with explicit access controls.
  • Use unique per-job workspaces in CI and avoid shared, persistent runner directories.
  • Pass filenames directly to jq rather than using unnecessary cat pipelines.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
Findings (15)

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 23)May include surrounding context.

md
# If not installed:
# Debian/Ubuntu
sudo apt-get install -y wget apt-transport-https gnupg lsb-release
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/trivy.list
sudo apt-get update && sudo apt-get install trivy

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 24)May include surrounding context.

md
# If not installed:
# Debian/Ubuntu
sudo apt-get install -y wget apt-transport-https gnupg lsb-release
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/trivy.list
sudo apt-get update && sudo apt-get install trivy

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

md
# If not installed:
# Debian/Ubuntu
sudo apt-get install -y wget apt-transport-https gnupg lsb-release
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/trivy.list
sudo apt-get update && sudo apt-get install trivy

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

md
# If not installed:
# Debian/Ubuntu
sudo apt-get install -y wget apt-transport-https gnupg lsb-release
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/trivy.list
sudo apt-get update && sudo apt-get install trivy

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

md
sudo apt-get install -y wget apt-transport-https gnupg lsb-release
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/trivy.list
sudo apt-get update && sudo apt-get install trivy

# macOS
brew install trivy

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The invocation examples include the generic phrase "run a security scan," which overlaps with common requests that may not specifically intend this Trivy skill. The description does not provide exclusion conditions or constraints to clarify when this skill should activate versus other security-related tools.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

md
# If not installed:
# Debian/Ubuntu
sudo apt-get install -y wget apt-transport-https gnupg lsb-release
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/trivy.list
sudo apt-get update && sudo apt-get install trivy

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

md
# If not installed:
# Debian/Ubuntu
sudo apt-get install -y wget apt-transport-https gnupg lsb-release
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/trivy.list
sudo apt-get update && sudo apt-get install trivy

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

md
# If not installed:
# Debian/Ubuntu
sudo apt-get install -y wget apt-transport-https gnupg lsb-release
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/trivy.list
sudo apt-get update && sudo apt-get install trivy

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

md
# If not installed:
# Debian/Ubuntu
sudo apt-get install -y wget apt-transport-https gnupg lsb-release
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/trivy.list
sudo apt-get update && sudo apt-get install trivy

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill instructs the agent to transmit scan-derived vulnerability identifiers to external services (EPSS and KEV sources) without an explicit warning or consent gate. Even though CVE IDs are not secrets by themselves, the set of discovered vulnerabilities can reveal details about the user's environment, dependencies, and patch state to third parties.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
95% confidence
Finding

This command sends the enumerated CVE list derived from the scan results to api.first.org for EPSS enrichment. That external transmission can disclose a fingerprint of the scanned asset's weaknesses and software posture, which may be sensitive in enterprise or regulated environments.

Content

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

bash
# Fetch EPSS scores for found CVEs
CVES=$(cat /tmp/trivy-image.json | jq -r '[.Results[].Vulnerabilities[]?.VulnerabilityID] | unique | join(",")')
curl -s "https://api.first.org/data/v1/epss?cve=$CVES" | jq '[.data[] | {
  cve: .cve,
  epss: .epss,
  percentile: .percentile

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 211)May include surrounding context.

md
# After (hardened):
FROM ubuntu:24.04 AS builder
RUN apt-get update && apt-get install -y --no-install-recommends curl \
    && rm -rf /var/lib/apt/lists/*
COPY . /app
RUN ./build.sh

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 211)May include surrounding context.

md
# After (hardened):
FROM ubuntu:24.04 AS builder
RUN apt-get update && apt-get install -y --no-install-recommends curl \
    && rm -rf /var/lib/apt/lists/*
COPY . /app
RUN ./build.sh

Chaining Abuse

Low
Category
Tool Misuse
Confidence
15% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

md
# After (hardened):
FROM ubuntu:24.04 AS builder
RUN apt-get update && apt-get install -y --no-install-recommends curl \
    && rm -rf /var/lib/apt/lists/*
COPY . /app
RUN ./build.sh

Static analysis

No suspicious patterns detected.