Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added common false positive check to openssl signature #766

Merged
merged 1 commit into from
Nov 25, 2024
Merged
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
19 changes: 13 additions & 6 deletions src/signatures/openssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,22 @@ pub fn openssl_crypt_parser(
..Default::default()
};

// This "salt" value are the bytes commonly found in the openssl binary itself
let known_false_positive_salts: Vec<usize> = vec![0x2D252D32];

// Parse the header
if let Ok(openssl_header) = parse_openssl_crypt_header(&file_data[offset..]) {
// If the magic starts at the beginning of a file, our confidence is a bit higher
if offset == 0 {
result.confidence = CONFIDENCE_MEDIUM;
}
// Check common false positive salt values
if !known_false_positive_salts.contains(&openssl_header.salt) {
// If the magic starts at the beginning of a file, our confidence is a bit higher
if offset == 0 {
result.confidence = CONFIDENCE_MEDIUM;
}

result.description = format!("{}, salt: {:#X}", result.description, openssl_header.salt);
return Ok(result);
result.description =
format!("{}, salt: {:#X}", result.description, openssl_header.salt);
return Ok(result);
}
}

Err(SignatureError)
Expand Down