During the talk, the slides will be available on the ResearchNet WiFi network. Simply direct your browser to the url in the upper right. Apologies for not encrypting the data. If you're concerned about man-in-the-middle, please use the signature to verify the authenticity of the tarball. In the upper left of each slide is my PGP key fingerprint. If you take this down, not only can you verify the authenticity of files and communications I provide, but you can also encrypt communcation to me. The paper isn't finished yet, so please wait patiently for the final draft.
Fair warning: If you are an employee of a federal, state, city, or county government, or if you carry a clearance I will be showing documents that you are not allowed to see. If you wish to become employed at such an agency, viewing this talk will make your life more difficult. This is a perfect time to leave because you will not be blowing your cover. If you are offended by coarse language, you are also invited to leave because I will not refrain from dropping the F-bomb when necessary.
IPsec-tools is vulnerable to a 0-day exploit that I am making available today. It is a null dereference crash, so it's a denial of service against the IKE daemon. You may gawk and say that it doesn't deserve a medium rating, but remember that IPsec is critical infrastructure and this attack requires two small UDP packets. This denial of service violates the premise that security is built upon. It is easily detectable if logs are turned on or if users disconnect and reconnect regularly. It may be possible to create an Intrusion Detection/Prevention (IDP) signature, but more likely you will have to run a honeypot to detect a sophisticated attacker. If you're running IPsec-tools, replace it sensibly as soon as possible. Do not replace it with Openswan or Freeswan and do not replace it with an old unpatched version of another IPsec implementation.
This talk is in two parts: IPsec Tools vulnerability and Software Security Prediction.
"Common Raccoon (Procyon lotor) in Northwest Indiana" by Dmytro S. - Own work. Licensed under Public Domain via Wikimedia Commons - http://commons.wikimedia.org/wiki/File:Common_Raccoon_(Procyon_lotor)in_Northwest_Indiana.jpg#/media/File:Common_Raccoon(Procyon_lotor)_in_Northwest_Indiana.jpg
IPsec is a piece of software that is often used for critical infrastructure. It modified the IP stack so that all layers below IP can be encrypted (TCP, UDP, etc) and even Layer 2 can be encrypted using a tunneling daemon. It's often described as a VPN and is used as part of a VPN, but don't confuse yourself about what IPsec is doing.
Javantea runs the exploit. VM racoon crashes. Applause.
courtesy Edward Snowden and Der Speigel http://www.spiegel.de/international/germany/inside-the-nsa-s-war-on-internet-security-a-1010361.html
The NSA wants all your data and they have the computational power to take it. That's why not.
if (iph1->rmconf->proposal->gssid != NULL) {
Lucky for us, people who use IPsec-tools are pretty vocal about it. IPsec-tools has a unique response signature, so you can write an NMap script to detect it with few or no false positives (many false negatives unfortunately I believe). If you run FreeBSD or NetBSD with IPsec, you are running IPsec-tools. If you are running pfSense, you are running IPsec-tools. I wasn't able to run NetBSD, FreeBSD, or pFSense, so these statements need to be tested. Who wants to e-mail all the authors? Not me.
You don't need to run
nmap -sU -Pn -n -vvv -iR 100000 -p 500 -oA nmap_ike1
or
sudo nmap -sU -sV -O -Pn -n -vvv -iR 100000 -p 500 -oA nmap_ike2
or
sudo zmap ike
to find a long list of people using IPsec-tools. Try downloading the Internet survey. Try getting a Pro account at Shodan. Also, nmap doesn't find vulnerable servers as easily as my exploit. I even have a non-harmful way of detecting IPsec-tools.
There are a large number of IPsec scanners currently scanning the whole IPv4 for IKE servers. What do you think they're up to? Some of them are just researching. Some of them are script kiddies. Some of them are spoofing their IP address. But my educated guess is that most of them have 0-day in hand and are exploiting every vulnerable VPN they come across. What evidence do I have to support my hypothesis? Only the packets that each of these are sending.
Count | IP Address |
---|---|
915 | 92.156.83.10 |
413 | 88.182.227.2 |
379 | 222.64.125.46 |
366 | 202.153.47.42 |
156 | 92.139.69.91 |
146 | 195.87.244.8 |
134 | 2.12.52.14 |
132 | 5.107.86.214 |
115 | 93.100.141.178 |
113 | 212.57.6.226 |
102 | 212.21.46.34 |
98 | 41.214.10.33 |
92 | 114.35.125.229 |
90 | 41.136.2.241 |
90 | 41.136.18.209 |
85 | 79.165.141.243 |
79 | 67.68.122.156 |
79 | 46.14.13.125 |
64 | 124.148.219.105 |
60 | 190.199.39.243 |
59 | 203.59.158.2 |
57 | 95.29.206.187 |
56 | 185.56.161.133 |
56 | 154.70.115.98 |
46 | 41.136.47.233 |
45 | 86.235.41.154 |
43 | 212.87.172.4 |
42 | 89.157.119.185 |
41 | 50.189.102.250 |
Hundreds. The reason I found this vulnerability is because I made the mistake of following someone's IPsec howto. Don't trust Howtos written ten years ago. Don't trust howtos written yesterday!
How many of these can be said of IPsec-tools? No recently found bugs, no maintainer, no development in years, and no self-respecting security company uses IPsec-tools. Or do they?
I am not here to give us a crystal ball or try to accurately predict the next month of Full-Disclosure. Instead of picking stocks, I am going to reveal a software security trend.
Today I provide a tool that will focus our efforts on replacing the bad actors of the software world and testing and fixing bugs in good software. If we decide not to fix these software that everyone uses, we will be worse off for it. Software is not a lemons' market like I have thought so many times before. It is a very complex market where some people know so much they burst at the seams trying to report all the vulnerabilities they find. Some people honestly know nothing and that's okay, so long as their choices are made based on other's expertise and enough data that we can make good decisions with.
Uninstall Windows. Uninstall Adobe Flash. Uninstall Java. I know a lot of people can't do that just yet. When you find the true name of a bad actor, it's important to add them to a list. We won't be glitter bombing these bad actors yet, instead we can start by creating systems that do not have their products installed. Do not put valuable data on systems that have their software installed. Do not type your valuable passwords into systems that have their software installed. This is hard. I know because I have tried it. If you find a solution that doesn't require users to expend enormous effort, please cite my paper.
Step 1: Create a metadata file for each package from your distro. Copy or link all metadata files into a directory. Put a directory listing into a file. Order the list of packages by number of systems that currently use that piece of software.
For starters, this is the code for Gentoo using eix. There are better ways to do this, but this is effective.
EIX_LIMIT=0 eix -I --only-names >packages1.txt
mkdir security_metadata; cd security_metadata
for pkg in $(cat ../packages1.txt); do
mkdir $(dirname "$pkg") 2>/dev/null
touch "$pkg"
ln -s "$pkg" $(dirname "$pkg")__$(basename "$pkg")
done
ls -1 |sed 's#__#/#g' >../packages_sort.txt
Now to get these in order of how many systems. Run the first command on many systems and name the output file differently for each system. Put all these files on one system and do the following:
cat ../packages1*.txt |sort |uniq -c |sort -nr >../packages1_sus.hist
Now we have a histogram that tells us which are the most important packages because they are installed on a lot of machines. For my four systems, 192 packages are on all 4, while 1102 are on 2 or more. This is out of 2328 packages. While even the smallest package can compromise a system, the ones that aren't used often can be pushed back and the ones that are used more often can be promoted. To use security data, we can use these two lines of code:
grep -h '<package name' /usr/portage/metadata/glsa/glsa-20*.xml | sed 's#<package name="##g;s#" auto="[^"]*" arch="[^"]*">##g' |sort |uniq -c |sort -nr >../glsa1.pkg.hist
As you can plainly see, all of the major offenders are right up top. Don't get me wrong, these are people who have spent countless hours tirelessly searching for vulnerabilities and fixing them. They should be applauded. But we can learn from this which software needs the most work. For those that don't go above and beyond on their testing, their software should be blacklisted until they prove themselves.
Step 2: Add a security contact to the metadata for that package.
Step 3: Once you filter the projects into maintained and unmaintained, start at the top of the unmaintained list and contact heavy users about possibly finding a maintainer.
Step 4: Once you filter the unmaintained projects into possibly maintained and needs to replaced, look for replacements for the project. If one exists, deprecate the project and let users know that a replacement exists. If users refuse to replace the project, let them know that they do it at their own risk and do not allow them to install it using your distro's package management. Instead provide a way for a user to download it manually and install it (like a Windows application). Use your security system to inform the user when they ask that the project is unmaintained.
Step 5: Require maintained projects to increase their security depending on their criticality. This is done by deciding the severity of a compromise of the system compared to date of the last vulnerability found. This will lower the value for projects that need security testing but will eventually decrease the time spent looking at projects that have good security from the get-go. Projects may decide to hide vulnerabilities to make their last bug found more distant, which means that when users report bugs in old software, this data can be integrated into this data rather than being lost in the bug tracker as just being fixed.
Step 6: Require security testing tools used on critical projects to be used against all similar projects (high and low importance projects). While this will uncover many low severity vulnerabilities and waste time, it will improve the overall quality of source code without requiring duplication of efforts.
The cost of looking for bugs is greatly outweighed by the benefit of testing these systems.
Step 7: Create a list of authors who have abandoned projects. Make sure that any project that they work on is treated more critically than it otherwise would be. This prevents serial offenders from contributing to a project during its maintenance phase, becoming the maintainer, and then abandoning it.
Step 8: Use smell test to determine whether a project is being tested as well as it should be. This includes running splint, pylint, and other noisy "bug finder" tools on the software as well as taking into account gripes from users about bugs that aren't being fixed. This type of transparent gripe factory will provide data for users decide whether a piece of software is in high development and shouldn't be used in production or whether it's a lemon, like OpenSSL. This will make it possible to predict security based on the trend of improving security without lemons or bad actors.
Bad actors usually think of themselves as the good guy. They are the main developer of a popular open source software project. They are a well paid developer of a major piece of software. They are the father of two wonderful children. They are the judge that makes hard choices because no one would otherwise. They are the entrepreneur who supplies people medication to people who are in severe pain.
Relativism and Utilitarianism are not a valid excuse for doing harm. A person who does harm consistently marks himself or herself as a bad actor. It is our job to name them and reduce harm.
GLSAs | Package Name |
---|---|
30 | clamav |
27 | adobe-flash |
24 | apache |
19 | opera |
19 | openssl |
19 | acroread |
18 | asterisk |
18 | mplayer |
18 | xine-lib |
18 | mozilla-thunderbird |
18 | mysql |
17 | php-myadmin |
16 | openoffice |
16 | mit-krb5 |
15 | squid |
15 | cups |
15 | php |
15 | java |
15 | ruby + rails |
15 | pidgin |
14 | seamonkey |
14 | samba |
11 | tikiwiki |
11 | bind |
9 | wordpress |
9 | xorg-server |
9 | xpdf |
8 | curl |
8 | ipsec-tools |
GLSAs | Package Name |
---|---|
34 | firefox |
31 | wireshark |
21 | chromium |
14 | libpng |
13 | kdelibs |
12 | libxml2 |
11 | freetype |
11 | glibc |
11 | python |
10 | gnutls |
10 | tiff |
10 | perl |
10 | sudo |
9 | poppler |
9 | lighttpd |
9 | gallery |
9 | file |
9 | kdegraphics |
9 | postgresql |
9 | gnupg |
8 | tor |
8 | vlc |
8 | v8 |
If security was a trivial matter, we wouldn't need to think very big about it. We'd batten down the hatches and weather the storm. Instead, we're seeing thousands of medium and high severity vulnerabilities each year. I produce a 1-20 each year and I'm only spending a few hours here and there.
We sit on top of a wealth of knowledge. Our inaction causes us harm. Our action causes us harm. Don't worry, I have a plan. Instead of reactive security, we should reward those software projects whose proactive security projects find and fix bugs. If a bug is found in a piece of software with many eyes on it, why? We can't just pat them on the back every time they add a bug and then fix it. We want them to release the tools by which they tested their software. If there are no tools, there is no testing. If they haven't fuzzed, why in the world not? If they haven't run their software with Valgrind, why not? If they haven't run static analysis tools on it, why not? If the static analysis tool produced a ton of false positives, who is staking their reputation on that being true? Who is validating the results of the static analysis tool they use?
I am Javantea and I do a lot of hacking, but my real passion is Nanotechnology. I've been studying for over a year and I am looking for peers. I am planning on taking the month of June off to do radio astronomy, so if I don't respond to your e-mails be patient.
Thanks to Ann, my friends, Neg9, Melody, Batman's Kitchen, the organizers of TA3M. To those who think critically and speak out: Keep it up!
How long? Not long, because the arc of the moral universe is long, but it bends toward justice.
Martin Luther King, Jr. http://mlk-kpp01.stanford.edu/index.php/kingpapers/article/our_god_is_marching_on/
/