The diagnostic interface is the one path into a vehicle that is designed to let an outside device read data, change settings and reflash ECUs, so weak diagnostic access control turns a service feature into an attack surface. This guide explains how Unified Diagnostic Services (UDS) protects privileged diagnostic functions with the SecurityAccess (0x27) and Authentication (0x29) services, why the OBD-II port and aftermarket dongles are a standing exposure, and how workshop tools, technician credentials and remote diagnostics should be governed as non-human and privileged identities. It is written for automotive product security engineers, ECU and gateway architects, and fleet security teams. It covers design and governance controls only: it does not describe ways to defeat diagnostic protections. For the wider vehicle programme see the Automotive Cybersecurity Guide.
Key takeaways
- Prefer Authentication (0x29) for new designs. ISO 14229-1 defines both SecurityAccess (0x27) and Authentication (0x29); the latter supports PKI certificate exchange and challenge-response, which allows per-tool identity, roles and revocation instead of shared secrets.
- Shared symmetric secrets are the core weakness of legacy 0x27. NHTSA's 2022 best practices advise minimising global symmetric keys and ad hoc cryptography for diagnostic access, because one leaked secret unlocks a whole fleet.
- Diagnostic tools are non-human identities. Every tester, workshop laptop, dongle and remote diagnostics service holds credentials that need issuance, scoping, expiry, revocation and logging like any service account.
- The OBD-II port is in scope of UN R155. Annex 5 lists external interfaces such as USB or other ports used as a point of attack, and diagnostic access such as dongles in the OBD port used to facilitate an attack, as threats to be assessed and mitigated.
- Defence in depth beats a single unlock. Gateway filtering, session and state conditions, rate limits and safe-by-design diagnostic routines limit damage when access control fails.
How vehicle diagnostics work (UDS and OBD-II)
ISO 14229-1 defines diagnostic services that are independent of the data link and let a diagnostic tester (the client) control diagnostic functions in an ECU (the server). They cover reading identification and live data, reading and clearing trouble codes, controlling actuators and running routines. The current edition is ISO 14229-1:2026 (edition 4, June 2026), which replaced the 2020 edition and its 2022 amendment; the publisher lists corrections to ResponseOnEvent as the main technical change. Transport is defined elsewhere, for example UDS on CAN or Diagnostics over IP on automotive Ethernet.
OBD-II is the regulated emissions diagnostic interface, reached through the standard connector under the dashboard. In practice the same connector usually gives access to the vehicle networks that carry UDS traffic, which is why the port matters well beyond emissions.
| UDS service (SID) | Purpose | Security relevance |
|---|---|---|
| DiagnosticSessionControl (0x10) | Switches between default, programming and extended sessions | Privileged services are usually only available outside the default session |
| SecurityAccess (0x27) | Unlocks a security level by seed and key exchange | Legacy gate for writes, routines and reprogramming |
| Authentication (0x29) | Authenticates the tester by certificate exchange or challenge-response | Identity-based gate with roles |
| WriteDataByIdentifier (0x2E) | Writes configuration and calibration values | Can change vehicle behaviour, odometer or feature coding |
| RoutineControl (0x31) | Starts, stops and queries ECU routines | Actuator tests and erase routines can be safety relevant |
| RequestDownload (0x34) and TransferData (0x36) | Transfers software into the ECU | Reprogramming path; must be paired with secure boot and signed software |
| SecuredDataTransmission (0x84) | Wraps diagnostic messages in the security sub-layer | Protects integrity and confidentiality of the diagnostic exchange itself |
ISO 14229-1 describes the security sub-layer and SecuredDataTransmission in a separate clause, and includes a state chart for security access. Treat these clauses as the design baseline and record in your cybersecurity concept which service is protected by which mechanism.
SecurityAccess (0x27) and its limits
SecurityAccess unlocks a numbered security level. The ECU issues a seed, the tester returns a key derived from it, and the ECU compares the result. In AUTOSAR Classic the Diagnostic Communication Manager (Dcm) tracks the active security level, leaves seed generation and key comparison to application callouts (GetSeed and CompareKey), keeps an attempt counter through callouts, and reports failures with negative response codes 0x35 (invalid key), 0x36 (exceeded number of attempts) and 0x37 (required time delay not expired).
The mechanism itself says nothing about who the tester is. Its strength depends entirely on how the key derivation secret is generated, stored and distributed. Where the same secret or algorithm is shared across many ECUs or vehicles and embedded in tool software, its exposure affects the whole population. That is the risk NHTSA's best practice T.8 targets when it advises minimising global symmetric keys and ad hoc cryptography in favour of public key techniques.
If you must keep 0x27 for legacy ECUs:
- Per-ECU secrets: derive secrets per ECU or per vehicle from a master held in an HSM at the OEM back end, so one extraction does not open the fleet.
- Back-end key computation: compute keys on an OEM server after authenticating the technician, rather than embedding the algorithm in tester software.
- Good randomness: generate seeds from a hardware random source and never reuse them.
- Attempt limits and delay: enforce the attempt counter and delay timer, persist them across resets and log every failure as a security event.
- Least privilege levels: separate levels for reading, coding and programming, so a workshop credential for coding does not grant reflash rights.
Authentication service (0x29) and certificates
ISO 14229-1 specifies two Authentication approaches: authentication with PKI certificate exchange (APCE) and authentication with challenge-response (ACR), plus requirements common to both. With APCE the tester presents a certificate, the ECU verifies it against a trust anchor, and the tester proves possession of the private key. The certificate can carry a role, so the ECU can decide which services and data identifiers that tester may use.
AUTOSAR Classic implements this in the Dcm with an authentication state per connection, de-authentication, certificate verification, proof of ownership, role and white-list verification, and certificate transmission. Certificate handling is delegated to the Key Manager (KeyM) and cryptographic operations to the Crypto Service Manager (Csm). The Dcm specification notes that its Authentication support is limited to PKI-based sub-functions, so challenge-response designs need a different implementation path.
| Aspect | SecurityAccess (0x27) | Authentication (0x29), PKI |
|---|---|---|
| Mechanism | Seed and key exchange unlocking a security level | Certificate exchange plus proof of possession, or challenge-response |
| Identity of tester | None; anyone with the secret or algorithm | Per tool or per technician certificate |
| Key management | Symmetric secret or algorithm per ECU, platform or fleet | Private keys on tool or back end; ECU holds trust anchor only |
| Authorisation granularity | Security levels | Roles and white lists per certificate |
| Revocation | Requires changing secrets in ECUs | Short-lived certificates or revocation of the issuing chain |
| Main strengths | Simple, small footprint, widely supported | Accountability, scoping, revocation, no fleet-wide secret in tools |
| Main risks | Secret extraction, shared algorithms, no audit of who unlocked | PKI operations, clock and validity handling, certificate issuance governance |
Design choices for 0x29:
- Short-lived tester certificates: issue certificates valid for a shift or a job from an OEM back end after the technician signs in with MFA. ECUs often lack reliable time, so short validity is easier to enforce at issuance than revocation checks in the vehicle.
- Role design: define a small set of roles (read only, workshop coding, programming, end-of-line) and map them to services and data identifiers in the ECU configuration.
- Trust anchor protection: store root or intermediate public keys in protected ECU memory and plan how anchors are rotated through signed software updates. See the Machine Identity, PKI and Certificate Lifecycle Guide.
- De-authentication: drop the authenticated state on session change, timeout or ignition cycle so a left-connected tool does not stay privileged.
- Secure the exchange: where diagnostics cross untrusted networks, combine authentication with SecuredDataTransmission or transport security such as TLS for Diagnostics over IP.
OBD port and aftermarket dongle risk
UN Regulation No 155, Annex 5 Part A, lists malicious diagnostic messages (threat 11.3), external interfaces such as USB or other ports used as a point of attack, for example through code injection (18.1), and diagnostic access such as dongles in the OBD port used to facilitate an attack, including manipulating vehicle parameters (18.3). Part B maps the external interface threats to mitigation M22, security controls applied to external interfaces. Physical manipulation, such as adding unauthorised hardware, is threat 32, mapped to M9.
NHTSA's 2022 cybersecurity best practices say manufacturers should weigh the risks of user-owned and aftermarket devices connected through points such as the OBD-II port (G.41), that connections to third-party devices should be authenticated and given limited access (G.42), and that aftermarket device makers should build in strong protections (G.43). Insurance, fleet and consumer dongles often combine a permanent OBD connection with a cellular or Bluetooth link, which creates a remote path to the vehicle bus.
| Risk | Control in the vehicle | Control for fleets and owners |
|---|---|---|
| Dongle with remote connectivity reaches the bus | Gateway passes only OBD emissions requests from the port by default; privileged UDS requires 0x29 | Approve dongle models; require vendor security evidence; disable unused radios |
| Malicious or forged diagnostic messages | Session, state and speed conditions on privileged services; SecOC on internal buses | Monitor for unexpected diagnostic sessions in fleet telemetry |
| Unauthorised hardware on the port | Detect diagnostic sessions while driving; log new tester addresses | Physical inspection during servicing; tamper-evident port covers where policy allows |
| Telematics back end compromise | Limit what remote diagnostics may request; separate read and write paths | Treat the dongle vendor as a third party with API key and access reviews |
Gateway filtering and session controls: the central gateway should route diagnostic requests from the OBD connector only to the ECUs and services that role allows, reject privileged requests until authentication succeeds, and refuse safety-relevant routines when the vehicle is moving. NHTSA best practice T.7 gives the example of limiting a single-brake diagnostic test to low speed, preventing all brakes being disabled together and time-limiting the action. T.6 asks that diagnostic features be limited to the operating mode they are meant for. For internal bus protections see the CAN Bus and AUTOSAR SecOC Guide, and for fleet devices the Connected Fleet and Telematics Security Guide.
Workshop and remote diagnostics access
Workshop testers, OEM diagnostic software, end-of-line tools and remote diagnostics services all authenticate to vehicles on someone's behalf. Govern them as non-human identities with owners, scopes and lifecycles. See the Automotive Identity Security Guide for the wider dealer and owner identity picture.
- Bind tool to person: the technician signs in to the OEM portal with MFA; the back end issues a short-lived credential to that tool session. Log technician, tool, VIN, services used and outcome.
- Tool inventory: register each tester and dongle with a device identity, owner and site. Revoke on loss, sale or site closure.
- Independent operators in the EU: Commission Delegated Regulation (EU) 2021/1244, applying from 30 July 2023, sets up the SERMI scheme for security-related repair and maintenance information. Employees of approved independent operators are authorised after checks by accredited conformity assessment bodies and receive a security token, digital certificate and PIN, which they must not share and must report lost within 24 hours. Manufacturers must authenticate with digital certificates only, confirm status with a trust centre, and keep records of each access (VIN, date, and registration and variant where available) for five years.
- Serviceability balance: NHTSA G.45 asks manufacturers to protect vehicles without unduly restricting owner-authorised third-party repair, so design roles that independent workshops can obtain through a defined process.
- Remote diagnostics: put remote diagnostic requests through the same authorisation model as workshop tools, restrict them to read and approved routines, and require local confirmation for reprogramming. NHTSA T.9 asks vehicle and tool makers to control which tools can reach diagnostic and reprogramming functions using authentication and access control.
For how these back-end credentials should be stored and rotated see the Secrets Management Guide.
Regulatory expectations (UN R155, ISO/SAE 21434)
UN R155 paragraph 7.2 requires a manufacturer's cybersecurity management system (CSMS) to cover development, production and post-production, including risk identification against the Annex 5 threats, testing, monitoring and response, and managing supplier dependencies. Paragraph 7.3 requires, for each vehicle type, an exhaustive risk assessment covering the Annex 5 Part A threats, proportionate mitigations, testing before approval, measures to detect and prevent attacks and provide forensic data, and cryptographic modules consistent with consensus standards. Diagnostic access therefore has to appear in the TARA and the mitigation evidence for type approval.
ISO/SAE 21434:2021 sets the engineering requirements for cybersecurity risk management across the life of vehicle electrical and electronic systems. Diagnostic interfaces should be modelled as assets and entry points in the TARA, with cybersecurity goals and requirements that trace to the chosen 0x27 or 0x29 design, gateway rules and tool governance. See the Automotive TARA Guide and Automotive Cybersecurity Regulations Compared.
| Control area | UN R155 reference | NHTSA 2022 best practice | Evidence to keep |
|---|---|---|---|
| External interface protection (OBD) | Annex 5 threats 18.1, 18.3; mitigation M22 | G.41, G.42 | Gateway rule set, interface TARA entries |
| Diagnostic tool authorisation | Threat 11.3; para 7.3 mitigations | T.8, T.9 | 0x29 design, PKI policy, tool inventory |
| Safe diagnostic routines | Para 7.3 proportionate mitigations | T.6, T.7 | Routine preconditions and test results |
| Physical tampering | Threat 32; mitigation M9 | G.41 | Tamper detection requirements |
Detection and measurement
- Security events to log in the ECU: failed and successful unlocks, NRC 0x35, 0x36 and 0x37 occurrences, authentication and certificate failures, and session changes to programming. AUTOSAR Dcm reports these as security events that can feed an intrusion detection system.
- Back-end logs: credential issuance per technician and tool, VIN, role, and the services requested.
- Metrics: share of ECUs in new programmes using 0x29 rather than 0x27; percentage of diagnostic credentials that are short-lived; mean time to revoke a lost tool; number of privileged diagnostic sessions outside authorised workshops; failed unlock rate per model line.
Common failure patterns
- One secret for the fleet: a single 0x27 algorithm or key per platform embedded in tester software, so disclosure opens every vehicle.
- Port wide open behind the gateway: the gateway forwards all diagnostic traffic from the OBD connector to every bus.
- Unscoped tool credentials: workshop accounts with programming rights for all models and no expiry, shared across staff.
- Dangerous routines without preconditions: actuator tests runnable at speed or without time limits, contrary to NHTSA T.7.
- Authentication without revocation planning: 0x29 deployed with long-lived certificates and no way to rotate trust anchors.
- Dongles outside procurement: fleet devices fitted without security review of the device, its app and its cloud API.
Practitioner checklist
- Inventory every ECU service protected by 0x27 or 0x29 and record the security level or role per service.
- Plan migration of privileged services in new programmes to Authentication (0x29) with short-lived tester certificates.
- Remove fleet-wide symmetric secrets from tool software; compute keys in an HSM-backed back end.
- Configure the gateway to restrict OBD port traffic by default and to block privileged requests until authentication.
- Add speed, state and time preconditions to safety-relevant routines.
- Register testers and dongles as non-human identities with owners, scopes, expiry and revocation.
- Map diagnostic threats 11.3, 18.1, 18.3 and 32 in your TARA and keep mitigation evidence for type approval.
- Feed diagnostic security events into fleet monitoring and review failed unlocks monthly.
Standards and references
- ISO: ISO 14229-1:2026 Road vehicles, Unified diagnostic services (UDS), Part 1: Application layer
- UNECE via EUR-Lex: UN Regulation No 155 Cyber security and cyber security management system
- ISO: ISO/SAE 21434 Road vehicles, Cybersecurity engineering
- NHTSA: Cybersecurity Best Practices for the Safety of Modern Vehicles (2022)
- EUR-Lex: Commission Delegated Regulation (EU) 2021/1244 on access to security-related RMI (SERMI)
- AUTOSAR: Specification of Diagnostic Communication Manager (Classic Platform)
Related NHI Mgmt Group resources: Automotive Cybersecurity Guide · Connected and Autonomous Vehicle Security Guide · Automotive Identity Security Guide · CAN Bus and AUTOSAR SecOC Guide