fix(mavlink): accept unsigned traffic only on traffic receiver links (#29488)

(cherry picked from commit 36919f8415)

Dropped the SECURITY_SCOPE.md change, because release/1.18 has no such file.
This commit is contained in:
Julian Oes authored and Ramon Roche committed 2026-11-16 07:57:11 -08:00
1 parent d66af0321b
commit c8e321d1b7
9 files changed
+67 -37

No files matched your search

+2 -1
View File
@@ -21,7 +21,8 @@ The available profiles (in source-code declaration order) are:
- _Minimal_ (`MAVLINK_MODE_MINIMAL`): Minimal set of messages for use with a GCS on a poor telemetry link.
- _Onboard Low Bandwidth_ (`MAVLINK_MODE_ONBOARD_LOW_BANDWIDTH`): Set of messages to be streamed to a companion computer for re-routing to a reduced-traffic link, such as a GCS.
- _Low Bandwidth_ (`MAVLINK_MODE_LOW_BANDWIDTH`): Reduced message set for low bandwidth links.
- _uAvionix_ (`MAVLINK_MODE_UAVIONIX`): Messages for a uAvionix ADS-B beacon.
- _ADS-B/Traffic (uAvionix)_ (`MAVLINK_MODE_UAVIONIX`): Link to a traffic receiver such as an ADS-B or FLARM device, plus the messages a uAvionix ADS-B beacon needs.
With [message signing](../mavlink/message_signing.md) active, unsigned `ADSB_VEHICLE` and `COLLISION` are only accepted on links in this mode.
- _Distance Sensor_ (`MAVLINK_MODE_DISTANCE_SENSOR`): Streams distance sensor data at unlimited rate.
:::tip
+23 -19
View File
@@ -112,19 +112,23 @@ For each incoming message, the MAVLink library checks whether a valid signature
If the message is unsigned or has an invalid signature, the library calls the `accept_unsigned` callback, which decides whether to accept or reject the message based on:
1. **Signing not active**: If no key has been loaded, all messages are accepted.
2. **Allowlisted message**: Certain [safety-critical messages](#unsigned-message-allowlist) are always accepted.
2. **Allowlisted message**: Certain [safety-critical messages](#unsigned-message-allowlist) are accepted, some of them only on links configured for a traffic receiver.
## Unsigned Message Allowlist
The following messages are **always** accepted unsigned, regardless of the signing state.
These are safety-critical messages that may originate from systems that don't support signing:
The following messages are accepted unsigned when signing is active.
They are safety-critical messages that may originate from systems that don't support signing:
| Message | ID | Reason |
| ----------------------------------------------------------------------- | --- | -------------------------------------------------------- |
| [HEARTBEAT](https://mavlink.io/en/messages/common.html#HEARTBEAT) | 0 | System discovery and liveness detection |
| [RADIO_STATUS](https://mavlink.io/en/messages/common.html#RADIO_STATUS) | 109 | Radio link status from SiK radios and other radio modems |
| [ADSB_VEHICLE](https://mavlink.io/en/messages/common.html#ADSB_VEHICLE) | 246 | ADS-B traffic information for collision avoidance |
| [COLLISION](https://mavlink.io/en/messages/common.html#COLLISION) | 247 | Collision threat warnings |
| Message | ID | Accepted unsigned on | Reason |
| ----------------------------------------------------------------------- | --- | ---------------------------------------- | -------------------------------------------------------- |
| [HEARTBEAT](https://mavlink.io/en/messages/common.html#HEARTBEAT) | 0 | All links | System discovery and liveness detection |
| [RADIO_STATUS](https://mavlink.io/en/messages/common.html#RADIO_STATUS) | 109 | All links | Radio link status from SiK radios and other radio modems |
| [ADSB_VEHICLE](https://mavlink.io/en/messages/common.html#ADSB_VEHICLE) | 246 | Links in `ADS-B/Traffic (uAvionix)` mode | ADS-B traffic information for collision avoidance |
| [COLLISION](https://mavlink.io/en/messages/common.html#COLLISION) | 247 | Links in `ADS-B/Traffic (uAvionix)` mode | Collision threat warnings |
Traffic receivers generally can't sign, but unsigned traffic accepted on any link would let anyone on a telemetry or network link inject phantom aircraft into [traffic avoidance](../peripherals/adsb_flarm.md).
Unsigned `ADSB_VEHICLE` and `COLLISION` are therefore only accepted on a link whose [MAV_X_MODE](../advanced_config/parameter_reference.md#MAV_0_MODE) is set to `ADS-B/Traffic (uAvionix)`, which is how a traffic receiver on a serial port should be configured.
On all other links they must be signed like any other message.
## Security Considerations
@@ -169,16 +173,16 @@ Physical access to the SD card or debug port is required.
- **No encryption**: Message signing provides **authentication and integrity only**.
Messages are still sent in plaintext.
An eavesdropper can read all message contents (telemetry, commands, parameters, missions) but cannot forge or modify them without the key.
- **Allowlisted messages bypass signing**: A small set of [safety-critical messages](#unsigned-message-allowlist) are always accepted unsigned.
An attacker can spoof these specific messages (e.g. fake `ADSB_VEHICLE` traffic) even when signing is active.
- **Allowlisted messages bypass signing**: A small set of [safety-critical messages](#unsigned-message-allowlist) are accepted unsigned.
An attacker can spoof `HEARTBEAT` and `RADIO_STATUS` on any link, and `ADSB_VEHICLE` and `COLLISION` on a link configured for a traffic receiver, even when signing is active.
### What signing does NOT protect against
| Attack | Why |
| ----------------------------------------------------- | ------------------------------------------------------- |
| Eavesdropping | Messages are not encrypted |
| SD card extraction | Key file is readable by anyone with physical access |
| Spoofed `HEARTBEAT`/`RADIO_STATUS`/`ADSB`/`COLLISION` | These are allowlisted unsigned |
| Lost key without SD card access | Requires SWD reflash |
| Key rotation | No automatic mechanism; manual re-provisioning required |
| In-flight key changes | `SETUP_SIGNING` rejected while armed |
| Attack | Why |
| ----------------------------------------------------- | ----------------------------------------------------------------------- |
| Eavesdropping | Messages are not encrypted |
| SD card extraction | Key file is readable by anyone with physical access |
| Spoofed `HEARTBEAT`/`RADIO_STATUS`/`ADSB`/`COLLISION` | These are allowlisted unsigned (traffic only on traffic receiver links) |
| Lost key without SD card access | Requires SWD reflash |
| Key rotation | No automatic mechanism; manual re-provisioning required |
| In-flight key changes | `SETUP_SIGNING` rejected while armed |
+2 -2
View File
@@ -78,8 +78,8 @@ If your threat model includes physical access, secure the SD card slot and debug
Message signing provides authentication and integrity, but messages are sent in plaintext.
An eavesdropper can read telemetry and commands but cannot forge them.
- **Allowlisted messages**:
A small set of [safety-critical messages](message_signing.md#unsigned-message-allowlist) (`HEARTBEAT`, `RADIO_STATUS`, `ADSB_VEHICLE`, `COLLISION`) are always accepted unsigned on all links.
An attacker could spoof these specific messages.
A small set of [safety-critical messages](message_signing.md#unsigned-message-allowlist) is accepted unsigned: `HEARTBEAT` and `RADIO_STATUS` on all links, and `ADSB_VEHICLE` and `COLLISION` only on links in `ADS-B/Traffic (uAvionix)` mode.
An attacker could spoof these specific messages where they are accepted.
- **Key management**:
There is no automatic key rotation.
Keys must be reprovisioned manually via a signed `SETUP_SIGNING` message.
+11 -6
View File
@@ -34,11 +34,11 @@ For other ports or boards, you will need to obtain your own cable.
The recommended port configuration for this receiver is:
| Parameter | Recommended Value |
| ---------------------------------------------------------------------------- | ----------------- |
| [MAV_X_CONFIG](../advanced_config/parameter_reference.md#MAV_1_CONFIG) | `TELEM 2` |
| [MAV_X_MODE](../advanced_config/parameter_reference.md#MAV_1_MODE) | uAvionix |
| [MAV_X_RADIO_CTL](../advanced_config/parameter_reference.md#MAV_1_RADIO_CTL) | Disabled |
| Parameter | Recommended Value |
| ---------------------------------------------------------------------------- | ------------------------ |
| [MAV_X_CONFIG](../advanced_config/parameter_reference.md#MAV_1_CONFIG) | `TELEM 2` |
| [MAV_X_MODE](../advanced_config/parameter_reference.md#MAV_1_MODE) | ADS-B/Traffic (uAvionix) |
| [MAV_X_RADIO_CTL](../advanced_config/parameter_reference.md#MAV_1_RADIO_CTL) | Disabled |
## FLARM
@@ -67,12 +67,17 @@ The recommended configuration for most devices (unless they have device-specific
| Parameter | Recommended Value |
| ------------------------------------------------------------------------ | --------------------------------- |
| [MAV_X_CONFIG](../advanced_config/parameter_reference.md#MAV_1_CONFIG) | `TELEM 2` |
| [MAV_X_MODE](../advanced_config/parameter_reference.md#MAV_1_MODE) | Normal |
| [MAV_X_MODE](../advanced_config/parameter_reference.md#MAV_1_MODE) | ADS-B/Traffic (uAvionix) |
| [MAV_X_RATE](../advanced_config/parameter_reference.md#MAV_1_RATE) | 0 (default sending rate for port) |
| [MAV_X_FORWARD](../advanced_config/parameter_reference.md#MAV_1_FORWARD) | Enabled |
Then reboot the vehicle.
::: info
Use the `ADS-B/Traffic (uAvionix)` mode for any traffic receiver.
If [MAVLink message signing](../mavlink/message_signing.md) is active, unsigned `ADSB_VEHICLE` and `COLLISION` messages are only accepted on a link in this mode, so a receiver on a link in another mode is ignored.
:::
You will now find a new parameter called [SER_TEL2_BAUD](../advanced_config/parameter_reference.md#SER_TEL2_BAUD), which must be set to 57600.
### Configure Traffic Avoidance
@@ -29,7 +29,7 @@ parameters:
9: extvisionmin
10: gimbal
11: onboard_low_bandwidth
12: uavionix
12: ADS-B/Traffic (uAvionix)
13: Low Bandwidth
default: 2
reboot_required: true
+2 -2
View File
@@ -235,7 +235,7 @@ public:
return "Low Bandwidth";
case MAVLINK_MODE_UAVIONIX:
return "uAvionix";
return "ADS-B/Traffic (uAvionix)";
case MAVLINK_MODE_DISTANCE_SENSOR:
return "DistanceSensor";
@@ -508,7 +508,7 @@ public:
bool radio_status_critical() const { return _radio_status_critical; }
bool accept_unsigned(uint32_t message_id) { return _sign_control.accept_unsigned(message_id); }
bool accept_unsigned(uint32_t message_id) { return _sign_control.accept_unsigned(message_id, _mode == MAVLINK_MODE_UAVIONIX); }
bool is_signing_active() const { return _sign_control.is_signing_active(); }
void set_signing_key_dirty() { _signing_key_dirty.store(true); }
void check_signing_key_dirty();
+17 -3
View File
@@ -47,11 +47,17 @@ static mavlink_signing_streams_t global_mavlink_signing_streams = {};
pthread_mutex_t MavlinkSignControl::_streams_mutex = PTHREAD_MUTEX_INITIALIZER;
// Messages accepted without signing per MAVLink spec recommendation.
// Messages accepted without signing on every link, per MAVLink spec recommendation.
// HEARTBEAT is required for link discovery/interop but allows spoofed phantom vehicles on GCS.
static const uint32_t unsigned_messages[] = {
MAVLINK_MSG_ID_HEARTBEAT,
MAVLINK_MSG_ID_RADIO_STATUS,
MAVLINK_MSG_ID_RADIO_STATUS
};
// Traffic messages, accepted without signing only on a link configured for a traffic
// receiver. Receivers generally cannot sign, but anyone on another link could use these
// to inject phantom aircraft into traffic avoidance.
static const uint32_t unsigned_traffic_messages[] = {
MAVLINK_MSG_ID_ADSB_VEHICLE,
MAVLINK_MSG_ID_COLLISION
};
@@ -224,7 +230,7 @@ void MavlinkSignControl::write_key_and_timestamp()
}
}
bool MavlinkSignControl::accept_unsigned(uint32_t message_id)
bool MavlinkSignControl::accept_unsigned(uint32_t message_id, bool traffic_link)
{
if (!_is_signing_initialized) {
return true;
@@ -236,6 +242,14 @@ bool MavlinkSignControl::accept_unsigned(uint32_t message_id)
}
}
if (traffic_link) {
for (unsigned i = 0; i < sizeof(unsigned_traffic_messages) / sizeof(unsigned_traffic_messages[0]); i++) {
if (unsigned_traffic_messages[i] == message_id) {
return true;
}
}
}
return false;
}
+3 -1
View File
@@ -94,8 +94,10 @@ public:
/**
* Checks whether an unsigned message should be accepted
* @param traffic_link true if the link is configured for a traffic receiver, which may
* send traffic messages unsigned
*/
bool accept_unsigned(uint32_t message_id);
bool accept_unsigned(uint32_t message_id, bool traffic_link);
/**
* Only call from the instance's receiver thread, which is the only thread that changes it.
+6 -2
View File
@@ -58,6 +58,10 @@ parameters:
The MAVLink Mode defines the set of streamed messages (for example the
vehicle's attitude) and their sending rates.
Use ADS-B/Traffic for a traffic receiver such as an ADS-B or FLARM
device. With message signing active, unsigned ADSB_VEHICLE and
COLLISION messages are only accepted on links in this mode.
type: enum
values:
0: Normal
@@ -72,7 +76,7 @@ parameters:
#9: External Vision Minimal # hidden
10: Gimbal
11: Onboard Low Bandwidth
12: uAvionix
12: ADS-B/Traffic (uAvionix)
13: Low Bandwidth
reboot_required: true
num_instances: *max_num_config_instances
@@ -223,7 +227,7 @@ parameters:
#9: External Vision Minimal
#10: Gimbal
11: Onboard Low Bandwidth
#12: uAvionix
#12: ADS-B/Traffic (uAvionix)
13: Low Bandwidth
# We shadow the modes that can block the FMU to SOM connection
reboot_required: true