Earlier this week we had an internal presentation on Attacking ActiveX Controls. The main reason we had it is because of the ridiculously high hit rate we have whenever we look at controls with a slight security bent.. When building the presentation i dug up an old advisory we never publicly released (obviously we reported it to the vendor who (kinda) promptly fixed the bug (without giving us any credit at all, but hey.. )) While the IEBlog promises updates to IE8 that will minimize the damage caused by owned controls in the future, the fundamental problems with ActiveX today are an attackers dream.
The Background:
The Juniper SSL-VPN products make use of an ActiveX Control on the client-side. Previously bugs had been found in the control by eEye and had been subsequently fixed by Juniper. This was a pretty garden variety stack smash and it would appear that Juniper did the right thing and hunted down other instances of these bugs within the control.
The Bug(s):
The ActiveX control included the functionality to upgrade itself if the server informed it of a new software version. By simply instantiating the control and passing it a high build number and a URL path to a downloadable file, we could cause the client to download our (possibly malicious) file.
![]()
The kicker though.. was that this file was not deleted, and was always downloaded to a predictable spot. (C:\predictable_location)
Interlude: Now.. the usual attack vectors dont really come through for us.. We cant over-write anything important with this file and simply filling the disk seems pointless.
Bug (Continues):
When instantiating the control, one of the parameters we can pass is the path to the control's .ini configuration file:
![]()
Now, in case you dont see it, the config file above has the winning line: UninstallString="calc.exe &&"
So.. the writing is on the wall and the full process is this:
Ok.. so the simple deal is.. that much like the eEye find, client visits page and client gets arb. code executed on his machine, but (and this was the point of this whole rant) bugs like this have always been considered "less sexy" than stack smashes. Whats far more important for me however, is that even if our static analysis tools get to the state where they match their marketing hype, they will never find a bug like this..
There are some things that computers are good at, and some things that humans are.. and just because we want this to be a problem thats solvable with technology doesnt mean that the technology to do it will ever exist. This obviously does not mean that such tools are useless, just that they will never be a silver bullet, and that its still difficult to beat a trained set of eyes with high criminal energy..
/mh
It's because it's not a man vs. machine problem, but a man vs. man problem :)
http://www.microsoft.com/downloads/details.aspx?FamilyID=43cd7e1e-5719-45c0-88d9-ec9ea7fefbcb&displaylang=en
"If you think that technology can solve your problems, you do not understand the problem and you do not understand the technology".
Carbon Units still have the edge.
which happens to look like their company's corporate web site, there are about 10 thousand other things you could do, like prompt them to download "Upgrades" to any of the hundreds of binaries installed on their machines, and backdoor them in countless ways. The only difference here being the VPN client appears to need a real upgrade, and so it appears more _plausible_ to the end user. Reality check: if you've got this far along in your attack (you're mitm-ing someone or !
they click on your link) where you'd consider using this "vulnerability", don't. Shoot yourself in the face. As a bad guy, this vuln makes you work HARDER to own the victim's box: Say you use this vuln. Now what? Do you think Sally in HR has nc.exe on her box? What are you going to do? "del *.* /s"? At least if you convince someone to simply download your "Adobe Acrobat" upgrade you can outright own their box in a single HTTP GET/double click. Haroon, you're an intelligent person and much better t
han this.
Maybe my explanation was not clear enough (for this i apologize).
a) i can download _any_ file to your machine
b) i download malware nc.exe, nc2.exe and nc3.exe for good measure
c) i download bad config file
d) then i use config file to do what i want..
Three more things..
a) All of this happens behind the scenes.. so the user doesnt have to click on anything / accept anything or be fooled by anything.. i.e. this can be an iframe within a popular reddit article to be mass owning people..
b) i think u underplay the value of being able to run a single command on Sallys box.. even just a net use \\me will be useful to steal her hash, that might prove useful elsewhere..
c) i never said this was a libtiff / slidingwindow style broken internet vulnerability.. i just thought it was cute..
Thanks for the comments though, and for not thinking me a complete monkey like my wife does :>
yeah.. the downloads are not done regular download style.. its the control fetching it and storing it on ur machine without u noticing anything at all.. thanks for writing in.. the feedback is always cool..
The same goes for SSL - the activex can make sure a site invoking it has a valid SSL cert, but hard coding a specific SSL cert would not be scalable (every customer has their own).
Microsoft IAG makes their SSL VPN users white-list the site instantiating the ActiveX upon first use. Seems like the best solution I've seen so far...
further reading: <a href="http://blog.phishme.com/2008/05/owning-the-mobile-workforce-blackhat-2008/" rel="nofollow">http://blog.phishme.com/2008/05/owning-the-mobile-workforce-blackhat-2008/</a>.
-schmoilito
A command is being executed based on tainted data (data from a file who's name is attacker controlled). There is nothing particularly special here that would stop static analysis from finding it. The challenge for static analysis would not be to find this bug, but to weed out false positives related to sanitisation of your tainted data, which is the problem static analysis faces for all bug classes that are considered identifiable by static anlysis.
I confess to not following the latest techniques in static analysis and so will likely have missed something. The point Haroon was making is that proof of exploitability for this bug would be hard to produce for static analysis rather than whether any single contributing factor could be identified. There are three contributing features/bugs that makeup the exploit:
1. Arbitrary download to a predictable location
2. Instantiation with an attacker-specified .ini
3. Uninstall feature in .ini
Static analysis should (would?) discover at least 3, and possibly 2 or even 1, however piecing them together to prove remote code exec seems unlikely. If the above are flagged then, as you point out, there is a good chance they're flagged as low or get lost in the noise as, for example, issue 2 is a pure feature and any check that flags this would also flag every other input point into the control.
However, as mentioned, static analysis is not my strong point. What would you consider to be the state of the art in terms of static analysis, so we can test this?
a) SMB means we always have files at predictable locations on a user's machine - you have be abel to specify the full path, but this is often possible
b) The browser environment has tonnes of ways to drop files at predictable locations
So being able to control files at predictable locations should be in your attack model even without a vulnerability in the specific control.
.: static analysis does not need to find issue #1
In my mind, Issues 2 and 3 are not the actual bugs, the existance of an uninstall feature is not the bug (but could be a DoS bug that static analysis cannot find), the real bug is that you can control the data in a call to system() or similar.
However, I don't know anything about the product space for static analysis, I can simply see that this bug doesn't hit any of the real limitations of static analysis.
A simple thought exercise is, could you write an algorithm that identified a bug in some code like this:
a=open(user data)
b=read(a, some location, some length)
system(b)
And I think your answer would be an easy yes. And that pseudocode snippet is the essence of the bug.
Of course the real bug might not be found by static analysis due to there being other issues that static analysis cannot really grapple with well atm (eg self modifying code, lol), but I just wanted to say that theoretically the bug in this post is not outside the realm of what static analysis can find
While it is reasonable for a static analyser to assume that files can be predictably placed when considering a generic attack model, having this "feature" as part of the exploit undeniably raises the immediacy of the exploit. But I take your point about introducing assumptions into the attack model. Of course, this implies that any application that calls execv(/some/path) is also flagged (consider a standalone client or some ActiveX control that launch apps). At this point one might reply with "file dropping is a specific issue in browsers and hence ActiveX, and can be ignored for standalone apps", but suddenly the attack model isn't so clear and we'd need to provide hints to the static analyser. And hints suggest the process is not so straightforward.
Agreed, issues 2 and 3 aren't strict bugs which is why I refer to "features/bugs". However they are needed for the full exploit to work, and therein lies the difficulty for static analysis since they're not clear faults in the application. Consider the sample code in your thought exercise. "user data" could refer not only to file contents, but registry entries, DOM elements (since we have to include XSS in our attack models due to its prevalence) or RPC calls (mitm is an ever present threat). At the same time, system() is not the only dangerous call we need to protect against. Unfortunately my static analysis knowledge falls down here and I can't estimate the number of calls considered dangerous, however I'm going to assume it's a bunch. The Cartesian product of multiple srcs of user input and unsafe functions means many many potential findings. Lot's of user-originated data winds up in unsafe calls; the trick is determining whether it's been sanitised and that's non-trivial for static analysis. If you assume all data is unsanitised, then you get flooded with false positives and the actual issues get lost in the noise. The theory of taint analysis is simple, but its implementation is devilishly difficult.
Returning to the exploit above, I have no doubt that an analyser could be written that looks for this specific issue. However, like many algorithms, the problem is in generalising and not optimising on individual cases too early. Static analysis should detect the above issue in such a way that it's useful; I'd argue that flagging the issue in a sea of false positives is equivalent to a false negative, from a user's perspective.
(I'm hoping Haroon will drop into the discussion shortly, he's aware of it and can provide more insight)
I agree that theoretically the bug is findable, if we agree that theoretically all bugs are findable.
kuza55 said:
> However, I don't know anything about the product space for static analysis, I can simply see that this bug doesn't hit any of the real limitations of static analysis.
I think a fundamental limit of static analysis has been identified in previous posts: If we manage to generalize a check for some issues, we drown in false positives.
For taint tracking to have a chance, the dev/tester will need a good understanding of what truly is tainted to begin with. In this case, i always got the feeling that they never considered we would be able to pass it a controlled ini to begin with. (i certainly dont think they thought it could be done remotely)
Having said all of this, i guess the topic would have been better written as "bugs your static analyzer are unlikely to find" instead of "bugs your static analyzer will never find"
/mh