Grype 란?

Grype는 Anchore에서 개발한 오픈 소스 취약점 스캔 도구입니다.
컨테이너 이미지와 파일시스템에서 알려진 취약점을 빠르게 검색할 수 있으며, 다양한 패키지 관리자와 프로그래밍 언어를 지원합니다.
CVE 데이터베이스를 기반으로 보안 취약점을 식별하고, CI/CD 파이프라인에 통합하여 자동화된 보안 검사를 수행할 수 있습니다.

Grype 설치

Grype는 간단한 설치 스크립트를 통해 설치할 수 있습니다.
아래 명령어는 최신 버전을 다운로드하여 /usr/local/bin 디렉토리에 설치합니다.

$ sudo curl -sSfL https://get.anchore.io/grype | sudo sh -s -- -b /usr/local/bin
[info]\033[0m checking github for the current release tag \033[0m
[info]\033[0m fetching release script for tag='v0.103.0' \033[0m
[info]\033[0m checking github for the current release tag \033[0m
[info]\033[0m using release tag='v0.103.0' version='0.103.0' os='linux' arch='amd64' \033[0m
[info]\033[0m installed /usr/local/bin/grype \033[0m

$ sudo which grype
/usr/local/bin/grype

Grype 사용법

CVE 데이터베이스 검색

특정 CVE 번호로 취약점 정보를 검색할 수 있습니다. 이 명령어는 Grype의 취약점 데이터베이스에서 해당 CVE가 영향을 미치는 패키지와 버전 정보를 조회합니다.

$ sudo grype db search "CVE-2024-56737"
VULNERABILITY   PACKAGE                              ECOSYSTEM  NAMESPACE                      VERSION CONSTRAINT
CVE-2024-56737  cpe:2.3:a:gnu:grub2:*:*:*:*:*:*:*:*             nvd:cpe                        <= 2.12
CVE-2024-56737  grub2                                deb        debian:distro:debian:11
CVE-2024-56737  grub2                                deb        debian:distro:debian:12
CVE-2024-56737  grub2                                deb        debian:distro:debian:13        < 2.12-6
CVE-2024-56737  grub2                                deb        debian:distro:debian:14        < 2.12-6
CVE-2024-56737  grub2                                deb        debian:distro:debian:unstable  < 2.12-6
CVE-2024-56737  grub2                                deb        echo:distro:echo:rolling       < 2.12-6
CVE-2024-56737  grub2                                rpm        mariner:distro:azurelinux:3.0  < 0:2.06-25.azl3
CVE-2024-56737  grub2                                rpm        mariner:distro:mariner:2.0     < 0:2.06-15.cm2
CVE-2024-56737  grub2                                rpm        sles:distro:sles:12.3          < 0:2.02-150.1
CVE-2024-56737  grub2                                rpm        sles:distro:sles:12.5          < 0:2.02-181.2 || < 0:2.02-181.2
CVE-2024-56737  grub2                                rpm        sles:distro:sles:15.3          < 0:2.04-150300.22.52.3
CVE-2024-56737  grub2                                rpm        sles:distro:sles:15.4          < 0:2.06-150400.11.55.2 || < 0:2.06-150400.11.55.2
...

시스템 전체 스캔

아래와 같은 방법을 통해 시스템 전체에 대해 스캔 할 수 있습니다.
이번 글에서는 ignore-package.yml 를 이용하여 runc 패키지의 취약점만 확인 할 수 있도록 ignore 옵션을 활용하였습니다.

$ cat ignore-package.yml
ignore:
  - package:
      name: "linux-kernel"
      type: "linux-kernel"
  - package:
      name: "*"
      type: "python"
  - package:
      name: "*"
      type: "go-module"
  - package:
      name: "kernel"
      type: "rpm"
  - package:
      name: "kernel-libbpf"
      type: "rpm"
  - package:
      name: "kernel-tools"
      type: "rpm"

설정 파일을 적용하여 루트 디렉토리를 스캔합니다. 스캔 결과에는 발견된 취약점의 심각도, 설치된 버전, 수정 버전 등이 표시됩니다.

$ sudo grype / -c ignore-package.yml
 ✔ Indexed file system                                                                                     /
 ✔ Cataloged contents                       8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1
   ├── ✔ Packages                        [1,321 packages]
   ├── ✔ Executables                     [1,889 executables]
   ├── ✔ File metadata                   [42,029 locations]
   └── ✔ File digests                    [42,029 files]
 ✔ Scanned for vulnerabilities     [5 vulnerability matches]
   ├── by severity: 7 critical, 1526 high, 3982 medium, 58 low, 0 negligible
   └── by status:   5105 fixed, 468 not-fixed, 5568 ignored
NAME  INSTALLED              FIXED IN               TYPE  VULNERABILITY       SEVERITY  EPSS           RISK
runc  1.1.11-1.amzn2023.0.1  1.1.13-1.amzn2023.0.1  rpm   ALAS2023-2024-710   Medium    < 0.1% (24th)  < 0.1
runc  1.1.11-1.amzn2023.0.1  1.2.4-2.amzn2023.0.1   rpm   ALAS2023-2025-1041  High      < 0.1% (5th)   < 0.1
runc  1.1.11-1.amzn2023.0.1  1.1.14-1.amzn2023.0.1  rpm   ALAS2023-2024-725   Low       < 0.1% (4th)   < 0.1
runc  1.1.11-1.amzn2023.0.1  1.3.2-2.amzn2023.0.1   rpm   ALAS2023-2025-1263  High      < 0.1% (0th)   < 0.1
runc  1.1.11-1.amzn2023.0.1  1.2.6-1.amzn2023.0.1   rpm   ALAS2023-2025-1078  Medium    < 0.1% (0th)   < 0.1

취약점 패치 적용

스캔 결과에서 발견된 취약점을 해결하기 위해 패키지를 업데이트합니다.

$ sudo rpm -qa | grep runc
runc-1.1.11-1.amzn2023.0.1.x86_64

$ sudo yum update runc
...
Upgraded:
  runc-1.3.3-2.amzn2023.0.1.x86_64

Complete!

$ sudo rpm -qa | grep runc
runc-1.3.3-2.amzn2023.0.1.x86_64

패치 후 재스캔

패키지 업데이트 후 다시 스캔하여 취약점이 해결되었는지 확인합니다.

$ sudo grype / -c ignore-package.yml
 ✔ Indexed file system                                                                                  /
 ✔ Vulnerability DB                [no update available]
 ✔ Cataloged contents                    8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1
   ├── ✔ Packages                        [1,322 packages]
   ├── ✔ Executables                     [1,890 executables]
   ├── ✔ File metadata                   [42,034 locations]
   └── ✔ File digests                    [42,034 files]
 ✔ Scanned for vulnerabilities     [0 vulnerability matches]
   ├── by severity: 4 critical, 1509 high, 3961 medium, 57 low, 0 negligible
   └── by status:   5063 fixed, 468 not-fixed, 5531 ignored
No vulnerabilities found

보시는 것처럼 취약점이 해결된 것을 확인 할 수 있었습니다.

컨테이너 이미지 검사

Grype 는 Docker 이미지의 취약점도 검사할 수 있습니다.

사용 방법은 아래와 같습니다.

$ sudo grype docker.io/library/nginx:1.28.0-alpine
 ✔ Loaded image                                                           index.docker.io/library/nginx:1.28.0-alpine
 ✔ Parsed image                               sha256:c318e336065b17ff460aeac6d14bce5d0b13e35f25d5cb1843b635359fc00c9a
 ✔ Cataloged contents                                c9fe5d237739ac0665d879b1ca8e4a81b8c1ab0a6158922e59937ca8163b43a7
   ├── ✔ Packages                        [68 packages]
   ├── ✔ File digests                    [976 files]
   ├── ✔ File metadata                   [976 locations]
   └── ✔ Executables                     [123 executables]
 ✔ Scanned for vulnerabilities     [15 vulnerability matches]
   ├── by severity: 2 critical, 3 high, 3 medium, 7 low, 0 negligible
NAME           INSTALLED   FIXED IN   TYPE  VULNERABILITY   SEVERITY  EPSS          RISK
libxml2        2.13.4-r6   2.13.9-r0  apk   CVE-2025-49796  Critical  0.4% (62nd)   0.4
libxml2        2.13.4-r6   2.13.9-r0  apk   CVE-2025-6021   High      0.4% (58th)   0.3
tiff           4.7.1-r0               apk   CVE-2023-6277   Medium    0.4% (61st)   0.2
libxml2        2.13.4-r6   2.13.9-r0  apk   CVE-2025-49794  Critical  0.3% (48th)   0.2
tiff           4.7.1-r0               apk   CVE-2023-52356  High      0.3% (49th)   0.2
libxml2        2.13.4-r6   2.13.9-r0  apk   CVE-2025-49795  High      0.1% (34th)   0.1
nginx          1.28.0-r1              apk   CVE-2025-53859  Medium    0.1% (28th)   < 0.1
tiff           4.7.1-r0               apk   CVE-2023-6228   Medium    < 0.1% (2nd)  < 0.1
libxml2        2.13.4-r6   2.13.9-r0  apk   CVE-2025-6170   Low       < 0.1% (6th)  < 0.1
busybox        1.37.0-r13             apk   CVE-2025-46394  Low       < 0.1% (1st)  < 0.1
busybox-binsh  1.37.0-r13             apk   CVE-2025-46394  Low       < 0.1% (1st)  < 0.1
ssl_client     1.37.0-r13             apk   CVE-2025-46394  Low       < 0.1% (1st)  < 0.1
busybox        1.37.0-r13             apk   CVE-2024-58251  Low       < 0.1% (3rd)  < 0.1
busybox-binsh  1.37.0-r13             apk   CVE-2024-58251  Low       < 0.1% (3rd)  < 0.1
ssl_client     1.37.0-r13             apk   CVE-2024-58251  Low       < 0.1% (3rd)  < 0.1

스캔 결과는 취약점의 심각도(Critical, High, Medium, Low)와 EPSS(Exploit Prediction Scoring System) 점수를 포함하여 우선순위를 판단할 수 있도록 출력합니다.

참고 문서

chhanz's profile image

chhanz

2025-11-12

Read more posts by this author