Bypassing T-Mobile User Agent Tether Filtering

I showed up at my university to discover, to my dismay, that the building I’m in this year doesn’t have a university LAN connection yet and the unionized university employees had left for the long weekend.

Thankfully, I have a T-Mobile sim with 5 Gigabytes of 4G data! But wait, after a few hours of use I was redirected:

The T-Mobile "buy this package to use the data we already sold you" screen
The T-Mobile “buy this package to use the data we already sold you” screen

So naturally, I said WTF and proceeded to my friendly neighborhood forum and confirmed that T-Mobile filters on User Agent Strings.

For those who aren’t aware, a User Agent String is sent by the web browser to the web server when it requests a page within the request header. The string is most commonly used in modern days to discern whether the server should feed it the mobile or desktop version of a website (hence the “request desktop version” button on mobile Chrome).

A neat trick I learned is to use netcat to print the request from a browser. Type “nc -l 8080” below into your bash shell with netcat and then type “localhost:8080/nickis/realcool” into your browser and watch what happens:

Nicholass-Awesome-MacBook-Air:~ nandre$ nc -l 8080
GET /nickswebsite/yay HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8

That was the original desktop user agent string provided by Chrome on my Macbook Air. Now, after install a User Agent String modifier:

GET /nickswebsite/yay HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8

Oh look! An android tablet has requested something! T-Mobile 0, Nick 1.

EDIT: I should note that any TCP protocol without a user agent string will not be affected by filtering. This means that SOCKS + SSH tunneling works just fine 🙂

One thought on “Bypassing T-Mobile User Agent Tether Filtering”

Leave a Reply