A relay attack does not break cryptography, it moves the conversation.
One device near the car talks to the car, another near the key talks
to the key, and the link between them carries the challenge and
response faster than the owner can notice. Because the key genuinely
answers, the car genuinely unlocks, and no secret is ever recovered.
This sub-skill covers measuring that exposure on your own vehicle and
key, in a controlled setting, and distinguishing a relay from a
replay, which needs a captured code rather than a live conversation.
Quick Workflow
- Confirm ownership and authorization, and choose a test site where
no other vehicle or key can be affected.
- Record the baseline, the normal unlock range with no relay in
place, and the normal lock behaviour.
- Set up the relay path on the bench or with your own car and key,
measuring each hop separately.
- Attempt the relay at increasing separation, recording success or
failure at each distance.
- Measure timing, the round trip the car sees, and compare it with
the baseline challenge response time.
- Test mitigations present on the system, motion sensing in the
key, sleep mode, and any distance bounding behaviour.
- Repeat each distance three times, since radio conditions vary and
a single success overstates reliability.
- Report the maximum reliable relay distance, the timing observed,
and which mitigations changed the result.
1. Baseline range and timing measurement
Measure before relaying anything. A relay result means nothing
without the normal range it extends, and timing is the signal that
distance bounding defences use, so both baselines are recorded.
# Baseline log template, one row per attempt, kept as CSV
# attempt, setup, distance_m, result, notes
# 1, baseline_no_relay, 1.0, unlock, key beside door handle
# 2, baseline_no_relay, 2.0, no_unlock, key held away from car
cat keyless_baseline.csv
# Summarise baseline and relay attempts from the CSV log
import csv
from collections import defaultdict
attempts = defaultdict(list)
for row in csv.DictReader(open("keyless_attempts.csv")):
attempts[(row["setup"], row["distance_m"])].append(row["result"])
for (setup, distance), results in sorted(attempts.items()):
successes = sum(1 for r in results if r == "unlock")
print(f"{setup} at {distance}m - {successes}/{len(results)} unlocks")
2. Relay path test procedure
Test each hop on its own before testing the full path. If the car
side link works and the key side link works but the full relay
fails, the bottleneck is the link between the two devices, not the
car or the key, and that distinction shapes the remediation advice.
# Relay test procedure, run on your own car and key only
# Step 1: place device A near the car door handle, device B near the key.
# Step 2: confirm device A to device B link quality before attempting.
# Step 3: trigger the car challenge (door handle touch on your car).
# Step 4: record unlock, no unlock, or partial (challenge answered,
# car rejected) for this distance.
# Step 5: move the key further away in 5 metre steps, repeat 3 times.
# Never test against a neighbour vehicle, a parked stranger car, or
# a key that is not yours.
echo "relay test procedure ready - record every attempt in the CSV log"
# Timing comparison: baseline challenge response vs relayed response
# Times are measured on the bench or with a logic analyser on your rig.
baseline_ms = [42.0, 45.0, 43.0]
relayed_ms = [118.0, 124.0, 121.0]
def mean(values):
return sum(values) / len(values)
print(f"baseline mean {mean(baseline_ms):.1f} ms")
print(f"relayed mean {mean(relayed_ms):.1f} ms")
print(f"added latency {mean(relayed_ms) - mean(baseline_ms):.1f} ms")
# A large added latency is what distance bounding checks look for.
# A small one means timing alone will not stop this relay path.
3. Mitigation testing
Test each mitigation separately, so the report can say which one
helped and by how much. A key that sleeps after inactivity may stop
a relay at night but not one during the day, and that time
dependence belongs in the finding.
# Mitigation test matrix, one variable changed per run
# Run A: key active, normal handling, relay at 10 m.
# Run B: key left still for the sleep interval, then relay at 10 m.
# Run C: key in a shielded pouch, relay at 10 m.
# Run D: key moved recently (motion sensor awake), relay at 10 m.
# Record unlock or no unlock for each run, three repeats each.
cat keyless_mitigation_runs.csv
Edge cases
- Key sleep timing varies: some keys sleep after minutes, others
after much longer, so a mitigation test run too soon after
handling the key can falsely report that sleep mode failed.
- Relay versus replay confusion: a replay uses a recorded response
and fails against rolling codes, while a relay forwards a live
response and succeeds, so a failed replay does not mean the
system resists relay.
- Multi-band systems: the car to key link and the key to car link
may use different bands, and relaying only one direction can
produce a partial result that looks like a car rejection.
- Environmental noise: car parks, metal structures, and other
key fobs change range run to run, which is why each distance is
repeated and the maximum reliable distance is reported, not the
single best distance.
- Passive entry versus passive start: a relay that unlocks the
doors may not allow starting, because start authorization can
check the key location separately, so unlock and start are
tested and reported as separate results.
- Owner behaviour: a key left near a front door at home is the
realistic relay target, so the home scenario distance matters
more than an open-field maximum, and both are recorded.
Key references
- The parent skill keyless-entry-attacks, for key fob signal
analysis, rolling code review, and the broader keyless attack
surface this sub-skill narrows to relay measurement.
- ISO 21434, road vehicles cybersecurity engineering, for threat
analysis and risk assessment framing of the relay finding.
- Vehicle manufacturer documentation for the specific keyless
system under test, used to confirm which mitigations the system
claims before testing whether they hold.
- Published relay attack research on passive keyless entry, for
test methodology and for the distance bounding and motion
sensing countermeasures evaluated here.
1---2name: keyless-entry-relay-attack-analysis3parent: keyless-entry-attacks4description: Use when analyzing relay attacks against passive keyless entry on a vehicle and key fob you own, on an authorized bench setup. Covers relay attack mechanics, signal range and timing measurement, relay versus replay distinction, distance bounding and motion sensor mitigations, and test reporting that separates a successful relay from a successful unlock. Also use when a keyless system assessment needs its relay exposure measured rather than assumed.5version: 1.0.06domain: automotive7lifecycle: stable8last_verified: '2026-10-27'9requires: [keyless-entry-attacks]10extends: []11relates: [automotive-threat-model, telematics-security, ecu-firmware]12tools:13 - name: Python14 version: '3.12'15 - name: Wireshark16 version: '4.4'17metadata:18 source: https://skillmd.com/skills/mizazhaider-ceh/keyless-entry-relay-attack-analysis19---2021A relay attack does not break cryptography, it moves the conversation.22One device near the car talks to the car, another near the key talks23to the key, and the link between them carries the challenge and24response faster than the owner can notice. Because the key genuinely25answers, the car genuinely unlocks, and no secret is ever recovered.26This sub-skill covers measuring that exposure on your own vehicle and27key, in a controlled setting, and distinguishing a relay from a28replay, which needs a captured code rather than a live conversation.2930## Quick Workflow31321. Confirm ownership and authorization, and choose a test site where33 no other vehicle or key can be affected.342. Record the baseline, the normal unlock range with no relay in35 place, and the normal lock behaviour.363. Set up the relay path on the bench or with your own car and key,37 measuring each hop separately.384. Attempt the relay at increasing separation, recording success or39 failure at each distance.405. Measure timing, the round trip the car sees, and compare it with41 the baseline challenge response time.426. Test mitigations present on the system, motion sensing in the43 key, sleep mode, and any distance bounding behaviour.447. Repeat each distance three times, since radio conditions vary and45 a single success overstates reliability.468. Report the maximum reliable relay distance, the timing observed,47 and which mitigations changed the result.4849## 1. Baseline range and timing measurement5051Measure before relaying anything. A relay result means nothing52without the normal range it extends, and timing is the signal that53distance bounding defences use, so both baselines are recorded.5455```bash56# Baseline log template, one row per attempt, kept as CSV57# attempt, setup, distance_m, result, notes58# 1, baseline_no_relay, 1.0, unlock, key beside door handle59# 2, baseline_no_relay, 2.0, no_unlock, key held away from car60cat keyless_baseline.csv61```6263```python64# Summarise baseline and relay attempts from the CSV log65import csv66from collections import defaultdict6768attempts = defaultdict(list)69for row in csv.DictReader(open("keyless_attempts.csv")):70 attempts[(row["setup"], row["distance_m"])].append(row["result"])7172for (setup, distance), results in sorted(attempts.items()):73 successes = sum(1 for r in results if r == "unlock")74 print(f"{setup} at {distance}m - {successes}/{len(results)} unlocks")75```7677## 2. Relay path test procedure7879Test each hop on its own before testing the full path. If the car80side link works and the key side link works but the full relay81fails, the bottleneck is the link between the two devices, not the82car or the key, and that distinction shapes the remediation advice.8384```bash85# Relay test procedure, run on your own car and key only86# Step 1: place device A near the car door handle, device B near the key.87# Step 2: confirm device A to device B link quality before attempting.88# Step 3: trigger the car challenge (door handle touch on your car).89# Step 4: record unlock, no unlock, or partial (challenge answered,90# car rejected) for this distance.91# Step 5: move the key further away in 5 metre steps, repeat 3 times.92# Never test against a neighbour vehicle, a parked stranger car, or93# a key that is not yours.94echo "relay test procedure ready - record every attempt in the CSV log"95```9697```python98# Timing comparison: baseline challenge response vs relayed response99# Times are measured on the bench or with a logic analyser on your rig.100baseline_ms = [42.0, 45.0, 43.0]101relayed_ms = [118.0, 124.0, 121.0]102103def mean(values):104 return sum(values) / len(values)105106print(f"baseline mean {mean(baseline_ms):.1f} ms")107print(f"relayed mean {mean(relayed_ms):.1f} ms")108print(f"added latency {mean(relayed_ms) - mean(baseline_ms):.1f} ms")109# A large added latency is what distance bounding checks look for.110# A small one means timing alone will not stop this relay path.111```112113## 3. Mitigation testing114115Test each mitigation separately, so the report can say which one116helped and by how much. A key that sleeps after inactivity may stop117a relay at night but not one during the day, and that time118dependence belongs in the finding.119120```bash121# Mitigation test matrix, one variable changed per run122# Run A: key active, normal handling, relay at 10 m.123# Run B: key left still for the sleep interval, then relay at 10 m.124# Run C: key in a shielded pouch, relay at 10 m.125# Run D: key moved recently (motion sensor awake), relay at 10 m.126# Record unlock or no unlock for each run, three repeats each.127cat keyless_mitigation_runs.csv128```129130## Edge cases131132- Key sleep timing varies: some keys sleep after minutes, others133 after much longer, so a mitigation test run too soon after134 handling the key can falsely report that sleep mode failed.135- Relay versus replay confusion: a replay uses a recorded response136 and fails against rolling codes, while a relay forwards a live137 response and succeeds, so a failed replay does not mean the138 system resists relay.139- Multi-band systems: the car to key link and the key to car link140 may use different bands, and relaying only one direction can141 produce a partial result that looks like a car rejection.142- Environmental noise: car parks, metal structures, and other143 key fobs change range run to run, which is why each distance is144 repeated and the maximum reliable distance is reported, not the145 single best distance.146- Passive entry versus passive start: a relay that unlocks the147 doors may not allow starting, because start authorization can148 check the key location separately, so unlock and start are149 tested and reported as separate results.150- Owner behaviour: a key left near a front door at home is the151 realistic relay target, so the home scenario distance matters152 more than an open-field maximum, and both are recorded.153154## Key references155156- The parent skill keyless-entry-attacks, for key fob signal157 analysis, rolling code review, and the broader keyless attack158 surface this sub-skill narrows to relay measurement.159- ISO 21434, road vehicles cybersecurity engineering, for threat160 analysis and risk assessment framing of the relay finding.161- Vehicle manufacturer documentation for the specific keyless162 system under test, used to confirm which mitigations the system163 claims before testing whether they hold.164- Published relay attack research on passive keyless entry, for165 test methodology and for the distance bounding and motion166 sensing countermeasures evaluated here.