Engineer working on a laptop connected to a device test rig, surrounded by wiring harnesses and test hardware

Firmware vulnerabilities & fixes

How to fix weak cryptography in embedded firmware

Last updated:

Weak cryptography in embedded firmware spans four related but distinct MITRE weaknesses, read 2026-11-02: a broken or deprecated algorithm (CWE-327, think DES, RC4, MD5 or SHA-1 doing a job that needs real confidentiality or integrity); an algorithm that is sound but under-sized for the job (CWE-326, like a key length an attacker can now brute-force); a cryptographic key hard-coded identically into every shipped unit (CWE-321); and key material, tokens or nonces generated from insufficiently random values (CWE-330). CISA calls continued use of deprecated algorithms a named "bad practice" for any product used in critical infrastructure, and firmware is where these weaknesses are hardest to retire quietly — unlike a web server, you can't always just flip a config flag and redeploy.

Key takeaways

  • They sound similar but call for different fixes, and a single device can carry more than one at once.
  • Use NIST's transition tables as the yardstick even outside US federal work, because most customer audits and many standards point back to them.
  • Device standards turn the CWE advice into pass/fail provisions.
  • Work from the shipped binary, because build flags and vendor patches often differ from what the source tree suggests.

Why does this keep showing up in shipping firmware?

CISA's Product Security Bad Practices guidance is direct about the risk: "Information technology products used in service of critical infrastructure or NCFs and that use known insecure or deprecated cryptographic algorithms or lack encryption for the transit or storage of sensitive information are dangerous," specifically naming continued use of TLS 1.0/1.1, MD5, SHA-1 and DES as examples still found in the field. In firmware specifically, this is rarely a deliberate current-day choice — a weak algorithm or key length is usually inherited from an SoC vendor's old reference SDK that nobody has revisited since the product's first revision, or it was a genuinely reasonable call on resource-constrained hardware years ago that has since been replaced by a chip capable of running something stronger, without the firmware's crypto choices being updated to match.

How do the four weaknesses actually differ in practice?

They sound similar but call for different fixes, and a single device can carry more than one at once. CWE-327 (broken/risky algorithm) is an algorithm-choice problem — the cipher itself is weak or deprecated, no matter how it's keyed. CWE-326 (inadequate encryption strength) assumes the algorithm is fine but the parameters aren't — a 64-bit key with AES is still AES, but it isn't adequate anymore. CWE-321 (hard-coded key) is a provisioning problem, not an algorithm problem — even a perfectly strong, modern cipher is defeated the moment every unit of a product shares the same embedded key, since extracting one unit's firmware compromises the entire fleet. CWE-330 (insufficient randomness) undermines whichever algorithm and key length were chosen, because a predictable PRNG seed makes supposedly-random session keys, nonces or tokens guessable regardless of how strong the cipher downstream is. Treating all four as "the crypto is bad" obscures that the actual fixes — swap an algorithm, lengthen a key, change provisioning, change entropy sourcing — are different engineering changes.

Weakness What is wrong Typical firmware symptom Type of fix
CWE-327 The algorithm or protocol DES/3DES, RC4, MD5 or SHA-1 signatures; TLS 1.0 enabled Replace the algorithm
CWE-326 The parameters RSA-1024 device certificate; short symmetric key Lengthen keys, re-issue
CWE-321 The provisioning Same key or private key in every image Per-unit keys at manufacture
CWE-330 The entropy PRNG seeded from time or a constant Hardware entropy, CSPRNG

Two ICS advisories show the CWE-321 row in practice. Westermo WeOS before 4.19.0 "uses the same SSL private key across different customers' installations," which helps man-in-the-middle attackers who know the key (CVE-2015-7923, 9.0 CVSS v3.0 per NVD). CISA's ICSA-19-227-01 says Johnson Controls Metasys ADS/ADX servers and NAE/NIE/NCE engines before 9.0 use a shared RSA key pair for Site Management Portal encryption, so anyone holding it could decrypt captured traffic (CVE-2019-7593, 6.8 per Johnson Controls and CISA, 9.1 per NVD).

Which algorithms and key sizes are still acceptable in 2026?

Use NIST's transition tables as the yardstick even outside US federal work, because most customer audits and many standards point back to them. NIST SP 800-131A Rev. 2 sets 112 bits of security strength as the floor: RSA moduli under 2048 bits and ECDSA curves with len(n) under 224 bits are disallowed for generating signatures, SHA-1 is disallowed for signature generation except where protocol-specific guidance allows it, two-key TDEA is disallowed, and three-key TDEA encryption has been disallowed since the end of 2023. The Rev. 3 initial public draft (October 2024) goes further: it proposes retiring ECB as a confidentiality mode, scheduling the retirement of SHA-1 and the 224-bit hash functions, and moving from 112-bit to 128-bit security strength.

The quantum timeline now matters for products with a 10-year field life. NIST IR 8547, final since October 2026, deprecates quantum-vulnerable RSA, ECDSA and EdDSA signatures and RSA/ECDH key establishment after 2030 and disallows them after 2035; it also states that NIST's few 112-bit symmetric standards will be disallowed in 2030. The replacement key-establishment standard, FIPS 203 (ML-KEM), was published on 13 August 2024 — see our FIPS 203/204/205 guide. On the protocol side, RFC 8996 (March 2021) formally deprecates TLS 1.0 and 1.1; TLS 1.3 (RFC 8446) is the target.

Primitive in firmware Status Source
DES, two-key TDEA, RC4 Disallowed / do not use SP 800-131A Rev. 2; CISA Bad Practices
Three-key TDEA encryption Disallowed after 2023 SP 800-131A Rev. 2
SHA-1 for signatures Disallowed (generation) SP 800-131A Rev. 2
RSA-1024, ECDSA on curves under 224 bits Disallowed (signature generation) SP 800-131A Rev. 2
RSA-2048, ECDSA P-256, ECDH Acceptable today; deprecated after 2030, disallowed after 2035 NIST IR 8547
AES-128/256, SHA-256/384 Acceptable SP 800-131A Rev. 2; NIST IR 8547
TLS 1.0 / 1.1 Deprecated RFC 8996

What does MITRE recommend for broken or undersized algorithms?

For CWE-327, MITRE's architecture-and-design mitigation is to "use strong, up-to-date cryptographic algorithms," picking "a well-vetted algorithm that is currently considered to be strong by experts in the field" rather than designing one in-house — a custom cipher "will likely be exposed to attacks that are well-understood by cryptographers" that its designer never anticipated. MITRE also flags that strength is not a one-time decision: "periodically ensure that the cryptography has not become obsolete," and design the system so one algorithm can be swapped for another in a future update rather than hard-wiring a single cipher choice a field device can never revise. For CWE-326, the matching fix is sizing keys and algorithm parameters to the protection actually required today, not to what was adequate when the product was first designed — the same algorithm with longer keys is often a smaller firmware change than a full cipher migration. Stored passwords are a common case: CISA's ICSA-23-026-02 says Econolite EOS traffic signal controller software before 3.2.23 keeps administrator and technician credentials as MD5 hashes in a configuration file readable without authentication (CVE-2023-0452, CWE-328, 9.8 per CISA, 5.3 per NVD).

What does MITRE recommend for hard-coded keys and weak randomness?

For CWE-321, MITRE states the fix directly: "prevention schemes mirror that of hard-coded password storage" — provision each unit with its own key at manufacturing or first boot, ideally derived from a hardware root of trust, instead of compiling one fixed key into every firmware image; our secure boot and hardware root of trust guide covers where that unique key material should actually be anchored in silicon. For CWE-330, MITRE is specific about scale and source: "a 256-bit seed is a good starting point for producing a 'random enough' number," a PRNG "not advertised as being cryptographically secure ... should not be used in security-sensitive contexts," and implementations should "re-seed ... from high quality ... sources, such as hardware devices" — a true hardware random number generator where the silicon has one, rather than a software PRNG seeded from something predictable like an uptime counter or boot timestamp. If you need to argue that a hardware source is good enough, NIST SP 800-90B defines the design requirements and validation tests for entropy sources.

What do IoT security standards require for cryptography?

Device standards turn the CWE advice into pass/fail provisions. ETSI EN 303 645 V3.1.3 says "hard-coded critical security parameters in consumer IoT device software source code shall not be used" (provision 5.4-3, mandatory), that sensitive security parameters in persistent storage "shall be stored securely" (5.4-1), that the device "shall use best practice cryptography to communicate securely" (5.5-1), and that "cryptographic algorithms and primitives should be replaceable" (5.5-3, recommended). Several national labels, Japan's JC-STAR STAR-1 among them, cross-reference ETSI EN 303 645, so one fix often closes findings in more than one scheme; see our ETSI EN 303 645 guide.

How do you find weak cryptography in a firmware image, step by step?

Work from the shipped binary, because build flags and vendor patches often differ from what the source tree suggests.

  1. Extract the image and list the crypto libraries and their versions (OpenSSL, mbed TLS, wolfSSL, BoringSSL, a vendor HAL). A firmware SBOM gives you this list and also shows old library versions with known CVEs.
  2. Read the library build configuration where it ships: OpenSSL's openssl version -a output or compile options, or mbed TLS's config header symbols for DES, ARC4, MD5 and SHA-1 support. Disabled at build time is stronger evidence than disabled in a config file.
  3. Search for key material: PEM headers (BEGIN RSA PRIVATE KEY, BEGIN EC PRIVATE KEY), DER blobs and high-entropy 16- or 32-byte constants near crypto calls. Compare two images from different units or batches; identical keys mean CWE-321.
  4. Probe every network service of a running unit. openssl s_client -connect host:443 -tls1_1 shows whether a deprecated protocol still negotiates (OpenSSL docs); Nmap's ssl-enum-ciphers script lists every protocol and cipher suite a TLS port accepts.
  5. Check certificates and update signing: key type and size of the device certificate, the code-signing key and the hash used in update signatures.
  6. Trace the random number path: which function seeds the CSPRNG, when, and from what source. Look specifically at the first boot after flashing.
  7. Record each finding with CWE, location in the image and the NIST status from the table above, so the fix can be prioritised and later verified.

How do we verify the fix actually worked?

A changelog entry saying "upgraded cryptography" is not evidence by itself. Confirm an algorithm or key-length change by extracting the shipped firmware binary and checking which crypto library calls, constants and key sizes it actually contains, not what the release notes claim. Confirm a hard-coded key is really gone by comparing binary strings or key material across multiple units from different manufacturing batches — if every sampled unit still produces an identical key or device certificate, per-device provisioning isn't actually happening regardless of what the design doc says. Confirm randomness quality by sampling generated tokens, nonces or session keys across many boots — including immediately after first flashing, a common point where a PRNG has gathered too little real entropy — rather than trusting that calling a function named "secure_random" makes the output secure.

Worked example: retiring a shared AES key and TLS 1.0 on a gateway

Synthetic example for illustration; the product and findings are invented.

A maker of a Linux-based building gateway receives an audit report with three findings: the local web UI accepts TLS 1.0, the cloud-pairing token is encrypted with one AES-128 key that appears in every image, and the token generator seeds rand() with the boot time.

  1. Triage: TLS 1.0 is CWE-327 (deprecated under RFC 8996). The shared key is CWE-321: the cipher is fine, the provisioning is not. The rand() seed is CWE-330.
  2. Fix the protocol: The team sets the minimum protocol to TLS 1.2, enables TLS 1.3, and removes CBC-SHA1 suites from the server configuration.
  3. Fix the key: The factory programming station now derives a per-unit key from the SoC's hardware unique key. Units in the field get a new key on their next update through a one-time re-pairing flow; the old shared key is revoked on the cloud side once the fleet reports the new version.
  4. Fix the randomness: Token generation moves to the kernel's getrandom(), which blocks until the kernel's random pool has been initialised.
  5. Verify: On release, the team runs ssl-enum-ciphers against three units, diffs key material across two batches (no match), and samples tokens from 500 cold boots without a repeat. The evidence goes into the release file next to the SBOM.

What are the common pitfalls?

  • Fixing the config, not the build. A cipher removed from a config file can come back with a factory reset; remove it at compile time where possible.
  • Forgetting the second TLS stack. Bootloaders, update agents and debug daemons often link their own crypto library.
  • Rotating keys without revoking the old one. If the cloud still accepts the shared key, the fleet stays exposed.
  • Testing randomness on a warm device. The weak moment is the first boot after flashing.
  • Hard-wiring the new algorithm. Without crypto agility (ETSI provision 5.5-3), the 2030–2035 quantum deadlines force another redesign. Plan signed over-the-air updates that can carry new algorithms.
  • Ignoring library CVEs. A correct configuration on an old OpenSSL release still inherits that release's known vulnerabilities.

SoftWSP's firmware scan builds a CycloneDX 1.6 SBOM from the image, which lists the crypto libraries it can identify (such as OpenSSL or mbed TLS) with their versions, and matches them against NVD, CISA KEV and FIRST EPSS so known library vulnerabilities are prioritised. The AI-drafted, cited report goes to an engineer for review; algorithm configuration, key uniqueness and randomness are reviewed by that engineer, not decided automatically. See device & firmware security services for how that scope covers CWE-327/326/321/330 alongside other CWE Top 25 classes like the ones in our memory corruption and hard-coded credentials guides.

This guide is based on MITRE's CWE-327, CWE-326, CWE-321 and CWE-330 definitions and CISA's Product Security Bad Practices guidance, read directly 2026-11-02, and on NIST SP 800-131A, NIST IR 8547, NIST SP 800-90B, RFC 8996 and ETSI EN 303 645, read 2026-11-11.

Put this guide to work

Frequently asked questions

What counts as "weak cryptography" in firmware, exactly?

MITRE catalogues it as several related but distinct weaknesses. CWE-327 (Use of a Broken or Risky Cryptographic Algorithm) covers a product that "uses a broken or risky cryptographic algorithm or protocol" — DES, RC4, MD5 or SHA-1 used where integrity or confidentiality actually matters, or a home-grown cipher instead of a vetted one. CWE-326 (Inadequate Encryption Strength) is narrower: the algorithm choice is "theoretically sound, but is not strong enough for the level of protection required" — for example a key length a modern attacker can brute-force even though the algorithm itself (like AES) is fine. CWE-321 (Use of Hard-coded Cryptographic Key) is a hard-coded key baked into every unit's firmware image. CWE-330 (Use of Insufficiently Random Values) covers predictable session tokens, nonces or key material generated from a weak pseudo-random number generator (PRNG). A single firmware image can carry more than one of these at once — a hard-coded key encrypted with a broken algorithm is a common combination.

Why do deprecated algorithms like DES, MD5, RC4 and SHA-1 keep showing up in firmware?

CISA's Product Security Bad Practices guidance names this directly as a bad practice for products used in critical infrastructure or National Critical Functions: "Information technology products ... that use known insecure or deprecated cryptographic algorithms or lack encryption for the transit or storage of sensitive information are dangerous," specifically calling out continued use of TLS 1.0/1.1, MD5, SHA-1 and DES. In firmware specifically, this usually isn't a conscious choice — it's inherited from an old SoC vendor SDK or reference design that was never revisited, or chosen years ago for a resource-constrained microcontroller that genuinely couldn't run a modern cipher at the time but has since been replaced by hardware that can.

What is MITRE's recommended fix for a broken or weak algorithm?

CWE-327's architecture-and-design mitigation: "use strong, up-to-date cryptographic algorithms," selecting "a well-vetted algorithm that is currently considered to be strong by experts in the field," and explicitly avoiding home-grown cryptography, since a custom algorithm "will likely be exposed to attacks that are well-understood by cryptographers" that its designer never considered. MITRE also recommends designing for replaceability — "periodically ensure that the cryptography has not become obsolete" and architect the system so one algorithm can be swapped for another in a future firmware update, rather than hard-wiring a single cipher choice that can't be revised without a full product redesign. CISA's parallel recommendation: adopt modern algorithms and, looking forward, begin planning for post-quantum cryptography per NIST guidance.

What is the fix for a hard-coded cryptographic key, and for weak randomness?

For CWE-321, MITRE states plainly that "prevention schemes mirror that of hard-coded password storage" — provision each device with a unique key at manufacturing or first boot (ideally derived from a hardware root of trust) instead of compiling one fixed key into every firmware image; see our [secure boot and hardware root of trust guide](/guides/secure-boot-hardware-root-of-trust/) for where that key material should actually live. For CWE-330, MITRE's mitigation is explicit about scale: "a 256-bit seed is a good starting point for producing a 'random enough' number," PRNGs not advertised as cryptographically secure should not be used in a security context at all, and a generator should "re-seed itself as needed from high quality ... sources, such as hardware devices" — i.e. a true hardware random number generator where the silicon has one, rather than a software PRNG seeded from a predictable value like a boot timestamp.

How do we verify a fix actually worked, rather than just changing a config flag?

Confirm the new algorithm and key length by extracting the actual firmware binary and checking what crypto library calls and constants it contains — a changelog claim isn't evidence. Confirm hard-coded keys are gone by diffing binary strings/entropy across multiple units from different manufacturing batches — if every unit still produces an identical key or certificate, provisioning isn't actually per-device yet. Confirm randomness quality by sampling generated tokens/nonces across many boots (including power-cycle immediately after flashing, a common point where a PRNG hasn't gathered enough entropy yet) and running statistical randomness tests rather than trusting the API name. This is the same evidence standard MITRE's CWE entries point to throughout: a named mitigation is only a fix once it's verified against the shipped binary, not the source comment describing it.

Sources

  1. MITRE CWE-327: Use of a Broken or Risky Cryptographic Algorithm
  2. MITRE CWE-326: Inadequate Encryption Strength
  3. MITRE CWE-321: Use of Hard-coded Cryptographic Key
  4. MITRE CWE-330: Use of Insufficiently Random Values
  5. CISA: Product Security Bad Practices (insecure/deprecated cryptographic algorithms)
  6. NIST SP 800-131A Rev. 2: Transitioning the Use of Cryptographic Algorithms and Key Lengths (March 2019)
  7. NIST SP 800-131A Rev. 3 initial public draft (October 2024)
  8. NIST IR 8547: Transition to Post-Quantum Cryptography Standards (final, October 2026)
  9. NIST FIPS 203: Module-Lattice-Based Key-Encapsulation Mechanism Standard (13 August 2024)
  10. NIST SP 800-90B: Recommendation for the Entropy Sources Used for Random Bit Generation
  11. IETF RFC 8996: Deprecating TLS 1.0 and TLS 1.1 (March 2021)
  12. IETF RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3
  13. ETSI EN 303 645 V3.1.3: Cyber Security for Consumer Internet of Things: Baseline Requirements (provisions 5.4 and 5.5)
  14. OpenSSL documentation: openssl-s_client
  15. Nmap NSE documentation: ssl-enum-ciphers
  16. Linux man-pages: getrandom(2)
Was this guide helpful?

In this cluster