mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-22 14:19:57 +08:00
fix(mavlink): accept unsigned traffic only on traffic receiver links (#29488)
This commit is contained in:
1 parent
5b423854eb
commit
36919f8415
10 files changed
+68
-38
No files matched your search
+1
-1
@@ -106,7 +106,7 @@ An integrator can harden a deployment with any of:
|
||||
See [uXRCE-DDS](docs/en/middleware/uxrce_dds.md) and [Zenoh](docs/en/middleware/zenoh.md) for how.
|
||||
- **Enable [MAVLink message signing](docs/en/mavlink/message_signing.md).**
|
||||
This authenticates MAVLink frames but does not encrypt them.
|
||||
A small allowlist (`HEARTBEAT`, `RADIO_STATUS`, `ADSB_VEHICLE`, `COLLISION`) is currently accepted unsigned.
|
||||
A small allowlist is accepted unsigned: `HEARTBEAT` and `RADIO_STATUS` on every link, and `ADSB_VEHICLE` and `COLLISION` only on a link configured for a traffic receiver.
|
||||
Signing is inactive if the key file is absent, which is deliberate: removing the card is the recovery path when a key is lost.
|
||||
- **Lock the configuration.**
|
||||
Read-only parameters, [secure boot](docs/en/advanced_config/bootloader_secure_boot.md) with a replaced key, and no wired reflash.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -118,19 +118,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
|
||||
|
||||
@@ -182,16 +186,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 |
|
||||
@@ -99,8 +99,8 @@ If your threat model includes physical access, secure the SD card slot and debug
|
||||
- **Unaudited implementation**:
|
||||
The signing protocol was audited when it was drafted, but PX4's implementation of it has not been.
|
||||
- **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.
|
||||
|
||||
@@ -49,11 +49,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
|
||||
|
||||
@@ -82,12 +82,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
|
||||
@@ -238,7 +238,7 @@ public:
|
||||
return "Low Bandwidth";
|
||||
|
||||
case MAVLINK_MODE_UAVIONIX:
|
||||
return "uAvionix";
|
||||
return "ADS-B/Traffic (uAvionix)";
|
||||
|
||||
case MAVLINK_MODE_DISTANCE_SENSOR:
|
||||
return "DistanceSensor";
|
||||
@@ -598,7 +598,7 @@ public:
|
||||
return (active > 1) ? (kBulkBandwidthShare / (float)active) : kBulkBandwidthShare;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -62,6 +62,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
|
||||
@@ -76,7 +80,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
|
||||
@@ -249,7 +253,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
|
||||
|
||||
Reference in new issue
Block a user