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 with transmitted freshness bits and no optional SecOC header; field lengths are configurable and widths are schematic.
How it works
- 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.
- 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.
- 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.
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.