Monday, September 25, 2017

GPS spoofing possibly seen in AIS data

Disclaimer:  The opinions here are my own and do not represent Google, SkyTruth, Global Fishing Watch, or the Univ. of New Hampshire.  I work for Google, co-founded Global Fishing Watch, and am an Affiliate Professor at the Univ. of New Hampshire.

https://twitter.com/schneierblog/status/912307960369504259

Warning:  This was written off the top of my head in less than an hour with no review and not much fact checking.  I know I'm missing lots of interesting details.

Before I go an read the article that Bruce Schneier linked to, I'll try to think through what could explain these general sorts of issues.  I've heard rumbling before of this in AIS data, but it's time to take a few minutes.

After trawling through AIS data from recent years, evidence of spoofing becomes clear. Goward says GPS data has placed ships at three different airports and there have been other interesting anomalies. "We would find very large oil tankers who could travel at the maximum speed at 15 knots," says Goward, who was formerly director for Marine Transportation Systems at the US Coast Guard. "Their AIS, which is powered by GPS, would be saying they had sped up to 60 to 65 knots for an hour and then suddenly stopped. They had done that several times."
All of the evidence from the Black Sea points towards a co-ordinated attempt to disrupt GPS. A recently published report from NRK found that 24 vessels appeared at Gelendzhik airport around the same time as the Atria. When contacted, a US Coast Guard representative refused to comment on the incident, saying any GPS disruption that warranted further investigation would be passed onto the Department of Defence.
So what could cause deviations in speed?  This is without looking deeper at the data.   First, I need to think about what is being recorded here.  A ship has an AIS device that is trying to broadcast it's position.  It has an internal sense of location.  Where does that come from?  It usually has a GPS receiver, but that isn't always where the position comes from.  It could be from a different GNSS (aka satellite) nav system, Loran (Loran is not dead - only the US version), dead reckoning, or other ways of entering position.

If it was a GPS, there could be a couple things go on.  The GPS might be receiving differential corrections or ephemeris from someplace other than the satellites.  That could be a direct RF link or some internet link.  Those could be bogus either intensionally or unintentionally.  The GPS could be defective and I've seen that very clearly before.

But it might not be GPS.  These ships could be using pure GLONASSGalileo, or other system.  Or it could be a receiver that blends multiple constellations.  If one of these other systems has a problem, I'm not sure how that would impact the resulting position and velocity fixes.

The USCG and Europeans stopped using LORAN, but that doesn't mean there are no places where the same or similar local ground systems are in use for positioning.  The Russians have CHAYKA.  I've got used them and haven't thought through their failure modes or how to attack them.  They have a long and interesting history with things like Decca.

We also have the possibility the ship operator modifying the position.   Global Fishing Watch has seen clear evidence of ships monkeying with the position values on their AIS transceivers to thwart observers.  That could be from a modified AIS unit (e.g. customized embedded software), modified GPS, or a device between the GPS hardware and the AIS hardware.  A simple way to do this is to just use a computer with a software defined radio and send what ever you want.

There may also be Inertial Navigation System (INS) between any positioning system(s) and the AIS's embedded computer.  What are the ways an INS can have trouble?  There are plenty.

But, the ship's AIS might not have even been on a position system.  If the system's connection to a position system fails or it thinks it failed, the system can dead reckon.  Depending on the sensor inputs available, you can get all sorts of fun results.  And if the system later gets positioning input back, how does if get itself back in line?  Does it jump to the most recent position or does it try to gradually catch up.

There is probably plenty more to positioning, but it is time to move on to other topics like speed and time.

Next I wonder what is being used for speed.  AIS messages 1-3 have a speed (not velocity) field.  It's up to the AIS unit to fill that out.  How is it doing that?  It would be easy to alter or have that wrong.  I'm thinking of the NOAA Ship Thomas Jefferson that had bad bits in their AIS messages for months after a lightning strike to the ship.  Or are people with the messages using the times of the messages and their locations to externally calculate a speed for the ship?  That begs the question of what time to associate with each message and more specifically the position within the message.

Each AIS message 1,2,3 reports the seconds within the minute of the position report.  Only some reports have a more detailed time record with hour and minute (in the comm state block).  So if you are looking at a message, there are several questions.  Did the system know what time it was?  How far off could the time be?  Does the system think it doesn't have a decent sense of time from the GPS and internal clock(s)?  A substantial number of AIS transceivers report that they are getting time from the AIS transceivers around them.  What does that mean when most systems have a built in GPS that should provide an accurate sense of time?

Then we have the question of how long from the position/time tuple does it take the AIS to form the AIS message and get it out of the RF link?  It should be quick (less than 3-4 seconds), but who knows what a misbehaving transceiver might do.  And there is the added factor that AIS units will listen and act on remote commands without any authentication at all.  You can even tell an AIS unit to switch frequency.  That was accidentally demonstrated in the wild by the USCG of the US East coast many years ago.  Whoops!

So now we have an AIS message out on RF.  Where did it come from?  There is nothing in an AIS message that proves it is from that ship.  There is no cryptographic signature or other trick to make sure an external source isn't providing position.  You could jam the slots the ship transmits on and make fake messages for the ship in other slots and it would be very hard to spot from just typical NMEA logs of AIS.

There are plenty of cases with multiple ships having the same MMSI.  That's not a huge deal when they are in different oceans, but what happens when they are near each other?

Next, some AIS receivers do a careful job of recording metadata for a received AIS message, but most do not.  Some don't even record a received timestamp.  So you have to use the overall NMEA stream to keep a sense of time in the logs.  The USCG put atomic clocks in their receiving system (woo hoo, must be perfect time logs...), but then suffered Windows Time Protocol issues that had their logging systems recording times up to 24 hours different from the actual receive time.  Some people just use the loggers internal clock without NTP... that's full of all sorts of fun.  Sadly, oscillators in computers in are also temperature sensors.  They alter their frequency some with temperature.  I've seen that with a logger on the end of a peer in New Hampshire and it was especially bad when the 24 hour temperature swing was as large as near 0F to 60F.

There is also the case of where is the timestamp being recorded.  Back in 2010, I was getting Orbcomm data via the USCG.  About every 6 hours, I'd get a huge dump of AIS messages.  The timestamp metadata for all those messages would be the time of the dump.  So not helpful.

Then once a message is "received" there is method of getting the data to the decoder.  As seen by many, you might not be getting what you think.  If someone has access to the network, they could inject fake / altered messages and metadata.  If you can't trust the network or the people in the network, who knows what you will get.  And even in a trusted situation, you may not be receiving what the receiver saw.  The USCG provides NAIS feeds that decimate the data to things like only 1 copy of a message received at multiple points in the network and only 1 message per minute from a particular MMSI.  How do you check such decimated data?

Then finally, there is your decoding process.  Which software is converting AIS RF received bits into messages and finally NMEA and optional metadata (e.g. NMEA TAG BLOCKs)?  What library is decoding the NMEA and metadata?  What is being done to check timestamps find probable errors.  If your research is just on the decoding XML, json, or whatever decoded format, how can you verify that their decoding / interpretation of the original AIS is correct?  Perhaps they interpolate position reports (or did for just a bit of time) to make their system look more impressive?  Or their system rounds values or bugs in their processing snap positions to locations.  And so on and so on.

And there is also noise throughout the entire process.  The checksums in NMEA are pathetic.  And many encode and decode systems will just drop messages that don't meet their expectations.

Yes, you can spoof the GPS system, but the above shows that there are plenty of ways to have craziness in AIS data that are not caused by GPS spoofing.

Time to take a look at the article...

https://nrkbeta.no/2017/09/18/gps-freaking-out-maybe-youre-too-close-to-putin/  Skrevet av Henrik Lied 18. september 2017

While their timing with Putin's location is pretty convincing, I'm mostly left with questions.  Were these all Class A devices or where some Class B devices impacted too?  Were their any logs of positions from other devices?  e.g. a cell phone with GPS off, but able to see wifi can give you position estimates.  Were there any AIS satellite message (27?) position reports impacted?  What were the configurations and models of AIS and GPS for these ships?  Where there issues with other received AIS messages?  e.g. if you had any fixed base stations or ATONs reporting position, did they stay fixed and what positioning mode were they in (e.g. GNSS or surveyed?)  What happened with ships at dock or anchor in the region?  What was reported by different GPSes on the same ship?  Usually the AIS has a GPS receiver inside the device that is separate from the chart plotter.  Were any NMEA logs from the ship recorded?  Were their heading or commstate quirks in the AIS messages?


http://maritime-executive.com/editorials/mass-gps-spoofing-attack-in-black-sea

They quote from the master of the ship:
Thank you for your below answer, nevertheless I confirm my GPS equipment is fine.
We run self test few times and all is working good.
I confirm all ships in the area (more than 20 ships) have the same problem.
I personally contacted three of them via VHF, they confirmed the same.
Sometimes, position is correct, sometimes is not.
GPS sometimes looses position or displays inaccurate position (high HDOP).
For few days, GPS gave a position inland (near Gelendyhik aiport) but vessel was actually drifting more than 25 NM from it.
Important: at that time, GPS system considered the position as "Safe within 100m".
Really?  "my GPS equipment is fine"  How is a master supposed to really know that?  What do those self tests do?  What does their system do to declare that safety statement?  I'd love to see the raw log from even a regular fixed GPS for a time window that included the time of issues.  Even better if someone with a 100+ channel survey grade receiver had RINEX logs.  What does the phase tracking info say?

Summary

Really, these articles are just teases.  There is no really useful information in them.  The topic deserves a real research project with data published along with the results.  I encourage researchers out there to dig into these issues.

I also wonder about these hardware and software on the ship and receive stations.  I've never fuzz tested an AIS transceiver (RF input or ship comm channels), GPS, or ECDIS/ECS.  I've poked at fuzzing libais and it definitely needs work.  Also, some of these systems have OSes under the hood that could easily be attack via more traditional malware or vendor supplied issues.  e.g. If you have Transas ECDIS on your bridge that only runs on Windows?  Your machine could be pwned or Transas could have worked with the Russian government to have a way to allow the system to degrade positing when it wants... I variation on the US's ability to turn on Selective Availability (SA).

Note: I am NOT claiming that Transas has done this.  It's just they are a Russian company.  Correct?  I can't find any info to fact check my memory.

I am continually baffled by the maritime communities' believe that they are somehow special when is comes to computer security.  My message to all those working with ships:  Your IT security issues are not unique or special.   Your just worse at dealing with them than most and have your head in the sand even more than Equifax.

2 comments:

  1. Does nautical GPS provide RAIM or WAAS like on aircraft? With these features/systems, the GPS will error check signals from all the sattelites and automatically detect and omit a bad signal as long as 4 or more sattelites are in view.

    ReplyDelete
    Replies
    1. There is a RAIM flag in some AIS messages (e.g. Class A position reports in messages 1, 2, & 3). What exactly does it mean? And if a differential station is providing you a huge corrector, does that trigger the RAIM flag?

      Delete