Log In

Matt Briggs

"Not all code needs to be a factory, some of it can just be origami." - _why, the lucky stiff

Understanding XSS

security
by Matt Briggs on 05/21/10

When you are talking about security with regards to web applications, the vast majority of it falls into IT land (i.e. configuring your firewall, webserver, etc). However, that doesn't mean web application developers can just ignore security. The most pervasive, and difficult to understand attack vectors out there is Cross Site Scripting, or XSS for short.The idea is that you find a public facing web page that exposes user generated content automatically, but does not take measures to prevent people from injecting arbitrary html or javascript. On the face of it, you may think "Ok, so that would mean a page gets defaced. Sucks, but its not the end of the world". It turns out it could get much, much worse then that. Here is a quick rundown of several scenarios where an XSS vulnerability could cause serious harm

Straight Forward XSS

  1. I find google has an xss vulnerability
  2. I write a script that rewrites a public google page to look exactly like the actual google login
  3. My fake page submits to a third party server, and then redirects back to the real page
  4. I get google account passwords, users don't realize what happened, google doesn't know what happened

XSS as a platform for CSRF

  1. Amazon has a csrf vulnerability where a "always keep me logged in" cookie allows you to flag an entry as offensive
  2. I find an xss vulnerability on a high traffic site
  3. I write a javascript that hits up the urls to mark all books written by gay/lesbian authors on amazon as offensive
  4. To amazon, they are getting valid requests from real browsers with real auth cookies. All the books disappear off the site overnight
  5. The internet freaks the hell out. (this supposedly actually happened)

XSS as a platform for Session Fixation attacks

  1. I find an e-commerce site that does not reset their session after a login (like any asp.net site), have the ability to pass session id in via query string or via cookie, and stores auth info in the session (pretty common)
  2. I find an XSS vulnerability on a page on that site
  3. I write a script that sets the session ID to the one I control
  4. Someone hits that page, and is bumped into my session.
  5. They log in
  6. I now have the ability to do anything I want as them, including buying products with saved cards

Those three are the big ones. The problem with XSS, CSRF, and Session Fixation attacks are that they are very, very hard to track down and fix, and are really simple to allow, especially if a developer doesn't know much about them.

my code blog.

what I am reading

Sidebar_clean_code

the people I follow

  • 24 ways
  • ABtests.com - Learn. Share. Improve your conversions today.
  • Ajaxian » Front Page
  • Alex Young
  • BEST IN CLASS
  • briancarper.net (λ)
  • Carbonica Blog Feed
  • Catalog Living
  • Clients From Hell
  • Clojure/core Blog
  • code is code
  • Coding Horror
  • CSS-Tricks
  • Daily Vim: Text Editor Tips, Tricks, Tutorials, and HOWTOs
  • David Chelimsky
  • dean.edwards.name/weblog
  • DHTML Kitchen News
  • disclojure: all things clojure
  • Edge Rails.info
  • End of Line
  • English - AkitaOnRails.com
  • Err the Blog
  • Evil Monkey Labs
  • Extra Cheese
  • Extra Cheese
  • For A Beautiful Web
  • Francis Hwang's site
  • Free Ruby and Rails Screencasts
  • Giles Bowkett
  • Hacker News
  • has_many :bugs, :through => :rails
  • Higgins for President
  • HTML5 Doctor
  • Information Is Beautiful
  • It's an all-you-can-leet buffet !
  • Jay Fields' Thoughts
  • JGUIMONT>COM
  • John Barnette
  • John Resig
  • K. Scott Allen
  • Katz Got Your Tongue?
  • Kirby's Dreamland
  • Kotaku
  • Kotka
  • Lambda the Ultimate - Programming Languages Weblog
  • Lazycoder
  • Loud Thinking by David Heinemeier Hansson
  • LukeW | Writings on Digital Product Strategy and Design
  • mir.aculo.us
  • MongoTips by John Nunemaker
  • Moonbase
  • No Strings Attached
  • Nuby on Rails
  • Official jQuery Blog
  • ones zeros majors and minors
  • opensoul.org by Brandon Keepers
  • Painfully Obvious
  • Painfully Obvious
  • Particletree
  • Paul Irish
  • Perfection kills
  • Plataforma Tecnologia Blog » English
  • Rails on PostgreSQL :
  • Railscasts
  • RedFlagDeals.com - Latest Deals
  • Relaselog | RLSLOG.net
  • remy sharp's b:log
  • Riding Rails - home
  • RightJS News
  • rmurphey
  • Room 101
  • Rubinius Blog
  • Ruby Best Practices
  • Ruby Inside
  • Ruby Quicktips
  • Ruby treats women as objects
  • RubyFlow
  • Signal vs. Noise
  • Slash7 with Amy Hoy - Home
  • Smashing Magazine Feed
  • Snail in a Turtleneck
  • Software Craftsmanship – Katas
  • St. on IT
  • Stevey's Blog Rants
  • Technomancy
  • Tender Lovemaking
  • Test Obsessed
  • Zed Shaw
  • The CSS Ninja
  • The GitHub Blog
  • The MongoDB NoSQL Database Blog
  • The Napkin ~ A Blog By Highgroove Studios
  • The UX Booth
  • The Word of Notch
  • the { buckblogs :here } - Home
  • Thoughts From Eric
  • Uncle Bob's Blog
  • VIM Tips Blog
  • Virtuous Code
  • Web Designer Wall - Design Trends and Tutorials
  • Wow! eBook - Great ebook, great site!
  • #<Mongoid::Criteria:0xb3e04d0>
profile for Matt Briggs at Stack Overflow
Feed
atom 1.0

mattcode.net stack

Rightjs
Rails
Mongo
Dropbox