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

fix verified field in pe module with multiple signatures #1988

Merged
merged 1 commit into from
Nov 17, 2023
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
9 changes: 4 additions & 5 deletions libyara/modules/pe/pe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1750,19 +1750,18 @@ void _process_authenticode(
if (!auth_array || !auth_array->count)
return;

/* If any signature will be valid -> file is correctly signed */
bool signature_valid = false;

for (size_t i = 0; i < auth_array->count; ++i)
{
const Authenticode* authenticode = auth_array->signatures[i];
bool verified = authenticode->verify_flags == AUTHENTICODE_VFY_VALID;

signature_valid |= authenticode->verify_flags == AUTHENTICODE_VFY_VALID
? true
: false;
/* If any signature is valid -> file is correctly signed */
signature_valid |= verified;

yr_set_integer(
signature_valid, pe->object, "signatures[%i].verified", *sig_count);
verified, pe->object, "signatures[%i].verified", *sig_count);

yr_set_string(
authenticode->digest_alg,
Expand Down
Loading