Code Monkey home page Code Monkey logo

dronesecurity's Introduction

Drone-ID Receiver for DJI OcuSync 2.0

Paper thumbnail

This project is a receiver for DJI's Drone-ID protocol. The receiver works either live with an SDR, or offline on pre-recorded captures.

Our paper from NDSS'23 explains the protocol and receiver design: Drone Security and the Mysterious Case of DJI's DroneID [pdf]

If you're looking for the fuzzer, we will upload that shortly :)

The live receiver was tested with:

  • Ettus USRP B205-mini
  • DJI mini 2, DJI Mavic Air 2

Our software is a proof-of-concept receiver that we used to reverse-engineer an unknown protocol. Hence, it is not optimized for bad RF conditions, performance, or range.

Decoded Payload

Sample Files

We provide sample files in the samples/ folder.

The samples were directly dumped from the first stage of the live receiver that detects candidate frames and performs no other data processing; it usually hands them directly to the rest of the code that you can test offline.

You can use inspectrum to visualize the raw sample file:

sudo apt install inspectrum
inspectrum -r 50e6 samples/mini2_sm

Inspectrum screenshot of Drone-ID bursts

Quick Start (Offline)

Create a virtual environment for Python and install the requirements:

python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txt 

You can now run the decoder on the sample file:

./src/droneid_receiver_offline.py -i samples/mini2_sm

Results

The script performs detection and decoding just as the live receiver would. It prints the decoded payload for each Drone-ID frame:

## Drone-ID Payload ##
{
    "pkt_len": 88,
    "unk": 16,
    "version": 2,
    "sequence_number": 878,
    "state_info": 8179,
    "serial_number": "SecureStorage?",
    "longitude": 7.267960786785307,
    "latitude": 51.446866781640146,
    "altitude": 39.32,
    "height": 5.49,
    "v_north": 0,
    "v_east": -7,
    "v_up": 0,
    "d_1_angle": 16900,
    "gps_time": 1650894901980,
    "app_lat": 43.26826445428658,
    "app_lon": 6.640125363111847,
    "longitude_home": 7.26794359805882,
    "latitude_home": 51.446883970366635,
    "device_type": "Mini 2",
    "uuid_len": 0,
    "uuid": "",
    "crc-packet": "c935",
    "crc-calculated": "c935"
}

The summary contains decoding stats and flight path. In the mini2_sm sample, the drone did not have GPS coordinates locked yet, and only the smartphone's location is transmitted:

$ ./src/droneid_receiver_offline.py -i samples/mini2_sm
… … …
Frame detection: 10 candidates
Decoder: 9 total, CRC OK: 7 (2 CRC errors)
Drone Coordinates:
App Coordinates:
(51.447176178716916, 7.266528392911369)
(51.447176178716916, 7.266528392911369)
…
(51.447176178716916, 7.266528392911369)

For samples/mavic_air_2 both locations are transmitted:

$ ./src/droneid_receiver_offline.py -i samples/mavic_air_2
…
Decoder: 1 total, CRC OK: 1 (0 CRC errors)
Drone Coordinates:
(51.44633393111904, 7.26721594197086, 12.8)
App Coordinates:
(51.44620788045814, 7.267101350460944)

Live Receiver

The live receiver additionally requires the UHD driver and quite powerful machines (for captures at 50 MHz bandwidth).

Environment:

  • Ettus USRP B205-mini
  • DJI mini 2, DJI Mavic Air 2

First, setup the Python environment. Due to the UHD driver, this does not work with a virtual environment. If you previously activated a virtual environment, exit that environment first. Install Python requirements:

pip3 install -r requirements.txt

Install UHD:

sudo apt install libuhd-dev uhd-host python3-uhd

Run the receiver:

./src/droneid_receiver_live.py 

The receiver will hop through a list of frequencies and, if a drone is detected, lock on that band.

Deeper Dive: Script output

Processing Pipeline

If you're looking for a deeper dive into the processing steps, we suggest calling the offline decoder with --debug. This will enable a GUI with step-by-step decoding.

./src/droneid_receiver_offline.py -i samples/mini2_sm --debug

First, the SpectrumCapture class performs packet detection and splits the capture file into individual frames:

Packet #0, start 0.000076, end 0.000721, length 0.000644, cfo -12207.031250
Packet #1, start 0.000811, end 0.001456, length 0.000644, cfo 0.000000
Packet #2, start 0.001546, end 0.002191, length 0.000644, cfo 0.000000
…

Some of these packets are false-positives and we do not expect successful decoding. Start and end are in seconds, so you can use inspectrum to take a look at individual frames.

Next, the Packet class detects the Zadoff-Chu sequences and performs time and frequency offset corrections. It splits the frames into individual OFDM symbols.

FFO: -6546.528614
Found ZC sequences: 600 147
ZC Offset: -2.867868

The Decoder class gets the OFDM symbols and demodulates the subcarriers using QPSK. We do not know the QPSK orientation here, hence, we simply brute-force the orientation. decoder.magic() performs the descrambling and turbo-decode.

DroneIDPacket unpacks the resulting bitstream into the Drone-ID struct. At this point the message could be decoded, but might be corrupted (CRC check needed).

CRC check FAIL is easy to spot by looking at the Serial Number (should read 'SecureStorage?'):

    "serial_number": "Sa#upeStore&q?\u0010\b",
    …
    "crc-packet": "d985",
    "crc-calculated": "9b01"
}
CRC Check FAILED!

At the very end, we print some statistics:

Successfully decoded 14 / 34 packets
4 Packets with CRC error

So in total we decoded 18 packets, 14 with correct CRC. Again, this is expected as the sample file includes Drone-ID Frames with greatly varying quality.

FAQ - Frequently Asked Questions

Is DJI's Drone-ID the same as the standardized, Bluetooth or WiFi-based "Remote ID"?

No. DJI uses a dedicated wireless protocol for its Drone-ID, hence the need to implement an receiver.

Can I use this software to locate drones from other manufacturers?

No. This software decodes DJI-specific protocols. It does not work with WiFi or Bluetooth-based "Remote ID".

Can I locate drones without this software?

Maybe. Since late 2022, the US or EU started requiring drone manufacturers to implement "Drone Remote ID" - an international standard that works on top of WiFi or Bluetooth. You can use a smartphone app to locate drones that support the standard. New drones already feature WiFi/Bluetooth-based "Remote ID", and existing drones are gradually retrofitted (e.g., through firmware updates).

Where can I find more information on the WiFi/Bluetooth-based Remote ID?

Standard documents in EU: EN 4709, US: ASTM F3411. For practical information, check out this page by the FAA. If you're looking for an open-source implementation (e.g., Android apps), we suggest opendroneid.org and their Github repositories.

Are you going to improve the receiver, introduce new features, or port to another SDR?

We're not planning to include new features at this point. The tool is provided as artifact along our academic paper and enables researchers to reproduce our results, and to help study the privacy implications. It is not meant for productive, reliable localization of drones.

Is your receiver the only receiver available?

No. The code in proto17/dji_droneid was developed in parallel. We think it's great and if you're interested in details, you should take a look at both implementations.

Citing the Paper

If you would like to cite our work, use the following BibTex entry:

@inproceedings{schiller2023drone,
  title={Drone Security and the Mysterious Case of DJI's DroneID},
  author={Schiller, Nico and Chlosta, Merlin and Schloegel, Moritz and Bars, Nils and Eisenhofer, Thorsten and Scharnowski, Tobias and Domke, Felix and Sch{\"o}nherr, Lea and Holz, Thorsten},
  booktitle={Network and Distributed System Security Symposium (NDSS)},
  year={2023}
}

dronesecurity's People

Contributors

mrlnc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dronesecurity's Issues

DroneID packet emission on Mavic Air 2

hi,

you made a really impressive work!

I am using your sw to get some droneID packets from a Mavic Air 2. I found some difficult to get those packets, i found and decoded some single droneID packets only saving demodulated data from my sdr and in some "random" bands and they looks like to be emitted very very rarely. When the drone use the first channel of 5.8 GHz band (center at 5735.5 MHz), i got some droneID packets centered at 5776.5 MHz emitted about every tens of second. In your paper the droneID packets should be emitted every 600 ms but i cant find them.

Do the droneID packets could be found in the same channel where other data (video ecc..) are sent? Because i searched there but i found no droneID packets.

thank you and br.

Maurice

BladeRF

Hello! Do you plan to add bladerf?

C2 and beacon packets

First of all congratulations for your job,
I'm doing some research on drone communication and I noticed on your software that you refer also to c2 and beacon packets.
I also noticed that the code part for those packets is at very early stages.
I'd like to know from you, if possible, something more about c2 and beacon packets.

In my captures I often find this kind of packets that are bigger than 2 MHz in bandwidth and last for about 500us. (attached here) Are these ones the C2 packets? (if so I think we should correct the bandwidth in your code since it is slighlty smaller)
unknown_pkt
If not, could you provide some samples, or at least a screenshot of what should we expect (for C2 and Beacons)?

Thank you!

DroneID packet frequencies

Hello,

I have to ask - the freqs of the droneIDs that uses in your code - did you check them? did you really see droneIDs in ALL this freqs?
I read the droneID article - "DJI drone IDs are not encrypted" and the work from github - https://github.com/proto17/dji_droneid,
and never saw your freqs.

moreover - when I tried to find manually droneIDs in my missing freqs - I didn't find any.
so if you tested that - I would like to know.

Something else - Should droneID works with other DJI drones? like DJI Lightbridge?

I would appreciate a response on these issues.

Uploading Fuzzer

Hello, I would like to experiment with the fuzzer part of your system. can you upload it?

Also, it would be appreciated if you could tell us how to send and receive input and output through the DUML protocol.

Demodulation failed

I am having some errors with the decoding if i am capturing the correct data,
Does anyone had the demodulation failed error?

Local Reproduction/ CA - YOW region - DJI Air 2s - OcuSync 3.0

Good Morning, thank you for the excellent article and associated repo for capturing droneID radio traffic.
I was also under the impression that DroneID was encrypted. There was a POC last year in Ottawa that tracked a range of 40KM from YOW. I didn't realize the

OcuSync 2.0 to 3.0
I wish to contribute to your project first by cloning your repo and reproducing your base setup towards the goal of automated tracking of various drones starting with my DJI Air 2S with a mini 2 as a backup. If required I will move up to the Mavik 3.

I currently fly the drone in Transport Canada approved airspace under the VLOS flight certificate and would like to combine your software/hardware setup eventually with AI based visual tracking.

Background: found your repo and paper via the Wired Magazine article https://www.wired.com/story/dji-droneid-operator-location-hacker-tool/

I will leave project reproduction and status on your repo as I go - in this issue id - with your permission or on my fork.

Work Items

WI 1: 20230302: SDN selection

The purchase of the SDN radio is a bit more expensive that the first drone itself so I would like to verify the recommended model.
On your readme the model is https://github.com/RUB-SysSec/DroneSecurity#drone-id-receiver-for-dji-ocusync-20
"Ettus USRP B205-mini"

On your paper https://www.ndss-symposium.org/wp-content/uploads/2023/02/ndss2023_f217_paper.pdf the model is a USRP B200mini
"Our setup uses a USRP B200mini SDR that we connect to a laptop"

I assume the following model is supported and will purchase
https://www.ettus.com/all-products/usrp-b205mini-i/

20230307: Order from Digilent

Ettus USRP B205mini-i: 1x1, 70MHz-6GHz SDR/Cognitive Radio(USRP B205mini-i Options: USRP B205mini-i with enclosure) 471-045
1 $1,354.00 USD

20230313: USRP B205mini-i received (minus enclosure until July)

Links

DroneID Packet duration

Regarding the experimental results of my DJI Mavic Air 2, I continuously monitored the spectrum for more than ten minutes and did not seem to find a suitable DroneID burst signal. I have some thoughts below.

In your paper, it was mentioned that the DroneID data packet is broadcasted every 640ms, but the actual data frame is only 648 μs. Despite its high transmit frequency and bandwidth of 15.36MHz, it is approximately 600 μs of the duration makes it difficult to detect such signals in the spectrum. Is my analysis correct?

I also tried to record signals within a certain frequency band, such as (5755MHz-5805MHz), with a sampling bandwidth of 50M, but I was unable to successfully detect the corresponding DroneID signal.

Do you have any good suggestions?

Decoding failed for DJI Mavic Air 2

Dear Sir;

I recorded the DJI MAVIC AIR 2 signal inside shielding room using adrv9361z7035 SDR board. I recorded the 3 Scenarios, one just ON (Mavic_air_2s_1000.fc32) and 2nd one turn on the propellers (Mavic_air_2s_1100.fc32) and 3rd take off (Mavic_air_2s_1110.fc32)and fly at the distance of 1m from the receiver. Whenever I run the offline receiver but decoding failed.I am sharing the complete log file and PNG files of in-spectrum testing. Kindly help needed. Please find the attachment.

DJI_MAVIC_AIR_2.zip

Thanks in advance

Inquiry about file creation in drone detection

how did you create the sample files of those two drones given in the repository and how can i make similar file for my DJI drone and test it from the droneid_receiver_offline.py program.
and also, can I use LimeSDR instead of USRP for the live detection?

waiting for your reply.
Thank you

List of minimum SDR requirements

A list of minimum SDR hardware requirements would be nice.
I have a NESDR 5, before playing with tools IDK if the frequencies to listen for are in the range of my device or not.

Recording of drone IQ data

I would like to ask a few questions on recording of IQ data as my recorded signal is not as clean and neat as the sample files recorded.
How did you record the Ocusync 2.0 signal from Mavic air 2 and mini 2? What was signal bandwidth the 2 drone is transmitting at?

Confusion about zcsequence_t and zcsequence_f,and find_zc_angle.

first question:if we use LTE's point, zcsequence_t is directly frequency seq, in find_zc_seq(),author uses zcsequence_t corralte with symbol_f in frequency,so i think author look zcsequence_t as frequency seq in there,but in estimate_channel() function author uses zcsequence_f as frequency expected_signal , why ?
next question: in find_zc_angle(): i think author'aim is to find the initial constant phase offset, why use the angle value of zero freq point :angle(symbol_f[NCARRIERS//2]) as the estimation of angle? perhaps DJI dosenot send ZC zeropoint, so set this value to a constant real value,so the receiver can use this point's angle value as phase estimation directly?

Decoding data from Mavic 2 Pro

Good evening. I am trying to run your code for DJI Mavic Pro. I set legacy = True. I see that the packet is detected and demodulation is attempted. But the decoding gives an error and I don't see any results at the output. Please tell me in which direction I should look for the problem? Maybe recording IQ will help?

OcuSync3

Does that work with OcuSync3 ?

Does it require a high signal-to-noise ratio for USRP to extract the signal?

I happen to have a USRP B200 SDR which works for your code. But it can not capture signals of my DJI Air 2S. Does it require a high SNR to extract the signal. How did you configure the parameters of your B200, or do you use a high gain antenna to get the signals and decode the drone ID? I am very curious. In my case, the code will never be touched for unqualified bw.
image

How to decoding data from OcuSync 3.0

hello,
I tried to capture the signal and decoding the OcuSync 3.0 signal from your file.
Can you please suggest Which parameters must be adjusted?
In your file it will help us.

Dependency hell

Hi,

I was not able to use the software, I always run into some numpy/scipy dependency hell. As not being a coding but a hardware guy, somehow I am stuck. Is there a recommended Linux distribution that should fulfil the expectations without too much fiddling? Latest Kubuntu obviously make trouble.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.