informa
/
Risk
Commentary

BeEF: XSS Vuln To Hack In Less Than 20 Characters

As I'm finishing another successful Web application penetration test, I'm kicking myself for not noticing a new release of one of my all-time favorite Web hacking tools, the Browser Exploitation Framework (BeEF). BeEFis a fantastic tool for getting across to developers and Web admins the seriousness of vulnerabilities like cross-site scripting (XSS).
As I'm finishing another successful Web application penetration test, I'm kicking myself for not noticing a new release of one of my all-time favorite Web hacking tools, the Browser Exploitation Framework (BeEF). BeEFis a fantastic tool for getting across to developers and Web admins the seriousness of vulnerabilities like cross-site scripting (XSS).There is a blurred line between a Web application vulnerability assessment and a Web application penetration test. The former focuses on identifying vulnerabilities, while the latter attempts to exploit the vulnerabilities in order to gain access to sensitive information, compromise users of the site, or take control of the Web server. The reason for the blurring is that to determine whether a vulnerability exists in a Web app, you have to exploit it.

A perfect example of this is XSS and BeEF. To find out if a Web application is vulnerable to XSS, a pen tester (or attacker) will usually insert a JavaScript alert statement into a search field. If the returned page results in a pop-up alert box, then the Web app is vulnerable. An alert box is pretty harmless, so using the alert method as an example during a meeting with the client elicits very little alarm.

Now for BeEF: Take the same scenario and, instead of a JavaScript alert statement, insert a script tag that includes the source tag pointing to your Web server where BeEF is installed (it's a PHP application that requires very little initial configuration). As soon as a client browses to the page you've attacked, BLAM! -- they are hooked and now a zombie under your control within the BeEF Web interface.

While this is a very simple example, it illustrates the fine line between determining whether a Web vulnerability exists, and exploiting it to take control of a user's Web browser. SQL injection is another vulnerability where the same blurriness exists. Inputting a single quote in a login field could cause the back-end SQL query to error out, while adding a few hyphens, ones, and equals sign means you could slip right past the authentication.

Meantime, BeEF is a wonderful tool, and the latest version adds some awesome features, including integration with the Metasploit Framework, the ability to exploit extensions in Mozilla, better detection of the victim's browser, and tiered logging (so report writing is a little easier because you know exactly what happened). If you haven't used it before, then take a look -- it's a seriously powerful tool and should be part of any Web app pen tester's toolkit.

John H. Sawyer is a senior security engineer on the IT Security Team at the University of Florida. The views and opinions expressed in this blog are his own and do not represent the views and opinions of the UF IT Security Team or the University of Florida. When John's not fighting flaming, malware-infested machines or performing autopsies on blitzed boxes, he can usually be found hanging with his family, bouncing a baby on one knee and balancing a laptop on the other. Special to Dark Reading.

Recommended Reading:
Editors' Choice
Kirsten Powell, Senior Manager for Security & Risk Management at Adobe
Joshua Goldfarb, Director of Product Management at F5