News for hackers. Stuff that matters.
Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by cylinder on Saturday March 30, 2019 @01:30AM (#19527946)
Can someone sensible with expertise comment on this please?
Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by elfchief on Saturday March 30, 2019 @02:08AM (#19528047)
Sure, gps geek and time-nut here.

The rollover problem is a hard one to fix, because there's no reasonable way for a GPS (at least one using LNAV (legacy) signals -- pretty much all of them, though I don't know what modern passenger jets use) to know which GPS "epoch" they're in. If you don't know what epoch you're in, you don't know what the date is.

Some GPSs solve this by recording the week number of their firmware build, and if the signals they get indicate the week number is less than that, they assume they're in the next epoch and update accordingly. Still means you run out of time, but you get a full ~19 years of life first (and then fail at some random GPS week). Some use fuses to record when an epoch has passed. Some use out of band information. Some store the current epoch in flash or battery-backed RAM. Some just never address the problem.

Thing is, though -- the only effect this has, is that it makes the GPS return the wrong date. That's it. The week rollover has no effect on navigation unless there's some significant bugs in the unit, or something external to the GPS relies on the date being output and doesn't deal well with the date suddenly going back in time. That's it.

I'd be kinda shocked if airplanes were just jam-syncing the clocks of their nav computers to the output of a GPS, and then had those nav systems be dependent on that time. But then again, I work in the tech industry, and I've seen the kinda code that goes into most products, so maybe I wouldn't be that shocked.

(I also can't imagine that GPS units used in aircraft aren't directly tested for their behavior during the week rollover. It's a well known and understood problem, and even if some random GPS manufacturer drops the ball, stuff that goes into aircraft has to go through certification for a reason...)

Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by sho on Saturday March 30, 2019 @04:03AM (#19528386)
> I'd be kinda shocked if airplanes were just jam-syncing the clocks of their nav computers to the output of a GPS, and then had those nav systems be dependent on that time

Obligatory not an aircraft software engineer, but I can say with some certainty that this is not the case. Aviation software, despite the recent issues with the 737 MAX, is generally designed and implemented to very high level of redundancy and SPOF-avoidance.

From an airbus manual, to give you some idea:

A300-600s, A310s, A320s, A330s and A340s with GPS PRIMARY

The navigation system of these aircraft consists of 2 FMS, 3 IRS, 2 GPS and radio navaid sensors. The GPS position is primarily used for FM position updates, however if GPS PRIMARY is lost, FM reverts to radio updates or to IRS ONLY navigation when outside radio navaid coverage.

FM(S) = Flight Management (System). IRS = inertial reference system (THREE of them). If GPS is lost or malfunctioning, the FMS falls back to that - which is periodically updated by reference to RNAV ground-based radio beacons. GPS could simply switch off worldwide and aircraft would be fine, just like they were pre-GPS.

There is no conceivable reason the navigation system would especially care about the time being received from its GPS units, let alone perform some critical calculation based upon it. This article is pretty uninformed fear-mongering.

Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by bloak on Saturday March 30, 2019 @05:45AM (#19528624)
The trouble with fuses is that if a receiver is tricked by a bogus or incorrectly received signal into moving into the next (sub)epoch then you can never get it to move back, unless there's a manual override, which is an option you didn't mention: not possible in some embedded applications, perhaps, but many consumer GPS devices already force the user to answer several questions whenever the device is rebooted.

Another option is trying to guess the epoch from the TAI-UTC offset, which, of course, can't be known in advance and to some extent depends on political decisions so that's more of an "interesting" option than a good or practical one.

Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by nyc111 on Saturday March 30, 2019 @06:02AM (#19528667)
> gps geek and time-nut here.

This is off topic, but since you describe yourself as "gps geek" I thought I ask. Is it possible to gain access to the actual operational code where GPS operators correct for General Relativity? I'm not disputing GR, I just want to find out if this is a myth or true. Thanks.

Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by elfchief on Saturday March 30, 2019 @11:32AM (#19529905)
If you want this straight from the spec, grab a copy of IS-GPS-200J (it's free, just google it), look at section 3.3.1.1, which talks about the carrier frequencies of the various signals. From that:

"The carrier frequencies for the L1 and L2 signals shall be coherently derived from a common frequency source within the SV. The nominal frequency of this source -- as it appears to an observer on the ground -- is 10.23 MHz. The SV carrier frequency and clock rates -- as they would appear to an observer located in the SV -- are offset to compensate for relativistic effects. The clock rates are offset by (delta f)/f = -4.4647E-10, equivalent to a change in the P-code chipping rate of 10.23 MHz offset by (delta)f = -4.5674E-3 Hz. This is equal to 10.2299999954326 MHz. The nominal carrier frequencies (f0) shall be 1575.42 MHz, and 1227.6 MHz for L1 and L2, respectively."

In this context, "SV" is "Space Vehicle", a.k.a. a GPS satellite.

You also have to make a relativistic adjustment in the user segment (aka "your GPS"). You can see an example of doing this correction in open-source software GPS receivers, for example https://github.com/jks-prv/Beagle_SDR_GPS/blob/de895035e93ba... . This adjustment is documented in the above spec, in section 20.3.3.3.3.1 (which you'll see is almost verbatim copied into the the code linked above)

Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by nyc111 on Saturday March 30, 2019 @01:01PM (#19530474)
Great! Thanks. I'll study these.
Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by jimktrains2 on Saturday March 30, 2019 @06:22AM (#19528722)
Not op and maybe I'm misunderstanding, but the correction is part of the spec in satellite design, not something that can be kept secret[1]. The timing code that is translated into navigational data, however, is encoded and encrypted, which have some well-known keys, and that used to prevent high accuracy. My understanding is that the us government can change those to prevent GPS usage or to limit accuracy. [2]

[1] http://www.astronomy.ohio-state.edu/~pogge/Ast162/Unit5/gps....

[2] https://www.trimble.com/gps_tutorial/sub_pseudo.aspx

Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by TickleSteve on Saturday March 30, 2019 @06:46AM (#19528788)
Having worked on gps chipsets, one of the corrections that need to be applied is for relativistic effects,those calculations are happening in every GPS chipset as it needs to iterate down to a very precise position estimation of the satellites in order to produce an estimation of your position. There is no magic involved, relativity/time-dilation is not a disputed effect.

As an example, clone https://github.com/gnss-sdr/gnss-sdr and search for "relativistic correction"

Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by nyc111 on Saturday March 30, 2019 @08:41AM (#19529121)
Thanks, but I don't know how to do this. Is there a way I can see the code without cloning?
Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by sokoloff on Saturday March 30, 2019 @09:27AM (#19529285)
Go to that github URL, click on the green "Clone or Download" button and download a zip file of the code. Unzip and search away.
Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by repolfx on Saturday March 30, 2019 @03:47PM (#19531380)
Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by Rebelgecko on Saturday March 30, 2019 @01:50AM (#19528005)
It's like Daylight Savings time or Y2K. In theory, it could wreak all kinds of havoc on buggy software. However this isn't a surprise. It's a known thing that happens every 1024 weeks. I would be astounded if GPS receivers used for aviation purposes don't test for this. On the other hand, I was astounded when I heard that F-22s stopped working after flying across the international date line.

And I was slightly less asounded when the Nexus S phones spat out broken GPS NMEA sentences on leap years

Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by goodcanadian on Saturday March 30, 2019 @02:32AM (#19528115)
On the other hand, I was astounded when I heard that F-22s stopped working after flying across the international date line.

It's a pretty big oops, but they rebooted the computers, and the planes kept flying. That's the second place where these disaster predictions fall down. These systems are rarely designed with a single point of failure.

Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by Rebelgecko on Saturday March 30, 2019 @02:38AM (#19528137)
The articles I read made it sound like they continued to have nav and comm issues after rebooting, and that things could've been worse if they hadn't been able to follow their tankers home.
Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by goodcanadian on Saturday March 30, 2019 @03:08AM (#19528249)
I'll admit that I don't know the details, but I'll point out that they would not have been so far from land without tankers. If they were closer to a base or had longer range, a complete navigational failure would be far less of a problem as there are still pilots on board who know roughly where they are and what the heading is and where to find emergency airfields. They can make decisions and come up with a plan to get out of the situation. Perhaps, I'll claim that as the third error in doom predictions. When any real problems do come up, there are intelligent people working the problem.
Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by function_seven on Saturday March 30, 2019 @02:55AM (#19528214)
> On the other hand, I was astounded when I heard that F-22s stopped working after flying across the international date line.

As was I, when I learned about taking off from the Dead Sea:

https://www.avgeekery.com/challenge-flying-sea-level/

Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by dingaling on Saturday March 30, 2019 @03:54AM (#19528368)
Most curious bug!

My local airfield is at -19ft and the landed altitude reported by Mode-S varies from -25ft ( GNSS sourced ) to -275ft ( pressure based on 1013hPa ). Hence why asking for the local air pressure QFE is essential.

Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by mlaretallack on Saturday March 30, 2019 @01:51AM (#19528007)
GPS provides the time (hour, minute, seconds) and date (day, month, year) over the NMEA messages. It also provides a week counter. This wraps around at 1024. The last time was about year 1999.

With most of the things I have used NMEA for (time sync), I did not use the weeks counter. However if there is any software that does use it, it needs to be able to handle the rollover.

Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by tonyarkles on Saturday March 30, 2019 @10:02PM (#19533257)
This is where you have to dig a little deeper. Your receiver outputs the date in the NMEA messages, but the satellite doesn't actually transmit year/month/day. The satellite transmits the week number and the number of seconds that have passed since the start of the week. In your case, the receiver could potentially output incorrect dates in the NMEA output when the week number wraps around.
Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by jtolmar on Saturday March 30, 2019 @05:11AM (#19528545)
There's an edge case in the GPS spec that only comes up every 20 years. It's well-documented and everything, but it only comes up every 20 years and software is terrible, so not every GPS unit is going to handle it well. Last time this happened, GPS wasn't nearly as widely used.

I would expect some percent of phones to flip out (try force restarting, or waiting a day and restarting). Which ones are a mystery - the GPS chip in a phone isn't even consistent for a particular model.

I wouldn't expect planes to fall out of the sky. I wouldn't be surprised by flight delays though; just because the safety critical stuff is well tested doesn't mean the rest is.

And the errors aren't going to be confined to April 6th. We're talking about software bugs here, and it's dealing with a number that counts in weeks. So while bugs should center on the 6th, anything within a week of that is pretty plausible too.

(I wrote the GPS tracking algorithm used for navigation in Google Maps. Nothing above is based on Google-specific knowledge. It's still just someone's opinion.)

Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by jimktrains2 on Saturday March 30, 2019 @06:05AM (#19528674)
Why would phones use the GPS date over the cellular-provided date?
Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by jtolmar on Saturday March 30, 2019 @11:21AM (#19529847)
The GPS unit needs to figure out the locations of all the satellites before it can use them to figure out your positions. The satellite positions are expressed as a function of time, and the times used are measured in seconds within the current GPS week[1].

This is the mechanism that I'd expect someone messed up. I'd expect location errors more than time errors, but because you can get time out of GPS then someone probably has.

[1] https://gssc.esa.int/navipedia/index.php/GPS_and_Galileo_Sat...

Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by elfchief on Saturday March 30, 2019 @05:35PM (#19532024)
The week number is (somewhat) used for navigation, but the way it is used is not affected in any way by the rollover, and there's not really a way (even taking into account bugs) that not knowing what the current GPS epoch is could affect navigation. This is purely a matter of an issue with the time that's output for human consumption, the GPS functionality itself doesn't care in the least.
Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by nyc111 on Saturday March 30, 2019 @06:10AM (#19528693)
I asked the same question above but since you actually wrote GPS code I thought I ask you too. Is it possible for me to find the actual line of code operators use to correct for General Relativity? I'm curious to know if this is a myth or if it is true. Thanks.
Re:GPS Flaw: Security Expert Says He Won't Fly April 6 by TickleSteve on Saturday March 30, 2019 @06:49AM (#19528795)
answered above.... every GPS chipset does this.