brocaar / chirpstack-network-server

ChirpStack Network Server is an open-source LoRaWAN network-server.
https://www.chirpstack.io
MIT License
1.5k stars 546 forks source link

Multiple devices can have same DevAddr and NwkSKey #534

Closed hylowaker closed 3 years ago

hylowaker commented 3 years ago

If two or more devices share same DevAddr and network session keys, their uplink will map to single session even if they are coming from different nodes, so that the other sessions are not able to receive uplink data.

It would not likely happen in OTAA devices. However user can accidentally or intentionally activate such devices by ABP.

I think the server should not allow activating an ABP device with duplicated DevAddr and network session keys.

brocaar commented 3 years ago

I'm not sure if this should be implemented.

For the NwkSKey, you should always use a cryptographic random value to avoid the risk you are mentioning. I'm not sure if there is a way where a NS could operate with multiple devices that have both the same DevAddr and NwkSKey, as this combo is used to retrieve the matching device-session based on MIC validation.

If the NS would enforce unique DevAddr + NwkSkey combinations, then the result would be that on duplicate it would prompt the user that a device with the same DevAddr and NwkSkey already exists, which would leak security sensitive data.