Burp Repeater

August 25th, 2016

As a consultant for Secure Ideas there are many tools I use often in my daily tasks.  One of the many great tools I use in web application testing is Burp Suite.

Burp Suite is an integrated platform for performing security testing of web applications.  Its various tools work seamlessly together to support the entire testing process, from initial mapping and analysis of an application’s attack surface, through to finding and exploiting security vulnerabilities (‘https://portswigger.net/burp/’).  You may download it for free at http://portswigger.net.

During this demonstration I will be using a Virtual Machine of SamuraiWTF.  The Samurai Web Testing Framework is a virtual machine, supported on VirtualBox and VMWare, that has been pre-configured to function as a web pen-testing and training environment.  The VM contains the best of the open source and free tools that focus on testing and attacking websites. SamuraiWTF can be downloaded free of charge from https://sourceforge.net/projects/samurai/.

Be very mindful that if you start testing a web site without prior approval from the owner you could get yourself into a lot of trouble.  It’s kind of like going to your neighbor’s house sitting down at their kitchen table and having breakfast while they are still in bed on a Sunday morning.

Burp can require a lot of memory resources while testing.  I normally launch Burp by typing the following command at the command prompt:
‘java -Xmx4096m -jar {location of Burp jar file}’.  You can also select the application under Samurai/Mapping/Interception Proxies/Burp Suite in Samurai WTF VM.  Keep in mind that the Xmx option is setting the Java heap size, so if you have less than 8GB of memory, setting this to 4096M is probably not a good idea. 😉 For tips on setting up a Burp Automator script on your Mac, see our blog post on the topic.

If you have never installed Burp and are unfamiliar with the settings please refer to https://portswigger.net/burp/help/suite_gettingstarted.html to get it configured and set up for use.  Once launched select next and then start using Burp default settings then hit next and ensure intercept is off under the Proxy Tab.

Screen Shot 2016-08-22 at 8.44.39 AM

After you have Burp launched you may notice there are many tabs and features in Burp that serve different functions. The one tab we will discuss is the Repeater tab.  We will cover the others in further posts or you can join the web class on Burp Suite at http://www.secureideastraining.com.  Burp Repeater is a tool for manually modifying, reissuing individual HTTP requests, and analyzing their responses.  During our web penetration tests and our WebScout testing services, we use Repeater quite frequently as a method to manipulate various parameters within the application.  This allows us to manually test applications to discover a variety of flaws.  Especially with modern applications, this is a very important method for testing the security of the application.

Now let’s get to testing. First, we need to pick a web site and start mapping out the site.  I am using Firefox with Foxyproxy enabled and Burp Suite as my proxy on the Samurai WTF VM.

For this blog we are going to use bWAPP which is an intentionally buggy web application.  In Firefox navigate to http://bwapp/login.php, then log into bWAPP using bee/bug as the login. Start mapping out your site, by selecting all the different tabs throughout your application.

Screen Shot 2016-08-23 at 9.39.28 AM

In Burp under the Target tab right click on http://bwapp and add to scope.  By adding your target site to the scope, this will weed out any superfluous websites and keep your testing focused on what is in scope.

Screen Shot 2016-08-23 at 9.58.42 AM

One item I found while mapping the bWAPP site was an OS Command Injection hack.  This can be found under the bug list when logged in to bWAPP.

Screen Shot 2016-08-23 at 1.21.27 PM

I typed in my web site I wanted to lookup and then searched for the results in Burp.  Now I select the last entry in Burp’s Proxy tab which is where I performed the lookup and send that to Repeater by right clicking on the entry listed.

Screen Shot 2016-08-23 at 9.58.42 AM

Select the Repeater tab and then select Go, this will give you the current state of your page before anything is altered to give us a reference point.  This verifies the session is still active and the page does not block any replay of the request.  We want to compare what comes back in Repeater to what we received in our original request from the browser to make sure nothing has changed.

Now once the target parameter is sent to Repeater and we can manipulate the cookies login/password or any other interesting items in order to send this to other tools such as intruder, decoder or comparer.  These tools will be discussed in a later blog.

So let’s play around with this and see what happens when we add some things to the target field with “target=www.secureideas.com;ls -l” and select Go.  We can look at the results and see what was returned.

Screen Shot 2016-08-23 at 1.38.35 PM

Notice that we returned a directory file list of the website.  Now let’s dig a little further and change our target to “target=www.secureideas.com;cat /etc/passwd” and rerun the test.

Screen Shot 2016-08-23 at 1.51.03 PM

So using Repeater, we have discovered a Command Injection flaw within the application.  We can then take this information and pivot deeper into the server or the network we are targeting. So that is basically it for Burp Repeater.  It’s all about playing with different fields on the page and see what can be changed or manipulated to get a different result than intended?

In the next segment I will explore the Intruder tab another resourceful tool in Burp Suite which can be used to help in a Brute Force attack.  If you would like a more in depth tutorial on Burp please sign up for the Tactical Burp recorded class on the Secure Ideas web site at http://www.secureideastraining.com/courses.  If you have any questions or comments on my blog, feel free to reach out to us at https://www.secureideas.com or email me at larry@secureideas.com. 


Hours After The Penetration Test, This CSO Revealed Something That Will Leave You In Tears

August 18th, 2016

We all recognize clickbait when we see it. And yet thousands still click on the links. In today’s world of social media and ad-funded news, a range of techniques are utilized to grab your attention, some with more success than others. One of these, used in the title of this post, is to create a false sense of importance. Something significantly affected someone else and you need to know about it! The goal of all clickbait is to steal your focus and attention. We see the same thing in security.

The latest hot topics in security get the news coverage and ultimately the attention of readers. Often that filters down through corporate politics into the organization’s priorities. Sometimes that’s great. In April 2014, when the Heartbleed bug was announced, that got people’s attention for good reason. Suddenly patching became a priority and resources were diverted to addressing the threats. Though it’s worth asking why patching wasn’t such a priority previously.

Usually the latest news articles really shouldn’t affect information security policies. Occasionally during a penetration test we’ll be informed that the CEO (or other C-level) is concerned about Advanced Persistent Threats or some other random newsworthy topic, and wants to know what we have planned to simulate those attacks. Generally we find that those environments suffer from the most basic security flaws: no segmentation, lack of patching, default passwords, etc. APTs should be the least of their concerns, but because it’s in the news it directs their focus.

Whether it’s a news article, a blog post, or the build-up to the latest security conference, marketing professionals are focused on grabbing our attention. And they’re good at what they do. The problem is that very subtle manipulations, intended to make an article seem more important, have a negative effect on our credulity, our skepticism, and on the ways that we unwittingly make decisions about media-ized information. If we’re not careful, they can literally rewrite our thought patterns and change our intentions.

In reality, the security controls that made us better yesterday will still make us better today. Our focus should be on consistency and completeness rather than chasing the latest hot topic. The latest bug may mean that someone stays late to push some patches through, but it shouldn’t mean that we have to suddenly figure out how to patch systems that we never touch. Learning that Target was breached through a 3rd party HVAC vendor might prompt a review of firewall rules, but it shouldn’t cause a sudden awareness that segmentation is important.

The danger of chasing the latest threat is that it becomes a merry-go-round ride from which we can never escape. There will always be something else to worry about. Instead our corporate security programs should be well defined with intentional, incremental steps. Tomorrow’s newsmaker may warrant a review of how it fits into the plan of securing the organization, but rarely will it require us to drop everything to stave off disaster.

The oft-used adage is that security is a journey, not a destination. When we get distracted by current events, there’s a tendency to think, “We have to fix XYZ to be secure.” That thought is dangerous because it indirectly implies that security is a binary state of being. You are or you aren’t. In truth we can work towards becoming more secure, but we will never get there. It’s like a real-world example of Zeno’s Dichotomy paradox.

One last example of this false sense of importance is demonstrated with compliance initiatives. The goal of compliance is to demonstrate security through adherence to some standard. Unfortunately many organizations make compliance the end-goal instead of the security it was intended to affirm. This is often called the “Check the Box Mindset.” Corporate focus, and therefore resources, can be dedicated towards proving compliance, sometimes to the detriment of security initiatives. We often see this in assessments where clients want to significantly restrict the scope of testing to reduce the chance of negative findings. A better approach is be more inclusive of the testing scope, but allow us to write separate reports; one that covers only the compliant environment and another that speaks to the security of the entire system.

We live in a hostile world. Just as attackers are fighting for our networks, the media is fighting for our attention. And they both use incredibly creative means to divert our focus and exploit our tendencies. As security practitioners we have to intentionally set our plan and struggle to maintain it. Unexpected vulnerabilities and new attacks will occur, but very rarely should they require significant deviations to the plan.

Are you struggling to develop your security program, or not sure what to prioritize? Let us help. We work with organizations large and small to review your environment, outline areas of concern, and help build a strategy for improving your security posture.

Nathan Sweaney is a Senior Security Consultant with Secure Ideas. If you are in need of an architecture review, penetration test, or other security consulting services you can contact him at nathan@secureideas.com, on Twitter @eternalsecurity, or visit the Secure Ideas site for services provided.


SQLMap Beginnings: What and How

August 11th, 2016

Testing web based applications is not only fun but is often multi-faceted and challenging. Often times a web front end will have places for data input. Those that do, often store this information into some sort of back-end or database. The architecture will often be on a separate, dedicated purpose built host. This means that a connection from the web/application server [may be one or two separate hosts] must connect to the database in order to store or retrieve data. For firms that are data-centric in their business model, the data in the database may be some of the most sought after to unauthorized persons. This aspect of internet facing web based applications makes them a constant target. Not surprisingly, playing defense against the threat spectrum is a never ending game.

For those of us who are interested in protecting such data we must think like the ‘bad guys.’ This is an odd paradigm and admittedly, a bit uncomfortable at first for many. But since our goals are to find vulnerabilities and help in closing them before criminals do it becomes something we just do.

So when we encounter a situation where we suspect a database is being used, we want to be able to discover as much information as any nefarious person. This allows us to detect and understand what risk a vulnerability may expose our client to. In order to exploit any weakness, we first have to find it and before we do that we need to fingerprint the technology as much as possible. This work can be tedious but rewarding.

Knowing what technologies are being used help us narrow our focus. Is the application vulnerable to injection attacks? Can we bypass any security layers to obtain information from the database without using the correct credentials? The answer is,”it depends.” Experience will help but even that alone is often insufficient. What we need is a means for determining as much about the database as we can possibly obtain without triggering alarms. Not surprisingly, we often use tools for such tasks.

One such tool is SQLMap. It was made for obtaining data about a targeted database, which particular type of database is in place, how it is laid out, and if the application using the database is vulnerable to injection based attacks. SQLMap can perform such data gathering and more. It may also identify the operating system of the host where the database resides. For a web based target, It needs only a URL as input initially. Depending on what one finds, additional switches and options can be used to delve deeper into the target system.

Where do I obtain it?
There are several places to obtain SQLmap. You may download it and set it up on your platform of choice from the its web site SQLMap. Since the tool is written in Python, that must be installed before this tool will function. Python can be found at its own website but it is installed by default on several variants of Linux. No matter which platform you choose to use, ensure the version you select is the right one for the operating environment you wish to use.

SQLMap can be found pre-installed in the Samurai Web Testing Framework. Of course, we here at Secure Ideas are a bit biased when it comes to SamuraiWTF. SQLMap also comes with Kali – the open source Penetration Framework maintained and distributed by the team at Offensive Security.

Within Samurai WTF, SQLMap is located in the Exploitation/SQL folder or you can open a terminal and change to the /opt/samurai/sqlmap directory or select from the GUI:

While we won’t go into how to set up Kali or Samurai WTF, within Kali you will find SQLMap under both the ‘Web Application Analysis’ section as well as the ‘Database Assessment’ section.


Getting Started
An alternative means of invoking SQLMap within Kali or SamuraiWTF is merely to type ‘sqlmap’ from a command line. Provided that Python is installed and in the PATH of the user context from which it is being invoked, it will be available. If using this method without switches, it will display its usage syntax. For example:

$python sqlmap

You will receive output that reminds you that the tool requires further parameters in order to operate. For example:

samuraiwtf@samuraiwtf-Desktop:~$ sqlmap
Usage: python sqlmap [options]
sqlmap: error: missing a mandatory option (-d, -u, -l, -m, -r, -g, -c, -x, –wizard, –update, –purge-output or –dependencies), use -h for basic or -hh for advanced help

Note that there are several features that should be of particular interest in the output above. Firstly, the two ‘help’ switches ‘-h’ and ‘-hh’ are noteworthy because those will show basic help and advanced help respectively. The number of options are lengthy and will not all be covered here as they include options, target, requests, injection, detection, techniques, enumeration and other general information that we can use to pass to this tool.

However, the options that are listed after just invoking sqlmap show several switches that we can use to start using sqlmap.

If testing a web based application known or suspected of using a database, the minimum needed is the -u switch. This parameter followed by the uniform resource locator (URL) enclosed by double quote marks. This combination tells SQLMap the target we want it to interact with. An example would be:

$python sqlmap -u “http://www.secureideastraining.com/index.php?page=user-info.php”

In the above example the URL would be the target that you are authorized to test.

Now is a good time to mention that it is unethical and likely illegal to perform any sort of test of a site that you are not expressedly given written permission to do so. If you have not already done so, look into setting up your own virtual lab environment. Consider running virtual hosting software and running your own hosts to attack. One such applications is OWASP’s Mutillidae 2 Project. There are plenty of vulnerabilities intentionally included in Mutillidae so that you can run SQLMap against it. You could also use the variety of vulnerable targets built into the SamuraiWTF project.

For those who have never used this tool or are new to SQL databases, you may wish to use the ‘wizard’ switch. That is invoked by adding the –wizard to the end of the string noted above. For example:

$sqlmap -u “http://www.secureideastraining.com/index.php?page=user-info.php” –wizard

If used, you will be given several options to choose from regarding “injection difficulty level” and “Enumeration.” The selections are simple 1-3 choices and look like this:

[18:45:26] [INFO] starting wizard interface
POST data (–data) [Enter for None]: –data
Injection difficulty (–level/–risk). Please choose:
[1] Normal (default)
[2] Medium
[3] Hard
> 1
Enumeration (–banner/–current-user/etc). Please choose:
[1] Basic (default)
[2] Intermediate
[3] All
> 3

sqlmap is running, please wait..

One of the cool features of SQLMap is that it provides feedback on what other parameters that should be considered adding based on what it finds. For example”, the output from the –wizard selections that were selected above to run against a Mutillidae instance resulted in the following:

[18:51:16] [CRITICAL] considerable lagging has been detected in connection response(s). Please use as high value for option ‘–time-sec’ as possible (e.g. 10 or more)
[19:41:12] [CRITICAL] all tested parameters appear to be not injectable. Try to increase ‘–level’/’–risk’ values to perform more tests. Also, you can try to rerun by providing either a valid value for option ‘–string’ (or ‘–regexp’) If you suspect that there is some kind of protection mechanism involved (e.g. WAF) maybe you could retry with an option ‘–tamper’ (e.g. ‘–tamper=space2comment’)

Note the suggestion to increase the level and risk values as well as the –string or –regexp, and even the –tamper options. Use the basic and advanced help features to explore additional options. SQLMap offers a rich feature set and the Security Professional should be familiar with its capabilities so it is well worth the time spent in learning to use it.

If you have any questions or comments, feel free to reach out at https://www.secureideas.com or email me at chris@secureideas.com. In the next segment I will explore some of the options that are useful in getting started with SQLinjection and SQLmap.


Announcing Tactical Sec Ops: Cloud Edition Online

August 3rd, 2016

2016 is shaping up to be an interesting and exciting time at Secure Ideas. We have always done training in one form or another. Many of you may have first heard of Secure Ideas through the training that we have done for organizations such as SANS, DerbyCon, Blackhat, OWASP, MISTI, Princeton University, Columbia University, and our webcasts. The evolution has continued this year and we are very proud to announce our first full length, on demand training class: Tactical Sec Ops: Cloud Edition!

This course is the same two-day course that we are launching at DerbyCon 6.0, but it will also be available via our online training platform! You can check the training site out by going to www.secureideastraining.com. Tactical Sec Ops: Cloud Edition will be released after DerbyCon at the end of September 2016!

So what is Tactical Sec Ops: Cloud Edition about? IT has changed quite a bit over the years and there has been a huge push to move systems to cloud computing. Unfortunately, a lot of what we are familiar with in security doesn’t translate real well to this model. Firewalls? Nope, now we have security groups. How about network IDS? Nope, we don’t have access to all our network traffic anymore. Fortunately, not everything is new and unfamiliar, so there’s a lot of common ground to build on!

TSO: CE is designed to jump start your understanding of Amazon’s AWS offerings specifically (and cloud computing in general) and covers how we can secure, monitor and assess our AWS based systems. Here are some of the highlights from the course:

  • Introduction to Cloud Computing and AWS
  • Understanding and Working with Elastic Cloud Computing (EC2)
  • Identity and Access Management (IAM) Basics
  • AWS API Setup and Usage
  • Amazon’s Simple Storage Service (S3)
  • Understanding Amazon Virtual Private Cloud (VPC)
  • Command Line Tools
  • Automation within AWS
  • Configuring AWS for Developers
  • Security Monitoring in AWS
  • Using the AWS WAF
  • Getting Familiar with AWS Inspector

TSO: CE is a hands-on class, so be prepared for exercises that will get you acquainted with AWS’ console and services. Labs will walk you through setting up, tuning and monitoring your cloud environment. If you would like to learn more about the class and get notified when the class becomes available, just complete the form below. We’ll keep you up to date on what’s going on and when registration is available. We are really excited to offer this course and are looking forward to seeing you in class!

Subscribe to receive notifications about Tactical Sec Ops: CE

* indicates required

I want to be notified with news about Tactical Sec Ops: CE


Wireless Attacking EAP-TTLS with Kali 2 and ALFA AWUS051NH

May 16th, 2016

Is your corporate wifi as secure as you think it is?

A common configuration for WPA Enterprise wireless networks is to use a combination of PEAP (Protected EAP) and EAP-TTLS (Tunneled Transport Layer Security). Though this configuration solves several issues found in other configurations, it (sometimes) also has its own fatal flaw. If a client is able to connect without properly verifying the authenticity of the access point (through its certificate), then there is an opportunity to capture the username and handshake. This information can be used to attempt to crack the user’s password offline using a password dictionary. To capture the necessary information we will need to set up a rogue access point (AP) that masquerades as the target AP. Setting up the rogue AP can be a bit of a challenge, so this blog post is a walkthrough of a rogue AP setup on Kali 2.

The rogue AP we will use for this purpose is a modified version of the open source FreeRADIUS server, currently called hostapd-wpe (hostapd Wireless Pwnage Edition). The modifications were developed by Joshua Wright and Brad Antoniewicz.

Installing hostapd-wpe:

To get this solution running on Kali 2, you first need to be sure you are using the rolling sources. At a minimum, you must add the following line to your /etc/apt/sources.list file if it is not already there:

deb http://http.kali.org/kali kali-rolling main contrib non-free

More details about the rolling sources can be found on the Kali docs website. My understanding is that the current recommendation is to move over to rolling repositories exclusively, but that decision is outside of the scope of this post.

If you had to make any changes to your sources, you will want to do a apt-get clean

Then to install hostapd-wpe you will want to do:

apt-get update
apt-get install hostapd-wpe

A sample configuration file will be produced at: /etc/hostapd-wpe/hostapd-wpe.conf. In most cases this file will require modifications before it can be used. Since this is a rogue AP used for a wireless assessment or pentesting engagement and not meant to be run as a service, it is easy enough to run it with a custom configuration file for the current engagement. So the easy way to manage this is to copy that file into an engagement working directory so that we have a record of the configuration used for the test. Then we simply edit the copy.

Verify your wireless interface:

Before we start editing the configuration file we should verify the name of our wireless interface. Typically this is wlan0 but if working with multiple cards it may be something else (e.g. wlan1, wlan2, etc…). You can use the iwconfig command to list wireless interfaces. If you don’t see any wireless interface listed, you may need to unplug and replug the USB adapter. This sometimes happens if running Kali inside a virtual machine.

Configuring hostapd-wpe:

The configuration file changes you will need to consider include:

  • interface=wlan0 Set this to your wireless interface, usually wlan0.
  • #driver=wired This is the default setting and must be commented out if using a wireless adapter (which is usually the case).
  • ssid=impersonated_ssid Uncomment and set this value to the SSID that is being impersonated.
  • hw_mode=g Uncomment and set to the value g for wireless g or n. Other values (e.g. a, b, ad) are possible. Ideally this should match the ap being impersonated.
  • channel=1 Uncomment and set to whichever channel you want to broadcast you ap. Often this is 1 or 6.
  • wpa=2 This should be set to 2 for wireless g, and 3 to support wireless n.
  • wpa_pairwise=TKIP CCMP This may need to be modified to match the ap being impersonated. Removing TKIP from the list is likely for modern configurations.

“Unmanage” your wireless adapter:

With the configuration file ready to go there is still one step left before we can turn on the server. By default Kali will probably have the NetworkManager service running, which is going to try to manage the state of our wireless interface for us. This makes it impossible to switch to AP mode, which is what we need. To address this, we can tell the NetworkManager service to ignore our device. This is done by modifying the /etc/NetworkManager/NetworkManager.conf file and adding the following section:


Note that the 00:aa:bb:cc:dd:ee should be the mac address of the ALFA. Multiple addresses can be specified if separated by a semicolon (i.e. ‘;’).

Once this change is made, unplug the USB, wait a few seconds, and plug it back in. The led on the ALFA should not be lit. The follow these steps:

  • Type iwconfig to verify that the device and interface was recognized.
  • Type ifconfig to verify that the interface is not up (it should not be listed).
  • Type the following command, replacing wlan0 with your interface: ip link set wlan0 up
  • Type ifconfig to verify that the interface is up (it should now be present). The led on the device should now be illuminated.

Start the rogue server:

If all of this works, you should be ready to go. Simply type:
hostapd-wpe ./hostapd-wpe.conf

Remember to replace ./hostapd-wpe.conf with the path to your custom configuration file.

You can test connecting to the rogue AP with any wireless device. Login will, of course, fail and you should get a certificate prompt, which is fine since most target users will click through and accept a bad cert. If all this passes you should start seeing stuff show up in the logs. A successfully collected credential will look something like:

mschapv2: Thu May 5 12:48:51 2016
username: test
    challenge: 35:30:33:52:07:d1:8c:78
    response: b8:53:4b:77:a5:a9:b2:ae:53:33:72:88:e4:d0:39:72:48:02:67:9b:b6:09:5f:c7
    jtr NETNTLM: test:$NETNTLM$3530335207d18c78$b8534b77a5a9b2ae53337288e4d039724802679bb6095fc7
wlan0: CTRL-EVENT-EAP-FAILURE 08:74:02:5d:de:86

The values from the challenge and response can then be fed into the asleap tool, also written by Joshua Wright and also present Kali 2.

Closing Notes:

If you are trying to do something that is not covered in this blog post, I would encourage you to take a look at the latest edition of Hacking Exposed Wireless, by Joshua Wright and Johnny Cache. That is where I found much of the information covered in this blog post.

Jason Gillam is a Principal Security Consultant with Secure Ideas. If you are in need of a penetration test or other security consulting services you can contact him at jgillam@secureideas.com, on Twitter @JGillam, or visit the Secure Ideas – ProfessionallyEvil site for services provided.


Whose Code Are You Running?

April 14th, 2016

One of my favorite ways to eat Oreo cookies is to twist the two halves apart, carefully set the filling aside, eat both chocolate halves, and then slowly enjoy the indulgent filling. Without milk, this is by far the best way to fully indulge in both parts of the cookie. But with a glass of milk the implementation changes. Not only is it harder to dunk the separate pieces, but the actual taste of the whole cookie soaked in milk seems much better than the sum of its parts.

In many organizations, Development and Security are two parts of a cookie. Individually they’ve both incredibly important, but too many miss the incredible combined experience. Often both sides hold fast to a false sense of superiority that would’ve made Dr. Seuss’ Sneetches proud.  In fact it’s very common for us to witness clashes between the two teams when it comes to penetration tests or discussing flaws.

When I was first introduced to information security, someone told me that developers focus on finding one way to make something work while security folks focus on finding all the possible ways that could break it. I don’t believe that’s fair. At the end of the day I think we’re all focused on making things better; we just come at it from different perspectives. Developers tend to focus on improving the experience of legitimate users while Security has the goal of preventing the experience of illegitimate users. Two parts of the same cookie you might say.

With this dualistic approach in mind, consider the recent fiasco surrounding the unpublished Kik module on the popular NPM JavaScript package manager. If you’re not familiar with the story, an angry open source developer, bitter over the loss of a module name (kik) to the company that owns the trademark, decided to unpublish all of his 273 published modules. Most of these were unimportant and unnoticed, but one, left-pad, was used extensively throughout the JavaScript world. NPM reported nearly 2.5 million downloads of left-pad in the month prior to this event.

If you’re not familiar with modern-day JavaScript development, it’s very common for libraries to have dependencies that require dependencies that require dependencies in a seemingly unending cascade of code. Each project is like a giant pyramid that only stands if each stone is placed in exactly the right spot. When the left-pad stone was removed, literally thousands of software projects came crashing down. Companies as large as Facebook, Netflix, and Spotify were affected, all because of a rather simple 11-line bit of missing code.

A plethora of blog posts and forum rants have since come out explaining and justifying the actions of each party to this exciting debacle. Like any good philosophical flame war, both sides of the debates have good points. But there is one angle that hasn’t been well covered. This whole situation was predicated on the accepted norm of using third party code, delivered via package managers, within commercial production applications.

Follow along with me for just a moment. This young man, Azer Koçulu, published open source code that was not only used by Fortune 500 companies, but was hosted by a third party package manager so that those commercial projects depended on the existence and maintenance of the hosted packages.

In this particular case, Mr. Koçulu simply unpublished the modules. But what if instead he had updated his modules to contain malicious code? What if he used something like the Browser Exploitation Framework or something worse that injected actual malware attacks into the pages serving his code? Such changes surely would’ve been detected quickly, but out of 2.5 million downloads in one month, how many of those sites would’ve been pushed to production or used in development before it was discovered? If combined with a targeted zero-day exploit, imagine the value of a bot-net that consists of developers and clients of some of the largest websites in the world.

Traditionally information security has been boiled down to a triad of key concepts: confidentiality, integrity, and availability. Though that simplistic breakdown is somewhat antiquated, it still serves the purpose of providing a reasonable understanding of the goals of security.  Infosec professionals are focused on improving these key areas rather than just saying “No” for the sake of some miserly power-trip. Unfortunately we don’t always do a good job of communicating in those terms.

This missing left-pad incident has demonstrated a situation in which developers across the world are suddenly reconsidering the impact to availability by depending on a third-party package manager like NPM for production code. The topics prompted by this even won’t go away anytime soon. However this experience should also cause us to question the impact on our systems’ integrity. If we allow third party code to be updated and integrated into an application without re-vetting the updates, how can we trust the integrity of the application or its data?  (spoiler: we can’t.)

The issue of malicious third party code isn’t unique to the NPM JavaScript package manager either. There’s a wide range of applications and systems that depend on third-party package managers to host and maintain code from a mind-boggling array of open source developers. Take Debian for example. The linux distribution has a very defined process for maintaining standards across package updates, but almost nothing is done to validate the security of the code in those packages. If a maintainer “goes rogue” and introduces malicious code, there are defined processes in place to handle the situation once detected, but nothing to catch it before it affects users.

The same could be said for app stores such as Google’s Play and Apple’s App Store. In each case, some degree of security review may take place, but there’s no way they can accurately review every line of each application for security issues. Many of us may be mindful of what applications we install, but we just assume that application updates are supposed to be safe.

Even if we had reason to trust certain developers or modules, we have no way to know that each update actually comes from the original developer. The cyber attack division of a nation-state could easily look for popular open source modules or applications that can be purchased from the owners. In some cases overworked owners may even just handover the reigns to a project if someone appears genuinely interested in seeing it maintained. Over time a very powerful arsenal could be built without anyone ever realizing it. When necessary, those packages could be weaponized and targeted and take advantage of our regimented patching schedules. By the time anyone realized what happened, it would be too late.

I’ll take off the conspiracy theory hat for a bit. I think it’s safe to assume that most developers are not the unknowing pawns of some malicious nation-state. But it’s important to realize that most security vulnerabilities are found by assuming the worst-case rather than the best-case.

So what do we do about it? To a large degree, there’s not much we can do. Our entire system has been built, literally from the hardware up, on the idea of trusting others. That’s bad enough for hardware, but when we move to software and its collaborative nature it becomes ridiculously unfeasible to even consider any sort of standardized security testing for every application patch or update, especially in the open source world.

In some cases, such as the NPM JavaScript modules, it may be reasonable to not allow dependencies on third party code, or to integrate a code review into all third-party libraries before use. But that would be difficult and often impractical to sustain.

For application updates from 3rd packages, I think we just have to recognize the threat and prepare appropriately. For example it should be assumed that a sufficiently devoted adversary is going to compromise a system. While we should take reasonable steps to prevent that from happening, our goal should be to monitor, detect, and respond to the intrusion before serious damage can be done. Building those probabilities into our threat models provides a more practical estimate of business risk assessments.

I don’t see third-party package managers, or the associated risks, going away anytime soon.  But we can all do a better job of understanding where our packages come from and who we’re trusting.

Nathan Sweaney is a Senior Security Consultant with Secure Ideas. If you are in need of a penetration test or other security consulting services you can contact him at nathan@secureideas.com, on Twitter @eternalsecurity, or visit the Secure Ideas – ProfessionallyEvil site for services provided.


Professionally Evil Insights: 2015

April 5th, 2016

Are you interested in knowing which vulnerabilities are the most commonly discovered in penetration tests?  How about which industries are doing the best (or worst) with improving on their security programs?  We pulled together all of our 2014 and 2015 findings, analyzed the results, and came up with some interesting (at least we think so) insights.  Welcome to our first ever findings report:

Professionally Evil Insights: 2015

Jason Gillam is a Principal Security Consultant with Secure Ideas. If you are in need of a penetration test or other security consulting services you can contact him at jgillam@secureideas.com, on Twitter @JGillam, or visit the Secure Ideas – ProfessionallyEvil site for services provided.


Reversing Type 7 Cisco Passwords

March 4th, 2016

While working on a recent pen test, I came across a few Cisco routers sitting on an internal network. The fact that they were using default cisco/cisco credentials made me cry a little inside, but wait, it gets worse… So I’m in the router, reviewing the running config, and I notice something interesting.

Screen Shot 2016-02-29 at 2.05.03 PM

Note that both of these accounts have the same privilege level, but that the passwords are stored differently. This is because the first user was created with a command like this:

Screen Shot 2016-03-01 at 4.48.44 PM

Whereas, the second user was created with this command:

Screen Shot 2016-03-01 at 4.49.11 PM

The difference between these two storage methods (password or secret) are the hashing algorithms. Type 7 passwords use a very weak algorithm that can be easily reversed, but the “secret” command utilizes a MD5 hash which is much more secure. Due to this, it is never a good idea to use Type 7 passwords. This policy applies to both user accounts and passwords applied to the VTY or Console lines.

So now that I’ve found these Type 7 passwords, I need a way to reverse them. There are several different tools and websites that have this capability, but there’s an easier way! I don’t even have to leave the router! Thanks to a nifty little feature called the “key chain”, I can reverse these passwords right here, right now!

1. First, we will enter config mode:

configure terminal

2. Next, we will create our key chain and give it the name of NEW:

key chain NEW

3. We will enter the first key:

key 1

4. Then we enter the key-string, which will include the number 7 for encryption type and the text of the “encrypted” password:

key-string 7 07212E587D062A0014000E18

* At this point, you may add more keys by repeating steps 3 and 4 if you have multiple passwords to reverse. Make sure to increase the key count though (key 2, key 3, etc.).

5. Finally, we do a show command, and voila! Passwords!

do show key chain

Now that you’ve seen how incredibly easy it is to reverse these types of passwords, please go forth and check your routers! Ensure that all user accounts and enable passwords listed in the running config are proceeded by the word “secret”.


Donna Fracarossi is a Security Consultant with Secure Ideas. If you are in need of a penetration test or other security consulting services you can contact her at donna@secureideas.com or visit the Secure Ideas – ProfessionallyEvil site for services provided.


We’re Just Like the NSA, and Nothing Like Them

February 11th, 2016

During penetration tests, and especially scoping calls, we often get quizzed about what secret, proprietary techniques we’ll use to gain access to privileged resources. Most folks assume they’re doing “good enough” or at least meeting “industry best practices” so only the latest, unknown attacks will be successful. The notorious ZeroDay always seems to take the top spot in many organizations’ threat matrix. Fortunately, that’s not realistic.

Last month Rob Joyce spoke at the Usenix Enigma conference in San Francisco. Rob is the head of the NSA’s Tailored Access Operations (TAO) hacking team. These guys are the American version of Mandiant’s APT1 in China. It’s their job to gain access to the systems of foreign nations. During his talk, Rob discussed how they go about their work, and lessons that businesses should learn from their experiences.

In several ways, their attack process is very similar to those of a good penetration test. Rob talked about the detailed reconnaissance phase in which they seek to know the network “better than the people running it.” Seeking out available information about the people, processes, & technologies in a network should be part of any good pen test. Part of that recon includes scanning the network, mapping out systems & services, looking for openings that may be exploitable.

“A lot of people think the nation states are running on this engine of zero days… There are so many more vectors that are easier, less risky, and more productive than going down that route.” Later he shared that “You know the technologies you intended to use in that network. We know the technologies that are actually in use in that network.” Similarly, in most of our pen tests, the issues that allow us to gain access are rarely a new fancy attack as opposed to chaining together common flaws that are often unknown to the organization. Rob shared that one required key to good security, and to defending against any attacker, is to know and understand your network and systems extremely well. He suggested common best practices such as regular scanning, penetration tests, and table top red teaming to discuss and familiarize yourself with every aspect of your network.

However there are a few critical differences between a TAO engagement and a standard penetration test that are important to realize. And understanding these differences is key to scoping out & receiving a good penetration test.  An attack by a nation state is an active, live-fire event; not an exercise. Conversely, a penetration test is an exercise designed to educate. So even though many of the techniques outlined and used by Rob’s team are similar, their purpose is not.

The first major difference is the scope of the engagement. Every penetration test has limitations on the scope of the assessment, many of which are are very reasonable. For example targeting the personal email accounts or home networks or employees during an education test is both illegal and unethical. Oftentimes though scope limitations are introduced for other reasons. Perhaps the business won’t accept the additional cost, or a compliance-driven test is focused only on checking a box on a form for auditors.  In most cases, the fewer restrictions placed on an assessment, the more successful it will ultimately be at painting a true picture of risk exposure.

A second key difference between an APT attack and a pen test is the amount of resources afforded for the assessment. Rob spoke of having copies of known software and experts in those systems that often know more about the technologies than the administrators themselves. Every firm and pen tester has a range of experiences and a network of colleagues that can be leaned on for support when attacking unfamiliar systems, but no private company can rival the checkbook of the U.S. government.  For this reason, we strongly recommend against black-box testing which is both impractical and ineffective. I mentioned previously that a pen-test is an educational opportunity that should provide as much benefit as possible to the organization. A black-box test inherently limits that transfer of knowledge. Alternatively nearly all of our tests are gray-box tests in which we utilize the existing resources of the organization to some degree in order to better assess security findings and associated risk. If you’re still approaching a pen test as a red-vs-blue contest, you’re doing it wrong.

The final issue is closely related. Rob discussing his team’s persistence (APT remember?)  “We’ll poke and we’ll poke and we’ll wait and we’ll wait and we’ll wait…,”  he shared. Eventually a hole will be introduced, maybe just for a short time during a maintenance window or while a vendor is fixing an issue. With nearly unlimited resources they can continue to scan and test and push until something changes. Most pen tests though rarely last more than a few weeks. However a good test can take these issues into account. A good tester can help you consider different variables and potential events and how those may effect deployed security controls. It may not be realistic to wait for an event to occur, but often a simulated situation can be used to explore potential risk. Again this falls back on the importance of an open gray-box test.

Ultimately, it’s important to understand the difference between advanced attackers and a penetration test. There are similarities, but also key differences.  If your testers aren’t able to have that conversation, give us a call.

Rob had a lot more great advice for businesses on how to secure their network. His 35 minute talk is definitely worth a listen. https://www.youtube.com/watch?v=bDJb8WOJYdA

Nathan Sweaney is a Senior Security Consultant with Secure Ideas. If you are in need of a penetration test or other security consulting services you can contact him at nathan@secureideas.com, on Twitter @eternalsecurity, or visit the Secure Ideas – ProfessionallyEvil site for services provided.


Red Teaming – Not What You May Have Thought

January 27th, 2016

Lately, I’ve been doing a lot of reading on some less technical topics and I ran across “Red Team: How to Succeed By Thinking Like the Enemy” by Micah Zenko.  If you are like me, you’ve probably thought of the red team as being a penetration test group or some kind of adversary simulation.  You know, red teams are the pretend bad guys and blue teams are the good guys defending against them.  Reading Micah’s book altered my view of what red teaming is.  I learned about a world of non-technical red teaming and how that can be applied to our organizations.

Credit: www.redteamjournal.com

Credit: www.redteamjournal.com

At its core, red teaming is the idea that we are going to look at things critically and with an eye towards an alternative point of view.  Conventional thought may lead you to believe that if you do X, then Y will be the result(s).  Because everyone believes this to be true, organizations make plans based on it and really don’t challenge it much.  A generic example may be “if we buy advertising, we will make more sales.”  Red teaming this would question that point of view and may come up with alternative results based on following questions through the process.  Questions like this may be asked:

  • What if buying advertising doesn’t result in enough sales to justify the expense?
  • What if buying ads in this particular format or delivery mechanism turns potential customers off?
  • What if the desired revenue level is never reached?  What impact will that have on our future plans?

In the world of cybersecurity and penetration testing, this could look something similar to the following:

IT says…

  • This server (or service) isn’t really important so we don’t need to worry about patching it yet.
  • We’ve got a SIEM and it will let us know if anything important is happening.
  • Our firewall rules are effective at preventing an attacker from moving through the network.

The red team asks…

  • What if that unimportant server has an important account logging into it?  What access could that give us?
  • What if that unimportant server has different network restrictions in place and being on this system would give us access to more important systems that I can’t get to right now?
  • When would the SIEM alert you and would it be in enough time?  Would anyone even read the alerts and how would they respond?

The list of What Ifs can go on and on.  In penetration testing, we would then start testing these scenarios to see what would happen.  We want to determine what the impact to the organization could be if an attacker ran a string of these What Ifs together and would they be able to get access to the victim’s secret sauce.  And we want to verify that controls are effective and perform as we expect.

I believe that there is value in taking in some of the perspectives and techniques that red teaming employs.  We don’t have to do a full penetration test or red team exercise (though these are useful) to start getting some benefit from this discipline.  Simply sitting down with a few other people and questioning the assumptions or understandings that are being used in projects can be very helpful.  The possible results at the end of these scenarios may not actually occur, but a number of the questions and answers that will be encountered during the process can spot risks that we may not have ever noticed.  We can then take steps to minimize the impact of these risks or the likelihood of them ever occurring.  We can be better prepared to respond if the unlikely suddenly becomes reality because we have at least thought through it before hand and kicked around how we could respond.

I’d recommend reading or listening to Micah’s book.  I enjoyed listening to it quite a bit and I learned a lot.  I’d also recommend looking at other resources for red teaming.  I ran into the Red Team Journal as a result of Micah’s book and found some of the things there to be very thought provoking.

Jason Wood is a Principal Security Consultant with Secure Ideas. If you are in need of a penetration test or other security consulting services you can contact him at jason@secureideas.com, on Twitter @Jason_Wood, or visit the Secure Ideas – ProfessionallyEvil site for services provided.