Weak cryptography and random values in firmware
Firmware cryptography depends on trustworthy algorithms, randomness and protected key handling. Understanding weak cryptography and random values in firmware helps establish which security property the feature needs and where that property is actually enforced.
What does this involve?
Firmware security depends on the relationship between the distributed image, installed configuration and code that actually executes. Offline analysis, emulation and real-device testing provide different kinds of evidence and should be connected before a strong impact claim is made.
Cryptography can be implemented in various ways. However, due to evolving technologies, new algorithms and more computing power becoming available, many old cryptographic algorithms are nowadays considered weak or insecure. Thus, either new and stronger cryptographic algorithms have to be used or existing algorithms must be adapted, e.g., by increasing the key length or using alternative modes of operation.
Only strong, state of the art cryptographic algorithms should be used. Furthermore, these algorithms must be used in a secure manner by setting proper parameters, such as an appropriate key length or mode of operation.
Why it matters
Consider a realistic failure: several devices generate identical key material after a predictable startup sequence.
A firmware weakness may expose device credentials, permit privileged actions or affect availability. The practical consequence depends on reachable services, execution privileges and the trust placed in the device by other components.
Firmware evidence should identify the image, installed configuration and execution conditions. Static analysis, emulation and hardware testing answer different questions and should support a consistent conclusion.
How penetration testers check for it
Review key generation, entropy availability and how cryptographic errors affect execution.
- The data, stored by or within the firmware, must be checked for the presence of encrypted data segments. In case that encrypted data segments are found, it must be checked whether the cryptographic algorithms in use can be identified.
- Furthermore, based on ISTG-FW-INFO-001 and ISTG-FW-INFO-002, it must be checked whether any source code, configuration files etc. disclose the usage of certain cryptographic algorithms.
- In case that cryptographic algorithms can be identified, it must be determined whether the algorithms in use and their configuration are providing a sufficient level of security at the time of testing, e.g., by consulting cryptography guidelines like the technical guideline TR-02102-1 by the BSI.
- Review privileges and externally influenced inputs.
- Preserve reproducible evidence and representative recovery conditions.
How to fix it
Use maintained implementations and a documented device key lifecycle.
- Remove unnecessary code, accounts and capabilities.
- Use safe input handling and narrow privileged interfaces.
- Protect secrets and authenticate relevant executable content.
- Verify fixes in the actual production and recovery artefacts.
A suspicious string or an emulation result is not enough to establish a working compromise. Validate the path and explain any environmental assumptions that affect the conclusion.
Recheck the changed behaviour against the original failure conditions and the legitimate user journey. Keep enough evidence to show which release and configuration were verified, and include related entry points that depend on the same security decision.
Related issues
- Sensitive user information retained in installed firmware
- Compiler and linker hardening in firmware binaries
- Memory safety defects in compiled firmware parsers
Read about our methodology or contact pentested.com to discuss your firmware and embedded systems.