UDS diagnostics security: the 0x27 SecurityAccess problem
How diagnostic security access works, where it is weak, and what a hardened UDS stack looks like
The service that guards everything else
Most of what can go wrong on an ECU sits behind one diagnostic gate. UDS SecurityAccess, service identifier 0x27, is the seed-and-key exchange that unlocks privileged operations: reflashing, writing calibration values, clearing protected fault memory and reading regions that are otherwise closed. If 0x27 falls, the controls above it fall with it. This is why a diagnostic weakness is rarely cosmetic — it is often the shortest path from bus access to firmware.
Unified Diagnostic Services is the ISO 14229 application-layer protocol that service tools, workshop equipment and back-end flashing stations speak to an ECU, typically over CAN or CAN-FD. Diagnostics are, by design, a powerful back door left in place for a legitimate reason. UN R155 Annex 5 calls this out directly under diagnostic access via the OBD-II port, and a credible TARA has to treat the diagnostic stack as an asset in its own right rather than a convenience feature.
How 0x27 is supposed to work
The exchange is a simple challenge-response:
- The tester requests a seed for a given security level:
0x27 <level>. - The ECU replies with a random seed.
- The tester computes a key from the seed using an agreed algorithm and sends it back:
0x27 <level+1> <key>. - The ECU computes the expected key and unlocks the level only if the two match.
The security rests on two assumptions: that the seed is unpredictable, and that only a legitimate tester can compute the correct key. When those assumptions hold, an attacker with bus access still cannot open the gate. When they do not, the gate is decorative.
Where it breaks
The recurring failures are well known, and they are the first things a vehicle penetration test goes looking for.
| Weakness | What it looks like | Why it matters |
|---|---|---|
| Static or fixed seed | ECU returns the same seed every session | A single captured key works forever; no computation needed |
| Low-entropy seed | Seed drawn from a small or predictable range | Key space is brute-forceable in minutes |
| Trivial seed-key transform | Key is seed XOR constant, a byte swap, or a short table | Algorithm recovered from one or two captured pairs |
| Algorithm extraction | Seed-key routine lifted from a service tool or ECU dump | One extraction unlocks the whole model range |
| Replay | Seed not bound to session or nonce | A recorded seed-key pair is simply replayed |
| No lockout | Unlimited attempts, no delay, no counter | Offline or online brute force runs unimpeded |
The through-line is that the secret is a shared, static algorithm compiled into tooling, not a per-ECU cryptographic key. Shared secrets do not survive contact with a determined attacker who owns a service tool, and service tools are not hard to obtain. Once the transform is known, every ECU that uses it is open. These are the same conditions that make CAN bus attacks effective: no authentication on the wire, and weak authentication at the endpoint.
What a hardened UDS stack looks like
Hardening 0x27 is less about a clever seed algorithm and more about changing the trust model.
Real cryptography, per-ECU keys. Move from proprietary seed-key transforms to authenticated challenge-response. UDS service 0x29 (Authentication), introduced in later editions of ISO 14229, supports certificate- and challenge-based authentication using genuine cryptographic primitives. Keys should be unique per ECU, not shared across a model range, so that compromising one unit does not compromise the fleet. This is where diagnostic security meets PKI and key management: the same disciplines that protect an update signing chain protect diagnostic authentication.
Strong seeds. Where 0x27 remains, the seed must be a cryptographically random value of adequate length, generated fresh per session and bound to that session, so that a captured pair cannot be replayed.
Lockout and rate limiting. After a small number of failed attempts, the ECU should impose an increasing delay and, ideally, a persistent counter that survives power cycles. This alone defeats naive brute force.
Session and timeout discipline. An unlocked security level must expire on a timer and on session end, and must not silently persist across a reset.
Protect the keys everywhere. The strongest on-ECU scheme is undone if the keys sit in plaintext inside a service tool, a laptop, or a back-end database. Key storage in the tester and the flashing infrastructure — including hardware-backed storage where feasible — is part of the same threat model, and this reaches into the plant, where flashing stations at end-of-line handle diagnostic credentials at volume.
How this shows up in an assessment
A UN R155 CSMS assessment does not test 0x27 line by line, but it does ask for evidence that diagnostic threats were identified, rated and treated, and that the treatment was verified. That verification is usually a penetration test against a representative ECU bench. A finding of a static seed or a recoverable transform is not an abstract risk — it is concrete, reproducible evidence that a mitigation claimed in the TARA does not hold. Closing it before the assessor arrives is far cheaper than explaining it during the audit.
The other reason to fix this early is that diagnostics touch the update path. An attacker who can reach a privileged security level can often influence what firmware an ECU will accept, which is precisely the boundary UN R156 and secure OTA design exist to protect. A weak 0x27 undermines the update integrity story a programme has otherwise paid for.
The AutoSifu view
We treat diagnostic security as a first-class part of the TARA and the test plan, not a workshop afterthought. Working with CIRT on a single route — compliance, solutioning and CoC/VTA support — lets us turn a hardened UDS stack into evidence the assessor can rely on, with the approval body in the room while the finding is closed rather than after. That is the difference between a diagnostic weakness surfacing in a report and it surfacing in an audit.
Sources
Questions
- What is UDS SecurityAccess (0x27)?
- UDS service 0x27 (SecurityAccess) is the Unified Diagnostic Services mechanism that gates privileged diagnostic operations behind a seed-and-key exchange. The ECU issues a random seed, the tester returns a key computed from that seed, and the ECU unlocks a security level only if the key matches. It protects operations such as reflashing, writing calibration data and reading protected memory.
- Why is 0x27 a common weakness?
- The seed-and-key algorithm is frequently weak: static or low-entropy seeds, trivial transforms, and keys recoverable from a handful of captured exchanges. Because the algorithm is compiled into service tools and shared across a model range, extraction from one tool or one ECU often unlocks a whole fleet. Replay of a captured seed-key pair also succeeds where the seed is not truly random or not bound to a session.
- How do you harden UDS diagnostics?
- Use cryptographically strong, per-session random seeds, and move from proprietary seed-key transforms to authenticated challenge-response using service 0x29 (Authentication) with real cryptography and per-ECU keys. Rate-limit and lock out repeated failures, bind unlock to a session and timeout, and protect the keys in the tester and back-end infrastructure. Treat diagnostic access as part of the TARA and verify it under penetration testing.
