Gaming Foursquare With 9 Lines of Perl 84
caffeinemessiah writes "With the recent launch of Facebook Places, the rise to prominence of Foursquare and GoWalla, and articles in the New York Times about the increasing popularity of 'checking in' to locations using GPS-enabled mobile phones, a number of businesses are wondering how to reward frequent patrons. But exactly how susceptible are these 'location based services' to being abused? A researcher at the University of Illinois at Chicago shows how easily Foursquare can be gamed in 9 Perl statements, and invites readers to submit more succinct versions of the code to game the system."
An anonymous reader contributes a link to a similar article about spoofing Facebook Places to create an alibi.
SPHREAKING (Score:5, Interesting)
I am happy that this is taking off. It's the only way we can fight back against data hoarders.
I propose SOCIAL PHREAKING: We need a P2P client that pretends to be a user of a social network: twitter, facebook, linked in, whatever. The software will login periodically (each client does it at a different rate, in fact, they negotiate.)
The idea is, the various fake accounts form relationships with one another. Every now and then they create a new account and share passwords where they login and 'appear to login' to be from a different location. The growth should be such that it is not suspicious and not an abuse of service. It would make more sense for every node to have only 1 or 2 accounts at most, to simulate families with accounts per family member.
With enough privacy advocates on the phreaknet should be able to generate enough traffic and data to distort the demographics at least slightly. We could make poison the data hoarders to make them think that everyone loves a certain brand of ice cream and then it would become more popular.
We can restore the tip of knowledge and power to ourselves.
Re:SPHREAKING (Score:4, Funny)
I'd like to subscribe to your mailing list.
Re: (Score:1)
Re: (Score:2)
Huh. How about that.
Re: (Score:3, Interesting)
A very interesting idea, but I think spam shows us that whoever actually developed and implemented such systems would most likely use them to intentionally skew the data towards something they could profit from, rather than adding noise to degrade the data.
How much of your spam is not related to making money off you?
I imagine this massive and convincing network of fake people would suddenly discover that they all love Axe body spray...
Re: (Score:2)
Spammers already do this, searched twitter lately?
Luckily (Score:1)
Foursquare isn't useful for anything important.
Re:Luckily (Score:5, Informative)
Re: (Score:2)
Re: (Score:2)
and guys who want to take out a hit on the burglars!
It all sort of balances out.
Re: (Score:2)
Or stealing from hit-men. They'd have the cool toys...
Re: (Score:2)
Re: (Score:2)
See the key point is not that you are away, it's how far away and for how long.
Re: (Score:2)
Re: (Score:2)
Foursquare isn't useful for anything important.
Clearly it functions well as the target of Perl scripts and being the butt of /. jokes. Hmm, I see you point.
Julian Assange... (Score:5, Funny)
How long before Julian Assange is proven (through his Facebook account) to have been at a McDonald's in Seattle when the alleged assault took place?
Warrant has been cancelled (Score:2)
Re: (Score:2)
Re: (Score:2)
A better question is, how long will it take before some random (relative) nobody is prosecuted for a crime based on their facebook 'location' ?
Of course it's easy (Score:2)
I think it was obvious to many from the start that it could be gamed, but most of those same people aren't interested in gaming it.
Re: (Score:2)
Or, for that matter, to prevent others from faking your GPS coordinates? If you opt out of providing your real location, where is your data to prove you WEREN'T at the scene of the crime when someone presents "data" that says you WERE there? Interesting conundrum...
Re: (Score:2)
Re: (Score:2)
I submit Exhibit A [blogspot.com], showing that Foursquare and Gowalla (at least... who knows how many other apps) send usernames and passwords in plaintext.
no need for srand; (Score:5, Informative)
So there is a wasted line right there. This whole thing is quite silly, though. perlgolf can be a lot more challenging and fun than making a simple http post.
Re: (Score:1)
This is not true of the Microsoft-based rand() function though. If you don't seed before you call rand() it will ALWAYS return 42 as the first random number(gee, I wonder if that's a joke), and the subsequent sequence of numbers are also always the same. I always call it to be sure, because what's a few clock cycles to make certain you're truly randomizing?
Re: (Score:3, Informative)
Re: (Score:1)
I thought the same thing, until I ran across a situation in ruby's Passenger, where they were initializing the srand with time or something similar, but of course all the servers were restarted at the same time. This then caused my UUID's to collide in another library because we had removed a 'superflous' srand in our code that was masking the problem.
Just saying you don't always know what the code that isn't yours is doing, so it is probably a good idea to assume it isn't done and do it explicitly.
Re: (Score:1)
In this case, read Perl's documentation for rand().
Re: (Score:1)
Yes, in this specific case of 9 lines of code that aren't doing anything with many outside libraries, etc., it may be possible to read the documentation, and assuming the documentation is correct, rely on the default behavior. That is very rarely the case however.
However when I have come across a particular problem that is resolved by being thorough, and ensuring things are initialized, my tendency is to remember that and keep doing it in the future, which is the case for srand/rand.
Just sharing my story.
Re: (Score:2)
9 lines of Perl? (Score:2)
How long before someone gets it down to five lines?
Re: (Score:2)
Ummm... already done [slashdot.org]. Do I get a cookie?
Re: (Score:2)
Do I get a cookie?
No.
Easy golf: round one (Score:5, Interesting)
#!/usr/bin/perl -W
use IO::Socket;
srand;
sleep(rand()*600);
my $sock = IO::Socket::INET->new(PeerAddr=>'api.foursquare.com', PeerPort=>80,
Proto =>'tcp', Type=>SOCK_STREAM) or die;
$ARGV[1] += rand() * 0.0001 - 0.00005;
$ARGV[2] += rand() * 0.0001 - 0.00005;
my $str = "vid=$ARGV[0]&private=0&geolat=$ARGV[1]&geolong=$ARGV[2]";
print $sock "POST
length($str)+2, "\r\n\r\n$str\r\n";
$_=;
The author didn't really even try, so it'll be easy to shorten it. Shortening it a lot is left as further exercise. I'll just get rid of some low-hanging fruit. I'm sure Perlmonks [perlmonks.org] will pick up the challenge if they haven't already.
#!/usr/bin/perl -W
use IO::Socket;
sleep(rand()*600);
my $sock = IO::Socket::INET->new(PeerAddr=>'api.foursquare.com', PeerPort=>80,
Proto =>'tcp', Type=>SOCK_STREAM) or die;
my $str = "vid=$ARGV[0]&private=0&geolat=" . ($ARGV[1] += rand() * 0.0001 - 0.00005)
. "&geolong=" . ($ARGV[2] += rand() * 0.0001 - 0.00005);
print $sock "POST
. " Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ "
length($str)+2, "\r\n\r\n$str\r\n";
Five logical lines. Actual display lines may of course be different depending upon several factors like attempting to break long lines for viewing and the vagaries of the textual mangling on Slashdot.
Re:Easy golf: round one (Score:4, Funny)
So now you can tell Foursquare to go away as I've replaced you with a small perl script?
to make it portable use \015\012 instead of \r\n (Score:2, Informative)
cause \r\n isn't \015\012 on every platform
Re: (Score:2)
Re: (Score:1)
What is foursquare? - The missing description. (Score:4, Informative)
Re: (Score:2)
Re: (Score:2)
Re:What is foursquare? - The missing description. (Score:5, Funny)
There's this other application on mobile phones that lets people selectively contact those they want at a particular moment and communicate arbitrary information including that and a bunch more via simultaneous two-way voice.
Re: (Score:2)
Well, for one thing, there's this feature called group calling. For another, there is probably a many-to-many over IP voice chat application for your phone if you look hard enough.
And finally... WOOSH!
This is why... (Score:2)
...we can't have nice things.
Yeah, foursquare is a cute little idea, but if people don't play nicely it'll suck. And with current GPS and locational technologies, it'll always be open to abuse.
Also, I reckon this is how Agent Smith managed to appear a zillion times in the same location.
Re: (Score:2)
Re: (Score:2)
Unfortunately, aside from being "cute" for a beer or something, it could conceivably be used as evidence to show that you were in a certain place at a certain time. Exploits like these have to become pretty common before we can be reasonably sure a court will throw out the "evidence" that I checked in at the scene of the crime...
Chris Gates did some research on this (Score:1)
Faking geolocation in Firefox (Score:3, Informative)
Re: (Score:1, Informative)
Apparently I was the first person on Facebook to check in at the NSA headquarters.
Re: (Score:1, Funny)
We're sorry, you have spelled Firefox correctly in your Slashdot post. Here at Slashdot, you are supposed to pretend to be all about "teh open sourcez" but spell the names of the all popular F/OSS apps like a retard. Some accepted misspellings are: FireFox, Fire-Fox, Fire Fox, Foxfire, FireFOX, and Mozilla. If you choose the last option, please remember to be consistent and refer to all Adobe Acrobat apps as simply "Adobe."
Thanks!
The Management
Great idea. (Score:1, Insightful)
> NOTE: To get this script to work, you must replace XXXXXX with the Base64
> encoded version of "email/phone:password", so base64("john@doe.com:mypassword").
> Here's Google's top ranked site for online Base64 encoding.
Yeah, what should go wrong by running your email/password-combo through a server-side Base64 encoder.
Re: (Score:2)
The same thing that could go wrong by sending it in Base64 in the first place? It's an encoding, not encryption. Oh, and there are already Perl modules to do Base64 encoding, but I guess importing another module and calling it for something you can calculate once would have just ballooned his line count a whole two lines.
So wait... (Score:5, Insightful)
Did any body else catch that the Foursquare API has you sending your username and password in the clear?
Please tell me you can do all this on port 443 and that your phone is using SSL.
That said, I love it!
Re:So wait... (Score:4, Informative)
Re: (Score:2)
Web 1.0 defeats Web 2.0! (Score:1)
It has been shown many times and it has been shown again: Web 1.0, with all of the glorious unreadable Perl stuff, neatly and cleanly defeats all this Ruby on Rails, gradients-and-rounded-corners, Twitter-compatible, "beta" Web 2.0 nonsense!
...or maybe Web 2.0 people should stop designing RESTful asynchronous JavaScript-compatible social-media APIs that are too easily abused. It's not that hard!
(This was supposed to be a humorous post, but it's not really working today, is it?)
Re: (Score:2)
It has been shown many times and it has been shown again: Web 1.0, with all of the glorious unreadable Perl stuff, neatly and cleanly defeats all this Ruby on Rails, gradients-and-rounded-corners, Twitter-compatible, "beta" Web 2.0 nonsense!
I can write that script much quicker and cleaner in Ruby. In nine lines, I might even be able to tweet the results, just to annoy you...
...or maybe Web 2.0 people should stop designing RESTful asynchronous JavaScript-compatible social-media APIs that are too easily abused. It's not that hard!
Agreed. It's actually quite easy to create a RESTFUL AJAX-compatible social-media API which isn't so easily abused.
(This was supposed to be a humorous post, but it's not really working today, is it?)
Nope.
9 lines of perl? (Score:1, Informative)
You can do that with 1 line of shell + wget/curl
spoofing the phone's internal GPS (Score:1)
Hire a "hacker" (Score:1)
Foursquare iPhone app sends password in plain text (Score:2)
You can see the Wireshark screenshot at my : blog post [blogspot.com].
I'm removing the Foursquare app from my iPhone now. It's way too dangerous.
$ARGV[0] (Score:2)
Re: (Score:2)
"Must accept a venue ID and base GPS coordinates as command line input."
$ARGV[0] is the venue ID
Gaming places (Score:2)
You don't need a proxy or perl to game facebook places... you can do it by changing one line in your about:config and hard code "geo.wifi.uri"
I wrote up a full tutorial [blogspot.com] on my blog for those who are interested.