SlideShare a Scribd company logo
Using Guided Missiles in Drive­bys
                    Automatic browser 
                    fingerprinting and 
                    exploitation with the 
                    Metasploit Framework: 
                    Browser Autopwn




                        James Lee
Browser Autopwn
●   Auxiliary module for the Metasploit Framework
●   Fingerprints a client
●   Determines what exploits might work
●   Used to suck
●   Now it doesn't




2
Outline
●   Intro
●   Cluster bombs
●   Guided missiles
    ●   Fingerprinting and targeting
●   Stealth
●   Demos
●   Commercial comparison

3
# whoami
    ●   James Lee
    ●   egypt 
    ●   Co­Founder, Teardrop Security
    ●   Developer, Metasploit Project




4
My Involvement in MSF
●   Started submitting patches and bug reports in 
    2007
●   HD gave me commit access in April 2008
    ●   Broke the repo April 2008




5
The Metasploit Framework
    ●   Created by HD Moore in 2003
        ●   ncurses based game
        ●   Later became a real exploit framework in perl
    ●   Rewritten in ruby in 2005
        ●   Which is way better than python
    ●   Extensible framework for writing exploits



6
I <3 MSF
●   Modular payloads and encoders
●   Many protocols already implemented
●   Many non­exploit tools
●   All kinds of exploits
    ●   Traditional server­side
    ●   Client­sides



7
Why Clientsides
    ●   Karmetasploit 
    ●   Any other tool that gets you in the middle
    ●   Users are weakest link, blah, blah, blah
    ●   See Chris Gates




8
Client Exploits in MSF
    ●   Extensive HTTP support
        ●   Heapspray in two lines of code
        ●   Sotirov's .NET DLL, heap feng shui
    ●   Wide range of protocol­level IDS evasion
    ●   Simple exploit in ~10 lines of code




9
Simple Exploit
content = “<html><body>
<object id='obj' classid='...'></object><script>
#{js_heap_spray}
sprayHeap(#{payload.encoded}, #{target.ret}, 0x4000);
obj.VulnMethod(#{[target.ret].pack(“V”)*1000});
</script></body></html>“

send_response(client, content)




10
Or Arbitrarily Complex
 ●   ani_loadimage_chunksize is 581 lines of code
 ●   As of June 28, MSF has 85 browser exploit 
      modules




11
Problem
Solution
Cluster Bomb Approach
 ●   Is it IE?  Send all the IE sploits
 ●   Is it FF?  Send all the FF sploits
 ●   Originally exploits were ad­hoc
     ●   Pain in the ass when new sploits come out




14
Problem
Solution
Guided Missile Approach
 ●   Better client and OS fingerprinting
     ●   less likely to crash or hang the browser
 ●   Only send exploits likely to succeed
     ●   Browser is IE7? Don't send IE6 sploits, etc.




17
Fingerprinting the Client
●    User Agent
     ●   Easy to spoof
     ●   Easy to change in a 
         proxy
     ●   A tiny bit harder to 
         change in JS




18
Fingerprinting the Client
●    Various JS objects only exist in one browser
     ●   window.opera, Array.every
●    Some only exist in certain versions
     ●   window.createPopup, Array.every, window.Iterator
●    Rendering differences and parser bugs
     ●   IE's conditional comments



19
Internet Explorer
●    Parser bugs, conditional comments
     ●   Reliable, but not precise
●    ScriptEngine*Version()
     ●   Almost unique across all combinations of client and 
         OS
     ●   Brought to my attention by Jerome Athias




20
Opera
●    window.opera.version()
     ●   Includes minor version, e.g. “9.61”




21
Hybrid Approach for FF
●    Existence of 
     document.getElementsByClassName
     means Firefox 3.0
●    If User Agent says IE6, go with FF 3.0
●    If UA says FF 3.0.8, it's probably not lying, so 
     use the more specific value



22
Safari
●    Still in progress
●    Existence of window.console
     ●   If Firebug is installed on FF, shows up there, too
●    Availability of window.onmousewheel
     ●   Defaults to null, so have to check typeof




23
Fingerprinting the OS
●    User Agent
●    Could use something like p0f
●    From the server side, that's about it




24
Internet Explorer
●    Again, ScriptEngine*Version()
●    Almost unique across all combinations of client 
     and OS, including service pack




25
Opera
●    Each build has a unique opera.buildNumber()
●    Gives platform, but nothing else




26
Firefox
●    navigator.platform and friends are affected by 
     the User Agent string
●    navigator.oscpu isn't
     ●   “Linux i686”
     ●   “Windows NT 6.0”




27
Others
●    Really all we're left with is the User Agent
●    That's okay, most don't lie
     ●   And those that do are likely to be patched anyway
●    Generic, works everywhere when UA is not 
     spoofed




28
Future Fingerprinting
●    QuickTime
●    Adobe
●    Less well­known third party stuff




29
ActiveX
●    “new ActiveXObject()” works if you have 
     the class name
●    Otherwise, IE doesn't seem to have a generic 
     way to tell if an ActiveX object got created 
     ●   document.write(“<object ...>”)
     ●   document.createElement(“object”)




30
Solution
●    typeof(obj.method)
     ●   'undefined' if the object failed to initialize
     ●   'unknown' or possibly a real type if it worked




31
Target Acquired
What is it Vulnerable to?
●    Coarse determination server­side
     ●   JavaScript builds fingerprint, sends it back to the 
         server
     ●   Server sends sploits that match the browser and 
         OS, possibly version
●    Fine determination client­side
     ●   navigator.javaEnabled exists, try 
         mozilla_navigatorjava


33
Select a Missile
●   Sort by reliability
●   Exploits contain 
    their own JS tests
Problem
Solution




36
Obfuscation
●    Randomize identifiers
●    Build strings from other things
●    JSON / AJAX
●    Obfuscation is not crypto




37
Encryption
●    Put a key in the URL
     ●   Not available in the stand­alone script
●    Simple XOR is enough to beat AV and NIDS
●    If they figure it out, it's easy to make the crypto 
     stronger




38
Demonstrations




39
And we're back...
●    I hope that worked
●    Now how do YOU make exploits work within 
     this framework?




40
Writing Exploits
●    Add autopwn_info() to top of exploit class
●    :ua_name is an array of browsers this exploit 
     will work against
●    :vuln_test is some javascript to test for the 
     vulnerability (unless it's ActiveX)
     ●   Usually comes directly from the exploit anyway




41
Example: mozilla_navigatorjava
    include Msf::Exploit::Remote::BrowserAutopwn
    autopwn_info({
        :ua_name    => HttpClients::FF,
        :javascript => true,
        :rank       => NormalRanking,#reliable memory corruption
        :vuln_test  => %Q|
            if ( 
               window.navigator.javaEnabled && 
               window.navigator.javaEnabled()
            ){
                is_vuln = true;
            }
            |,
    })



   42
Example: ms06_067_keyframe

    include Msf::Exploit::Remote::BrowserAutopwn
    autopwn_info({
        :ua_name    => HttpClients::IE,
        :javascript => true,
        :os_name    => OperatingSystems::WINDOWS,
        :vuln_test  => 'KeyFrame',
        :classid    => 'DirectAnimation.PathControl',
        :rank       => NormalRanking #reliable memory corruption
    })




   43
Example: winzip_fileview

    include Msf::Exploit::Remote::BrowserAutopwn
    autopwn_info({
        :ua_name    => HttpClients::IE,
        :javascript => true,
        :os_name    => OperatingSystems::WINDOWS,
        :vuln_test  => 'CreateFolderFromName',
        :classid    => '{A09AE68F­B14D­43ED­B713­BA413F034904}',
        :rank       => NormalRanking #reliable memory corruption
    })




   44
Browser Autopwn Summary
●    Reliable Target Acquisition
●    Smart Missile Selection
●    Stealthy from an AV perspective
●    Easy to extend
●    Detection results stored in a database




45
Commercial Comparison
●    Mpack
●    Firepack
●    Neosploit
●    Luckysploit




46
Mpack, Firepack
●    Hard to acquire
●    Old exploits
●    Detection is only server­side
●    Hard to change or update exploits
●    Obfuscation + XOR




47
Neosploit
●    Compiled ELFs run as CGI
●    Unless you get the source or do some RE, you 
     won't really know what it does




48
Luckysploit
●    Real crypto (RSA, RC4)
●    Even harder to acquire




49
Browser Autopwn
●    Easy to write new exploits or take out old ones
●    Free (three­clause BSD license)
●    Easy to get (http://metasploit.com)
●    Not written in PHP 
●    OS and client detection is client­side, more 
     reliable in presence of spoofed or borked UA


50
Future
●    More flexible payload selection
●    Stop when you get a shell
     ●   Maybe impossible in presence of NAT/proxies
●    Easier­to­use JS obfuscation
●    UAProf for mobile devices
●    Integration with MetaPhish


51
Download it
●    svn co http://metasploit.com/svn/framework3/trunk 
●    Submit patches to msfdev@metasploit.com




52
Thanks
●   hdm, valsmith, 
    tebo, mc, cg, Dean 
    de Beer, pragmatk
●   Everybody who 
    helped with testing
●   Whoever created 
    ActiveX

More Related Content

PDF
WAF protections and bypass resources
PDF
Pentester++
PDF
Understand study
PDF
Static analysis for beginners
PDF
A Battle Against the Industry - Beating Antivirus for Meterpreter and More
PPTX
An overview of node.js
PPTX
The Veil-Framework
PDF
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000
WAF protections and bypass resources
Pentester++
Understand study
Static analysis for beginners
A Battle Against the Industry - Beating Antivirus for Meterpreter and More
An overview of node.js
The Veil-Framework
Windows 10 - Endpoint Security Improvements and the Implant Since Windows 2000

What's hot (20)

PDF
Raptor web application firewall
PDF
AntiVirus Evasion Reconstructed - Veil 3.0
PDF
The Supporting Role of Antivirus Evasion while Persisting
PDF
Higher Level Malware
PPTX
PDF
The Listening: Email Client Backdoor
PPTX
Hacking - Breaking Into It
PDF
The Art of AV Evasion - Or Lack Thereof
PDF
Масштабируемый и эффективный фаззинг Google Chrome
PPTX
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
PDF
Don't Give Credit: Hacking Arcade Machines
PDF
Bringing Down the House - How One Python Script Ruled Over AntiVirus
PDF
An EyeWitness View into your Network
PDF
[UniteKorea2013] Protecting your Android content
PDF
Selenium camp v1
PDF
Php unit (eng)
PPTX
Java Exploit Analysis .
PDF
Passive Intelligence Gathering and Analytics - It's All Just Metadata!
PDF
Android Attacks
Raptor web application firewall
AntiVirus Evasion Reconstructed - Veil 3.0
The Supporting Role of Antivirus Evasion while Persisting
Higher Level Malware
The Listening: Email Client Backdoor
Hacking - Breaking Into It
The Art of AV Evasion - Or Lack Thereof
Масштабируемый и эффективный фаззинг Google Chrome
Patching Windows Executables with the Backdoor Factory | DerbyCon 2013
Don't Give Credit: Hacking Arcade Machines
Bringing Down the House - How One Python Script Ruled Over AntiVirus
An EyeWitness View into your Network
[UniteKorea2013] Protecting your Android content
Selenium camp v1
Php unit (eng)
Java Exploit Analysis .
Passive Intelligence Gathering and Analytics - It's All Just Metadata!
Android Attacks
Ad

Similar to Using Guided Missiles in Drive-bys: Automatic Browser Fingerprinting and Exploitation with the Metasploit Framework's Browser Autopwn (20)

PDF
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
PDF
Black hat dc-2010-egypt-uav-slides
PDF
Dan Guido SOURCE Boston 2011
PDF
Thug: a new low-interaction honeyclient
PDF
Metasploitation part-1 (murtuja)
PDF
24 33 -_metasploit
PDF
01 Metasploit kung fu introduction
PPTX
Cross Context Scripting attacks & exploitation
PDF
Defcon 20-zulla-improving-web-vulnerability-scanning
PDF
Defcon 20-zulla-improving-web-vulnerability-scanning
PPTX
Finalppt metasploit
PDF
Window Shopping Browser - Bug Hunting in 2012
PDF
CNIT 129S: Ch 5: Bypassing Client-Side Controls
PPT
gofortution
PPTX
Metasploit (Module-1) - Getting Started With Metasploit
PPTX
2013 Security Threat Report Presentation
PDF
Open Source Cyber Weaponry
PPT
Ch10 Hacking Web Servers http://ouo.io/2Bt7X
PDF
Metasploit Basics
PDF
Toorcon Seattle 2011 - Browser Exploit Packs
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Black hat dc-2010-egypt-uav-slides
Dan Guido SOURCE Boston 2011
Thug: a new low-interaction honeyclient
Metasploitation part-1 (murtuja)
24 33 -_metasploit
01 Metasploit kung fu introduction
Cross Context Scripting attacks & exploitation
Defcon 20-zulla-improving-web-vulnerability-scanning
Defcon 20-zulla-improving-web-vulnerability-scanning
Finalppt metasploit
Window Shopping Browser - Bug Hunting in 2012
CNIT 129S: Ch 5: Bypassing Client-Side Controls
gofortution
Metasploit (Module-1) - Getting Started With Metasploit
2013 Security Threat Report Presentation
Open Source Cyber Weaponry
Ch10 Hacking Web Servers http://ouo.io/2Bt7X
Metasploit Basics
Toorcon Seattle 2011 - Browser Exploit Packs
Ad

More from egypt (11)

PPTX
Privilege Escalation with Metasploit
PDF
The State of the Metasploit Framework.pdf
PDF
New Shiny in the Metasploit Framework
PDF
Open Source, Security, and Open Source Security.pdf
PPTX
Authenticated Code Execution by Design.pptx
PDF
One-Liners to Rule Them All
PDF
Offensive Security with Metasploit
PDF
Shiny
PDF
already-0wned
PDF
Post Metasploitation
PDF
State of the Framework Address: Recent Developments in the Metasploit Framework
Privilege Escalation with Metasploit
The State of the Metasploit Framework.pdf
New Shiny in the Metasploit Framework
Open Source, Security, and Open Source Security.pdf
Authenticated Code Execution by Design.pptx
One-Liners to Rule Them All
Offensive Security with Metasploit
Shiny
already-0wned
Post Metasploitation
State of the Framework Address: Recent Developments in the Metasploit Framework

Recently uploaded (20)

PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Electronic commerce courselecture one. Pdf
PDF
cuic standard and advanced reporting.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Cloud computing and distributed systems.
PDF
KodekX | Application Modernization Development
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPT
Teaching material agriculture food technology
PPTX
Understanding_Digital_Forensics_Presentation.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Unlocking AI with Model Context Protocol (MCP)
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Reach Out and Touch Someone: Haptics and Empathic Computing
Electronic commerce courselecture one. Pdf
cuic standard and advanced reporting.pdf
MYSQL Presentation for SQL database connectivity
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Advanced methodologies resolving dimensionality complications for autism neur...
The AUB Centre for AI in Media Proposal.docx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Per capita expenditure prediction using model stacking based on satellite ima...
Cloud computing and distributed systems.
KodekX | Application Modernization Development
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Teaching material agriculture food technology
Understanding_Digital_Forensics_Presentation.pptx

Using Guided Missiles in Drive-bys: Automatic Browser Fingerprinting and Exploitation with the Metasploit Framework's Browser Autopwn