Towards More Security in Data Exchange



Similar documents
Acunetix Website Audit. 5 November, Developer Report. Generated by Acunetix WVS Reporter (v8.0 Build )

Check list for web developers

Cross Site Scripting Prevention

What about MongoDB? can req.body.input 0; var date = new Date(); do {curdate = new Date();} while(curdate-date<10000)

Cross Site Scripting (XSS) and PHP Security. Anthony Ferrara NYPHP and OWASP Security Series June 30, 2011

Webapps Vulnerability Report

Magento Security and Vulnerabilities. Roman Stepanov

HTTPParameter Pollution. ChrysostomosDaniel

Protection, Usability and Improvements in Reflected XSS Filters

Finding Your Way in Testing Jungle. A Learning Approach to Web Security Testing.

Creating Stronger, Safer, Web Facing Code. JPL IT Security Mary Rivera June 17, 2011

Adobe Systems Incorporated

CSE598i - Web 2.0 Security OWASP Top 10: The Ten Most Critical Web Application Security Vulnerabilities

A Tale of the Weaknesses of Current Client-Side XSS Filtering

Web Application Security

Blackbox Reversing of XSS Filters

Client vs. Server Implementations of Mitigating XSS Security Threats on Web Applications

RIPS - A static source code analyser for vulnerabilities in PHP scripts

A Tale of the Weaknesses of Current Client-side XSS Filtering

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

Information Supplement: Requirement 6.6 Code Reviews and Application Firewalls Clarified

elearning for Secure Application Development

Bypassing Web Application Firewalls (WAFs) Ing. Pavol Lupták, CISSP, CEH Lead Security Consultant

An Empirical Analysis of XSS Sanitization in Web Application Frameworks

Hack-proof Your Drupal App. Key Habits of Secure Drupal Coding

External Vulnerability Assessment. -Technical Summary- ABC ORGANIZATION

Ecma/TC39/2013/NN. 4 th Draft ECMA-XXX. 1 st Edition / July The JSON Data Interchange Format. Reference number ECMA-123:2009

Detecting Web Application Vulnerabilities Using Open Source Means. OWASP 3rd Free / Libre / Open Source Software (FLOSS) Conference 27/5/2008

Understanding Cross Site Scripting

How To Protect A Web Application From Attack From A Trusted Environment

Everyday Lessons from Rakudo Architecture. Jonathan Worthington

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

Criteria for web application security check. Version

EVALUATING COMMERCIAL WEB APPLICATION SECURITY. By Aaron Parke

How To Fix A Web Application Security Vulnerability

A Multi agent Scanner to Detect Stored XSS Vulnerabilities

The Top Web Application Attacks: Are you vulnerable?

Textual Modeling Languages

How to Improve Database Connectivity With the Data Tools Platform. John Graham (Sybase Data Tooling) Brian Payton (IBM Information Management)

XSS-GUARD : Precise Dynamic Prevention of Cross Site Scripting (XSS) Attacks

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

Secure Coding. External App Integrations. Tim Bach Product Security Engineer salesforce.com. Astha Singhal Product Security Engineer salesforce.

What is Web Security? Motivation

Project 2: Web Security Pitfalls

Enterprise Security API (ESAPI) Java Java User Group San Antonio. Jarret Raim June 3 rd, 2010

General principles and architecture of Adlib and Adlib API. Petra Otten Manager Customer Support

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

RIPS - A static source code analyser for vulnerabilities in PHP scripts

Excellence Doesn t Need a Certificate. Be an. Believe in You AMIGOSEC Consulting Private Limited

Performance Testing for Ajax Applications

Gateway Apps - Security Summary SECURITY SUMMARY

Web Application Security

Robust Defence against XSS through Context Free Grammar

Document Structure Integrity: A Robust Basis for Cross-Site Scripting Defense

The purpose of this report is to educate our prospective clients about capabilities of Hackers Locked.

Strategic Information Security. Attacking and Defending Web Services

Application Security Testing. Erez Metula (CISSP), Founder Application Security Expert

Live Hacking. Threats & Countermeasures in Action (SEC411) Ofer Maor CTO Hacktics Ltd.

Systematically Enhancing Black-Box Web Vulnerability Scanners

Sitefinity Security and Best Practices

Web Application Security

Web Application Guidelines

Institutionen för datavetenskap

Building & Measuring Security in Web Applications. Fabio Cerullo Cycubix Limited 30 May Belfast

Detecting and Exploiting XSS with Xenotix XSS Exploit Framework

Universal XSS via IE8s XSS Filters

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

Java Program Vulnerabilities

Agenda. SQL Injection Impact in the Real World Attack Scenario (1) CHAPTER 8 SQL Injection

Threat Modeling. Categorizing the nature and severity of system vulnerabilities. John B. Dickson, CISSP

Input Validation Vulnerabilities, Encoded Attack Vectors and Mitigations OWASP. The OWASP Foundation. Marco Morana & Scott Nusbaum

Introduction to Web Application Security. Microsoft CSO Roundtable Houston, TX. September 13 th, 2006

ASP.NET MVC Secure Coding 4-Day hands on Course. Course Syllabus

Web Application Firewall Bypassing

A Review of Web Application Security for Preventing Cyber Crimes

Web Application Penetration Testing

Improving Web Application Security by Eliminating CWEs Weijie Chen, China INFSY 6891 Software Assurance Professor Dr. Maurice Dawson 15 December 2015

A benchmark approach to analyse the security of web frameworks

Implementation of Web Application Security Solution using Open Source Gaurav Gupta 1, B. K. Murthy 2, P. N. Barwal 3

Web Application Attacks and Countermeasures: Case Studies from Financial Systems

1 Web Application Firewalls implementations, common problems and vulnerabilities

HTML5. Eoin Keary CTO BCC Risk Advisory.

FINAL DoIT v.8 APPLICATION SECURITY PROCEDURE

External Network & Web Application Assessment. For The XXX Group LLC October 2012

Application security testing: Protecting your application and data

SQL Injection and XSS

Risk Analysis Report [Implementation Constraints]

Ethical Hacking Penetrating Web 2.0 Security

Transcription:

Towards More Security in Data Exchange Defining Unparsers with Context-Sensitive Encoders for Context-Free Grammars Lars Hermerschmidt, Stephan Kugelmann, Bernhard Rumpe Software http://www.se-rwth.de/

Slide 2 About Me Background Penetration Tester Now Software Research Focus Model-Driven Software Development Textual Modeling Languages Security Architecture Why is Cross Site Scripting (XSS) Protection so hard to get right?

Slide 3 Injection Attacks SQL Injection HTTP SQL Attacker Frontend Target XSS: plenty of different contexts where JavaScript can be used HTTP HTML,... Attacker Frontend Target

Slide 4 Injection Attacks SQL Injection HTTP SQL Attacker Frontend Target XSS: plenty of different contexts where JavaScript can be used HTTP HTML,... Attacker Frontend Target Injection Attack unparse parse Language1 Language2 Attacker Frontend Target

Slide 5 State of the art In general: Do not trust user data, sanitize or encode it SQL: Prepared Statements HTML, JavaScript, CSS context aware encoding (HTML, <script>, JavaScript in HTML attribute,...) apply encoding automatically [Weinberger2011] What about all the other languages? Enterprise backend communication e.g. SAP systems Cyber Physical Systems like cars, industrial control systems new or custom formats

Slide 6 It happens during unparsing String representation parse AST program logic's interface to the document unparse Correct roundtrip AST x : parse ( unparse ( x )) x Injection: malicious AST m containing control tokens within terminals d : parse ( d ) correct roundtrip for malicious AST m m parse decode ( unparse encode ( m )) m

Slide 7 Defining Context-sensitive encoding MontiCoder Generate (un)parser with context-sensitive (en/de)coder Define encoding per token in the grammar Element = "tags" LCURLY TagsToken RCURLY; MG token LCURLY = "{"; token RCURLY = "}"; production rule token TagsToken = (~('{' '}' ' '))+; encodetable TagsToken = { "{" -> "ģ", "}" -> "ĥ", "&" -> "8", " " -> " " };

Slide 8 Language Composition One grammar per language (enables reuse, lowers complexity) Replace terminal from super-language with start symbol of sublanguage enables embedding of JavaScript in HTML Encoding specified separately for each language Unparsing Start Encoding in the most nested language Control characters from L 2 get encoded when used in L 4 Parsing Start parsing super-language Run decoder on tokens Run subparser L 2 L 1 L 3 L 4

Slide 9 Reducing Language Features Use Case: Include rich user input e.g. HTML into output Option 1: Reduce output language Change production rules to match only tokens with special names, define encoding not elegant, but more secure Option 2: Reduce input language Copy input into output AST Program logic must not alter this input

Slide 10 Using MontiCoder Language Developer 1. Define output grammar and encoding table 2. Generate parser and unparser which include Context-Sensitive (de/en)coding Language user a.k.a. application developer 1. Construct an AST for the output document a) Create parsable template b) Parse template to preinitialized AST 2. Add untrusted user data to AST nodes 3. Run generated MontiCoder unparser

Slide 11 Case Study: HTML and JavaScript Implemented grammars and encoding tables for HTML and JavaScript Web Application uses generated unparser Performed XSS Scan with OWASP ZAP and FuzzDB found no XSS Manual penetration test found error in one encoding table definition (<script> = <Script>) added options: case-insensitive, ignore whitespaces

Slide 12 Conclusion Injection attacks arise from unparsing without encoding Encoding is a language property defined by encoding table per grammar token MontiCoder: Derive context-sensitive encoder from it's definition within the grammar NOT yet another HTML, JavaScript encoder Templates considered harmful Directly putting untrusted data into output Context within the output is lost Stop using IO APIs which have no idea of correct encoding e.g. System.out.printl()

Slide 13 Thank You Comments? Questions?