Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ jobs:
contains(github.event.pull_request.labels.*.name, 'generate-dumps-on-pr')
env:
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
ROX_LEGACY_NVD_LOADER: true
ROX_NVD_FEED_LOADER: true
runs-on: ubuntu-latest
needs:
- pre-build-updater
Expand Down
3 changes: 2 additions & 1 deletion cmd/clair/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ func Boot(config *Config, slimMode bool) {
go func() {
defer wg.Add(-1)
var err error
db, err = database.OpenWithRetries(config.Database, true, 30, 10*time.Second)
// Wait for the DB to be ready: 10 minutes.
db, err = database.OpenWithRetries(config.Database, true, 60, 10*time.Second)
if err != nil {
log.WithError(err).Fatal("Failed to open database despite multiple retries...")
}
Expand Down
71 changes: 37 additions & 34 deletions e2etests/testcase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2289,7 +2289,7 @@ var testCases = []testCase{
VersionFormat: "rpm",
Version: "2.9.1-4.el8.x86_64",
AddedBy: "sha256:35ad9b4fba1fa6b00a6f266303348dc0cf9a7c341616e800c2738030c0f64167",
FixedBy: "2.9.1-9.el8",
FixedBy: "2.9.1-10.el8_10",
Vulnerabilities: []apiV1.Vulnerability{
{
Name: "RHSA-2020:4952",
Expand Down Expand Up @@ -3595,7 +3595,7 @@ For more details about the security issue(s), including the impact, a CVSS score
},
{
AddedBy: "sha256:2412e60e610160d090f7e974a208c6ffd26b2d530361b7c9aa8967e160ac7996",
FixedBy: "2:8.2.2637-21.el9",
FixedBy: "2:8.2.2637-22.el9_6",
Name: "vim-minimal",
NamespaceName: "rhel:9",
Version: "2:8.2.2637-16.el9_0.2.x86_64",
Expand Down Expand Up @@ -3838,8 +3838,8 @@ Applications using RegexRequestMatcher with '.' in the regular expression are po
FixedBy: "3.0.2-0ubuntu1.7",
},
},
FixedBy: "3.0.2-0ubuntu1.16",
// This image installs the openssl pacakge in the second layer;
FixedBy: "3.0.2-0ubuntu1.18",
// This image installs the openssl package in the second layer;
// however, the first layer already installed libssl3 whose source package is openssl.
// Therefore, we claim openssl was installed in the first layer.
AddedBy: "sha256:301a8b74f71f85f3a31e9c7e7fedd5b001ead5bcf895bc2911c1d260e06bd987",
Expand Down Expand Up @@ -4028,7 +4028,7 @@ All OpenShift Container Platform 4.10 users are advised to upgrade to these upda
Name: "tomcat",
VersionFormat: component.JavaSourceType.String(),
Version: "9.0.59",
FixedBy: "9.0.90",
FixedBy: "9.0.107",
Location: "tomcat-embed-core-9.0.59.jar",
Vulnerabilities: []apiV1.Vulnerability{
{
Expand Down Expand Up @@ -4056,7 +4056,7 @@ All OpenShift Container Platform 4.10 users are advised to upgrade to these upda
},
{
Name: "CVE-2023-28708",
Description: "\nWhen using the RemoteIpFilter with requests received from a reverse proxy via HTTP that include the X-Forwarded-Proto header set to https, session cookies created by Apache Tomcat 11.0.0-M1 to 11.0.0.-M2, 10.1.0-M1 to 10.1.5, 9.0.0-M1 to 9.0.71 and 8.5.0 to 8.5.85 did not\u00a0include the secure attribute. This could result in the user agent\u00a0transmitting the session cookie over an insecure channel.\n\n\n\n\n\n\n\n",
Description: "When using the RemoteIpFilter with requests received from a reverse proxy via HTTP that include the X-Forwarded-Proto header set to https, session cookies created by Apache Tomcat 11.0.0-M1 to 11.0.0.-M2, 10.1.0-M1 to 10.1.5, 9.0.0-M1 to 9.0.71 and 8.5.0 to 8.5.85 did not\u00a0include the secure attribute. This could result in the user agent\u00a0transmitting the session cookie over an insecure channel.\n\nOlder, EOL versions may also be affected.",
Link: "https://nvd.nist.gov/vuln/detail/CVE-2023-28708",
Severity: "Moderate",
FixedBy: "9.0.72",
Expand Down Expand Up @@ -4318,7 +4318,7 @@ All OpenShift Container Platform 4.10 users are advised to upgrade to these upda
},
},
AddedBy: "sha256:661ff4d9561e3fd050929ee5097067c34bafc523ee60f5294a37fd08056a73ca",
FixedBy: "3.1.4-r5",
FixedBy: "3.1.7-r0",
},
},
},
Expand Down Expand Up @@ -4354,7 +4354,34 @@ All OpenShift Container Platform 4.10 users are advised to upgrade to these upda
NamespaceName: "alpine:v3.20",
VersionFormat: "apk",
Version: "3.3.0-r2",
AddedBy: "sha256:d25f557d7f31bf7acfac935859b5153da41d13c41f2b468d16f729a5b883634f",
Vulnerabilities: []apiV1.Vulnerability{
{
Name: "CVE-2024-6119",
NamespaceName: "alpine:v3.20",
Description: "Issue summary: Applications performing certificate name checks (e.g., TLS\nclients checking server certificates) may attempt to read an invalid memory\naddress resulting in abnormal termination of the application process.\n\nImpact summary: Abnormal termination of an application can a cause a denial of\nservice.\n\nApplications performing certificate name checks (e.g., TLS clients checking\nserver certificates) may attempt to read an invalid memory address when\ncomparing the expected name with an `otherName` subject alternative name of an\nX.509 certificate. This may result in an exception that terminates the\napplication program.\n\nNote that basic certificate chain validation (signatures, dates, ...) is not\naffected, the denial of service can occur only when the application also\nspecifies an expected DNS name, Email address or IP address.\n\nTLS servers rarely solicit client certificates, and even when they do, they\ngenerally don't perform a name check against a reference identifier (expected\nidentity), but rather extract the presented identity after checking the\ncertificate chain. So TLS servers are generally not affected and the severity\nof the issue is Moderate.\n\nThe FIPS modules in 3.3, 3.2, 3.1 and 3.0 are not affected by this issue.",
Link: "https://www.cve.org/CVERecord?id=CVE-2024-6119",
Severity: "Important",
FixedBy: "3.3.2-r0",
Metadata: map[string]interface{}{
"NVD": map[string]interface{}{
"CVSSv2": map[string]interface{}{
"ExploitabilityScore": 0.0,
"ImpactScore": 0.0,
"Score": 0.0,
"Vectors": "",
},
"CVSSv3": map[string]interface{}{
"ExploitabilityScore": 3.9,
"ImpactScore": 3.6,
"Score": 7.5,
"Vectors": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H",
},
},
},
},
},
AddedBy: "sha256:d25f557d7f31bf7acfac935859b5153da41d13c41f2b468d16f729a5b883634f",
FixedBy: "3.3.2-r0",
},
},
},
Expand Down Expand Up @@ -4399,30 +4426,6 @@ All OpenShift Container Platform 4.10 users are advised to upgrade to these upda
},
},
},
{
Name: "CVE-2024-47177",
NamespaceName: "rhel:8",
Description: "DOCUMENTATION: A security flaw was found in OpenPrinting CUPS. The `FoomaticRIPCommandLine` directive in a PPD file will allow arbitrary commands to be executed when a print job is sent to the affected printing device. An attacker who could provide a malicious PPD file for a new print device or modify a PPD file of an existing device could execute arbitrary commands. \n STATEMENT: Red Hat rates the severity of this CVE as Moderate due to the restrictions of the unprivileged ‘lp’ user which the resulting commands would be run as. Additionally, creating and modifying printer definitions is restricted to the privileged user groups sys, root, and wheel by default.\n MITIGATION: See the security bulletin for a detailed mitigation procedure.",
Link: "https://access.redhat.com/security/cve/CVE-2024-47177",
Severity: "Moderate",
FixedBy: "",
Metadata: map[string]interface{}{
"Red Hat": map[string]interface{}{
"CVSSv2": map[string]interface{}{
"ExploitabilityScore": 0.0,
"ImpactScore": 0.0,
"Score": 0.0,
"Vectors": "",
},
"CVSSv3": map[string]interface{}{
"ExploitabilityScore": 0.6,
"ImpactScore": 5.5,
"Score": 6.1,
"Vectors": "CVSS:3.1/AV:L/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:L",
},
},
},
},
},
},
{
Expand Down Expand Up @@ -4794,7 +4797,7 @@ All OpenShift Container Platform 4.10 users are advised to upgrade to these upda
NamespaceName: "rhel:8",
VersionFormat: "rpm",
Version: "1:17.0.11.0.9-2.el8.x86_64",
FixedBy: "1:17.0.14.0.7-3.el8",
FixedBy: "1:17.0.16.0.8-2.el8",
AddedBy: "sha256:06c7a3d491f551a56296ccb9bee8a68c83776991e73a9005e8b5ebb533002097",
},
},
Expand All @@ -4813,7 +4816,7 @@ All OpenShift Container Platform 4.10 users are advised to upgrade to these upda
NamespaceName: "rhel:8",
VersionFormat: "rpm",
Version: "1:17.0.13.0.11-3.el8.x86_64",
FixedBy: "1:17.0.14.0.7-3.el8",
FixedBy: "1:17.0.16.0.8-2.el8",
AddedBy: "sha256:2f7b9495af5ddc85b0be7ca9411fddb54f37999ea73b03cbf1115dd0c5bd4f95",
},
},
Expand Down
6 changes: 3 additions & 3 deletions pkg/env/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ var (
// MaxGrpcConcurrentStreams configures the maximum number of HTTP/2 streams to use with gRPC
MaxGrpcConcurrentStreams = RegisterIntegerSetting("ROX_GRPC_MAX_CONCURRENT_STREAMS", DefaultMaxGrpcConcurrentStreams)

// LegacyNVDLoader when true will cause the loader to pull NVD data using
// the NVD Legacy Data Feeds, if false will pull from the NVD 2.0 API.
LegacyNVDLoader = RegisterBooleanSetting("ROX_LEGACY_NVD_LOADER", false)
// NVDFeedLoader when true will cause the loader to pull NVD data using
// the NVD 2.0 Data Feeds. If false, the loader will pull from the NVD 2.0 API.
NVDFeedLoader = RegisterBooleanSetting("ROX_NVD_FEED_LOADER", false)

// RHLineage when true will cause all parent layers (a.k.a lineage) to be considered when
// storing scan results for RHEL image layers.
Expand Down
25 changes: 17 additions & 8 deletions pkg/vulnloader/nvdloader/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const (
jsonTimeFormat = "2006-01-02T15:04Z"
)

func toJSON(vulns []*apischema.CVEAPIJSON20DefCVEItem) ([]*jsonschema.NVDCVEFeedJSON10DefCVEItem, error) {
func toJSON10(vulns []*apischema.CVEAPIJSON20DefCVEItem) ([]*jsonschema.NVDCVEFeedJSON10DefCVEItem, error) {
if vulns == nil {
return nil, nil
}
Expand All @@ -31,6 +31,11 @@ func toJSON(vulns []*apischema.CVEAPIJSON20DefCVEItem) ([]*jsonschema.NVDCVEFeed
continue
}

// Ignore rejected vulnerabilities.
if strings.EqualFold(vuln.CVE.VulnStatus, "Rejected") {
continue
}

cve := vuln.CVE

modifiedTime, err := toTime(cve.LastModified)
Expand Down Expand Up @@ -152,14 +157,18 @@ func toBaseMetricV2(metrics []*apischema.CVEAPIJSON20CVSSV2) *jsonschema.NVDCVEF
}

func toBaseMetricV3(metrics30 []*apischema.CVEAPIJSON20CVSSV30, metrics31 []*apischema.CVEAPIJSON20CVSSV31) *jsonschema.NVDCVEFeedJSON10DefImpactBaseMetricV3 {
switch {
case len(metrics31) != 0:
return toBaseMetricV31(metrics31)
case len(metrics30) != 0:
return toBaseMetricV30(metrics30)
default:
return nil
// Prefer CVSS 3.1.
baseMetric := toBaseMetricV31(metrics31)
if baseMetric != nil {
return baseMetric
}

baseMetric = toBaseMetricV30(metrics30)
if baseMetric != nil {
return baseMetric
}

return nil
}

func toBaseMetricV31(metrics []*apischema.CVEAPIJSON20CVSSV31) *jsonschema.NVDCVEFeedJSON10DefImpactBaseMetricV3 {
Expand Down
130 changes: 130 additions & 0 deletions pkg/vulnloader/nvdloader/convert_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
package nvdloader

import (
"os"
"testing"

jsonschema "github.com/facebookincubator/nvdtools/cvefeed/nvd/schema"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestToJSON10(t *testing.T) {
f, err := os.Open("testdata/nvdcve-2.0-2025.json")
require.NoError(t, err)
t.Cleanup(func() {
require.NoError(t, f.Close())
})

cveAPI, err := parseReader(f)
require.NoError(t, err)

cveFeed, err := toJSON10(cveAPI.Vulnerabilities)
assert.NoError(t, err)

expected := []*jsonschema.NVDCVEFeedJSON10DefCVEItem{
{
CVE: &jsonschema.CVEJSON40{
CVEDataMeta: &jsonschema.CVEJSON40CVEDataMeta{
ID: "CVE-2025-0168",
},
Description: &jsonschema.CVEJSON40Description{
DescriptionData: []*jsonschema.CVEJSON40LangString{
{
Lang: "en",
Value: "A vulnerability classified as critical has been found in code-projects Job Recruitment 1.0. This affects an unknown part of the file /_parse/_feedback_system.php. The manipulation of the argument person leads to sql injection. It is possible to initiate the attack remotely. The exploit has been disclosed to the public and may be used.",
},
},
},
},
Configurations: &jsonschema.NVDCVEFeedJSON10DefConfigurations{
Nodes: []*jsonschema.NVDCVEFeedJSON10DefNode{
{
CPEMatch: []*jsonschema.NVDCVEFeedJSON10DefCPEMatch{
{
Cpe23Uri: "cpe:2.3:a:anisha:job_recruitment:1.0:*:*:*:*:*:*:*",
Vulnerable: true,
},
},
Operator: "OR",
},
},
},
Impact: &jsonschema.NVDCVEFeedJSON10DefImpact{
BaseMetricV3: &jsonschema.NVDCVEFeedJSON10DefImpactBaseMetricV3{
CVSSV3: &jsonschema.CVSSV30{
AttackComplexity: "LOW",
AttackVector: "NETWORK",
AvailabilityImpact: "NONE",
BaseScore: 7.5,
BaseSeverity: "HIGH",
ConfidentialityImpact: "HIGH",
IntegrityImpact: "NONE",
PrivilegesRequired: "NONE",
Scope: "UNCHANGED",
UserInteraction: "NONE",
VectorString: "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N",
Version: "3.1",
},
ExploitabilityScore: 3.9,
ImpactScore: 3.6,
},
},
LastModifiedDate: "2025-02-25T21:26Z",
PublishedDate: "2025-01-01T14:15Z",
},
{
CVE: &jsonschema.CVEJSON40{
CVEDataMeta: &jsonschema.CVEJSON40CVEDataMeta{
ID: "CVE-2025-22144",
},
Description: &jsonschema.CVEJSON40Description{
DescriptionData: []*jsonschema.CVEJSON40LangString{
{
Lang: "en",
Value: "NamelessMC is a free, easy to use & powerful website software for Minecraft servers. A user with admincp.core.emails or admincp.users.edit permissions can validate users and an attacker can reset their password. When the account is successfully approved by email the reset code is NULL, but when the account is manually validated by a user with admincp.core.emails or admincp.users.edit permissions then the reset_code will no longer be NULL but empty. An attacker can request http://localhost/nameless/index.php?route=/forgot_password/&c= and reset the password. As a result an attacker may compromise another users password and take over their account. This issue has been addressed in release version 2.1.3 and all users are advised to upgrade. There are no known workarounds for this vulnerability.",
},
},
},
},
Configurations: &jsonschema.NVDCVEFeedJSON10DefConfigurations{
Nodes: []*jsonschema.NVDCVEFeedJSON10DefNode{
{
CPEMatch: []*jsonschema.NVDCVEFeedJSON10DefCPEMatch{
{
Cpe23Uri: "cpe:2.3:a:namelessmc:nameless:*:*:*:*:*:*:*:*",
VersionEndExcluding: "2.1.3",
Vulnerable: true,
},
},
Operator: "OR",
},
},
},
Impact: &jsonschema.NVDCVEFeedJSON10DefImpact{
BaseMetricV3: &jsonschema.NVDCVEFeedJSON10DefImpactBaseMetricV3{
CVSSV3: &jsonschema.CVSSV30{
AttackComplexity: "LOW",
AttackVector: "NETWORK",
AvailabilityImpact: "HIGH",
BaseScore: 9.8,
BaseSeverity: "CRITICAL",
ConfidentialityImpact: "HIGH",
IntegrityImpact: "HIGH",
PrivilegesRequired: "NONE",
Scope: "UNCHANGED",
UserInteraction: "NONE",
VectorString: "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
Version: "3.1",
},
ExploitabilityScore: 3.9,
ImpactScore: 5.9,
},
},
LastModifiedDate: "2025-05-13T15:42Z",
PublishedDate: "2025-01-13T20:15Z",
},
}

assert.ElementsMatch(t, expected, cveFeed)
}
Loading