SlideShare a Scribd company logo
Randall Valenciano Fallas
ravf.226@gmail.com
AGENDA
–
–
Injection
Broken Authentication and Session
Management
Cross Site Scripting (XSS) Insecure Redirect Object References
Security Misconfiguration Sensitive Data Exposure
Missing Function Level Access
Control
Cross Site Request Forgery
Using Components with Known
Vulnerabilities
Unvalidated Redirect and Forwards
–
–
–
–
Command Injection SQL Injection Attack Surface
Cross Site Scripting (XSS) Sessions
Business Logic
Bugs
Authentication Mass Assignment
Cross Origin
Resource
Sharing
Redirects and Forwards Cross Site Request Forgery Encryption
Dynamic Render Paths Sensitive Files
Ruby on rails security guide
–
–
–
@users = User.find(:all, :conditions =>
"name like #{params[:name]}")
–
input_name = params[:name]
@users = User.where(" name like
#{input_name}")
–
params[:name] = "name=') OR admin = 't' --"
User.find(:first, :conditions => "name =
'#{params[:name]}'")
SELECT "users".* FROM "users" WHERE (name = 'name=') OR
admin = 't' --') LIMIT 1
Result
#<User id: 1650, name: "Admin", password: "supersecretpass", age: 51, admin: true, created_at: "2013-02-
11 17:03:47", updated_at: "2013-02-11 17:03:47">
–
•
•
•
•
•
•
params[:column] = "age) FROM
users WHERE name = 'Bob';"
Order.calculate(:sum,
params[:column])
SELECT SUM(age) FROM users WHERE name
= 'Bob';) AS sum_id FROM "orders"
Result: 27
–
•
params[:admin] = "') OR 1=1--'"
User.destroy_all(["id = ? AND admin =
'#{params[:admin]}", params[:id]])
–
•
params[:admin] = "') OR 1=1--'"
User.destroy_all(["id = ? AND admin =
'#{params[:admin]}", params[:id]])
–
params[:column] = "* FROM users WHERE admin = 't' ;"
User.first(:conditions => { :name => params[:name], :password =>
params[:password] }, :select => params[:column])
SELECT * FROM users WHERE admin = 't' ; FROM "users" WHERE "users"."name" IS
NULL AND "users"."password" IS NULL LIMIT 1
Result
#<User id: 1716, name: "Admin", password: "supersecretpass", age: 68, admin: true, created_at:
"2013-02-11 17:03:47", updated_at: "2013-02-11 17:03:47">
–
–
Model.where("login = ? AND password = ?",
entered_user_name, entered_password).first
–
–
–
Model.where("login = ? AND password = ?",
entered_user_name, entered_password).first
Model.where(login: entered_user_name,
password: entered_password).first
–
–
Ruby on rails security guide
–
–
input = "<script>alert('XSS')</script>"
–
<p><%= input %></p>
–
<p>&lt;script&gt;alert(&#39;XSS&#39;)&lt;/script&
gt;</p>
–
<script>var user = <%= @user.to_json %></script>
–
<script>var user = <%= @user.to_json %></script>
<script> var user = {&quot;name&quot;:
&quot;&lt;/script&gt;
&lt;script&gt;alert(1)&lt;/script&gt;&quot;};</script>
–
<script>var user = <%= @user.to_json.html_safe %></script>
–
<script>
var user = {"name": "</script> <script>alert(1)</script>"};
</script>
–
•
•
–
•
–
tags = %w(a acronym b strong i em li ul ol h1 h2 h3 h4 h5 h6 blockquote
br cite sub sup ins p)
s = sanitize(user_input, tags: tags, attributes: %w(href title))
–
•
–
tags = %w(a acronym b strong i em li ul ol h1 h2 h3 h4 h5 h6
blockquote br cite sub sup ins p)
s = sanitize(user_input, tags: tags, attributes: %w(href
title))
–
•
–
strip_tags("some<<b>script>alert('hello')<</b>/script>")
some<script>alert('hello')</script>
–
–
• <%=h @stuff %>
–
–
–
{ attribute_name => value }
–
•
•
–
–
{:id => 42, :user => {:first => "NewJohn", :email =>
"john.doe@newemail.com"}}
–
–
{:id => 42, :user => {:first => "NewJohn", :email =>
"john.doe@newemail.com"}}
–
–
–
•
–
–
•
–
–
–
• .
def person_params
params.require(:person).permit(:name, :age)
end
https://github.com/rvalenciano/r24e/blob/master/app/controllers/users_controller.rb#L6
9-L80
–
–
Ruby on rails security guide
Ruby on rails security guide
●
–
–
●
–
–
•
–
–
•
Ruby on rails security guide
–
•
•
•
–
–
Ruby on rails security guide
Ruby on rails security guide
●
–
●
–
●
–
●
–

More Related Content

What's hot (18)

PPTX
Sql Injection V.2
Tjylen Veselyj
 
PPTX
Web Design Course - Lecture 21 - Bootstrap Jumbotron, Thumbnails, Alerts, Pro...
Al-Mamun Sarkar
 
PDF
Repo Madness: Taming the Open-Source Repository
Jeffrey Wear
 
PPTX
07 application security fundamentals - part 2 - security mechanisms - data ...
appsec
 
PPT
NHibernate in Action (Parte 1)
DotNetMarche
 
PDF
XSS And SQL Injection Vulnerabilities
Mindfire Solutions
 
PDF
Intro to Php Security
Dave Ross
 
PPTX
Web Design Course - Lecture 20 - Bootstrap Dropdown, Button group, Input grou...
Al-Mamun Sarkar
 
PDF
Sql Injection and XSS
Mike Crabb
 
PPTX
A 2-2 php on windows azure
GoAzure
 
PPTX
PHP on Windows Azure
Microsoft Openness Japan
 
PDF
Authentication and authorization in res tful infrastructures
Corley S.r.l.
 
ODP
Security In PHP Applications
Aditya Mooley
 
DOCX
Types of sql injection attacks
Respa Peter
 
PDF
Magento2&amp;java script (2)
EvgeniyKapelko1
 
PDF
SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya Morimoto
Pichaya Morimoto
 
PPTX
ZeroNights 2018 | I <"3 XSS
Дмитрий Бумов
 
DOCX
Div id
Nelson Dionizio
 
Sql Injection V.2
Tjylen Veselyj
 
Web Design Course - Lecture 21 - Bootstrap Jumbotron, Thumbnails, Alerts, Pro...
Al-Mamun Sarkar
 
Repo Madness: Taming the Open-Source Repository
Jeffrey Wear
 
07 application security fundamentals - part 2 - security mechanisms - data ...
appsec
 
NHibernate in Action (Parte 1)
DotNetMarche
 
XSS And SQL Injection Vulnerabilities
Mindfire Solutions
 
Intro to Php Security
Dave Ross
 
Web Design Course - Lecture 20 - Bootstrap Dropdown, Button group, Input grou...
Al-Mamun Sarkar
 
Sql Injection and XSS
Mike Crabb
 
A 2-2 php on windows azure
GoAzure
 
PHP on Windows Azure
Microsoft Openness Japan
 
Authentication and authorization in res tful infrastructures
Corley S.r.l.
 
Security In PHP Applications
Aditya Mooley
 
Types of sql injection attacks
Respa Peter
 
Magento2&amp;java script (2)
EvgeniyKapelko1
 
SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya Morimoto
Pichaya Morimoto
 
ZeroNights 2018 | I <"3 XSS
Дмитрий Бумов
 

Similar to Ruby on rails security guide (20)

ODP
Security on Rails
David Paluy
 
PPTX
security.pptx
HusseinNassrullah
 
PDF
&lt;x> Rails Web App Security Title
'"><x> '"><x>
 
PDF
Web Application Security in Rails
Uri Nativ
 
PDF
The top 10 security issues in web applications
Devnology
 
PPTX
Ethical Hacking Project: SQL Injection Vulnerability Analysis.pptx
Boston Institute of Analytics
 
PDF
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Sam Bowne
 
PDF
Rails Security
Wen-Tien Chang
 
PDF
Devbeat Conference - Developer First Security
Michael Coates
 
PPSX
Web application security
www.netgains.org
 
PPTX
Attacking Web Applications
Sasha Goldshtein
 
PDF
Neoito — Secure coding practices
Neoito
 
PDF
Whatever it takes - Fixing SQLIA and XSS in the process
guest3379bd
 
PPTX
Security: Odoo Code Hardening
Odoo
 
PDF
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Sam Bowne
 
PDF
CNIT 129S: Securing Web Applications Ch 1-2
Sam Bowne
 
PDF
Owasp Top 10
Gaurav Narwani
 
PDF
Application security 101
Vlad Garbuz
 
PPTX
Secure Dot Net Programming
Adam Getchell
 
ODP
Web Application Security
Stuart Colville
 
Security on Rails
David Paluy
 
security.pptx
HusseinNassrullah
 
&lt;x> Rails Web App Security Title
'"><x> '"><x>
 
Web Application Security in Rails
Uri Nativ
 
The top 10 security issues in web applications
Devnology
 
Ethical Hacking Project: SQL Injection Vulnerability Analysis.pptx
Boston Institute of Analytics
 
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Sam Bowne
 
Rails Security
Wen-Tien Chang
 
Devbeat Conference - Developer First Security
Michael Coates
 
Web application security
www.netgains.org
 
Attacking Web Applications
Sasha Goldshtein
 
Neoito — Secure coding practices
Neoito
 
Whatever it takes - Fixing SQLIA and XSS in the process
guest3379bd
 
Security: Odoo Code Hardening
Odoo
 
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Sam Bowne
 
CNIT 129S: Securing Web Applications Ch 1-2
Sam Bowne
 
Owasp Top 10
Gaurav Narwani
 
Application security 101
Vlad Garbuz
 
Secure Dot Net Programming
Adam Getchell
 
Web Application Security
Stuart Colville
 
Ad

Recently uploaded (20)

PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PDF
Simplify React app login with asgardeo-sdk
vaibhav289687
 
PPTX
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
PPTX
Transforming Insights: How Generative AI is Revolutionizing Data Analytics
LetsAI Solutions
 
PDF
NPD Software -Omnex systems
omnex systems
 
PPTX
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PPTX
Prompt Like a Pro. Leveraging Salesforce Data to Power AI Workflows.pptx
Dele Amefo
 
PDF
intro_to_cpp_namespace_robotics_corner.pdf
MohamedSaied877003
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PPTX
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PPTX
Function & Procedure: Function Vs Procedure in PL/SQL
Shani Tiwari
 
PPTX
Build a Custom Agent for Agentic Testing.pptx
klpathrudu
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PPTX
Library_Management_System_PPT111111.pptx
nmtnissancrm
 
PDF
UITP Summit Meep Pitch may 2025 MaaS Rebooted
campoamor1
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
Simplify React app login with asgardeo-sdk
vaibhav289687
 
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
Transforming Insights: How Generative AI is Revolutionizing Data Analytics
LetsAI Solutions
 
NPD Software -Omnex systems
omnex systems
 
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
Prompt Like a Pro. Leveraging Salesforce Data to Power AI Workflows.pptx
Dele Amefo
 
intro_to_cpp_namespace_robotics_corner.pdf
MohamedSaied877003
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
Function & Procedure: Function Vs Procedure in PL/SQL
Shani Tiwari
 
Build a Custom Agent for Agentic Testing.pptx
klpathrudu
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
Library_Management_System_PPT111111.pptx
nmtnissancrm
 
UITP Summit Meep Pitch may 2025 MaaS Rebooted
campoamor1
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
Ad

Ruby on rails security guide