Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
pv42 opened this issue Jul 31, 2024 · 2 comments

Comments

@pv42
Copy link

pv42 commented Jul 31, 2024

The function check_signature(..) -> bool in mavutil.py generated from mavgen_python.py

def check_signature(self, msgbuf${type_bytearray}, srcSystem${type_int}, srcComponent${type_int})${type_bool_ret}:
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.

@tridge
Copy link
Contributor

tridge commented Aug 27, 2024

@pv42 I think you are right and this needs to be fixed. Would you like to do a PR yourself? or shall I do it?

@pv42
Copy link
Author

pv42 commented Aug 27, 2024

Hello @tridge, thanks for the response.
I just noticed the issue when comparing the c implementation, this python implementation and the documentation. While I was reasonably confident that there is something wrong with this implementation I am not sufficiently confident to write the security critical code of a codebase I am not familiar with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants