본문으로 건너뛰기
Skillpedia
에이전트35k · #8359

scanning-iac-and-images-with-trivy

하는 일

이 도구는 컨테이너 이미지, 인프라 설정 파일(Terraform이나 Kubernetes 등), 코드의 보안 문제를 점검합니다. 알려진 결함, 잘못된 설정, 실수로 노출된 민감한 정보를 찾습니다.

사용하는 경우

  • ✓새 프로그램을 만들고 사용하기 전에 안전한지 확인하고 싶을 때.
  • ✓기술 인프라 구성을 바꿀 때 변경 사항이 안전한지 확인하고 싶을 때.
  • ✓코드나 설정 파일에 노출된 민감한 정보(비밀번호나 키 등)가 있는지 확인하고 싶을 때.

스킬 링크

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/scanning-iac-and-images-with-trivy/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/scanning-iac-and-images-with-trivy/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“‘my-app:latest’ 컨테이너 이미지에서 취약점과 잘못된 설정을 검사해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 도구는 Trivy라는 프로그램으로 파일과 이미지를 분석합니다. 찾은 내용을 알려진 문제와 보안 규칙 데이터베이스와 비교해 위험을 식별합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Scanning IaC and Images with Trivy

Overview

Trivy (by Aqua Security) is a comprehensive, open-source security scanner that finds vulnerabilities (CVEs), misconfigurations (IaC), secrets, software licenses, and software supply-chain weaknesses across a wide range of targets: container images, filesystems, Git repositories, virtual machine images, Kubernetes clusters, and SBOM documents. It is widely adopted as a "shift-left" gate in CI/CD pipelines because it is fast, runs as a single static binary, requires no agent, and supports machine-readable output formats (JSON, SARIF, CycloneDX, SPDX) for integration with code-scanning dashboards.

Trivy bundles four primary scanners that can be toggled with --scanners:

  • vuln — OS package and language-dependency vulnerability detection (CVE matching against the Trivy vulnerability DB).
  • misconfig — Infrastructure-as-Code and configuration misconfiguration detection (Terraform, CloudFormation, Kubernetes manifests, Dockerfile, Helm) using built-in and custom Rego policies.
  • secret — Hard-coded secret/credential detection (API keys, tokens, private keys).
  • license — Software license identification and policy enforcement.

This skill covers building a Trivy-based scanning workflow that gates a CI/CD pipeline: scanning images before push, scanning IaC before apply, generating and re-scanning SBOMs, and failing builds on policy violations. Detecting these weaknesses defends against the MITRE ATT&CK technique T1525 (Implant Internal Image), where adversaries plant malicious or vulnerable images in a registry to be deployed across the environment.

When to Use

  • When integrating vulnerability and misconfiguration scanning into a CI/CD pipeline as a quality/security gate before images are pushed or infrastructure is applied.
  • When auditing container images in a registry for known CVEs prior to deployment.
  • When validating Terraform, CloudFormation, Kubernetes, Dockerfile, or Helm IaC for security misconfigurations.
  • When generating an SBOM (CycloneDX/SPDX) for supply-chain transparency and later re-scanning that SBOM for newly disclosed CVEs.
  • When scanning a running Kubernetes cluster for vulnerable workloads and misconfigured RBAC/resources.
  • When enforcing license compliance policy on dependencies.

Prerequisites

  • A Linux/macOS/Windows host or CI runner with network access to download the Trivy vulnerability database.
  • Docker (optional) if scanning local images by name or using the containerized Trivy.
  • Install Trivy (Aqua Security official methods):
# Debian/Ubuntu (APT repository)
sudo apt-get install -y wget gnupg
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 generic main" | sudo tee /etc/apt/sources.list.d/trivy.list
sudo apt-get update
sudo apt-get install -y trivy

# RHEL/CentOS (YUM repository), macOS (Homebrew), and install script
brew install trivy
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sudo sh -s -- -b /usr/local/bin

# Containerized usage (no install)
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock aquasec/trivy:latest image python:3.10-alpine

# Verify
trivy --version
  • For air-gapped or rate-limited environments, pre-download the DB with trivy image --download-db-only and the Java/policy bundles as needed.

Objectives

  • Scan a container image for OS and language vulnerabilities and fail the build above a severity threshold.
  • Scan IaC (Terraform/Kubernetes/Dockerfile) for misconfigurations.
  • Detect hard-coded secrets in a repository or filesystem.
  • Generate a CycloneDX or SPDX SBOM and re-scan it for vulnerabilities.
  • Emit SARIF for GitHub code scanning and JSON for programmatic gating.
  • Wire Trivy into a CI/CD pipeline with --exit-code to enforce policy.

MITRE ATT&CK Mapping

Technique ID Name Tactic Relevance
T1525 Implant Internal Image Persistence Trivy detects vulnerable or malicious images/layers and embedded secrets before they are implanted in a registry and propagated to running workloads.

Workflow

1. Scan a container image for vulnerabilities

…

자주 묻는 질문

‘취약점’이란 무엇인가요?

악의적인 사용자가 악용해 피해를 입히거나 정보를 훔칠 수 있는, 소프트웨어의 알려진 보안 결함입니다.

‘잘못된 구성’이란 무엇인가요?

시스템이나 프로그램을 설정하는 과정의 오류로, 보안 허점을 만들 수 있습니다.

‘비밀 정보’란 무엇인가요?

비밀번호, API 키, 토큰처럼 코드나 설정 파일에 노출되어서는 안 되는 민감한 정보입니다.

상세 정보

작성자의 원본 설명

Scans container images, Infrastructure-as-Code (Terraform, CloudFormation, Kubernetes manifests, Dockerfile, Helm), filesystems, git repos, and SBOMs with Trivy's vuln, misconfig, secret, and license scanners. Use when building a CI/CD security gate that scans images before push, IaC before apply, or SBOMs for supply-chain weaknesses, and fails the build on policy violations.

repo: mukul975/Anthropic-Cybersecurity-Skills

인기도

GitHub 스타
35k
순위
#8359
라이선스
Apache-2.0
업데이트
2026. 8. 31.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬