Saturday, March 29, 2014

Snoopy: Distributed Tracking and Profiling Framework

Snoopy is a distributed tracking and profiling framework to perform some pretty interesting tracking and profiling of mobile users through the use of WiFi. The talk was well received (going on what people said afterwards) by those attending the conference and it was great to see so many others as excited about this as we have been.

In addition to the research, we both took a different approach to the presentation itself. A 'no bullet points' approach was decided upon, so the slides themselves won't be that revealing. Using Steve Jobs as our inspiration, we wanted to bring back the fun to technical conferences, and our presentation hopefully represented that. As I type this, I have been reliably informed that the DVD, and subsequent videos of the talk, is being mastered and will be ready shortly. Once we have it, we will update this blog post. In the meantime, below is a description of the project.
Background
There have been recent initiatives from numerous governments to legalise the monitoring of citizens' Internet based communications (web sites visited, emails, social media) under the guise of anti-terrorism. Several private organisations have developed technologies claiming to facilitate the analysis of collected data with the goal of identifying undesirable activities. Whether such technologies are used to identify such activities, or rather to profile all citizens, is open to debate. Budgets, technical resources, and PhD level staff are plentiful in this sphere.
Snoopy
The above inspired the goal of the Snoopy project: with the limited time and resources of a few technical minds could we create our own distributed tracking and data interception framework with functionality for simple analysis of collected data? Rather than terrorist-hunting, we would perform simple tracking and real-time + historical profiling of devices and the people who own them. It is perhaps worth mentioning at this point that Snoopy is compromised of various existing technologies combined into one distributed framework.
"Snoopy is a distributed tracking and profiling framework."
Below is a diagram of the Snoopy architecture, which I'll elaborate on:



Snoopy runs client side code on any Linux device that has support for wireless monitor mode / packet injection. We call these "drones" due to their optimal nature of being small, inconspicuous, and disposable. Examples of drones we used include the Nokia N900Alfa R36 routerSheeva plug, and the RaspberryPi. Numerous drones can be deployed over an area (say 50 all over London) and each device will upload its data to a central server.

2. WiFi?

A large number of people leave their WiFi on. Even security savvy folk; for example at BlackHat I observed >5,000 devices with their WiFi on. As per the RFC documentation (i.e. not down to individual vendors) client devices send out 'probe requests' looking for networks that the devices have previously connected to (and the user chose to save). The reason for this appears to be two fold; (i) to find hidden APs (not broadcasting beacons) and (ii) to aid quick transition when moving between APs with the same name (e.g. if you have 50 APs in your organisation with the same name). Fire up a terminal and bang out this command to see these probe requests:
tshark -n -i mon0 subtype probereq
(where mon0 is your wireless device, in monitor mode)

2. Tracking?
Each Snoopy drone collects every observed probe-request, and uploads it to a central server (timestamp, client MAC, SSID, GPS coordinates, and signal strength). On the server side client observations are grouped into 'proximity sessions' - i.e device 00:11:22:33:44:55 was sending probes from 11:15 until 11:45, and therefore we can infer was within proximity to that particular drone during that time.
We now know that this device (and therefore its human) were at a certain location at a certain time. Given enough monitoring stations running over enough time, we can track devices/humans based on this information.
3. Passive Profiling?
We can profile device owners via the network SSIDs in the captured probe requests. This can be done in two ways; simple analysis, and geo-locating.
Simple analysis could be along the lines of "Hmm, you've previously connected to hooters, mcdonalds_wifi, and elCheapoAirlines_wifi - you must be an average Joe" vs "Hmm, you've previously connected to "BA_firstclass, ExpensiveResataurant_wifi, etc - you must be a high roller".
Of more interest, we can potentially geo-locate network SSIDs to GPS coordinates via services like Wigle (whose database is populated via wardriving), and then from GPS coordinates to street address and street view photographs via Google. What's interesting here is that as security folk we've been telling users for years that picking unique SSIDs when using WPA[2] is a "good thing" because the SSID is used as a salt. A side-effect of this is that geo-locating your unique networks becomes much easier. Also, we can typically instantly tell where you work and where you live based on the network name (e.g BTBusinessHub-AB12 vs BTHomeHub-FG12).
The result - you walk past a drone, and I get a street view photograph of where you live, work and play.
4. Rogue Access Points, Data Interception, MITM attacks?

Snoopy drones have the ability to bring up rogue access points. That is to say, if your device is probing for "Starbucks", we'll pretend to be Starbucks, and your device will connect. This is not new, and dates back to Karma in 2005. The attack may have been ahead of its time, due to the far fewer number of wireless devices. Given that every man and his dog now has a WiFi enabled smartphone the attack is much more relevant.
Snoopy differentiates itself with its rogue access points in the way data is routed. Your typicalPineappleSilica, or various other products store all intercepted data locally, and mangles data locally too. Snoopy drones route all traffic via an OpenVPN connection to a central server. This has several implications:
(i) We can observe traffic from all drones in the field at one point on the server. (ii) Any traffic manipulation needs only be done on the server, and not once per drone. (iii) Since each Drone hands out its own DHCP range, when observing network traffic on the server we see the source IP address of the connected clients (resulting in a unique mapping of MAC <-> IP <-> network traffic). (iv) Due to the nature of the connection, the server can directly access the client devices. We could therefore run nmap, Metasploit, etc directly from the server, targeting the client devices. This is a much more desirable approach as compared to running such 'heavy' software on the Drone (like the Pineapple, pr Pwnphone/plug would). (v) Due to the Drone not storing data or malicious tools locally, there is little harm if the device is stolen, or captured by an adversary.
On the Snoopy server, the following is deployed with respect to web traffic:
(i) Transparent Squid server - logs IP, websites, domains, and cookies to a database (ii) sslstrip - transparently hijacks HTTP traffic and prevent http upgrade by watching for http links and redirecting. It then maps those links into either look-alike HTTP links or homograph-similar http links. All credentials are logged to the database (thanks Ian & Junaid). (iii) mitmproxy.py - allows for arbitary code injection, as well as the use of self-signed SSL certificates. By default we inject some JavaScipt which profiles the browser to discern the browser version, what plugins are installed, etc (thanks Willem).
Additionally, a traffic analysis component extracts and reassembles files. e.g. PDFs, VOiP calls, etc. (thanks Ian).
5. Higher Level Profiling?

Given that we can intercept network traffic (and have clients' cookies/credentials/browsing habbits/etc) we can extract useful information via social media APIs. For example, we could retrieve all Facebook friends, or Twitter followers.

6. Data Visualization and Exploration?

Snoopy has two interfaces on the server; a web interface (thanks Walter), and Maltego transforms.
-The Web Interface The web interface allows basic data exploration, as well as mapping. The mapping part is the most interesting - it displays the position of Snoopy Drones (and client devices within proximity) over time. This is depicted below:



 -Maltego Maltego Radium has recently been released; and it is one awesome piece of kit for data exploration and visualisation.What's great about the Radium release is that you can combine multiple transforms together into 'machines'. A few example transformations were created, to demonstrate:
  1. Devices Observed at both 44Con and BlackHat Vegas Here we depict devices that were observed at both 44Con and BlackHat Las Vegas, as well as the SSIDs they probed for. 
2. Devices at 44Con, pruned Here we look at all devices and the SSIDs they probed for at 44Con. The pruning consisted of removing all SSIDs that only one client was looking for, or those for which more than 20 were probing for. This could reveal 'relationship' SSIDs. For example, if several people from the same company were attending- they could all be looking for their work SSID. In this case, we noticed the '44Con crew' network being quite popular. To further illustrate Snoopy we 'targeted' these poor chaps- figuring out where they live, as well as their Facebook friends (pulled from intercepted network traffic*). 




Snoopy Field Experiment

We collected broadcast probe requests to create two main datasets. I collected data at BlackHat Vegas, and four of us sat in various London underground stations with Snoopy drones running for 2 hours. Furthermore, I sat at King's Cross station for 13 hours (!?) collecting data. Of course it may have made more sense to just deploy an unattended Sheeva plug, or hide a device with a large battery pack - but that could've resulted in trouble with the law (if spotted on CCTV). I present several graphs depicting the outcome from these trials:
The pi chart below depicts the proportion of observed devices per vendor, from the total sample of 77,498 devices. It is interesting to see Apple's dominance. pi_chart
The barchart below depicts the average number of broadcast SSIDs from a random sample of 100 devices per vendor (standard deviation bards need to be added - it was quite a spread). 

The barchart below depicts my day sitting at King's Cross station. The horizontal axis depicts chunks of time per hour, and the vertical access number of unique device observations. We clearly see the rush hours.


Potential Use

What could be done with Snoopy? There are likely legal, borderline, and illegal activities. Such is the case with any technology.
Legal -Collecting anonymized statistics on thoroughfare. For example, Transport for London could deploy these devices at every London underground to get statistics on peak human traffic. This would allow them to deploy more staff, or open more pathways, etc. Such data over the period of months and years would likely be of use for future planning. -Penetration testers targeting clients to demonstrate the WiFi threat.
Borderline -This type of technology could likely appeal to advertisers. For example, a reseller of a certain brand of jeans may note that persons who prefer certain technologies (e.g. Apple) frequent certain locations. -Companies could deploy Drones in one of each of their establishments (supermarkets, nightclubs, etc) to monitor user preference. E.g. a observing a migration of customers from one establishment to another after the deployment of certain incentives (e.g. promotions, new layout). -Imagine the Government deploying hundreds of Drones all over a city, and then having field agents with mobile Drones in their pockets. This could be a novel way to track down or follow criminals. The other side of the coin of course being that they track all of us...
Illegal -Let's pretend we want to target David Beckham. We could attend several public events at which David is attending (Drone in pocket), ensuring we are within reasonable proximity to him. We would then look for overlap of commonly observed devices over time at all of these functions. Once we get down to one device observed via this intersection, we could assume the device belongs to David. Perhaps at this point we could bring up a rogue access point that only targets his device, and proceed maliciously from there. Or just satisfy ourselves by geolocating places he frequents. -Botnet infections, malware distribution. That doesn't sound very nice. Snoopy drones could be used to infect users' devices, either by injection malicious web traffic, or firing exploits from the Snoopy server at devices. -Unsolicited advertising. Imagine browsing the web, and an unscrupulous 3rd party injects viagra adverts at the top of every visited page?

Similar tools

Immunity's Stalker and Silica Hubert's iSniff GPS

Snoopy in the Press

FAQ

Q. But I use WPA2 at home, you can't hack me! A. True - if I pretend to be a WPA[2] network association it will fail. However, I bet your device is probing for at least one open network, and when I pretend to be that one I'll get you.
Q. I use Apple/Android/Foobar - I'm safe! A. This attack is not dependent on device/manufacture. It's a function of the WiFi specification. The vast majority of observed devices were in fact Apple (>75%).
Q. How can I protect myself? A. Turn off your WiFi when you l leave home/work. Be cautions about using it in public places too - especially on open networks (like Starbucks). A. On Android and on your desktop/laptop you can selectively remove SSIDs from your saved list. As for iPhones there doesn't seem to be option - please correct me if I'm wrong? A. It'd be great to write an application for iPhone/Android that turns off probe-requests, and will only send them if a beacon from a known network name is received.
Q. Your research is dated and has been done before! A. Some of the individual components, perhaps. Having them strung together in our distributed configuration is new (AFAIK). Also, some original ideas where unfortunately published first; as often happens with these things.
Q. But I turn off WiFi, you'll never get me! A. It was interesting to note how many people actually leave WiFi on. e.g. 30,000 people at a single London station during one day. WiFi is only one avenue of attack, look out for the next release using Bluetooth, GSM, NFC, etc :P
Q. You're doing illegal things and you're going to jail! A. As mentioned earlier, the broadcast nature of probe-requests means no laws (in the UK) are being broken. Furthermore, I spoke to a BT Engineer at 44Con, and he told me that there's no copyright on SSID names - i.e. there's nothing illegal about pretending to be "BTOpenzone" or "SkyHome-AFA1". However, I suspect at the point where you start monitoring/modifying network traffic you may get in trouble. Interesting to note that in the USA a judge ruled that data interception on an open network is not illegal.
Q. But I run iOS 5/6 and they say this is fixed!! A. Mark Wuergler of Immunity, Inc did find a flaw whereby iOS devices leaked info about the last 3 networks they had connected to. The BSSID was included in ARP requests, which meant anyone sniffing the traffic originating from that device would be privy to the addresses. Snoopy only looks at broadcast SSIDs at this stage - and so this fix is unrelated. We haven't done any tests with the latest iOS, but will update the blog when we have done so.

Source : sensepost.com 

Friday, March 21, 2014

The Unix Tip of the Day - Running Commands remotely using ssh

Today we will create a small script that will allow us to run one or more commands on multiply Unix/Linux servers ..

List of Commands / Tools :

SSH :    (SSH client) is a program for logging into a remote machine and
for executing commands on a remote machine.  It is intended to replac
rlogin and rsh, and provide secure encrypted communications between
two untrusted hosts over an insecure network.  X11 connections and  
arbitrary TCP ports can also be forwarded over the secure channel.  

CAT :    cat reads each file in sequence and writes it on the standard output.

FOR :    for will allow us to run in loop until the end of input .

ECHO :  echo writes its arguments separated by blanks and terminated by a
new-line on the standard output

VI :   it's just a text editor

CHMOD :  The chmod command changes the permissions of one or more files
according to the value of symbolic_mode_list or numeric_mode



and the script :

#!/bin/ksh
for u in `cat "$1"`; do
echo "########################################"
echo "             working on $u"
echo "########################################"
ssh $u "$2"
done


save this script in a file , and give it run permissions :

1.  vi Run_My_Commands.sh

      a. click "i" , to start input mode .
     
      b. bust the script .

2.  chmod +x Run_My_Commands.sh


3. and that is it you can run the script like the following : " ./Run_My_Commands.sh  "


the script will get 2 argoments , the first one is a file contain list of users@hosts , and the second argument will be the commands the we willing to run ..

here is an example of the run :


the file_list of users :


the command run :   and here what i run :   ./Run_My_Commands.sh users.txt "ps -efl;bdf .;ls -lrt"



running this will give you the run of the commands :

a.  ps -efl
b.  bdf .
c.  ls -lrt

on all the users in the users.txt fiel .



Thursday, March 20, 2014

The Unix Tip of the Day

Hi ALL

it's Been  long time since last unix/linux tips , so today we will learn to use ps / grep / awk / xargs / kill in one long command .. .

ps :    prints information about selected processes. Use options to specify which processes to select and what information to print about them .

grep :  The grep command searches the input text files (standard input
default) for lines matching a pattern.  Normally, each line found is
copied to the standard output.  grep supports the Basic Regular
Expression syntax (see regexp(5)).  The -E option (egrep) supports
Extended Regular Expression (ERE) syntax (see regexp(5)).  The -F
option (fgrep) searches for fixed strings using the fast Boyer-Moore
string searching algorithm.  The -E and -F options treat newlines
embedded in the pattern as alternation characters.  A null expression
or string matches every line.

awk :   awk scans each input file for lines that match any of a set of
patterns specified literally in program or in one or more files
specified as -f progfile.  With each pattern there can be an
associated action that is to be performed when a line in a file
matches the pattern.  Each line is matched against the pattern portion
of every pattern-action statement, and the associated action is
performed for each matched pattern.  The file name - means the
standard input.  Any file of the form var=value is treated as an
assignment, not a filename.  An assignment is evaluated at the time it
would have been opened if it were a filename, unless the -v option is
used.

An input line is made up of fields separated by white space, or by
regular expression FS.  The fields are denoted $1, $2, ...; $0 refers
to the entire line.

xargs :   xargs combines the fixed initial-arguments with arguments read from
standard input to execute the specified command one or more times.
The number of arguments read for each command invocation and the
manner in which they are combined are determined by the options
specified.

kill :   The kill command sends a signal to each process specified by a pid
process identifier.  The default signal is SIGTERM, which normally
terminates processes that do not trap or ignore the signal.


now , it's time to run some examples :

>ps    # that is what we have running on the Back Ground ..


>ps | grep sleep    # here we filter from the general output the rows with the word sleep



>ps | grep sleep | awk '{print $2}'      # here we cut the second string form every row , which is the PID



> ps | grep sleep | awk '{print $2}' | xargs -i kill -9 {}   # here we kill the process we filtered on by one by using xargs and the stoping the process with signal 9 by using kill .



and here is the final status :





Monday, March 17, 2014

EU law to require that all cellphones charge through a common standard


The EU successfully pushed for voluntary adoption of a cellphone charging standard a few years ago, and it's now close to making that standard mandatory. The European Parliament has voted in favor of a draft law requiring that cellphones work with a common charger. Provided the Council of Ministers green lights the regulation, EU countries will have until 2016 to put it into their local laws; phone makers will have until 2017 to change their hardware. The charger requirement is a formality when many phone designers already support the concept, but it could force some companies to shape up -- and spare more Europeans from tossing out power adapters when they switch handsets.

Samsung's new smartphone case uses ultrasound to detect people and objects

Samsung's Galaxy S5 may be getting lots of smart new accessories, but the Korean smartphone maker is also making sure its lower-powered phones get some love too. After including various software usability functions in the Galaxy Core Advance at the end of last year, the company today introduced three new accessories that have been designed specifically to help disabled or visually impaired users do more with their Android device. First up is the Optical Scan Stand, a raised bracket that automatically triggers the phone's OCR features to recognize and read aloud text placed in front of the phone. There's also Voice Labels, which are similar to Samsung's NFC-equipped TechTile stickers, but let visually impaired users make voice notes or record short explanations on how to use various devices around the home.
Perhaps the most impressive accessory of the three is Samsung's Ultrasonic Cover: a specialized case that uses sound waves to detect people or objects (in a two-meter radius), helping users navigate new surroundings by sending vibration or spoken alerts. Even without the accessories, the Galaxy Advance Core features a trio of physical buttons on the front and dedicated camera and voice recorder buttons on the side, assisting smartphone owners that don't want to rely solely on on-screen controls.

Wednesday, March 12, 2014

Raspberry Pi gets its own sound card and more ..

When UK Prime Minister David Cameron gave a speech at CeBIT this year, what examples did he use to highlight tech innovation in Britain? Yes, ARM and Imagination were on his list, but he also referred to the tiny, Linux-based computer called Raspberry Pi, which has now sold over 2.5 million units. In a timely fashion, the Pi's makers, element 14, have just announced a new $33,Wolfson-powered audio card that should give the device a broader range of functions.
The add-on board fits right onto the Pi's P5 pins and carries a Wolfson audio processor that supports high-res audio up to 24-bit / 192KHz, which can be played via a direct connection to an amp over 3.5mm line-out or alternatively via a digital S/PDIF output. Audio recording, meanwhile, comes courtesy of two onboard MEMS mics (useful for things like voice control), a 3.5mm mic jack and a digital S/PDIF input. It's true that some of these audio capabilities have already been possible on the Pi through USB peripherals such as DACs, but the Wolfson Audio Card gets into the DIY spirit of things with a $33 price tag and an emphasis on experimentation and community support. Speaking of which, some Pi owners have already gotten their hands on the board prior to today's global release

Sunday, March 9, 2014

Want An RFID Chip Implanted Into Your Hand? Here's What The DIY Surgery Looks Like (Video)



Amal Graafstra snaps on a pair of black rubber gloves. “Do you want to talk about pain management techniques?” he asks. The bearded systems administrator across the table, who requested I call him “Andrew,” has paid Grafstra $30 to have a radio-frequency identification (RFID) chip injected into the space between his thumb and pointer finger, and as Graafstra describes Lamaze-type breathing methods, Andrew looks remarkably untroubled, in spite of the intimidatingly high-gauge syringe sitting on the table between them.
Graafstra finishes his pain talk, fishes a tiny cylindrical two-millimeter diameter EM4012 RFID chip out of a tin of isopropyl alcohol, and drops it into the syringe’s end, replacing the RFID tag intended for pets that came with the injection kit. He swabs Andrew’s hand with iodine, carefully pinches and pulls up a fold of skin on the top of his hand to create a tent of flesh, and with the other hand slides the syringe into the subcutaneous layer known as the fascia, just below the surface.
Then he plunges the plastic handle and withdraws the needle. A small crowd of onlookers applauds. The first subject of the day has been successfully chipped.
Here’s a video of the procedure.

Over the course of the weekend, Andrew would be one of eight people to undergo the RFID implantation among the 500 or so attendees of Toorcamp, a hacker conference and retreat near the northwest corner of Washington State. Graafstra’s “implantation station” was set up in the open air: Any camper willing to spend $30 and sign a liability waiver could have the implantation performed, and after the excitement of Andrew’s injection, a small line formed to be next.
And why volunteer to be injected with a chip that responds to radio signals with a unique identifier, a procedure typically reserved for tracking pets and livestock? “I thought it would be cool,” says Andrew, when we speak at a picnic table a few minutes after his injection. (The pain, he tells me, was only a short pinch, followed by a “weird feeling of a foreign body sliding into my hand.”)


The practical appeal of an RFID implant, in theory, is quick authentication that’s faster, cheaper and more reliable than other biometrics like thumbprints or facial scans. When the chip is hit with a radio frequency signal, it emits a unique identifier number that functions like a long, unguessable password. Implantees like Andrew imagine the ability to unclutter their pockets of keys and keycards and instead access their cars, computers, and homes with with a mere wave of the hand.
Andrew says he initially hoped to use his RFID implant instead of the HID identity card his office uses for entry, but wasn’t deterred from the injection when Graafstra told him that HID uses a proprietary system whose chips Graafstra couldn’t implant. “I don’t have anything specific in mind, now, but I didn’t know when I’d have another opportunity to do it,” says Andrew. “And it’s a good excuse to start learning more about RFID.”
Another young hacker who underwent the procedure at Toorcamp said he hopes to install an RFID access system at the door of his local hackerspace. A young woman with a small collection of rings and studs in her ears compared her new implant to aesthetic body modifications like piercings and tattoos, or even the fringier culture of erotic “needleplay.” “I guess I have an interest in my body’s response to pain and modification,” she says. “There’s a certain thrill of the new.”

For Graafstra himself, the chips are more than a novelty or a hacker hobby. Graafstra uses them to access his home near Seattle, to turn on his motorcycle, to open a safe in his house, even to authenticate into his phone, a Samsung Galaxy Nexus that’s capable of near-field communications. He had his first chip installed in 2005 by a doctor client of his IT services firm, and has since become one of a few vocal RFID body implant evangelists, chronicling his experiences with the chip on his website and in a book,RFID Toys.
The enthusiasm of hackers like those at Toorcamp for RFID implants may seem a bit surprising–privacy advocates have long warned that the chips could allow individuals to be tracked by governments and corporations, even when they’re merely housed in passports or clothing, not to mention injected subcutaneously. But Graafstra says that the chips he’s implanting are difficult to read from more than a few inches away. And he argues the idea of someone trying to read his chip in order to spoof its signal and access his house or other property is far less of a threat than other potential privacy invasions.
“If someone manages to read this, it’s just as if they found a piece of paper with a number on the ground,” he says. “For any kind of attack, they would have to also know me and where I live and want to gain access to the things I’ve enabled. There are easier ways to do that, like breaking into my window.”
That hasn’t stopped privacy advocates and religious types from attacking Graafstra as a harbinger of evil–Some link his hand chip with the Bible’s “mark of the beast,” a number stamped by the Devil on hands and heads in the Book of Revelations. Graafstra ignores their emails or responds politely. “Some people view the body as a sacred temple,” he says. “Some view it as a sports utility vehicle they can upgrade. I’m definitely in the second category.”
Even so, he says his Toorcamp implantation station was a one-off. Outside of the camp’s community of hacking and experimentation, he worries that the risk of unhappy customers would be too high. “I trust that the people here have put a little thought into it and know what they’re getting into,” he says. “For everyone else, I recommend you contact your local piercing artist.”


and finally if you like to try it !! :

then visit : https://dangerousthings.com/