I really enjoy playing the Capture the Flag (CTF) challenges you'll find on VulnHub.com or at an information security conference. Even more, I enjoy teaching others how to block the red team attack paths through proactive security hardening.
In episode 5 of my Attacking and Defending Linux series, we proceed through a three-stage attack, breaking into the Cuckoo's Egg-themed Milnet Boot2Root CTF virtual machine, collecting flags as we go. Milnet is an intentionally-vulnerable CTF puzzle, created by Sebastian Brabetz and inspired by Cliff Stoll's book, The Cuckoo's Egg. Stoll’s book, published in 1989, details the fascinating true story of how he caught a hacker. In my on-demand webinar, we initially play the role of hacker. Then, we put on our white hats and execute one proactive defense that would break a link in the attack chain we just used.
These CTFs involve chaining vulnerabilities together to reach a goal. On the webinar, we break exploitation of one of the vulnerabilities, but today, let’s talk about how we could break the very first exploit in the chain: the point where we got the Internet-accessible web application to give us a low privileged shell. That exploit uses a Remote File Inclusion vulnerability to trick the application server into downloading and running code from a remote machine.
Now, we can’t always be sure that our programs lack vulnerabilities, but a simple proactive best practice would have broken the attack here: an outbound host-based firewall. A host-based firewall can prevent the application server from initiating a connection to an arbitrary host on the Internet. If we activate the machine's built-in host-based firewall, we'll foil any remote file inclusion vulnerability, basically by the very definition of that vulnerability.
However, keep in mind, this is just one of several tactics to block this attack. To see and understand the full attack path, as well as another defense, watch the webinar! You can even download the same virtual machine I did from VulnHub (https://www.vulnhub.com/entry/milnet-1,148/) and play along.
Footnote to "play along": You'll want a copy of Kali Linux if want to use the same attacker environment that I did.
Jay Beale, co-founder, COO and CTO, InGuardians
Jay Beale has created several defensive security tools, including Bastille Linux/UNIX and the CIS Linux Scoring Tool, both of which were used widely throughout industry and government. He has served as an invited speaker at many industry and government conferences, a columnist for Information Security Magazine, SecurityPortal and SecurityFocus, and a contributor to nine books, including those in his Open Source Security Series and the “Stealing the Network” series. He has led training classes on Linux Hardening and other topics at Black Hat, CanSecWest, RSA, and IDG conferences, as well as in private corporate training. Jay is a co-founder, Chief Operating Officer and CTO of the information security consulting company InGuardians.