SlideShare a Scribd company logo
OWASP and Rails Security
RoR Meetup, December 10, 2013
What could happen if
your source code was
leaked?
• CI and Static Analysis
companies used them to store
GitHub Keys
• Those GitHub keys could have
granted the attacker access to
your source code
MongoDB Hacked
• One of their developers
inadvertently posted his repo
credentials
• White hat hacker was able to
grab all of their source without
their knowledge
Prezi Source Leaked
What is OWASP?
• 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 Background
1. Injection
2. Broken Authentication
3. Cross Site Scripting
4. Insecure Direct Object
References
5. Security Misconfiguration
6. Sensitive Data Exposure
7. Missing Function Level
Access Control
8. CSRF
9. Vulnerable Components
10.Unvalidated Forward/Redirect
OWASP Top 10, 2013
1. Injection
2. Broken Authentication
3. Cross Site Scripting
4. Insecure Direct Object
References
5. Security Misconfiguration
6. Sensitive Data Exposure
7. Missing Function Level
Access Control
8. CSRF
9. Vulnerable Components
10.Unvalidated Redirects
OWASP Top 10, 2013
Allowing non-sanitized user data into
persistent data queries.
Injection
Injection
User.where("email LIKE '%#{params[:email]}%'")
Most obvious example
User.find(params[:id]).update_attributes(params[:user])
Less obvious example
Injection
User.where("email LIKE '%#{params[:email]}%'")
Turn this bad code
User.where{email =~ “%#{params[:email]}%”}
into this sanitized code
Solution is to use scopes or Squeel
Injection
User.update_attributes(params[:user])
This update allows them to get the admin role
good_params = params[:user].slice(:name, :email)
User.update_attributes(good_params)
This does not
Cross Site Scripting
Allowing user injected Javascript to run
in your site.
Cross Site Scripting
%p=@user.biography.html_safe
Most obvious example
%p=link_to @user.name.html_safe, @user.homepage
Less obvious example
Cross Site Scripting
Don’t use html_safe
Solution #1
Use a sanitizer gem like rgrove/sanitize
Solution #2
Allowing a user to access data they
should not access.
Insecure Direct Object Reference
Insecure Direct Object Reference
send_file “docs/#{params[:id]}.pdf”
Using file references
`rake gen:test_data[#{params[:test_id]}]`
Using a UNIX command
Insecure Direct Object Reference
Use whitelists for file references
Use thoughtbot/cocaine for UNIX commands
Or just don’t use UNIX commands
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
Missing Authorization
Accepting potentially dangerous data
from other domains
Cross Site Request Forgery
Cross Site Request Forgery
Admin
Logs in
Your site
Navigates to
Malicious site Your site
Posts back to
Via hidden image
Cross Site Request Forgery
Disable posting from other domains.
See rhk/rack_protection.
Solution Part 1
Always use POST for editing data
Solution Part 2
Redirecting a user to an unvalidated
URL
Unvalidated Redirects
render params[:page]
Unvalidated Redirects
redirect_to @user.website
Unvalidated Redirects
Unvalidated Redirects
case params[:page]
when ‘show’
render :show
when ‘edit’
render :edit
else
render :index
end
Dynamic Rendering
Unvalidated Redirects
Dynamic Redirect
Either avoid doing it or use an interstitial page.
Never trust user input!
How many
vulnerabilities in your
code?
• Brakeman gem
• good to get started
• Code Climate
• good for ongoing analysis
• Coupon! IFU15MA2
Tools to Answer That
Demo Time

More Related Content

What's hot

Owasp top 10 security threats
Owasp top 10 security threatsOwasp top 10 security threats
Owasp top 10 security threats
Vishal Kumar
 
Web application Security tools
Web application Security toolsWeb application Security tools
Web application Security tools
Nico Penaredondo
 
Security Testing Training With Examples
Security Testing Training With ExamplesSecurity Testing Training With Examples
Security Testing Training With Examples
Alwin Thayyil
 
BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...
BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...
BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...
Aditya K Sood
 
Web security: concepts and tools used by attackers
Web security: concepts and tools used by attackersWeb security: concepts and tools used by attackers
Web security: concepts and tools used by attackers
tomasperezv
 
Abusing Exploiting and Pwning with Firefox Addons
Abusing Exploiting and Pwning with Firefox AddonsAbusing Exploiting and Pwning with Firefox Addons
Abusing Exploiting and Pwning with Firefox Addons
Ajin Abraham
 
MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...
MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...
MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...
Quek Lilian
 
Rapid Android Application Security Testing
Rapid Android Application Security TestingRapid Android Application Security Testing
Rapid Android Application Security Testing
Nutan Kumar Panda
 
SQL Injection: How It Works, How to Stop It
SQL Injection: How It Works, How to Stop ItSQL Injection: How It Works, How to Stop It
SQL Injection: How It Works, How to Stop It
Grant Fritchey
 
Api security-testing
Api security-testingApi security-testing
Api security-testing
n|u - The Open Security Community
 
Starwest 2008
Starwest 2008Starwest 2008
Starwest 2008
Caleb Sima
 
G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...
G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...
G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...
Ajin Abraham
 
Android pen test basics
Android pen test basicsAndroid pen test basics
Android pen test basics
OWASPKerala
 
Web Hacking Series Part 5
Web Hacking Series Part 5Web Hacking Series Part 5
Web Hacking Series Part 5
Aditya Kamat
 
The Quiet Rise of Account Takeover
The Quiet Rise of Account TakeoverThe Quiet Rise of Account Takeover
The Quiet Rise of Account Takeover
IMMUNIO
 
Attacking android insecurity
Attacking android insecurityAttacking android insecurity
Attacking android insecurity
Godfrey Nolan
 
Step by step guide for web application security testing
Step by step guide for web application security testingStep by step guide for web application security testing
Step by step guide for web application security testing
Avyaan, Web Security Company in India
 
InsecureDirectObjectReferences
InsecureDirectObjectReferencesInsecureDirectObjectReferences
InsecureDirectObjectReferences
macanazon
 
Pentesting Android Apps
Pentesting Android AppsPentesting Android Apps
Pentesting Android Apps
Abdelhamid Limami
 
Automated Security Analysis of Android & iOS Applications with Mobile Securit...
Automated Security Analysis of Android & iOS Applications with Mobile Securit...Automated Security Analysis of Android & iOS Applications with Mobile Securit...
Automated Security Analysis of Android & iOS Applications with Mobile Securit...
Ajin Abraham
 

What's hot (20)

Owasp top 10 security threats
Owasp top 10 security threatsOwasp top 10 security threats
Owasp top 10 security threats
 
Web application Security tools
Web application Security toolsWeb application Security tools
Web application Security tools
 
Security Testing Training With Examples
Security Testing Training With ExamplesSecurity Testing Training With Examples
Security Testing Training With Examples
 
BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...
BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...
BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...
 
Web security: concepts and tools used by attackers
Web security: concepts and tools used by attackersWeb security: concepts and tools used by attackers
Web security: concepts and tools used by attackers
 
Abusing Exploiting and Pwning with Firefox Addons
Abusing Exploiting and Pwning with Firefox AddonsAbusing Exploiting and Pwning with Firefox Addons
Abusing Exploiting and Pwning with Firefox Addons
 
MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...
MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...
MS Innovation Day: A Lap Around Web Application Vulnerabilities by MVP Walter...
 
Rapid Android Application Security Testing
Rapid Android Application Security TestingRapid Android Application Security Testing
Rapid Android Application Security Testing
 
SQL Injection: How It Works, How to Stop It
SQL Injection: How It Works, How to Stop ItSQL Injection: How It Works, How to Stop It
SQL Injection: How It Works, How to Stop It
 
Api security-testing
Api security-testingApi security-testing
Api security-testing
 
Starwest 2008
Starwest 2008Starwest 2008
Starwest 2008
 
G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...
G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...
G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...
 
Android pen test basics
Android pen test basicsAndroid pen test basics
Android pen test basics
 
Web Hacking Series Part 5
Web Hacking Series Part 5Web Hacking Series Part 5
Web Hacking Series Part 5
 
The Quiet Rise of Account Takeover
The Quiet Rise of Account TakeoverThe Quiet Rise of Account Takeover
The Quiet Rise of Account Takeover
 
Attacking android insecurity
Attacking android insecurityAttacking android insecurity
Attacking android insecurity
 
Step by step guide for web application security testing
Step by step guide for web application security testingStep by step guide for web application security testing
Step by step guide for web application security testing
 
InsecureDirectObjectReferences
InsecureDirectObjectReferencesInsecureDirectObjectReferences
InsecureDirectObjectReferences
 
Pentesting Android Apps
Pentesting Android AppsPentesting Android Apps
Pentesting Android Apps
 
Automated Security Analysis of Android & iOS Applications with Mobile Securit...
Automated Security Analysis of Android & iOS Applications with Mobile Securit...Automated Security Analysis of Android & iOS Applications with Mobile Securit...
Automated Security Analysis of Android & iOS Applications with Mobile Securit...
 

Viewers also liked

ActiveSupport
ActiveSupportActiveSupport
ActiveSupport
sean_todd
 
Suresh Resume with Pic
Suresh Resume with PicSuresh Resume with Pic
Suresh Resume with Pic
SURESH BABU
 
Africa Rising 2014
Africa Rising 2014Africa Rising 2014
Africa Rising 2014
Anushka Sharma
 
Zurb foundation
Zurb foundationZurb foundation
Zurb foundation
sean_todd
 
ئه‌مجاره‌ش بارزانى پشتوێنه‌كه‌ى شل ده‌كاته‌وه‌
ئه‌مجاره‌ش بارزانى پشتوێنه‌كه‌ى شل ده‌كاته‌وه‌ئه‌مجاره‌ش بارزانى پشتوێنه‌كه‌ى شل ده‌كاته‌وه‌
ئه‌مجاره‌ش بارزانى پشتوێنه‌كه‌ى شل ده‌كاته‌وه‌
Arsalan Rahman
 
په‌راوێزه‌ ميدياييه‌كان 4
په‌راوێزه‌ ميدياييه‌كان 4په‌راوێزه‌ ميدياييه‌كان 4
په‌راوێزه‌ ميدياييه‌كان 4
Arsalan Rahman
 
په‌راوێزه‌ ميدياييه‌كان 4 ئه‌رسه‌لان ره‌حمان
په‌راوێزه‌ ميدياييه‌كان 4 ئه‌رسه‌لان ره‌حمانپه‌راوێزه‌ ميدياييه‌كان 4 ئه‌رسه‌لان ره‌حمان
په‌راوێزه‌ ميدياييه‌كان 4 ئه‌رسه‌لان ره‌حمانArsalan Rahman
 
ئه‌مجاره‌ش بارزانى پشتوێنه‌كه‌ى شل ده‌كاته‌وه‌
ئه‌مجاره‌ش بارزانى پشتوێنه‌كه‌ى شل ده‌كاته‌وه‌ئه‌مجاره‌ش بارزانى پشتوێنه‌كه‌ى شل ده‌كاته‌وه‌
ئه‌مجاره‌ش بارزانى پشتوێنه‌كه‌ى شل ده‌كاته‌وه‌Arsalan Rahman
 
Rails Engines
Rails EnginesRails Engines
Rails Engines
sean_todd
 
null_object_meetup
null_object_meetupnull_object_meetup
null_object_meetup
sean_todd
 
Selenium webdriver
Selenium webdriverSelenium webdriver
Selenium webdriver
sean_todd
 
What is teaching
What is teachingWhat is teaching
What is teaching
drarchanac
 
tipos de bombas
tipos de bombas tipos de bombas
tipos de bombas
Alex Chicaiza Vilca
 
8. pengembangan bahan ajar
8. pengembangan bahan ajar8. pengembangan bahan ajar
8. pengembangan bahan ajar
Kiki Yulita Sari
 

Viewers also liked (16)

Nrt 1 7 - 2014
Nrt 1   7 - 2014Nrt 1   7 - 2014
Nrt 1 7 - 2014
 
ActiveSupport
ActiveSupportActiveSupport
ActiveSupport
 
Suresh Resume with Pic
Suresh Resume with PicSuresh Resume with Pic
Suresh Resume with Pic
 
Africa Rising 2014
Africa Rising 2014Africa Rising 2014
Africa Rising 2014
 
Zurb foundation
Zurb foundationZurb foundation
Zurb foundation
 
ئه‌مجاره‌ش بارزانى پشتوێنه‌كه‌ى شل ده‌كاته‌وه‌
ئه‌مجاره‌ش بارزانى پشتوێنه‌كه‌ى شل ده‌كاته‌وه‌ئه‌مجاره‌ش بارزانى پشتوێنه‌كه‌ى شل ده‌كاته‌وه‌
ئه‌مجاره‌ش بارزانى پشتوێنه‌كه‌ى شل ده‌كاته‌وه‌
 
په‌راوێزه‌ ميدياييه‌كان 4
په‌راوێزه‌ ميدياييه‌كان 4په‌راوێزه‌ ميدياييه‌كان 4
په‌راوێزه‌ ميدياييه‌كان 4
 
په‌راوێزه‌ ميدياييه‌كان 4 ئه‌رسه‌لان ره‌حمان
په‌راوێزه‌ ميدياييه‌كان 4 ئه‌رسه‌لان ره‌حمانپه‌راوێزه‌ ميدياييه‌كان 4 ئه‌رسه‌لان ره‌حمان
په‌راوێزه‌ ميدياييه‌كان 4 ئه‌رسه‌لان ره‌حمان
 
El skate
El skateEl skate
El skate
 
ئه‌مجاره‌ش بارزانى پشتوێنه‌كه‌ى شل ده‌كاته‌وه‌
ئه‌مجاره‌ش بارزانى پشتوێنه‌كه‌ى شل ده‌كاته‌وه‌ئه‌مجاره‌ش بارزانى پشتوێنه‌كه‌ى شل ده‌كاته‌وه‌
ئه‌مجاره‌ش بارزانى پشتوێنه‌كه‌ى شل ده‌كاته‌وه‌
 
Rails Engines
Rails EnginesRails Engines
Rails Engines
 
null_object_meetup
null_object_meetupnull_object_meetup
null_object_meetup
 
Selenium webdriver
Selenium webdriverSelenium webdriver
Selenium webdriver
 
What is teaching
What is teachingWhat is teaching
What is teaching
 
tipos de bombas
tipos de bombas tipos de bombas
tipos de bombas
 
8. pengembangan bahan ajar
8. pengembangan bahan ajar8. pengembangan bahan ajar
8. pengembangan bahan ajar
 

Similar to owasp_meetup_12_10

Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Brian Huff
 
Reliable and fast security audits - The modern and offensive way-Mohan Gandhi
Reliable and fast security audits - The modern and offensive way-Mohan GandhiReliable and fast security audits - The modern and offensive way-Mohan Gandhi
Reliable and fast security audits - The modern and offensive way-Mohan Gandhi
bhumika2108
 
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADFOWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
Brian Huff
 
OWASP
OWASPOWASP
Andrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.pptAndrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.ppt
SilverGold16
 
iOS Application Security.pdf
iOS Application Security.pdfiOS Application Security.pdf
iOS Application Security.pdf
Ravi Aggarwal
 
Is Drupal Secure?
Is Drupal Secure?Is Drupal Secure?
Is Drupal Secure?
David Timothy Strauss
 
Is Drupal secure?
Is Drupal secure?Is Drupal secure?
Is Drupal secure?
Four Kitchens
 
Presentation on Top 10 Vulnerabilities in Web Application
Presentation on Top 10 Vulnerabilities in Web ApplicationPresentation on Top 10 Vulnerabilities in Web Application
Presentation on Top 10 Vulnerabilities in Web Application
Md Mahfuzur Rahman
 
Writing Secure SharePoint Code - SharePoint Saturday Toronto
Writing Secure SharePoint Code - SharePoint Saturday TorontoWriting Secure SharePoint Code - SharePoint Saturday Toronto
Writing Secure SharePoint Code - SharePoint Saturday Toronto
Eli Robillard
 
Web and Mobile Application Security
Web and Mobile Application SecurityWeb and Mobile Application Security
Web and Mobile Application Security
Prateek Jain
 
Application Security Vulnerabilities: OWASP Top 10 -2007
Application Security Vulnerabilities: OWASP Top 10  -2007Application Security Vulnerabilities: OWASP Top 10  -2007
Application Security Vulnerabilities: OWASP Top 10 -2007
Vaibhav Gupta
 
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
IBM Security
 
Web security
Web securityWeb security
Web security
kareem zock
 
Security risks awareness
Security risks awarenessSecurity risks awareness
Security risks awareness
Janagi Kannan
 
Web Application Security 101
Web Application Security 101Web Application Security 101
Web Application Security 101
Cybersecurity Education and Research Centre
 
Owasp top 10 2013
Owasp top 10 2013Owasp top 10 2013
Owasp top 10 2013
Edouard de Lansalut
 
Php security common 2011
Php security common 2011Php security common 2011
Php security common 2011
10n Software, LLC
 
9 Writing Secure Android Applications
9 Writing Secure Android Applications9 Writing Secure Android Applications
9 Writing Secure Android Applications
Sam Bowne
 
Making application threat intelligence practical - DEM06 - AWS reInforce 2019
Making application threat intelligence practical - DEM06 - AWS reInforce 2019 Making application threat intelligence practical - DEM06 - AWS reInforce 2019
Making application threat intelligence practical - DEM06 - AWS reInforce 2019
Amazon Web Services
 

Similar to owasp_meetup_12_10 (20)

Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)
 
Reliable and fast security audits - The modern and offensive way-Mohan Gandhi
Reliable and fast security audits - The modern and offensive way-Mohan GandhiReliable and fast security audits - The modern and offensive way-Mohan Gandhi
Reliable and fast security audits - The modern and offensive way-Mohan Gandhi
 
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADFOWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
 
OWASP
OWASPOWASP
OWASP
 
Andrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.pptAndrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.ppt
 
iOS Application Security.pdf
iOS Application Security.pdfiOS Application Security.pdf
iOS Application Security.pdf
 
Is Drupal Secure?
Is Drupal Secure?Is Drupal Secure?
Is Drupal Secure?
 
Is Drupal secure?
Is Drupal secure?Is Drupal secure?
Is Drupal secure?
 
Presentation on Top 10 Vulnerabilities in Web Application
Presentation on Top 10 Vulnerabilities in Web ApplicationPresentation on Top 10 Vulnerabilities in Web Application
Presentation on Top 10 Vulnerabilities in Web Application
 
Writing Secure SharePoint Code - SharePoint Saturday Toronto
Writing Secure SharePoint Code - SharePoint Saturday TorontoWriting Secure SharePoint Code - SharePoint Saturday Toronto
Writing Secure SharePoint Code - SharePoint Saturday Toronto
 
Web and Mobile Application Security
Web and Mobile Application SecurityWeb and Mobile Application Security
Web and Mobile Application Security
 
Application Security Vulnerabilities: OWASP Top 10 -2007
Application Security Vulnerabilities: OWASP Top 10  -2007Application Security Vulnerabilities: OWASP Top 10  -2007
Application Security Vulnerabilities: OWASP Top 10 -2007
 
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
 
Web security
Web securityWeb security
Web security
 
Security risks awareness
Security risks awarenessSecurity risks awareness
Security risks awareness
 
Web Application Security 101
Web Application Security 101Web Application Security 101
Web Application Security 101
 
Owasp top 10 2013
Owasp top 10 2013Owasp top 10 2013
Owasp top 10 2013
 
Php security common 2011
Php security common 2011Php security common 2011
Php security common 2011
 
9 Writing Secure Android Applications
9 Writing Secure Android Applications9 Writing Secure Android Applications
9 Writing Secure Android Applications
 
Making application threat intelligence practical - DEM06 - AWS reInforce 2019
Making application threat intelligence practical - DEM06 - AWS reInforce 2019 Making application threat intelligence practical - DEM06 - AWS reInforce 2019
Making application threat intelligence practical - DEM06 - AWS reInforce 2019
 

owasp_meetup_12_10