Hardcoded accounts, keys and credentials in firmware
A credential embedded in a distributed image can become known to every person who obtains that image. Understanding hardcoded accounts and keys and credentials 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.
Secrets should not be hard-coded into the source code. Instead, secrets should be stored in a secure manner (see ISTG-FW-SCRT-001 and ISTG-FW-SCRT-002) and the software process should dynamically retrieve the secrets from the secure storage during runtime.
Many IoT devices need to implement cryptographic algorithms, e.g., to securely store sensitive data, for authentication purposes or to receive and verify encrypted data from other network nodes. Failing to implement secure, state of the art cryptography might lead to the exposure of sensitive data, device malfunctions or loss of control over the device.
Why it matters
Consider a realistic failure: a shared maintenance password grants the same privilege on every device.
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
Identify hardcoded values and test their actual acceptance and scope.
- endangering all devices that are using the given software since it is very likely that the same secret is used on all devices (otherwise, the source code needs to be changed and compiled for every device individually) and.
- impeding reactive measures in case of the secret being compromised since changing the secret requires a software update.
- Based on ISTG-FW-INFO-001, it must be checked if any hard-coded secrets can be identified.
- Review privileges and externally influenced inputs.
- Preserve reproducible evidence and representative recovery conditions.
How to fix it
Use per-device provisioning and revoke shared credentials that confer unintended access.
- 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
- Secrets exposed through firmware storage and packaging
- Outdated firmware components and embedded software inventories
- Unnecessary daemons and hidden functionality in firmware
Read about our methodology or contact pentested.com to discuss your firmware and embedded systems.