fix(prodtest): Hotfix for invalid Infineon certificate format.
What changed, and why it matters
This commit is a small hotfix in Trezor's factory production-test tool (prodtest), which is used during manufacturing, not in normal end-user wallets. It changes how a certificate read from the Infineon OPTIGA secure chip is parsed. Previously, the code carefully checked a multi-certificate chain format; now it simply skips 9 bytes and assumes there is only one certificate. The change removes safety checks and could make the tool accept malformed or unexpected certificate data, but it only affects an internal manufacturing diagnostic command, not the wallet firmware users rely on for funds.
Treat as a low-risk manufacturing-tool hardening issue. If reviewing, verify that the new single-certificate assumption matches the actual Infineon certificate format used in production, and consider re-adding minimal bounds checks (e.g., cert_size >= 9) to avoid reading garbage or crashing the prodtest CLI. No end-user action is needed.
Security signals we found
Removal of length/offset validation in certificate parsing
Hardcoded assumption of single-certificate layout
Potential for out-of-bounds or malformed data handling in a production-test CLI
No changelog entry and no security disclosure language in commit
Evidence from the diff
In core/embed/projects/prodtest/cmd/prodtest_optiga.c, the cert_read() function previously parsed a 0xC0-prefixed TLS identity certificate chain by validating nested length fields (tls_identity_size, cert_chain_size, first_cert_size) and then returning only the first certificate. The hotfix removes all length validation and the zero-size check, instead hardcoding offset=9 and returning cert_size-9 bytes. This weakens input validation and assumes a single-certificate layout. The commit message frames this as fixing an ‘invalid Infineon certificate format’ parsing issue, but no advisory, CVE, or security relevance is stated.
Changed components
core/embed/projects/prodtest/cmd/prodtest_optiga.cTrezor factory production-test (prodtest) OPTIGA certificate read commandInspect captured patch +2 / −17
diff --git a/core/embed/projects/prodtest/cmd/prodtest_optiga.c b/core/embed/projects/prodtest/cmd/prodtest_optiga.c
index 88b75bc7..55ba190a 100644
--- a/core/embed/projects/prodtest/cmd/prodtest_optiga.c
+++ b/core/embed/projects/prodtest/cmd/prodtest_optiga.c
@@ -334,26 +334,11 @@ static void cert_read(cli_t* cli, uint16_t oid) {
size_t offset = 0;
if (cert[0] == 0xC0) {
- // TLS identity certificate chain.
- size_t tls_identity_size = (cert[1] << 8) + cert[2];
- size_t cert_chain_size = (cert[3] << 16) + (cert[4] << 8) + cert[5];
- size_t first_cert_size = (cert[6] << 16) + (cert[7] << 8) + cert[8];
- if (tls_identity_size + 3 > cert_size ||
- cert_chain_size + 3 > tls_identity_size ||
- first_cert_size > cert_chain_size) {
- cli_error(cli, CLI_ERROR, "invalid TLS identity in 0x%04x.", oid);
- return;
- }
+ // TLS identity certificate chain. We assume there is only one certificate.
offset = 9;
- cert_size = first_cert_size;
- }
-
- if (cert_size == 0) {
- cli_error(cli, CLI_ERROR, "no certificate in 0x%04x.", oid);
- return;
}
- cli_ok_hexdata(cli, cert + offset, cert_size);
+ cli_ok_hexdata(cli, cert + offset, cert_size - offset);
}
static bool check_device_cert_chain(cli_t* cli, const uint8_t* chain,
Why this scored 20/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.