Johannes Willbold
@jwillbold
/jwillbold
Johannes Willbold
@jwillbold
/jwillbold
$whoami
44th IEEE Symposium on Security and Privacy (S&P)
Distinguished Paper Award
MEO
2k - 35k km
LEO
160 - 2k km
GEO
35786 km
34 cm
10 cm
3U CubeSat
Firmware Attacks
Bigger Picture
Survey
System Analysis
Live Demo
Space Segment
?
Affordable Ground Stations
Ground Station as a Service
GSaaS
More Satellites
GEO → LEO
No Insights <=> No Attacker
No Insights <=> No Attacker
Commercial off-the-Shelf (COTS)
Components
Higher Stakes
Critical Infrastructure
More Developers
More People Involved
Payload
Bus
?
COM
Payload
CDHS
EPS
ADCS
COM
Payload
CDHS
Telecommand (TC)
Telemetry (TM)
EPS
ADCS
COM
PDHS
CDHS
EPS
ADCS
PLCOM
Payload Traffic
TC / TM Traffic
PDHS
PLCOM
COM
CDHS
Bus
PDHS
PLCOM
COM
CDHS
Bus
COM
CDHS
Bus
COM
CDHS
Bus
COM
CDHS
Bus
1
2
3
4
Bypass COM Protection
Dangerous / Vulnerable TC
Hijack Bus Control Flow
Full Bus Privileges
System Design
Protocols
ESTCube-1
Peripherals
E-Sail (E. Solar Wind Sail) Propulsion
Bus Platform
ARM STM32
Developed by University of Tartau
Sender Subsystem ID
Recipient Subsystem ID
Flow Control Flags
Inner Payload
Fletcher-16 Checksum
TX seq.
RX seq.
COM
ID | Subsystem |
---|---|
0 | EPS |
1 | COM |
2 | CDHS |
... | |
5 | Ground Station |
bit 0 | bit 1 | bit 2 | bit 3 | bit 4 | bit 5 | bit 6 | bit 7 | |
---|---|---|---|---|---|---|---|---|
Byte 0 | ||||||||
Byte 1 | ||||||||
Byte 2 | ||||||||
Byte 3 | ||||||||
... |
Command Identifier (MSB)
Command Identifier (LSB)
Source
Block ID
Length
Args
COM
CDHS
int sch_handle_command(scheduler_packed_cmd_t ∗pCmd) {
// ! simplified !
sch_unpack_command(&g_command, pCmd);
// ...
handler_func = &handler_table[g_command.handler_func_index] ;
// ...
retval = (∗handler_func) (&g_command) ;
}
bit 0 | bit 1 | bit 2 | bit 3 | bit 4 | bit 5 | bit 6 | bit 7 | |
---|---|---|---|---|---|---|---|---|
Byte 0 | ||||||||
Byte 1 | ||||||||
Byte 2 | ||||||||
Byte 3 | ||||||||
... |
Command Identifier (MSB)
Command Identifier (LSB)
Source
Block ID
Length
Args
COM
CDHS
int sch_handler_set_raw_memory(scheduler_cmd_t* pCmd) {
raw_mem_access_cmd_t* pAddr = pCmd−>pCmdArgs;
char* pWriteData;
if (pAddr) {
if (g_sch_exec_mode != 1 ) {
/* exception and return */
}
char* pWriteData = &pAddr−>start_of_data_buf;
if (pAddr−>filesystem_target) {
// [...]
} else {
memcpy(pAddr−>targetAddr,
&pAddr−>start_of_data_buf,
pAddr−>writeLength);
}
}
// ...
}
COM
CDHS
Image Source: Maximilian Gerhardt, Reverse Engineering Satellite Firmware for Security Evaluation, 13. Dec. 2021
COM
CDHS
Bus
Experimenter
Operated by ESA
Open for Research
Peripherals
S-/X-Band, SDR, Optical Rx., Camera, ...
2
4
3
CCSDS Protocol Stack
4
ARM Cortex A9, Yocto Linux
2
AVR32 AT32UTC3, FreeRTOS
1
3
1
Cubesat Space Protocol (CSP)
2
2
AVR32 AT32UTC3, FreeRTOS
1
1
Cubesat Space Protocol (CSP)
/ libcsp
Source: https://en.wikipedia.org/wiki/Cubesat_Space_Protocol
TCP/IP Oriented Design
1
Security Issues
memcmp
to compare the digestconst uint32_t nonce = (uint32_t)rand();
Authors: Issues fixed in libcsp v2
Security Features
1
Security Issues
memcmp
to compare the digestconst uint32_t nonce = (uint32_t)rand();
Authors: Issues fixed in libcsp v2
Security Features
1
3
CCSDS Protocol Stack
3
2
AVR32 AT32UTC3, FreeRTOS
2
Space Packet Protocol
IP
Sync. and Channel Coding Sublayer
Message Abstraction
...
IPSec
TM Space Link Protocol
TC Space Link Protocol
AOS Space Data Link P.
Proximity-1
Data Link Lay.
3
Space Packet Protocol
IP
Sync. and Channel Coding Sublayer
Message Abstraction
...
IPSec
TM Space Link Protocol
TC Space Link Protocol
AOS Space Data Link P.
Proximity-1
Data Link Lay.
3
int csp_route_security_chek(...) {
if (packet->id.flags & CSP_FXTEA) {
csp_log_error("Received XTEA encrypted packet, but CSP was compiled without XTEA support. Discarding packet");
}
// ...
if (packet->id.flags & CSP_FHMAC) {
csp_log_error("Received packet with HMAC, but CSP was compiled without HMAC support. Discarding packet");
}
// ...
}
COM
COM
CDHS
int sch_handler_set_raw_memory(scheduler_cmd_t* pCmd) {
raw_mem_access_cmd_t* pAddr = pCmd−>pCmdArgs;
char* pWriteData;
if (pAddr) {
if (g_sch_exec_mode != 1 ) {
/* exception and return */
}
char* pWriteData = &pAddr−>start_of_data_buf;
if (pAddr−>filesystem_target) {
// [...]
} else {
memcpy(pAddr−>targetAddr,
&pAddr−>start_of_data_buf,
pAddr−>writeLength);
}
}
// ...
}
Message Abstraction Layer (MAL)
S-Band
Space Packet Protocol (SPP)
PUBSUB_MonitorEvent
SUBMIT_SetPowerState
INVOKE_GetGPSData
...
PROGRESS_GetSummary
Custom Byte Parsing
ADCS Server
...
UHF
Cubesat Space Protocol (CSP)
Parameter DB
CSP => SPP
Space Packet Protocol
Message Abstraction
void task_adcs_servr() {
char log_file_name [32];
csp_listen(socket, 10);
csp_bind(socket, port);
do {
do {
conn = csp_accept(socket, 0xff);
} while (do_wait_for_conn);
packet = csp_read(conn, 10);
if (packet) {
packet_data = packet->data;
switch(*packet_data) {
// [...]
case SET_LOGFILE: {
packet_data = packet->data + 0xf;
log_file_name[0] = '\0';
strcat(log_file_name,packet_data);
// ...
}
}
}
}
}
ADCS Server
Cubesat Space Protocol (CSP)
COM
CDHS
Bus
QEMU
AVR32
OBSW
Simulation Agent
Sensors
UHF
TC Handlers
Telecommand
Telemtry
TCP
TCP
Flight Manuvers
Sensor Values
How to add a new architecture to QEMU - Part 1-4 |
QEMU
AVR32
1
2
3
4
Hijack Control Flow
Patch Live Firmware
Add "Password" to TC stack
...
5
$$$
1
Hijack Control Flow
void init_adcs(void) {
gpio_enable_module((gpio_map_t *)GPS_USART_GPIO_MAP.18362,2);
usart_init(1,32000000,0x2580);
// ...
cmd_adcs_setup();
adcs_node_set(1,0x14);
xTaskGenericCreate(task_adcs,"ADCS",0x2000, 0x0, 8, &pvStack_18, 0x0, 0x0);
xTaskGenericCreate(task_adcs_server, "ASRV", 0x1000, &adcs_server_port, 9, &pvStack_18, 0x0, 0x0);
return;
}
void task_adcs_servr() {
// ...
do {
// ...
packet = csp_read(conn, 10);
if (packet) {
packet_data = packet->data;
switch(*packet_data) {
// [...]
case SET_LOGFILE: {
packet_data = packet->data + 0xf;
log_file_name[0] = '\0';
strcat(log_file_name,packet_data);
// ...
}
}
}
}
}
1
Hijack Control Flow
void GS_ADCS_Log_Start(char *filename, void *pkt_data, uint param_3) {
char sprintf_buf [60];
// ...
__n = sprintf(sprintf_buf,"%s\n%7.6f\n%3.1f\n%u%u%u%u%u\n", filename, ...);
// ...
fd = fopen(filename, "wb");
// ...
fwrite(&data, 1, __n, fd);
}
case SET_LOGFILE: {
packet_data = packet->data + 0xf;
log_file_name[0] = '\0';
strcat(log_file_name,packet_data);
adcs_logdata._20_4_ = csp_hton32( packet->data[...] | ... );
adcs_logdata._24_4_ = csp_hton32( packet->data[...] | ... );
adcs_logdata[28] = packet->data[10];
adcs_logdata[29] = packet->data[0xb];
// ...
adcs_get_jdate();
GS_ADCS_Log_Start(log_file_name, packet_data, pcVar7)
}
1
Hijack Control Flow
I2C
CSP
TM Sender
ADCS Server
CSP -> SPP
Parameter DB
CSP Handlers
Device Cmds.
TC Buffer