# Keyless Entry Relay Attack Analysis

> 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.

- Skill: `mizazhaider-ceh/keyless-entry-relay-attack-analysis` (Agent Skill)
- Install (CLI): `npx get-skill add mizazhaider-ceh/keyless-entry-relay-attack-analysis`
- Raw SKILL.md: https://api.skillmd.com/api/skills/mizazhaider-ceh/keyless-entry-relay-attack-analysis/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: mizazhaider-ceh (https://skillmd.com/u/mizazhaider-ceh)
- Updated: 2026-11-22
- Page: https://skillmd.com/skills/mizazhaider-ceh/keyless-entry-relay-attack-analysis

---


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

1. Confirm ownership and authorization, and choose a test site where
   no other vehicle or key can be affected.
2. Record the baseline, the normal unlock range with no relay in
   place, and the normal lock behaviour.
3. Set up the relay path on the bench or with your own car and key,
   measuring each hop separately.
4. Attempt the relay at increasing separation, recording success or
   failure at each distance.
5. Measure timing, the round trip the car sees, and compare it with
   the baseline challenge response time.
6. Test mitigations present on the system, motion sensing in the
   key, sleep mode, and any distance bounding behaviour.
7. Repeat each distance three times, since radio conditions vary and
   a single success overstates reliability.
8. 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.

```bash
# 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
```

```python
# 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.

```bash
# 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"
```

```python
# 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.

```bash
# 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.

