For a long time, law enforcement agencies and hackers have been able to track the identity and location of mobile users by setting up fake cellular network towers and tricking their devices into connecting to them. Researchers have now found that the same can be done much more cheaply with a simple Wi-Fi hotspot.

The devices that pose as cell towers are known in the industry as IMSI catchers, with the IMSI (international mobile subscriber identity) being a unique number tied to a mobile subscriber and stored on a SIM card. IMSI catchers can be used for tracking and in some cases, for intercepting calls, but commercial solutions, such as the Stingray used by the FBI, are expensive.

Researchers Piers O'Hanlon and Ravishankar Borgaonkar from the University of Oxford's Department of Computer Science found that, for the purpose of tracking only, Wi-Fi networks can also be used to trick mobile devices into exposing their IMSI numbers.

That's due to a protocol and configuration weaknesses in mobile data offloading technologies such as automatic Wi-Fi connections and Wi-Fi calling that mobile operators are increasingly adopting to reduce costs and congestion on their cellular networks.

These technologies are supported on mobile devices running iOS, Android, Windows Mobile and Blackberry, and in some cases, profiles for automatic Wi-Fi connections are built into the operating systems themselves. Apple's iOS, for example, has more than 50 hard-coded profiles for Auto Wi-Fi from mobile operators that automatically get enabled whenever a SIM card from one of them is inserted, the researchers found.

Wi-Fi Auto Connect uses Extensible Authentication Protocol over LAN (EAPOL) with authentication methods that use the permanent IMSI number as well as temporary identities. The IMSI is typically used for the initial connection and the temporary identities for re-authentication.

However, most Wi-Fi Auto Connect implementations are configured by default in a "liberal" peer mode, where they will always respond to requests for their permanent identity -- the IMSI. This means that an attacker can set up rogue access points -- with SSIDs matching those that devices will automatically connect to -- and then simply request their IMSI for authentication.

For example, someone could set up a device that creates spoofed access points for all the Auto Wi-Fi profiles hard-coded into iOS and then grab the IMSI numbers for all nearby iPhones, O'Hanlon said Thursday during a presentation at the Black Hat Europe security conference in London.

Android requires initial manual configuration for Auto Wi-Fi after before it will automatically connect to such networks, but starting with version 6 (Marshmallow), it also provides a mechanism for privileged applications like those loaded by operators to provide carrier-specific configurations.

The researchers have notified OS makers, mobile operators, and trade group GSMA of their findings, and Apple has already added "conservative" peer support for the Auto Wi-Fi authentication in iOS 10.

In conservative peer mode, the device will only respond to requests for permanent identity when no pseudonym identity is available, so after a user has connected to an operator's legitimate Wi-Fi network once and authenticated using its IMSI, no spoofed access point will later be able to force the device to expose it.

OS makers and operators have acknowledged the problem, but there's no easy way to fix it, the researchers said. There are Extensible Authentication Protocol (EAP) authentication methods that work over Transport Layer Security and are encrypted, but they need to be supported in both mobile OSes and operators' systems. Deploying certificate-based infrastructure requires investments and is harder to maintain, they said.

Wi-Fi calling suffers from a similar problem. This technology allows users to make voice calls over Wi-Fi by connecting to the operator's Edge Packet Data Gateway (EPDG) using the encrypted IPsec protocol. This is different from voice over IP apps like WhatsApp or Skype.

Wi-Fi calling is supported on iOS and Android devices and uses the Internet Key Exchange Protocol (IKEv2) for authentication. Like Wi-Fi auto connect, the IKEv2 authentication is also based on identities like the IMSI number, which are exchanged over EAP-AKA.

EAP-AKA exchanges are encrypted, but are not protected by a certificate, which means they're exposed to man-in-the-middle attacks that could recover the IMSI number, the researchers said.

The good news is that Wi-Fi calling can be disabled on the device by the user, while Auto Wi-Fi can only be disabled when such a network is in range.

Leaking IMSI numbers is a privacy concern because there are services on the Internet that allow matching them to phone numbers, and finding the identity of a phone number's owner is not hard.

In general, IMSI numbers can be used to track and identify who has been in a certain place at a certain time. For example, authorities in a country where freedom of speech is not well respected could use them to identify participants of an unauthorized protest.