Contents

SecOC — Secure Onboard Communication

How ECUs prove that a CAN or Ethernet message really comes from a legitimate sender and is fresh — using a MAC and a freshness value, standardised in AUTOSAR.

Why it exists

Classic in-vehicle buses such as CAN were designed for a closed system: any node on the bus can send any message ID, and receivers trust whatever arrives. If an attacker gains a foothold on one ECU — through a compromised infotainment unit, a telematics module or the diagnostic port — they can inject messages that look exactly like a brake or steering command. Research such as the 2015 remote attack on a passenger vehicle showed that this is not theoretical.

SecOC (Secure Onboard Communication) closes that gap for selected, critical messages: the receiver can check that a message was created by an ECU that holds the right key, that it was not modified, and that it is not an old message replayed later.

What it is

SecOC is a module of the AUTOSAR Classic Platform (with equivalent mechanisms on the Adaptive Platform). It sits between the communication stack and the bus interface and turns a normal message (the authentic PDU) into a secured PDU:

Part Purpose
Authentic payload The original signals, unchanged and readable
Freshness value (often truncated) A counter or time value that makes every message unique
Authenticator (truncated MAC) A cryptographic checksum computed with a secret key over ID, payload and freshness

Important: SecOC provides authenticity and integrity, not confidentiality — the payload stays in clear text.

Example secured I-PDU layout
Authentic payloadvariableOriginal signals remain readable
Truncated freshness valueconfigurableTransmitted bits help reconstruct full freshness
Truncated MACconfigurableAuthenticates ID, payload and full freshness

Example with transmitted freshness bits and no optional SecOC header; field lengths are configurable and widths are schematic.

How it works

  1. Sender: the SecOC module takes the payload, asks the freshness value manager for the current freshness value, and asks the crypto stack (usually backed by the HSM) to compute a MAC — typically AES-CMAC with a 128-bit key shared by sender and receivers. It appends the least significant bits of the freshness value and a truncated MAC.
  2. Receiver: it rebuilds the full freshness value from its own counter and the transmitted bits, recomputes the MAC with the same key and compares. Only if the MAC matches and the freshness value is newer than the last accepted one is the message passed to the application.
  3. Failure: the message is dropped; the event is reported (for example to the intrusion detection system) and the application falls back to its timeout or substitute-value behaviour.

Freshness can be counter-based (each sender keeps a counter per message) or time-based (a secured global time). Counters must survive ECU restarts and be resynchronised — this “freshness management” is where most integration effort goes.

SecOC verification and forged frame rejection
Sending ECU
Receiving ECU
AttackerNo valid key
Build secured PDUMAC covers ID, payload and full freshness
Secured PDUPayload, truncated freshness and truncated MAC
Verify messageReconstruct full freshness; check freshness and MAC
Deliver payloadVerification succeeds; application receives payload
Forged frameInvalid MAC
Discard frameMAC verification fails

Example using transmitted freshness bits; the receiver accepts the valid message and discards the illustrated forgery because its MAC fails verification.

When to use it — and when not

  • Use it for messages whose manipulation could cause safety, financial or operational harm and that cross trust boundaries: actuator commands (brake, steering, propulsion), immobiliser and access messages, messages from externally connected ECUs.
  • Don’t use it everywhere. Every protected message costs bytes, CPU or HSM time and latency. The TARA should drive the selection.
  • On Ethernet links between powerful ECUs, link-level protection (MACsec) or transport security (TLS/IPsec) may protect all traffic more efficiently; SecOC remains useful end-to-end across gateways and mixed buses.

Best practices

  • Derive the list of protected messages and the MAC length from the TARA, document the trade-off, and keep it under change control.
  • Use CAN FD or Ethernet for heavily secured traffic; on classical CAN, payload space forces very short MACs and freshness values.
  • Use separate keys per security domain or message group, provision them securely at end-of-line, and plan how to update or revoke them (see key management).
  • Design startup and resynchronisation explicitly: what does the receiver accept in the first milliseconds after wake-up?
  • Order protections deliberately: E2E protection for safety is usually applied to the payload inside the SecOC-protected PDU.
  • Report verification failures to the IDS and rate-limit them so an attacker cannot flood the error memory.
  • Test with fault injection: replayed, modified, delayed and out-of-order messages.

Common pitfalls

  • Treating SecOC as encryption — it is not.
  • Freshness counters that reset to zero after a power cycle, which makes replay attacks possible.
  • A single global key for the whole vehicle: one extracted key compromises everything.
  • Gateways that strip the authenticator when routing between buses, silently removing the protection.
  • Underestimating HSM load at startup when many messages must be verified at once.

What it means for your discipline

  • Cybersecurity Core

    Decides which messages need authentication (from the TARA), the MAC length, the freshness scheme and the key strategy. SecOC is one of the main controls against message spoofing listed as a threat in UN R155.

  • Base software Core

    Configures the SecOC module, the crypto stack (Csm, CryIf, crypto driver) and the PDU routing. Gets startup behaviour, freshness synchronisation and failure reporting right.

  • Networks & communication Partial

    Plans the extra bytes per frame, bus load and latency. On classical CAN the 8-byte payload leaves little room; CAN FD and Ethernet make SecOC practical. Gateways must keep or re-create the protection.

  • Functional safety Partial

    A message that fails verification is discarded — the receiver must react safely (substitute values, degraded mode). SecOC complements E2E protection but does not replace it.

  • Hardware & silicon Partial

    MACs are computed in the HSM or a SHE-compatible crypto engine; its throughput and number of key slots limit how many messages can be protected.

  • Diagnostics & lifecycle Partial

    Keys are provisioned at end-of-line and in service; verification failures should be visible as security events or DTCs without flooding the diagnostic memory.

No direct stake: E/E architecture · HPC & application software · Software update & OTA

Where it sits in the software stack

Generic layered software of a central HPC (application processor with hypervisor, plus a safety island) and of a classic MCU-based ECU (AUTOSAR Classic). Highlighted modules matter for this topic. Click any module to open its page.

HPC · application processor (MPU) and safety island (MCU)
  • Classic RTE & COM — Integrates SecOC into the safety island's Classic communication stack to authenticate selected PDUs and enforce freshness.
  • Security services — Provides key management, cryptographic services and security event handling for authenticated vehicle messages.
  • Safety monitors — Uses timeout or substitute-value behaviour when message authentication fails and incoming control data is unavailable.
MCU-based ECU · AUTOSAR Classic
  • Communication — SecOC generates and verifies authenticators, checks freshness and discards messages that fail verification.
  • Memory · crypto · WdgM — Csm supplies MAC operations; persistent storage supports freshness state across restarts.
  • Microcontroller · HSM — The HSM protects authentication keys and accelerates MAC generation and verification.
  • Application layer — Handles missing authenticated inputs through defined timeout, substitute-value or degraded-mode behaviour.