SlideShare a Scribd company logo
OWASP and Rails Security
RoR Meetup, December 10, 2013
What could happen if
your source code was
leaked?
MongoDB Hacked
•

CI and Static Analysis
companies used them to store
GitHub Keys

•

Those GitHub keys could have
granted the attacker access to
your source code
Prezi Source Leaked
•

One of their developers
inadvertently posted his repo
credentials

•

White hat hacker was able to
grab all of their source without
their knowledge
What is OWASP?
OWASP Background
•

Founded in 2001

•

Non-profit organization

•

Produces lots of material on how to
secure web applications

•

Top 10 is an ongoing list of the most
important web app vulnerabilities
OWASP Top 10, 2013
1. Injection

6. Sensitive Data Exposure

2. Broken Authentication

7. Missing Function Level
Access Control

3. Cross Site Scripting
8. CSRF
4. Insecure Direct Object
References

9. Vulnerable Components

5. Security Misconfiguration

10.Unvalidated Forward/Redirect
OWASP Top 10, 2013
1. Injection

6. Sensitive Data Exposure

2. Broken Authentication

7. Missing Function Level
Access Control

3. Cross Site Scripting
8. CSRF
4. Insecure Direct Object
References

9. Vulnerable Components

5. Security Misconfiguration

10.Unvalidated Redirects
Injection
Allowing non-sanitized user data into
persistent data queries.
Injection
Most obvious example
User.where("email LIKE '%#{params[:email]}%'")

Less obvious example
User.find(params[:id]).update_attributes(params[:user])
Injection
Solution is to use scopes or Squeel
Turn this bad code
User.where("email LIKE '%#{params[:email]}%'")

into this sanitized code
User.where{email =~ “%#{params[:email]}%”}
Injection
This update allows them to get the admin role
User.update_attributes(params[:user])

This does not
good_params = params[:user].slice(:name, :email)
User.update_attributes(good_params)
Cross Site Scripting
Allowing user injected Javascript to run
in your site.
Cross Site Scripting
Most obvious example
%p=@user.biography.html_safe

Less obvious example
%p=link_to @user.name.html_safe, @user.homepage
Cross Site Scripting
Solution #1
Don’t use html_safe

Solution #2
Use a sanitizer gem like rgrove/sanitize
Insecure Direct Object Reference
Allowing a user to access data they
should not access.
Insecure Direct Object Reference
Using file references
send_file “docs/#{params[:id]}.pdf”

Using a UNIX command
`rake gen:test_data[#{params[:test_id]}]`
Insecure Direct Object Reference
Use whitelists for file references
Use thoughtbot/cocaine for UNIX commands
Or just don’t use UNIX commands
Missing Authorization
Every secure page needs to authorize
the user against the used data
Missing Authorization
!

1.Non-admin user can read, but not update an order
2.They navigate to the order show page
• /site/123/order/456
3. They hand edit the url to this
• /site/123/order/456/edit
With authorization they should not see that page
Cross Site Request Forgery
Accepting potentially dangerous data
from other domains
Cross Site Request Forgery
Logs in
Admin

Navigates to
Your site

Via hidden image
Posts back to

Malicious site

Your site
Cross Site Request Forgery
Solution Part 1
Disable posting from other domains.
See rhk/rack_protection.

Solution Part 2
Always use POST for editing data
Unvalidated Redirects
Redirecting a user to an unvalidated
URL
Unvalidated Redirects
render params[:page]
Unvalidated Redirects
redirect_to @user.website
Unvalidated Redirects
Dynamic Rendering
case params[:page]
when ‘show’
render :show
when ‘edit’
render :edit
else
render :index
end
Unvalidated Redirects
Dynamic Redirect
Either avoid doing it or use an interstitial page.
Never trust user input!
How many
vulnerabilities in your
code?
Tools to Answer That
•

Brakeman gem
•

•

good to get started

Code Climate
•

good for ongoing analysis

•

Coupon! IFU15MA2
Demo Time

More Related Content

PDF
owasp_meetup_12_10
sean_todd
 
PPTX
Prevent Malicious Hacking Attacks on your APIs
SmartBear
 
PDF
Approaching the unknown - Windows Phone application security assessment guide
SecuRing
 
PPTX
Abusing Google Apps and Data API: Google is My Command and Control Center
Ajin Abraham
 
PPTX
Web app security essentials
Rafał Hryniewski
 
PPTX
3. backup file artifacts - mazin ahmed
Rashid Khatmey
 
PPTX
Web security: concepts and tools used by attackers
tomasperezv
 
PPTX
2 . web app s canners
Rashid Khatmey
 
owasp_meetup_12_10
sean_todd
 
Prevent Malicious Hacking Attacks on your APIs
SmartBear
 
Approaching the unknown - Windows Phone application security assessment guide
SecuRing
 
Abusing Google Apps and Data API: Google is My Command and Control Center
Ajin Abraham
 
Web app security essentials
Rafał Hryniewski
 
3. backup file artifacts - mazin ahmed
Rashid Khatmey
 
Web security: concepts and tools used by attackers
tomasperezv
 
2 . web app s canners
Rashid Khatmey
 

What's hot (20)

PDF
SQL Injection: How It Works, How to Stop It
Grant Fritchey
 
PPTX
InsecureDirectObjectReferences
macanazon
 
PPTX
Owasp top 10 security threats
Vishal Kumar
 
PPTX
Web application Security tools
Nico Penaredondo
 
PDF
Web App Security Presentation by Ryan Holland - 05-31-2017
TriNimbus
 
PPTX
Security Testing Training With Examples
Alwin Thayyil
 
PDF
BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...
Aditya K Sood
 
PPTX
OWASP Khartoum Top 10 A4 - 7th meeting
OWASP Khartoum
 
PPTX
Web Hacking Series Part 5
Aditya Kamat
 
PPT
Starwest 2008
Caleb Sima
 
PPTX
Web application security: Threats & Countermeasures
Aung Thu Rha Hein
 
PPT
Step by step guide for web application security testing
Avyaan, Web Security Company in India
 
PPTX
MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...
Quek Lilian
 
PDF
Api security-testing
n|u - The Open Security Community
 
PPTX
The Quiet Rise of Account Takeover
IMMUNIO
 
PPTX
Rapid Android Application Security Testing
Nutan Kumar Panda
 
PPS
Information Gathering With Google
Zero Science Lab
 
PPTX
Php security common 2011
10n Software, LLC
 
PPT
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Brian Huff
 
PPTX
Owasp top 10 vulnerabilities
OWASP Delhi
 
SQL Injection: How It Works, How to Stop It
Grant Fritchey
 
InsecureDirectObjectReferences
macanazon
 
Owasp top 10 security threats
Vishal Kumar
 
Web application Security tools
Nico Penaredondo
 
Web App Security Presentation by Ryan Holland - 05-31-2017
TriNimbus
 
Security Testing Training With Examples
Alwin Thayyil
 
BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...
Aditya K Sood
 
OWASP Khartoum Top 10 A4 - 7th meeting
OWASP Khartoum
 
Web Hacking Series Part 5
Aditya Kamat
 
Starwest 2008
Caleb Sima
 
Web application security: Threats & Countermeasures
Aung Thu Rha Hein
 
Step by step guide for web application security testing
Avyaan, Web Security Company in India
 
MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...
Quek Lilian
 
Api security-testing
n|u - The Open Security Community
 
The Quiet Rise of Account Takeover
IMMUNIO
 
Rapid Android Application Security Testing
Nutan Kumar Panda
 
Information Gathering With Google
Zero Science Lab
 
Php security common 2011
10n Software, LLC
 
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Brian Huff
 
Owasp top 10 vulnerabilities
OWASP Delhi
 
Ad

Similar to OWASP Top 10 and Securing Rails - Sean Todd - PayNearMe.com (20)

PDF
Security Awareness
Lucas Hendrich
 
PPTX
Becoming a SOC2 Ruby Shop - Montreal.rb November, 5, 2022 Ruby Meetup
Andy Maleh
 
PPT
WebApps_Lecture_15.ppt
OmprakashVerma56
 
PDF
Web vulnerabilities
Oleksandr Kovalchuk
 
PDF
Developer Security for WordPress
Brandon Dove
 
PDF
Application Security on a Dime: A Practical Guide to Using Functional Open So...
POSSCON
 
PDF
Rails Security
David Keener
 
PPTX
OWASP top 10-2013
tmd800
 
PPT
StartPad Countdown 2 - Startup Security: Hacking and Compliance in a Web 2.0 ...
Start Pad
 
PDF
2013 OWASP Top 10
bilcorry
 
PDF
Api days 2018 - API Security by Sqreen
Sqreen
 
PDF
Owasp top 10 2013
Edouard de Lansalut
 
PPT
Owasp Top 10 - Owasp Pune Chapter - January 2008
abhijitapatil
 
PPT
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities
Braindev Kyiv
 
PDF
Beyond OWASP Top 10 - Hack In Paris 2017
Aaron Hnatiw
 
PPTX
Application Security Vulnerabilities: OWASP Top 10 -2007
Vaibhav Gupta
 
PPTX
OWASP Top 10 - 2017 Top 10 web application security risks
Kun-Da Wu
 
PPTX
Owasp top-ten-mapping-2015-05-lwc
Katy Anton
 
PPT
OWASP App Sec US - 2010
Aditya K Sood
 
PDF
Secure coding presentation Oct 3 2020
Moataz Kamel
 
Security Awareness
Lucas Hendrich
 
Becoming a SOC2 Ruby Shop - Montreal.rb November, 5, 2022 Ruby Meetup
Andy Maleh
 
WebApps_Lecture_15.ppt
OmprakashVerma56
 
Web vulnerabilities
Oleksandr Kovalchuk
 
Developer Security for WordPress
Brandon Dove
 
Application Security on a Dime: A Practical Guide to Using Functional Open So...
POSSCON
 
Rails Security
David Keener
 
OWASP top 10-2013
tmd800
 
StartPad Countdown 2 - Startup Security: Hacking and Compliance in a Web 2.0 ...
Start Pad
 
2013 OWASP Top 10
bilcorry
 
Api days 2018 - API Security by Sqreen
Sqreen
 
Owasp top 10 2013
Edouard de Lansalut
 
Owasp Top 10 - Owasp Pune Chapter - January 2008
abhijitapatil
 
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities
Braindev Kyiv
 
Beyond OWASP Top 10 - Hack In Paris 2017
Aaron Hnatiw
 
Application Security Vulnerabilities: OWASP Top 10 -2007
Vaibhav Gupta
 
OWASP Top 10 - 2017 Top 10 web application security risks
Kun-Da Wu
 
Owasp top-ten-mapping-2015-05-lwc
Katy Anton
 
OWASP App Sec US - 2010
Aditya K Sood
 
Secure coding presentation Oct 3 2020
Moataz Kamel
 
Ad

More from SV Ruby on Rails Meetup (6)

PPTX
Ruby and iOS: An inside look
SV Ruby on Rails Meetup
 
KEY
SV Ruby on Rails Meetup - FlickMunk
SV Ruby on Rails Meetup
 
KEY
How to do Scalable UI-Heavy Development at a Breakneck Pace
SV Ruby on Rails Meetup
 
KEY
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
SV Ruby on Rails Meetup
 
PDF
Inside GitHub with Chris Wanstrath
SV Ruby on Rails Meetup
 
PDF
HTML5 for the Ruby Developer
SV Ruby on Rails Meetup
 
Ruby and iOS: An inside look
SV Ruby on Rails Meetup
 
SV Ruby on Rails Meetup - FlickMunk
SV Ruby on Rails Meetup
 
How to do Scalable UI-Heavy Development at a Breakneck Pace
SV Ruby on Rails Meetup
 
How I Learned to Stop Worrying and Love the Cloud - Wesley Beary, Engine Yard
SV Ruby on Rails Meetup
 
Inside GitHub with Chris Wanstrath
SV Ruby on Rails Meetup
 
HTML5 for the Ruby Developer
SV Ruby on Rails Meetup
 

Recently uploaded (20)

PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
Doc9.....................................
SofiaCollazos
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
The Future of Artificial Intelligence (AI)
Mukul
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
Doc9.....................................
SofiaCollazos
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 

OWASP Top 10 and Securing Rails - Sean Todd - PayNearMe.com