CWE-347

Improper Verification of Cryptographic Signature. [Cryptographic-Issues, Data-Integrity-Issues, Protection-Mechanism-Failure]

Required inputs: IR

The product does not verify, or incorrectly verifies, the cryptographic signature for data.
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

certificate_key_functions

certificate_key_functions

Type: set[bauhaus.analysis.config.QualifiedName]

Default: {'X509_get0_pubkey', 'X509_get_pubkey', 'gnutls_pubkey_import_x509', 'wolfSSL_X509_get_pubkey'}

Functions that hand out the public key stored in a certificate.
 

signature_verification_functions

signature_verification_functions

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'}

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.