diff --git a/syft/pkg/cataloger/binary/cataloger_test.go b/syft/pkg/cataloger/binary/cataloger_test.go index e7aa36cd8..d38de2e41 100644 --- a/syft/pkg/cataloger/binary/cataloger_test.go +++ b/syft/pkg/cataloger/binary/cataloger_test.go @@ -763,6 +763,18 @@ func Test_Cataloger_DefaultClassifiers_PositiveCases(t *testing.T) { Metadata: metadata("bash-binary"), }, }, + { + name: "positive-openssl-3.1.4", + fixtureDir: "test-fixtures/classifiers/positive/openssl-3.1.4", + expected: pkg.Package{ + Name: "openssl", + Version: "3.1.4", + Type: "binary", + PURL: "pkg:generic/openssl@3.1.4", + Locations: locations("openssl"), + Metadata: metadata("openssl-binary"), + }, + }, } for _, test := range tests { diff --git a/syft/pkg/cataloger/binary/default_classifiers.go b/syft/pkg/cataloger/binary/default_classifiers.go index e3ecd58b1..95376052f 100644 --- a/syft/pkg/cataloger/binary/default_classifiers.go +++ b/syft/pkg/cataloger/binary/default_classifiers.go @@ -334,6 +334,17 @@ var defaultClassifiers = []classifier{ PURL: mustPURL("pkg:generic/bash@version"), CPEs: singleCPE("cpe:2.3:a:gnu:bash:*:*:*:*:*:*:*:*"), }, + { + Class: "openssl-binary", + FileGlob: "**/openssl", + EvidenceMatcher: fileContentsVersionMatcher( + // [NUL]OpenSSL 3.1.4' + `\x00OpenSSL (?P[0-9]+\.[0-9]+\.[0-9]+(-alpha[0-9]|-beta[0-9]|-rc[0-9])?)`, + ), + Package: "openssl", + PURL: mustPURL("pkg:generic/openssl@version"), + CPEs: singleCPE("cpe:2.3:a:openssl:openssl:*:*:*:*:*:*:*:*"), + }, } // in both binaries and shared libraries, the version pattern is [NUL]3.11.2[NUL] diff --git a/syft/pkg/cataloger/binary/test-fixtures/classifiers/positive/openssl-3.1.4/openssl b/syft/pkg/cataloger/binary/test-fixtures/classifiers/positive/openssl-3.1.4/openssl new file mode 100755 index 000000000..a2fc1b691 Binary files /dev/null and b/syft/pkg/cataloger/binary/test-fixtures/classifiers/positive/openssl-3.1.4/openssl differ