Report Formats

    1. 2019-05-16T01:46:31.777+0900 INFO Updating vulnerability database...
    2. 2019-05-16T01:47:03.007+0900 INFO Detecting Alpine vulnerabilities...

    JSON

    1. [
    2. {
    3. "Target": "php-app/composer.lock",
    4. "Vulnerabilities": null
    5. },
    6. {
    7. "Target": "node-app/package-lock.json",
    8. "Vulnerabilities": [
    9. {
    10. "VulnerabilityID": "CVE-2018-16487",
    11. "PkgName": "lodash",
    12. "InstalledVersion": "4.17.4",
    13. "FixedVersion": "\u003e=4.17.11",
    14. "Title": "lodash: Prototype pollution in utilities function",
    15. "Description": "A prototype pollution vulnerability was found in lodash \u003c4.17.11 where the functions merge, mergeWith, and defaultsDeep can be tricked into adding or modifying properties of Object.prototype.",
    16. "Severity": "HIGH",
    17. "References": [
    18. "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-16487",
    19. ]
    20. }
    21. ]
    22. },
    23. {
    24. "Target": "trivy-ci-test (alpine 3.7.1)",
    25. "Vulnerabilities": [
    26. {
    27. "VulnerabilityID": "CVE-2018-16840",
    28. "InstalledVersion": "7.61.0-r0",
    29. "FixedVersion": "7.61.1-r1",
    30. "Title": "curl: Use-after-free when closing \"easy\" handle in Curl_close()",
    31. "Description": "A heap use-after-free flaw was found in curl versions from 7.59.0 through 7.61.1 in the code related to closing an easy handle. ",
    32. "Severity": "HIGH",
    33. "References": [
    34. "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-16840",
    35. ]
    36. {
    37. "VulnerabilityID": "CVE-2019-3822",
    38. "PkgName": "curl",
    39. "InstalledVersion": "7.61.0-r0",
    40. "FixedVersion": "7.61.1-r2",
    41. "Title": "curl: NTLMv2 type-3 header stack buffer overflow",
    42. "Description": "libcurl versions from 7.36.0 to before 7.64.0 are vulnerable to a stack-based buffer overflow. ",
    43. "Severity": "HIGH",
    44. "References": [
    45. "https://curl.haxx.se/docs/CVE-2019-3822.html",
    46. "https://lists.apache.org/thread.html/8338a0f605bdbb3a6098bb76f666a95fc2b2f53f37fa1ecc89f1146f@%3Cdevnull.infra.apache.org%3E"
    47. ]
    48. },
    49. {
    50. "VulnerabilityID": "CVE-2018-16839",
    51. "PkgName": "curl",
    52. "InstalledVersion": "7.61.0-r0",
    53. "FixedVersion": "7.61.1-r1",
    54. "Title": "curl: Integer overflow leading to heap-based buffer overflow in Curl_sasl_create_plain_message()",
    55. "Description": "Curl versions 7.33.0 through 7.61.1 are vulnerable to a buffer overrun in the SASL authentication code that may lead to denial of service.",
    56. "Severity": "HIGH",
    57. "References": [
    58. "https://github.com/curl/curl/commit/f3a24d7916b9173c69a3e0ee790102993833d6c5",
    59. ]
    60. },
    61. {
    62. "VulnerabilityID": "CVE-2018-19486",
    63. "PkgName": "git",
    64. "InstalledVersion": "2.15.2-r0",
    65. "FixedVersion": "2.15.3-r0",
    66. "Description": "Git before 2.19.2 on Linux and UNIX executes commands from the current working directory (as if '.' were at the end of $PATH) in certain cases involving the run_command() API and run-command.c, because there was a dangerous change from execvp to execv during 2017.",
    67. "Severity": "HIGH",
    68. "References": [
    69. "https://usn.ubuntu.com/3829-1/",
    70. ]
    71. },
    72. {
    73. "PkgName": "git",
    74. "InstalledVersion": "2.15.2-r0",
    75. "FixedVersion": "2.15.3-r0",
    76. "Title": "git: arbitrary code execution via .gitmodules",
    77. "Description": "Git before 2.14.5, 2.15.x before 2.15.3, 2.16.x before 2.16.5, 2.17.x before 2.17.2, 2.18.x before 2.18.1, and 2.19.x before 2.19.1 allows remote code execution during processing of a recursive \"git clone\" of a superproject if a .gitmodules file has a URL field beginning with a '-' character.",
    78. "Severity": "HIGH",
    79. "References": [
    80. "http://www.securitytracker.com/id/1041811",
    81. ]
    82. }
    83. ]
    84. },
    85. {
    86. "Target": "python-app/Pipfile.lock",
    87. "Vulnerabilities": null
    88. },
    89. {
    90. "Target": "ruby-app/Gemfile.lock",
    91. "Vulnerabilities": null
    92. },
    93. {
    94. "Target": "rust-app/Cargo.lock",
    95. "Vulnerabilities": null
    96. }
    97. ]

    VulnerabilityID, PkgName, InstalledVersion, and Severity in Vulnerabilities are always filled with values, but other fields might be empty.

    Result

    1. 2020-01-02T18:02:32.856+0100 INFO Detecting Alpine vulnerabilities...
    2. golang:1.12-alpine (alpine 3.10.2)
    1. $ trivy image --format template --template '{{- $critical := 0 }}{{- $high := 0 }}{{- range . }}{{- range .Vulnerabilities }}{{- if eq .Severity "CRITICAL" }}{{- $critical = add $critical 1 }}{{- end }}{{- if eq .Severity "HIGH" }}{{- $high = add $high 1 }}{{- end }}{{- end }}{{- end }}Critical: {{ $critical }}, High: {{ $high }}' golang:1.12-alpine

    Result

    1. Critical: 0, High: 2

    For other features of sprig, see the official sprig documentation.

    You can load templates from a file prefixing the template path with an @.

    XML

    1. $ trivy image --format template --template "@contrib/junit.tpl" -o junit-report.xml golang:1.12-alpine

    SARIF

    In the following example using the template sarif.tpl can be generated.

    1. $ trivy image --format template --template "@contrib/sarif.tpl" -o report.sarif golang:1.12-alpine

    This SARIF format can be uploaded to GitHub code scanning results, and there is a Trivy GitHub Action for automating this process.

    Trivy also supports an

    HTML