In my Linux Attack and Defense webinar series, I demonstrate attacks on Linux systems, then show how proactive security hardening could block the attacks. The immense value of proactive hardening is that it can eliminate security vulnerabilities that you don’t even know are present.
In this webinar, we attack the Breach2 “Capture the Flag” (CTF) virtual machine (VM), created by @mrb3n. The Breach CTF virtual machines are all themed on the classic cult movie, Office Space. You don’t need to remember the movie to enjoy the CTF and the webinar, but it’s a great bonus if you do.
The Breach2 CTF virtual machine is particularly fun and a bit unusual in that it exposes new target services to attack as you progress through an attack path. This helps each step build on the one previous to it.
The Breach 2 CTF VM also puts services, like its SSH server, on non-standard port numbers. The use of non-standard ports presents the potential to apply a particularly cool hardening measure. Think about it this way: what happens if an attacker can only figure out if you have an SSH server by attempting connections to many ports? If only attackers try connecting to that many different ports on a single system, then you’ve identified one of those useful anomalies that differentiates attacker behavior from legitimate user behavior.
You can configure a free tool, like OSSEC, to block any IP address that tries connections to more than, say, three different ports within a five-minute period. The tool can use expanding lockout durations, so the first attempt creates a short lockout, but the next creates a one-day lockout. It takes the attacker forever to get through anything close to the available 65,536 ports. This renders the port scan ineffective as an attack toolin the short term, while making attacks easier to identify and catch and respond to by IT and security teams.
While this wouldn’t be your only security measure to better protect the Breach 2 CTF VM, it’s a valuable measure within a broader defense-in-depth strategy. But, why isn’t it enough on its own? Well, information security is always a back-and-forth arms race. As an attacker, I can rent time on a botnet, which lets me coordinate around 22,000 hosts to each send probes to 3 ports on the target machine. All 22,000 IP addresses will be locked out, but not before I’ve been able to scan all 65,536 available ports to uncover that hidden SSH server.
Now that you know the counter-attack, would you skip the hardening steps? I know that I wouldn’t. Here’s why. The bulk of the total population of attackers, including fully-automated worms, aren’t willing or able to use a botnet. That leaves some small percentage that are able to do so. At that point, the probability is much lower that the attacker coming after me is in the “willing and capable” group. Without applying the security hardening measure described, the probability is much higher than my attacker will have what they need be successful in their cyber assault.
If you enjoy this kind of attack-and-defense back and forth, check out the webinar: Linux Attack and Defense - Office Space Style!
You can get the Breach2 virtual machine from VulnHub.com. I encourage you to download Breach2 and a Kali Linux virtual machine and then follow along with both the attack and defense in the webinar.
Jay Beale, CEO, CTO at InGuardians, Inc.
Jay Beale is CTO and CEO for InGuardians. He works on Kubernetes, Linux and Cloud-Native security, both as a professional threat actor and an Open Source maintainer and contributor. He's the architect of the open source Peirates attack tool for Kubernetes and Bustakube CTF Kubernetes cluster. Jay helps create and run DEF CON's Kubernetes CTF, is a member of the Kubernetes organization, and previously co-led the Kubernetes project's Security Audit Working Group. Since 2000, he has led training classes on Linux & Kubernetes security at public conferences and in private training.