Docsity

Ajax Security: Understanding the Risks and Mitigating XSS Attacks, Slides of Javascript programming

Partial preview of the text

Download Ajax Security: Understanding the Risks and Mitigating XSS Attacks and more Slides Javascript programming in PDF only on Docsity!

Ajax Security

Security

The number 1 biggest problem with

the whole World Wide Web.

What can an attacker do if he

gets some script into your page?

An attacker can request additional scripts from any server in the world.

Once it gets a foothold, it can obtain

all of the scripts it needs.

An attacker can read the

document.

The attacker can see everything the

user sees.

An attacker has control over the display and can request information from the user.

The user cannot detect that the

request did not originate with your

application.

The browser does not prevent

any of these.

That's why they happen.

The consequences of a successful attack are horrible. Harm to customers. Loss of trust. Legal liabilities. Possible criminal penalties.

The Turducken Problem

  • Many Languages:
    • HTTP, HTML, URL, CSS, JavaScript, XML, JSON, plaintext, SQL...
  • Each language has different quoting and commenting conventions.
  • The languages can be nested inside each other.

A text that is benign in one context might be dangerous in another.

Sloppy encoding allows injection of

evil scripts

A Simple Attack **http://yourdomain.com/

File not found: <script>alert("XSS");</script >

**
  • Proper escapement provides some safety.

Another Example

  • Bad text " + alert("XSS") + "
  • Bad encoding {"json": "" + alert("XSS") + ""}
  • Good encoding {"json": "" + alert("XSS") + ""}

Cross Site Data Access

It is extremely useful to

obtain data from other

sites and mash it up.

Same Origin Policy

Prevents useful things.

Allows dangerous things.