MS-ISAC Primer – Ransomware
You’re watching a movie. A criminal is trying to evade a crime scene in a sports car on the highway. A helicopter is following the car from above. The car enters a tunnel with multiple exits and the helicopter loses track of the car.
A VPN works just like the tunnel in this movie scene — it connects different roads and turns them into one, and a helicopter can’t see what’s happening inside the tunnel.
I’m sure many people around you have recommended you a VPN service. They usually tell you that a VPN is great, it lets you watch geo-blocked content, avoid the Great Firewall of China or browse the internet securely. VPNs are great, sometimes. But using a VPN can be as dangerous as not using one if you don’t know what you’re doing.
What really is it?
If you have multiple computers, phones and tablets at home, you are using a local area network. These devices are all connected to the same Wi-Fi network and you can even transfer photos or movies from one computer to another without using the internet. Local area networks are private networks by design.
A VPN is a virtual private network. It lets you remotely connect to a private network. For instance, your office might be using a VPN for remote employees. This way, you can establish a connection with your company’s intranet and use your computer as if it were in the office. You’re virtually in the office, using your company’s Wi-Fi network.
Using a VPN is quite simple. Usually, a company or a developer installs a VPN server on a computer at home, in your office or in a data center. Then, users with the right credentials can connect to this server using a VPN client. There are many VPN clients out there on computers, mobile devices and even routers. Windows, Android, iOS and macOS even come with a basic VPN client in your device’s settings.
Let’s say you’re establishing a VPN connection on your computer. Your computer and the VPN server will start a point-to-point connection and all your network traffic will go through this connection. Think about this connection as a tunnel between your computer and a server. This tunnel is usually encrypted, and everything goes through the tunnel, from one end to another.
Why should I use a VPN?
Many of you probably first started using a VPN for work, especially when you’re working from home. There are a few advantages in using a VPN for a company. For example, it lets employees access office servers that aren’t connected to the internet, as you’re all connected to the same private network. Back in the days before cloud-hosted Office 365 servers or the G Suite, many companies were managing their own email and calendar servers. IT services could force you to connect to the company’s VPN first to access your emails and calendar events. It’s a good way to protect sensitive information.
But there are a few drawbacks as well. When you use a VPN connection, all network traffic goes through the VPN, including your internet traffic. Your company’s IT service could enforce strict browsing rules and prevent you from using Twitter. Or they could even watch and record your internet browsing habits to find a good excuse to fire you later down the road (too much Reddit, kthxbye).
But office environments aren’t the only use case for a VPN. If you live outside of the U.S., you know that a VPN can save the day when you’re trying to stream something from HBO Now, Netflix’s U.S. movie library, Hulu or one of the many streaming services that restrict you from using them abroad.
Many companies provide access to a bunch of servers around the world so that you can pretend you’re in another country. As I told you, once you set up a VPN connection, all network traffic goes through a tunnel and HBO’s servers will think that they’re sending data to a customer in the U.S. They’re sending data to an American IP address indeed (the address of the server), but everything is then sent through the VPN tunnel to your device on the other side of the world.
Sometimes, the VPN server doesn’t have enough bandwidth to upload the movie through the tunnel in a good resolution and your movie will look like crap. Sometimes, content companies like Netflix try to ban IP addresses that belong to well-known VPN servers, rendering this trick useless.
And finally, if you’ve traveled to China or another country that blocks many internet services, you’ve been relying on a VPN to connect to Gmail, Facebook or Twitter. China blocks websites at the network level. You need to connect to a VPN server outside of China to access those websites. Just like Netflix, the Chinese government tries to ban IP addresses of popular VPN services, making it more difficult to establish a reliable connection with a server outside of China.
Why should I use a VPN to be secure on the Internet?
Many coffee shops or hotels don’t spend too much time securing their Wi-Fi networks. Just like at home, it means that a user can see another user’s computer on the local network. And if there’s a hacker in your favorite coffee shop, they could snoop on your internet traffic to learn some information about you.
This was a serious issue a few years ago. Many websites didn’t use a secure connection on their login page. Hackers could get your bank account’s login and password and steal all your money.
Not using the Wi-Fi network at all was the best way to avoid that. But if you really needed to checked your email account, you could use a trustworthy VPN server to prevent snooping — nobody can see what’s happening in the tunnel.
Things have changed quite a lot. Now, a vast majority of internet services have switched to HTTPS and end-to-end encryption to make sure that nobody can see your private information, even without a VPN.
All of this leads me to today’s false assumptions about VPNs. No, a VPN doesn’t mean that you’ll be more secure on the internet. It depends on the VPN server.
When you use a VPN to change your country, avoid censorship or protect your connection in a coffee shop, the VPN server at the other end can see all your network traffic. You’re just moving the risk down the VPN tunnel, and it can be quite dangerous if you’re not careful enough.
Assume that all the free VPN apps that you see in the App Store and Google Play are free for a reason. They’ll analyze your browsing habits, sell them to advertisers, inject their own ads on non-secure pages or steal your identity. You should avoid free VPNs at all costs.
As for encryption, some protocols aren’t as secure as you might think. L2TP with a pre-shared key for authentication can be decrypted for instance, destroying the concept of the unbreachable tunnel. A secure server running OpenVPN with a server certificate is more robust.
All of this might sound a bit complicated, but the bottom line is quite simple: a VPN is great and can fill different needs, but don’t do business with someone shady.
First thing, you want to make sure you have all the required software installed, you can install most of them and their dependencies using your distribution package manager. Let’s start with the libraries and tools for the hackrf itself, on a Debian/Ubuntu distro you’ll install them like so:
sudo apt-get install hackrf libhackrf-dev libhackrf0
Once these libraries are installed, you can plug your hackrf into one of your USB ports and execute the hackrf_info command, at this point you should see something like the following:
Found HackRF board.
Board ID Number: 2 (HackRF One)
Firmware Version: 2014.08.1
Part ID Number: 0x00574746 0x00574746
Serial Number: 0x00000000 0x00000000 0x14d463dc 0x2f4339e1
You will now install gnuradio which is the software we’ll use to decode the RF signals, gqrx a tool to visualize signal power on certain frequencies and everything else that will be needed in the next steps:
sudo apt-get install gnuradio gnuradio-dev gr-osmosdr gr-osmosdr gqrx-sdr wireshark
Proceed with gr–gsm, the GnuRadio blocks that will decode GSM packets:
sudo apt-get install git cmake libboost-all-dev libcppunit-dev swig doxygen liblog4cpp5-dev python-scipy
git clone https://github.com/ptrkrysik/gr-gsm.git
sudo make install
Now create the file ~/.gnuradio/config.conf and paste the following contents into it:
Finally install kalibrate-hackrf, a tool that will hop among known GSM frequencies and will tell you which your country is using:
sudo make install
FINDING GSM FREQUENCIES:
Each operator in each country uses a different frequency in the GSM possible spectrum, which usually starts from 900Mhz. You can use hackrf_kalibrate to find the frequencies you want to sniff:
./kal -s GSM900 -g 40 -l 40
Note the two gain values, those are important in order to get some results. Leave kalibrate running and after a while you should see an output similar to this:
You will have to use the proper GSM parameter (‘-s’) to correspond to your local operator. Consult this list for verification.
Sometimes you might want to see the frequencies in order to ensure correct results from hackrf_kalibrate, or to save yourself from calculating the correct frequency given by hackrf_kalibrate (notice the +/- Khz sign of each result – this means the top peak with the corresponding power,not 100% correct frequency). Open gqrx and tune it to the first frequency you got from hackrf_kalibrate, for example 940.6Mhz, and you’ll see something like the following picture:
In the above screenshot you can visually see the activity is around 945Mhz.
Once you know the GSM channels frequencies, you can start gr-gsm by running the python script ./airprobe_rtlsdr.py or load the airprobe_rtlsdr.grc file using gnuradio-companion and set one of the channel frequencies you just found in the frequency field. Don’t forget to add ‘gain’ value again, move back to the frequency field and start pressing the UP/DOWN arrows on your keyboard to start scrolling the frequencies in 200Khz steps until you start seeing some data in your console window. The whole process should look something like this:
Now you only need to launch wireshark from another terminal tab with the following command:
sudo wireshark -k -Y ‘gsmtap && !icmp’ -i lo
If gr-gsm did his job, you should be able to see decoded GSM traffic sniffed by your hackrf.