pymavlink icon indicating copy to clipboard operation
pymavlink copied to clipboard

Message signature verification in the python library does not properly check the timstamp.

Open pv42 opened this issue 6 months ago • 2 comments

The function check_signature(..) -> bool in mavutil.py generated from mavgen_python.py https://github.com/ArduPilot/pymavlink/blob/e192ad8114f203220f404f37f971d6359dd5e3d2/generator/mavgen_python.py#L963 does not increase the value of self.signing.stream_timestamps[stream_key] after initially setting it on the first message received per logical stream. The documentation says that a packet should be rejected if

Timestamp is older than the previous packet from the same logical stream - where a logical stream is defined as the sequence of MAVLink packets with the same (SystemID, ComponentID, LinkID) tuple.

but since the value is never updated this comparison is only done against the first packet of the stream.

pv42 avatar Jul 31 '24 13:07 pv42