Filesystem

Scan a filesystem (such as a host machine, a virtual machine image, or an unpacked container image filesystem).

  1. $ trivy fs /path/to/project

Local Project

Trivy will look for vulnerabilities based on lock files such as Gemfile.lock and package-lock.json.

  1. $ trivy fs ~/src/github.com/aquasecurity/trivy-ci-test

Result

  1. 2020-06-01T17:06:58.652+0300 WARN OS is not detected and vulnerabilities in OS packages are not detected.
  2. 2020-06-01T17:06:58.652+0300 INFO Detecting pipenv vulnerabilities...
  3. 2020-06-01T17:06:58.691+0300 INFO Detecting cargo vulnerabilities...
  4. Pipfile.lock
  5. ============
  6. Total: 10 (UNKNOWN: 2, LOW: 0, MEDIUM: 6, HIGH: 2, CRITICAL: 0)
  7. +---------------------+------------------+----------+-------------------+------------------------+------------------------------------+
  8. | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE |
  9. +---------------------+------------------+----------+-------------------+------------------------+------------------------------------+
  10. | django | CVE-2020-7471 | HIGH | 2.0.9 | 3.0.3, 2.2.10, 1.11.28 | django: potential |
  11. | | | | | | SQL injection via |
  12. | | | | | | StringAgg(delimiter) |
  13. + +------------------+----------+ +------------------------+------------------------------------+
  14. | | CVE-2019-19844 | MEDIUM | | 3.0.1, 2.2.9, 1.11.27 | Django: crafted email address |
  15. | | | | | | allows account takeover |
  16. + +------------------+ + +------------------------+------------------------------------+
  17. | | CVE-2019-3498 | | | 2.1.5, 2.0.10, 1.11.18 | python-django: Content |
  18. | | | | | | spoofing via URL path in |
  19. | | | | | | default 404 page |
  20. + +------------------+ + +------------------------+------------------------------------+
  21. | | CVE-2019-6975 | | | 2.1.6, 2.0.11, 1.11.19 | python-django: |
  22. | | | | | | memory exhaustion in |
  23. | | | | | | django.utils.numberformat.format() |
  24. +---------------------+------------------+----------+-------------------+------------------------+------------------------------------+
  25. ...

From Inside Containers

Scan your container from inside the container.

  1. $ docker run --rm -it alpine:3.11
  2. / # curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin
  3. / # trivy fs /

Result

  1. 2021-03-08T05:22:26.378Z INFO Need to update DB
  2. 2021-03-08T05:22:26.380Z INFO Downloading DB...
  3. 20.37 MiB / 20.37 MiB [-------------------------------------------------------------------------------------------------------------------------------------] 100.00% 8.24 MiB p/s 2s
  4. 2021-03-08T05:22:30.134Z INFO Detecting Alpine vulnerabilities...
  5. 2021-03-08T05:22:30.138Z INFO Trivy skips scanning programming language libraries because no supported file was detected
  6. 313430f09696 (alpine 3.11.7)
  7. ============================
  8. Total: 6 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 6, CRITICAL: 0)
  9. +--------------+------------------+----------+-------------------+---------------+---------------------------------------+
  10. | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE |
  11. +--------------+------------------+----------+-------------------+---------------+---------------------------------------+
  12. | libcrypto1.1 | CVE-2021-23839 | HIGH | 1.1.1i-r0 | 1.1.1j-r0 | openssl: incorrect SSLv2 |
  13. | | | | | | rollback protection |
  14. | | | | | | -->avd.aquasec.com/nvd/cve-2021-23839 |
  15. + +------------------+ + + +---------------------------------------+
  16. | | CVE-2021-23840 | | | | openssl: integer |
  17. | | | | | | overflow in CipherUpdate |
  18. | | | | | | -->avd.aquasec.com/nvd/cve-2021-23840 |
  19. + +------------------+ + + +---------------------------------------+
  20. | | CVE-2021-23841 | | | | openssl: NULL pointer dereference |
  21. | | | | | | in X509_issuer_and_serial_hash() |
  22. | | | | | | -->avd.aquasec.com/nvd/cve-2021-23841 |
  23. +--------------+------------------+ + + +---------------------------------------+
  24. | libssl1.1 | CVE-2021-23839 | | | | openssl: incorrect SSLv2 |
  25. | | | | | | rollback protection |
  26. | | | | | | -->avd.aquasec.com/nvd/cve-2021-23839 |
  27. + +------------------+ + + +---------------------------------------+
  28. | | CVE-2021-23840 | | | | openssl: integer |
  29. | | | | | | overflow in CipherUpdate |
  30. | | | | | | -->avd.aquasec.com/nvd/cve-2021-23840 |
  31. + +------------------+ + + +---------------------------------------+
  32. | | CVE-2021-23841 | | | | openssl: NULL pointer dereference |
  33. | | | | | | in X509_issuer_and_serial_hash() |
  34. | | | | | | -->avd.aquasec.com/nvd/cve-2021-23841 |
  35. +--------------+------------------+----------+-------------------+---------------+---------------------------------------+