How to Cheat at Foursquare

by therippa

In the last couple of months, I've noticed a new trend popping up on my Facebook newsfeed: friends checking into places using Foursquare.

Foursquare is a service that allows you to let the world know what restaurant you've been to, what gas station you've filled up at, and what bar you've been frequenting.  Each local business has its own page letting you know who's been there, with a special "Mayor" designation for the person who has checked-in there more than anyone else.

Frequenting a location multiple times sometimes gives that person special benefits: a free item, preferred seating, etc.  Recently, a friend of mine made it his mission to become the Mayor of his favorite cafe, obsessing over it like the high score of an old arcade game.  After a month or two of eating there a few times a week, he earned the Mayor badge on his Foursquare page.

Now, personally, I find Foursquare to be the same sort of overshare/masturbatory experience that Twitter has become.  I have no interest in demanding that people pay attention to the insignificant details of my daily life.  But, after hearing how upset he got when he temporarily lost his Mayor status, I saw an opportunity for a little mischief.

I was to become mayor of his cafe, without ever stepping foot in there.

How Check-Ins Work

When you check-in to a place on Foursquare, it is typically done through an application on your phone.

Previously, the applications were not location-aware, so you could say you were eating somewhere when in fact you were across town.  This caused cheating problems on the service, and the process was changed so that only check-ins including your GPS location would technically add to the running tally you keep.  You could still check into an establishment without your location, but it wouldn't count towards your one day becoming the Mayor or receiving any other random badges.

My first thought was to find a GPS location spoofing app for my jailbroken iPhone.  I found one and it worked well, allowing me to fake the location and check-in.  The downfall, however, was the 10-day trial limit on the app, and the fact that I had a new Android phone being delivered that didn't have an application with these capabilities.

After some searching around, I found a Firefox extension named Foursquarefox (foursquarefox_v1_2.xpi) that allowed check-ins over the web.

I downloaded and installed it, provided my Foursquare login, and it found my location to within three houses of where I live.  After poking around in the source code of the extension, I learned that it was using Google's Geolocation API to determine where I was.

This API cleverly uses your IP address and a list of nearby Wi-Fi beacons (provided by Firefox) to approximate your location.  It returns a JSON string containing your location data, and I knew it would be a cinch to spoof.

After about a half-hour of debugging and tweaking, I had modified the extension to include input boxes that allowed me to enter my latitude and longitude, overriding what was supplied by Google's Geolocation.  By doing this, I could check-in to any place I wanted and Foursquare would think I was physically there.

Method

1.)  Make sure you are running Firefox 3.5 or greater.  Previous version do not support Location-Aware browsing.

2.)  Google search for Foursquarefox and install the extension.  Restart Firefox and enter your Foursquare account information into it.

3.)  Close Firefox, and browse to your extensions folder.  On Windows, this can be found in: %APPDATA%\Mozilla\Firefox\Profiles\<profile name>\extensions

4.)  There should be a folder named {8D8755DA-0541-4E4C-818A-99188622BA02}, open this and then open the chrome folder.

5.)  In this folder will be a file called foursquarefox.jar.  Even though the file's extension is .JAR, it is a ZIP file.  Extract all of its contents to a temporary directory.

6.)  Once you have your JAR file expanded, open the file foursquarefox.xul.  This is the file that defines the user interface of the extension.

Look for a line that says <toolbaritem id="fsfxlogin"> and add this chunk of code directly below it:

<bbox>
  <checkbox id="fsfx-toolbar-custom-checkbox" label="Use Custom Location" />
  <label value="Latitude:"/>
  <textbox id="fsfx-toolbar-custom-lat" width="60px" />
  <label value="Longitude:"/>
  <textbox id="fsfx-toolbar-custom-long" width="60px" />
</bbox>

This will create new elements on the extension toolbar that allow you to enter your custom location.

7.)  Open the file /com/chrisfinke/geolocation.js, find the line that says var json = JSON.parse(req.responseText); and this chunk of code directly below it:

if (document.getElementById("fsfx-toolbar-custom-checkbox").checked) {
  json.location.latitude = document.getElementById("fsfx-toolbar-custom-lat").value;
  json.location.longitude = document.getElementById("fsfx-toolbar-custom-long").value;
  json.location.address.street_number = "Custom";
  json.location.address.street = "Location";
  json.location.address.city = "Lat/Long";

This code tells the geolocation wrapper that if you checked the checkbox, to ignore the data returned from Google and use the data you entered instead.

8.)  Using your favorite ZIP utility, ZIP all the contents back together (making sure to preserve the directory structure) and name the file foursquarefox.jar.

9.)  Replace the old JAR file with the new one you just created.

If you did this all correctly, when you re-open Firefox the Foursquarefox bar should now have your checkbox and input fields.

You now have the ability to check-in to anywhere from anywhere; all you have to do is use a latitude/longitude map to find the coordinates of where you'd like to be, enter them into the text fields, check the box, and refresh your location.

When you click to check-in, you will be presented a list of locations within that proximity.

Enjoy!

Return to $2600 Index