CWE-347¶
Improper Verification of Cryptographic Signature. [Cryptographic-Issues, Data-Integrity-Issues, Protection-Mechanism-Failure]
Required inputs: IR
Demonstrative Examples
Example 1
In the following code, a JarFile object is created from a downloaded file.
Example Language:Java (Unsupported language for documentation only)
File f = new File(downloadedFilePath);
JarFile jf = new JarFile(f);
The JAR file that was potentially downloaded from an untrusted source is created without verifying the signature (if present). An alternate constructor that accepts a boolean verify parameter should be used instead.
Excerpts from CWE [https://cwe.mitre.org], Copyright (C) 2006-2026, the MITRE Corporation. See 9.4 3rd-Party Licenses in the documentation for full details.Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
unverified_signature |
Public key taken from a certificate without verifying a signature. |
None |
False |
Options¶
This rule shares the following common options: confidence, exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
certificate_key_functions¶
certificate_key_functions
Functions that hand out the public key stored in a certificate.Type: set[bauhaus.analysis.config.QualifiedName]
Default:
{'X509_get0_pubkey', 'X509_get_pubkey', 'gnutls_pubkey_import_x509', 'wolfSSL_X509_get_pubkey'}
signature_verification_functions¶
signature_verification_functions
Functions that decide whether a signature is valid. Adding an entry here also silences the findings for keys that are taken from a certificate for another purpose, such as encrypting to the certificate holder.Type: set[bauhaus.analysis.config.QualifiedName]
Default:
{'DSA_verify', 'ECDSA_verify', 'EVP_DigestVerify', 'EVP_DigestVerifyFinal', 'EVP_PKEY_verify', 'EVP_PKEY_verify_recover', 'EVP_VerifyFinal', 'RSA_verify', 'X509_verify', 'gnutls_pubkey_verify_data2', 'gnutls_pubkey_verify_hash2', 'mbedtls_pk_verify', 'mbedtls_pk_verify_ext', 'wc_RsaSSL_Verify', 'wc_ecc_verify_hash', 'wc_ed25519_verify_msg'}