• No results found

Introduction to Computer Security

N/A
N/A
Protected

Academic year: 2021

Share "Introduction to Computer Security"

Copied!
28
0
0

Loading.... (view fulltext now)

Full text

(1)

Introduction to Computer Security

Web Application Security

Pavel Laskov

(2)

Modern threat landscape

The majority of modern vulnerabilities are found in web applications.

(3)

Web application vulnerabilities in numbers

3,462/2,029 web/non-web application vulnerabilities were discovered by Symantec in 2008

Average exposure time: 60 days

12,885 site-specific XSS vulnerabilities were submitted to XSSed in 2008

(4)

Web application: a user’s view

HTTP: a simple stateless protocol.

Browser Web server

HTTP reply

HTTP request

Client-side operations:

open a TCP connection on port 80 send a request

Server-side operations

establish a TCP connection request process an HTTP request

(5)

Web application: technical infrastructure

Browser Web server

(6)

Web application: software instrumentation

Browser Web server

Firewall HTTP proxy

Cache HTTP request

HTTP reply

Cached reply

Extensions Applicationgateway

(7)

Web application threats

Client side Server side Implementation C/C++, Java Script languages Attack types buffer overflows

drive-by downloads

XSS, XSRF code injection SQL injection

Attack outcome malware installation loss of private data

(8)

HTTP protocol

Simple protocol for transfer of hyperlinked content Request/response

(9)

HTTP request structure

Initial request line:

Method (GET, POST, etc.) Resource specified by URI Protocol version

Header lines: key/value pairs, e.g. Accept-language: <language>

Body (arbitrary byte stream, separated by CR LF)

(10)

HTTP methods

GET

retrieves a resource form parameters in URI safe, no side-effects

GET /cgi-bin/birthday.pl? month=june&day=27 HTTP/1.0

POST

(11)

Uniform resource identifier (URI)

Syntax:

<scheme>://<authority><path>?<query>#<fragment> Special characters can be hex-encoded

(12)

HTTP response structure

Initial response line

protocol version status code status message

Header lines (same as request)

Body (arbitrary byte stream, separated by CR LF)

(13)

HTTP basic authentication

Goal: allow a browser send login credentials Method

concatenate user name and password separated by the colon encode using base64

(14)

HTTP digest authentication

Server receives a (method:URI) request.

Server denies access and returns a nonce as a challenge. Client asks a user for credentials

Client calculates:

H1 = MD5(username:realm:password) H2 = MD5(method:URI)

Client sends msg = MD5(H1:nonce:H2) to a server Server knowspasswordfor the user and computes:

H1= MD5(username:realm:password) H2 = MD5(method:URI)

(15)

Session management and cookies

Cookieis a set of name/value pairs stored in a browser Cookie usage:

authentication

state maintenance (e.g. “shopping cart”) user preference tracking

Cookie attributes:

name value

expiration date

(16)
(17)
(18)

Main problem of XSS

Any web application that returns user input without filtering is a potential XSS vulnerability!

Allows execution of arbitrary Javascript in user’s browser. Why would a user do this?

Inadvertently click on an emailed link Click on an infected image

(19)
(20)

What is “cross-site” in XSS?

“Injection” of Javascript in a browser is actually perfectly legal, but...

Typically Javascript is allowed to only access resources from the same site that has injected it into a browser.

(21)

Samy worm

Inject Javascript into a user profile using document.body.innerHTML

Get the list of user’s heros by using a GET on a user profile Add Samy as a field by performing XML-HTTP on the addFriends page

Any user who visits an infected user’s page will gets profile infected with Javascript and his friends list infected with Samy

Eventually about 1,000,000 MySpace profiles were infected. More technical details and hacks at:

(22)

Cross-site request forging: an example

Why does every online bank request you to sign off?

User logs in to bank.com and does not sign off. Session cookie remains in browser stats.

User accidentally visits a malicious site with the following content:

(23)

Cross-site request forging: an example

Why does every online bank request you to sign off? User logs in to bank.com and does not sign off.

Session cookie remains in browser stats.

User accidentally visits a malicious site with the following content:

(24)

Cross-site request forging: an example

Why does every online bank request you to sign off? User logs in to bank.com and does not sign off. Session cookie remains in browser stats.

User accidentally visits a malicious site with the following content:

(25)

Cross-site request forging: an example

Why does every online bank request you to sign off? User logs in to bank.com and does not sign off. Session cookie remains in browser stats.

User accidentally visits a malicious site with the following content:

<form name=F action=http://bank.com/PayBill.php> <input name=recipient value=badguy>...</form> <script> document.F.submit(); </script>

(26)

Cross-site request forging: an example

Why does every online bank request you to sign off? User logs in to bank.com and does not sign off. Session cookie remains in browser stats.

User accidentally visits a malicious site with the following content:

(27)
(28)

Summary

Security of web applications crucially depends on sanitisation of user input.

The latter is easier said than done.

References

Related documents

“Workforce Development Board” or “WDB” shall mean the Board established by the City as a non-profit, public benefit corporation and certified by the Governor of the State

W3C standard: Document Object Model (DOM) for HTML and XML) &lt;html&gt; &lt;head&gt; &lt;title&gt; &lt;body&gt; … … &lt;/body&gt; &lt;/html&gt; HTML Parser document form input

Replace &lt;domain&gt; by your domain name, &lt;user&gt; by the user name created in section 2 (if no domain is defined, just enter the &lt;computer name&gt;\&lt;user&gt;). Stop

Matrices of scattering amplitudes between all combinations of input –output pairs of no-collision states of 2 and 4 photons into 8 modes, for Sylvester and Fourier matrices..

In memory of Harold Taub, beloved husband of Paula Taub by: Karen &amp; Charles Rosen.. Honouring Maria Belenkova-Buford on her marriage by: Karen &amp;

Long years of service for the students practice job of the Faculty for Tou- rism and Business Logistics from University “Goce Delcev”-Shtip, Republic of North Macedonia (further

The table below provides a comparison of the cost per square foot for Menlo Park Fire District Station 2, located in East Palo Alto, bid and rebuilt starting in 2013, and Station

To address these questions, the following goals were set: (a) to reproduce field explosions pertaining to primary blast injury as accurate as possible in a controlled