I have discovered a high-severity buffer overflow vulnerability in the ArduPilot SRXL2 protocol parsing function srxlParsePacket(). Due to a lack of validation on the minimum value of the attacker-controlled pRx->header.lengthfield, supplying a value less than 10 triggers an unsigned integer underflow. This causes memcpyto attempt writing approximately 4GB of data into a global buffer of only 64 bytes, resulting in memory corruption and potentially leading to remote code execution (RCE). I have provided a fix that includes boundary checks to address this issue.
I am not sure if my analysis is entirely correct, so I welcome everyone to review and discuss it together.
SRXL2_srxlParsePacket_integer_underflow.pdf (104.4 KB)