Skip to content

Authenticode-rs is too strict about the presence of content-type attribute #238

@roblabla

Description

@roblabla

here's another sample where windows accepts the signature, but authenticode-rs doesn't: no_content_type_attribute.exe.zip.

This time, we have a binary that is missing the content-type attribute in the signed attributes. Here's the code generating the signed_attrs:

let signed_attrs = SignedAttributes::from_iter(vec![Attribute {
    oid: OID_MESSAGE_DIGEST,
    values: SetOfVec::from_iter(vec![
        Any::encode_from(&OctetString::new(econtent_hash.finalize().as_slice()).unwrap()).unwrap(),
    ])
    .unwrap(),
}])
.unwrap();

As you can see, there is no ContentType. And yet windows accepts the signature without issue. In fact, I also have a test binary that has the wrong content-type attribute, and windows accepts it too: content_type_mismatch_signedattr_invalid.exe.zip.

It seems like windows only checks the content-type found in the EmbeddedContent (which is not signed 😬).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions