Summary
The BST telemetry probe writes a string terminator using a device-provided length without bounds. A malicious BST device can report an oversized dev_name_len, causing a stack overflow in the driver and crashing the task (or enabling code execution).
Details
In src/drivers/telemetry/bst/bst.cpp (BST::probe), after receiving a device info reply the code does:
dev_info_reply.payload.dev_name[dev_info_reply.payload.dev_name_len] = '\0';
The dev_name buffer is 32 bytes, but dev_name_len is attacker-controlled from the I2C reply and is never bounded (lines ~190-215). A
length ≥32 writes past the stack buffer, corrupting adjacent data.
PoC
px4-bst-dev-name-overflow-poc.tar.gz
Use the provided ASAN harness px4-bst-dev-name-overflow-poc/:
cmake -S px4-bst-dev-name-overflow-poc -B px4-bst-dev-name-overflow-poc/build
cmake --build px4-bst-dev-name-overflow-poc/build
./px4-bst-dev-name-overflow-poc/build/px4_bst_dev_name_overflow_poc
The mock I2C device returns a BST info reply with dev_name_len=0xFF; ASAN reports a stack-buffer-overflow at bst.cpp:209 in BST::probe.
Impact
Stack-based buffer overflow triggered by any BST device or I2C bus attacker responding to the probe. Causes denial of service and could enable code execution in the BST driver context if protections are weak.
Acknowledgments
Summary
The BST telemetry probe writes a string terminator using a device-provided length without bounds. A malicious BST device can report an oversized
dev_name_len, causing a stack overflow in the driver and crashing the task (or enabling code execution).Details
In
src/drivers/telemetry/bst/bst.cpp(BST::probe), after receiving a device info reply the code does:PoC
px4-bst-dev-name-overflow-poc.tar.gz
Use the provided ASAN harness px4-bst-dev-name-overflow-poc/:
The mock I2C device returns a BST info reply with
dev_name_len=0xFF; ASAN reports a stack-buffer-overflow at bst.cpp:209 in BST::probe.Impact
Stack-based buffer overflow triggered by any BST device or I2C bus attacker responding to the probe. Causes denial of service and could enable code execution in the BST driver context if protections are weak.
Acknowledgments