Docsity

Web Security Lecture Notes for CIS 551 / TCOM 401 Spring 2009, Study notes of Computer Science

Partial preview of the text

Download Web Security Lecture Notes for CIS 551 / TCOM 401 Spring 2009 and more Study notes Computer Science in PDF only on Docsity!

CIS 551 / TCOM 401

Computer and Network

Security

Spring 2009

Lecture 24

Announcements

  • Plan for Today:
    • Web Security Part
  • Project 4 is due 28 April 2009 at 11:59 pm
  • Final exam has been scheduled:
    • Friday, May 8, 2009
    • 9:00am – 11:00am, Moore 216
  • Please complete online course evaluations:
    • http://www.upenn.edu/eval

HyperText Transfer Protocol

  • Used to request and return data
    • Methods: GET, POST, PUT, HEAD, DELETE, …
  • Stateless request/response protocol
    • Each request is independent of previous requests
    • Statelessness has a significant impact on design and implementation of applications
  • Evolution
    • HTTP 1.0: simple
    • HTTP 1.1: more complex, added persistent connections

GET /default.asp HTTP/1. Accept: image/gif, image/x-bitmap, image/jpeg, / Accept-Language: en User-Agent: Mozilla/1.22 (compatible; MSIE 2.0; Windows 95) Connection: Keep-Alive If-Modified-Since: Sunday, 20-Apr-08 04:32:58 GMT

HTTP Request

Method File HTTP version Headers Data – none for GET Blank line

HTTP Server Status Codes

Code Description 200 OK 201 Created 301 Moved Permanently 302 Moved Temporarily 400 Bad Request – not understood 401 Unauthorized 403 Forbidden – not authorized 404 Not Found 500 Internal Server Error

  • Return code 401
    • Used to indicate HTTP authorization
    • HTTP authorization has serious problems!!!

HTML and Scripting

…

…

Browser receives content, displays

HTML and executes scripts

Document object model (DOM)

  • Object-oriented interface used to read and write documents
    • web page in HTML is structured data
    • DOM provides representation of this hierarchy
  • Examples
    • Properties: document.alinkColor, document.URL, document.forms[ ], document.links[ ], document.anchors[ ]
    • Methods: document.write(document.referrer)
  • Also Browser Object Model (BOM)
    • Window, Document, Frames[], History, Location, Navigator (type and version of browser)

Browser security risks

  • Compromise host
    • Write to file system
    • Interfere with other processes in browser environment
  • Steal information
    • Read file system
    • Read information associated with other browser processes (e.g., other windows)
    • Fool the user
    • Reveal information through traffic analysis

Browser sandboxing

  • Idea
    • Code executed in browser has only restricted access to OS,

network, and browser data structures

  • Isolation
    • Similar to OS process isolation, conceptually
    • Browser is a “weak” OS
  • Same Origin Principle
    • Only the site that stores some information in the browser may later read or modify that information (or depend on it in any way).
  • Details?
    • What is a “site”?
      • URL, domain, pages from same site …?
    • What is “information”?
      • cookies, document object, cache, …?
    • Default only: users can set other policies
      • No way to keep sites from sharing information

Schematic web site architecture

IDS

Application

Firewall

(WAF)

Firewall

Load

Balancer DB

WS 1

WS 2

WS 3

Firewall

Authorization

Netegrity (CA)

Oblix (Oracle)

App

Servers

Common vulnerabilities (OWASP)

  • Inadequate validation of user input
    • Cross site scripting
    • SQL Injection
    • HTTP Splitting
  • Broken session management
    • Can lead to session hijacking and data theft
  • Insecure storage
    • Sensitive data stored in the clear.
    • Prime target for theft – e.g. egghead, Verizon.
    • Note: PCI Data Security Standard (Visa, Mastercard)

Warm up: a simple example

  • Direct use of user input:

– http://victim.com/copy.php? name=username

– copy.php:

– Problem:

  • http://victim.com/copy.php? name=“a ; rm *”

(should be: name=a%20;%20rm%20* )

script name script input

system(“cp temp.dat $name.dat”)

Cross-Site Scripting: The setup

  • User input is echoed into HTML response.
  • Example: search field
    • http://victim.com/search.php? term = apple
    • search.php responds with: ** Search Results **
      Results for : ...
  • Is this exploitable?

Bad input

  • Problem: no validation of input term
  • Consider link: (properly URL encoded) http://victim.com/search.php? term = ****
  • What if user clicks on this link?

1. Browser goes to victim.com/search.php

2. Victim.com returns

** Results for **

3. Browser executes script:

  • Sends badguy.com cookie for victim.com