OWASP Europe Conference 2008 OWASP Anti. Samy Project Jason Li Senior Application Security Engineer jason. li@aspectsecurity. com OWASP Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP Foundation http: //www. owasp. org
Who are you people?
Talk Outline
What is OWASP Anti. Samy?
Why did you make it?
What is XSS?
Reflected XSS - Illustrated Email / Instant Message attacker@evil. com innocent@victim. com Check out this cool link!!! http: //www. example. com/search? OWASP
Reflected XSS - Illustrated HTTP / HTTPS innocent@victim. com www. example. com GET /search? 2. 0 P/1. 1 User-Agent: Inter. Oper. Fire. Fari/4. 04 Cookie: SESSION_COOKIE: QXJza. GFu. IGlz. IG 15 IGhlcm 8=; OWASP
Reflected XSS - Illustrated HTTP / HTTPS innocent@victim. com www. example. com … You searched for: … OWASP
Stored XSS - Illustrated HTTP / HTTPS attacker@evil. com www. example. com POST /comment? 2. 0 P/1. 1 User-Agent: Inter. Oper. Fire. Fari/4. 04 Cookie: SESSION_COOKIE: QXJza. GFu. IGlz. IG 15 IGhlcm 8=; OWASP
Stored XSS - Illustrated HTTP / HTTPS innocent@victim. com sacrificial@lamb. com www. example. com … Headline News (Waffles, BE): … attacker@evil. com Says: … OWASP
But That’ll Never Happen to Me!
The Samy Worm
The Samy Worm (continued)
The Samy Worm (continued)
What If I… tags (i. e. blacklist)! 4 Requires constant update 4 Provides low assurance (ex. Samy Worm)
What If I…
So What Makes Anti. Samy Better?
How does it work? Turn HTML into XML Scan Each Node Take Responsive Action OWASP
How does it work? (cont) Turn HTML into XML
How does it work? (cont) Scan Each Node
How does it work? (cont) Take Responsive Action
How does it work? (cont) Stylesheet Behavior Parse • Parse CSS using SAC (Simple API for CSS) • SAC is event-driven (a la SAX) • Validate selector names against policy Validate • Validate property values against policy • Remove failed properties and selectors Serialize • Canonicalize style output OWASP
How does it work? (cont)
This is so cool!!