1. Project Artropa: How to Turn a Raspberry Pi into a Rogue Device with .NET

Loading

Raspberry Pi Hacks – Facebook – Notice: This text is several years old, and many things have changed, especially in ASP.NET Core (referred to here by its old name, ASP.NET 5). I am keeping the article as a reference, but generally recommend finding newer sources.

 Nedeštruktívne Technoogie ktoré nikde nekúpiš. 

I like small computers and ASP.NET, and I am generally “evil” by nature. I decided to combine these interests, get the new ASP.NET 5 running on a Raspberry Pi minicomputer and turn it into a Wi-Fi honeypot that tricks foolish people into revealing their login credentials. I also decided to document the process and publish it here as a guide. I leave it to the kind reader to judge whether that is a mitigating or aggravating circumstance.

Why Artropa?

The Raspberry Pi is a miniature single-board microcomputer that is cheap and readily available. It can run all kinds of things, such as Linux or a special edition of Windows 10. The latter is still in its infancy, so if you want to do anything more serious on the RPi, you have little choice but to get involved with Linux.

To avoid giving up my favorite technology, .NET, I wanted to see how ASP.NET applications written using the new ASP.NET 5 could actually run on Linux beyond the demo stage.

Since I work in computer security, I had the idea of turning a Raspberry Pi into a “rogue access point” (rogue AP). It will broadcast Wi-Fi; when someone connects, they will see a captive portal, as is common with many Internet connections, where I will attempt to trick the victim into revealing sensitive login credentials.

I am not the only person to have had this idea. A full Kali Linux installation can be loaded onto a Raspberry Pi, including Mana Toolkit, which can do all this and more. However, I wanted to try programming it in .NET and configuring the whole program to be completely autonomous, run unattended as soon as power is connected, and work even without an Internet connection.

And why is it called Atropa? Atropa Belladonna is the Latin name for deadly nightshade, a highly poisonous plant found throughout almost all of Europe, including the Slovak Republic. Poisoning by this plant is estimated to account for roughly half of all serious plant poisonings in our territory. “Raspberry” refers to the fruit, but my variation on the theme is not quite so palatable.

Of course, what you do with the information you gain is up to you. The vast majority of the procedures can be used without any difficulty to develop any ASP.NET applications for the RPi, including much better ones. We will do the “evil” things in only two parts.

What Will You Need?

  • Raspberry Pi. I work with a RASPBERRY Pi 2 Model B, but a RASPBERRY Pi Model B + should also suffice. I recommend buying a case for it as well.
  • A sufficiently powerful power supply with a MicroUSB connector. This will power the Raspberry and should provide at least 2 A. I use a 2 A tablet power supply and am happy with it. A mobile phone charger will almost certainly be insufficient.
  • A MicroSD card. I use a 16 GB Class 10 card, but a smaller one should suffice – certainly 8 GB, possibly even 4 GB. You will also need a suitable reader for your PC and, possibly, a MicroSD-to-full-size-SD adapter. Some cards include an adapter in the package.
  • A monitor with an HDMI input. Most newer monitors have one; alternatively, a DVI or DisplayPort input with an appropriate adapter/cable is enough.
  • A USB keyboard. Any standard keyboard will do.
  • A USB Wi-Fi adapter. I have had the best results with the TP-LINK TL-WN722N. It is cheap, widely compatible (Raspbian works with it automatically), offers all the features needed for more advanced Wi-Fi use and has an external antenna that can be replaced with another.

You will also need an ordinary computer running practically any operating system. I use the latest Windows 10 preview, but it does not matter, because all we need this PC for is copying files and using a terminal program. We will also use various freely available software, which I will introduce as we go through the guide.

What Will You Learn?

The series will be divided into several parts, published at weekly intervals. The target audience is .NET programmers; I assume no experience with Linux or similar topics, so the instructions will be entirely specific.

Advertisements

The individual parts will cover the following:

  1. The introduction you are reading now.
  2. Setting up Raspberry Pi and Raspbian Linux.
  3. Installing and configuring Mono and ASP.NET 5, and getting the first application running.
  4. Installing and configuring nginx as a proxy, and configuring ASP.NET for production use.
  5. Installing and configuring HostAPD, DnsMasq and a Wi-Fi captive portal.
  6. Creating a captive portal in ASP.NET 5.
  7. Guides to defending against attacks of this kind.

Parts 1-4 are “good” and will produce a platform capable of running any ASP.NET application. Parts 5-6 are “evil” and will show how these technologies are used to attack trusting users. Part 7 is the best-behaved and will show you how to defend yourself.

Warning

I am writing about things I do not understand particularly well. I do not know much about Linux, and this series is largely a compilation of guides I found elsewhere, modified and updated. I am not claiming that my chosen solution is the best, or even the only one possible. I also do not focus much on security, because I do not expect a device of this type to contain its operator’s sensitive data.

I am writing about things that change quickly. New versions of libraries and other software are released, ASP.NET is in beta… Something may not work for you, or may behave differently than it did for me. That was my biggest problem when following other people’s advice: filtering out information that was no longer current and had become outdated.

Using the resulting device may be illegal in certain circumstances. Actually using a device of this kind could involve a wide range of criminal offenses, such as unauthorized access to a computer system and information medium under Section 230 of the Criminal Code.

An interpretation of the law that I would not consider excessively broad could regard publication of this article itself as the offense of obtaining and possessing an access device and password for a computer system and other such data under Section 231 of the Criminal Code. I am convinced that I am not committing a criminal offense. My aim is not to commit offenses under Sections 182 and 230 of the Criminal Code, and I am also convinced that my conduct poses no danger to society. On the contrary, its aim is to benefit society.

I make my living teaching users and programmers to behave and act more securely. I have many years of experience in this, and an important part of it is knowing that people simply do not believe me. They think cyberattacks happen only in American films, can be carried out only by top hackers – of whom there are five in the country – and require expensive, sophisticated specialist equipment. They think their data would not be worth the trouble to anyone. I know that people on my courses start taking me seriously only when I show them that harm can be done with things I happened to find in my pockets.

Nothing I describe here is new. All these procedures are known and have been commonly used for many years, and I have encountered them as real attacks “in the wild.” I hope that once you try them yourself, you will start taking them seriously.

Link to the next – upcoming article.

  1. Project Artropa: How to Turn a Raspberry Pi into a Rogue Device with .NET
  2. Project Atropa: Setting Up Raspberry Pi and Raspbian Linux
  3. Project Atropa: How to Get ASP.NET 5 Running on Linux
  4. Project Atropa: Automatically Starting the Website and Publishing through nginx
  5. Project Atropa: Creating a Honeypot
  6. Project Atropa: Creating a Captive Portal
  7. Project Atropa: How to Defend Yourself?
Advertisements
AliExpress

Leave a Reply

Your email address will not be published. Required fields are marked *