Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Software Mischief (Part 1)

Software Mischief (Part 1)

I gave this presentation at an internal Oracle tech talk to serve as a primer on a few common security vulnerabilities in Rails applications. The mentioned bug was in a new feature buried behind a beta flag and didn't actually affect any customers, but it's always good to refresh everyone on things like this that can easily slip into large projects unnoticed.

Elliott Wood

April 26, 2013
Tweet

More Decks by Elliott Wood

Other Decks in Programming

Transcript

  1. OUR PLATFORM a short DEMO on * well, i’m demoing

    on staging so i don’t screw with customer data, but this definitely exists on production
  2. OUR PLATFORM PRODUCTION a short DEMO on * well, i’m

    demoing on staging so i don’t screw with customer data, but this definitely exists on production *
  3. OUR PLATFORM PRODUCTION a short DEMO on YES,THIS IS FOR

    REAL * well, i’m demoing on staging so i don’t screw with customer data, but this definitely exists on production *
  4. HACKER think LIKE A assume all users are malicious this

    is the INTERNET after all. people on the internet are not nice.
  5. HACKER think LIKE A design security in layers this could

    have been just an injection bug. one customer would have to attack another customer.
  6. HACKER think LIKE A design security in layers this could

    have been just an injection bug. one customer would have to attack another customer. or, this could have been just a CSRF bug. an attacker would have to target a user’s specific ad.
  7. HACKER think LIKE A design security in layers this could

    have been just an injection bug. one customer would have to attack another customer. or, this could have been just a CSRF bug. an attacker would have to target a user’s specific ad. the combination lets third parties attack our customers.
  8. HACKER think LIKE A design security in layers this could

    have been just an injection bug. one customer would have to attack another customer. or, this could have been just a CSRF bug. an attacker would have to target a user’s specific ad. the combination lets third parties attack our customers. that’s significantly worse.
  9. server sends a form to the client INJECTION URL client

    submits form back to server client edits the HTML source
  10. server sends a form to the client INJECTION URL client

    submits form back to server client edits the HTML source
  11. what if the :id is an external post id? are

    you verifying that it exists on the resource that you authorized? what if the :id is passed to a gem? an api? are you assuming that the api or gem is handling authorization for you? is it? INJECTION URL
  12. STEP 1: log in to a website STEP 2: visit

    a malicious site FORGERY CROSS-SITE REQUEST
  13. FORGERY CROSS-SITE REQUEST what if that form submits hidden fields

    to a different server? is your SRMA session cookie still valid?
  14. FORGERY CROSS-SITE REQUEST 1. A secret form_autheticity_token is added to

    all forms in your application. 2. That token matches a key in your application session cookie. 3. If a form submission comes in without a valid token, it is rejected.
  15. FORGERY CROSS-SITE REQUEST GET requests are not protected! Don’t use

    GET requests for actions that modify data. Don’t use match to define routes, because it accepts both POST and GET requests.
  16. FORGERY CROSS-SITE REQUEST GET requests are not protected! Don’t use

    GET requests for actions that modify data. Don’t use match to define routes, because it accepts both POST and GET requests.
  17. FORGERY CROSS-SITE REQUEST GET requests are not protected! Don’t use

    GET requests for actions that modify data. Don’t use match to define routes, because it accepts both POST and GET requests.