SlideShare a Scribd company logo
1 of 53
Download to read offline
Drupal security
             Gábor Hojtsy , Acquia




   February 27. 2010, Drupalcamp Bratislava
With special thanks to Four Kitchens, Greg Knaddison and Jakub Suchy
Why I’m here?

• Stepping in for Jakub Suchy
• Co-maintainer to Drupal 6
• De-facto member of the security team
Are you affected?
With relatively simple holes,
your administrator user can
be taken over.
Open Web Application
           Security Project’s
              Top 10 risks
http://www.owasp.org/images/0/0f/OWASP_T10_-_2010_rc1.pdf
Security misconfiguration
Secure server

• Avoid using FTP at all cost (Total
  Commander is the enemy)
• Who do you share your server with? Are
  you confident?
• Keep your OS, PHP, SQL server, etc. up
  to date
Secure Drupal

• Is your admin password “admin”?
• Look at all “administer *” permissions
• “administer filters” can take over a site
• Use update.module, watch the security
  news (Wednesdays)
Secure Drupal

• Avoid any kind of PHP input, write your
  own modules instead
• Watch your input formats (you can be
  googled)
Injection
index.php?id=12


mysql_query(“UPDATE mytable
SET value = ‘”. $value .”’
WHERE id = ”. $_GET[‘id’]);
Drupal approach

• db_query(“UPDATE {mytable} SET
  value = ‘%s’ WHERE id = %d”, $value,
  $id);
• If you need to include dynamic table or
  column names in your query, see
  db_escape_table()
Cross Site Scripting (XSS)
index.php?id=12
print $_GET[‘id’];


$output .= $node->title;
Giving full HTML access.
66%
  likeliness a website has
 Cross site scripting issues
http://www.whitehatsec.com/home/assets/presentations/09PPT/PPT_statsfall09_8th.pdf
jQuery.get('/user/1/edit',
   function (data, status) {
     if (status == 'success') {
       var p = /id="edit-user-edit-form-token"
value="([a-z0-9]*)"/;
       var matches = data.match(p);
       var token = matches[1];
       var payload = {
          "form_id": 'user_edit',
          "form_token": token,
          "pass[pass1]": 'hacked',
          "pass[pass2]": 'hacked'
       };
       jQuery.post('/user/1/edit', payload);
     }
   }
);

                 Example from Heine Deelstra, Drupal Security team lead
                  http://heine.familiedeelstra.com/change-password-xss
Drupal approach

• check_plain() to escape text to HTML
• check_markup() to format text to HTML
• filter_xss() to filter text to HTML
• filter_xss_admin() to filter admin text to HTML
• node_view($node) instead of $node->body
Drupal approach
• t(), format_plural() placeholders:
  %name, @url, !insecure

  t(‘%name has a blog at <a
  href=”@url”>@url</a>’, array(‘@url’ =>
  valid_url($user->profile_blog), ‘%name’
  => $user->name));
• Use Drupal.t(), Drupal.formatPlural() in JS.
Authentication
 & sessions
• Weak password storage and
 account management
• Session hijacking / fixation
• Lack of session timeout /
 logout
Drupal approach

• Passwords are stored encrypted
• Session IDs changed when permissions
  change
• Drupal works with Apache’s SSL transport
• Modules to set certain URLs to use SSL
Common problem

global $user;
// ....
$user = user_load($uid);
Proper solution

global $user;
// ....
$account = user_load($uid);
Insecure direct object references
index.php?id=12


db_query(“SELECT * FROM {user}
WHERE id = %d”, $_GET[‘id’]);
Drupal approach
• Menu system handles permission checking
• user_access(‘administer nodes’, $account)
• node_access(‘edit’, $node, $account);
• db_query(db_rewrite_sql(‘SELECT title
  FROM {node} n’));
• Form API checks for data validity
Cross Site Request
 Forgery (CSRF)
http://example.com/index.php?
delete=12


<img src=”http://example.com/
index.php?delete=12” />
Drupal approach
• Form API works with POST submissions
  by default (makes it harder)
• Form API includes form tokens, requires
  form retrieval before submission, checks
  valid values
• drupal_valid_token() provided to
  generate/validate tokens for GET requests
Failure to restrict
   URL access
Drupal approach


• Menu system uses access callback and
  access arguments
• Continually review permissions
Common problem
$items[‘myitem’] = array(
     ‘page callback’ => ‘myfunc’,
  ‘access callback’ =>
user_access(‘access content’),
);
Proper solution
$items[‘myitem’] = array(
     ‘page callback’ => ‘myfunc’,
  ‘access callback’ =>
‘user_access’,
  ‘access arguments’ => array
(‘access content’),
);
Unvalidated
redirections
http://example.com/index.php?
target=evil.com
Drupal approach

• Drupal has various internal
  redirections, which use local paths and
  generate URLs based on them
• Look for use of drupal_goto() and Form
  API #redirect instances in your
  modules to validate their compliance
Insecure cryptographic storage
Drupal approach
• Drupal stores user passwords encrypted
  with a one-way hash
• Different randomly generated private
  key is provided on each site, which can
  be used to do reversible encryption
• Up to you to ensure backups are
  properly protected
Insufficient transport protection
Drupal approach
• Run Drupal on top of full SSL
• Use securepages and
  securepages_prevent_hijack to wall
  your important pages
• http://crackingdrupal.com/blog/
  greggles/drupal-and-ssl-multiple-
  recipes-possible-solutions
• Use a valid certificate
Is Open Source
    secure?
“Open Source is
       secure”

• Open Source makes people look at it
• Popularity gets more eyes
• There are always more smart people to
  find and fix problems
“Open Source is
       insecure”
• People can equally find holes
• Some people (inadvertently) disclose
  issues in the public
• Fix becomes public and can / will be
  reviewed
Is Drupal secure?
Developers and users
• Drupal APIs are designed to be secure
• It is eventually up to programmers to
  use them that way
• http://drupal.org/writing-secure-code
• Tools designed for security can still be
  misconfigured
Drupal security team


A team of volunteers working to ensure
best security of Drupal and thousands of
contributed modules
Design. Educate. Fix.
What’s supported?
• Drupal core and all(!) contributed
  project on drupal.org
• Not actively looking for vulnerabilities
  in contributed modules
• Stable releases and development
  versions (for very popular modules)
• Only current and one earlier versions
  are supported: now 6.x, 5.x
Points of contact

• Releases at http://drupal.org/security
• Reporting issues: http://drupal.org/
  node/101494
• Reporting cracked sites: http://
  drupal.org/node/213320
These slides are (CC)
                       Images used:
       http://www.flickr.com/photos/rtv/2398561954/
       http://www.flickr.com/photos/jonk/19422564/
     http://www.flickr.com/photos/duncan/2693141693/
     http://www.flickr.com/photos/duncan/2742371814
 http://www.flickr.com/photos/jontintinjordan/3736095793/
    http://www.flickr.com/photos/djbrady/2304740173/
    http://www.flickr.com/photos/inkytwist/2654071573/
     http://www.flickr.com/photos/duncan/2741594585/
  http://www.flickr.com/photos/shellysblogger/2924699161/
  http://www.flickr.com/photos/blogumentary/434097609/
    http://www.flickr.com/photos/glamhag/2214986176/
     http://www.flickr.com/photos/duncan/2693140217/




This presentation is © Gábor Hojtsy
Licensed: Licensed: http://creativecommons.org/licenses/by-nc-sa/2.0/
Questions?
Thank you!
 Gábor Hojtsy, Acquia
http://twitter.com/gaborhojtsy

More Related Content

What's hot

Django introduction @ UGent
Django introduction @ UGentDjango introduction @ UGent
Django introduction @ UGentkevinvw
 
Front End Web Development Basics
Front End Web Development BasicsFront End Web Development Basics
Front End Web Development BasicsTahir Shahzad
 
JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)jeresig
 
Html5 Brown Bag
Html5 Brown BagHtml5 Brown Bag
Html5 Brown Bagstuplum
 
Advanced jQuery (Ajax Exp 2007)
Advanced jQuery (Ajax Exp 2007)Advanced jQuery (Ajax Exp 2007)
Advanced jQuery (Ajax Exp 2007)jeresig
 
SilverStripe From a Developer's Perspective
SilverStripe From a Developer's PerspectiveSilverStripe From a Developer's Perspective
SilverStripe From a Developer's Perspectiveajshort
 
Tech Gupshup Meetup On MongoDB - 24/06/2016
Tech Gupshup Meetup On MongoDB - 24/06/2016Tech Gupshup Meetup On MongoDB - 24/06/2016
Tech Gupshup Meetup On MongoDB - 24/06/2016Mukesh Tilokani
 
doing_it_right() with WordPress
doing_it_right() with WordPressdoing_it_right() with WordPress
doing_it_right() with WordPressryanduff
 
Introduction to jQuery (Ajax Exp 2006)
Introduction to jQuery (Ajax Exp 2006)Introduction to jQuery (Ajax Exp 2006)
Introduction to jQuery (Ajax Exp 2006)jeresig
 
HTML 5 Drupalcamp Ireland Dublin 2010
HTML 5 Drupalcamp Ireland Dublin 2010HTML 5 Drupalcamp Ireland Dublin 2010
HTML 5 Drupalcamp Ireland Dublin 2010alanburke
 
Real World REST with Atom/AtomPub
Real World REST with Atom/AtomPubReal World REST with Atom/AtomPub
Real World REST with Atom/AtomPubPeter Keane
 
Fronttechnieken met HTML5 en de Slice-template
Fronttechnieken met HTML5 en de Slice-templateFronttechnieken met HTML5 en de Slice-template
Fronttechnieken met HTML5 en de Slice-templateInventis Web Architects
 
iOS & Drupal
iOS & DrupaliOS & Drupal
iOS & DrupalFoti Dim
 
Building Web Sites that Work Everywhere
Building Web Sites that Work EverywhereBuilding Web Sites that Work Everywhere
Building Web Sites that Work EverywhereDoris Chen
 
Extending Stash - Jason Hinch
Extending Stash - Jason HinchExtending Stash - Jason Hinch
Extending Stash - Jason HinchAtlassian
 
WordPress Harrisburg Meetup - Best Practices
WordPress Harrisburg Meetup - Best PracticesWordPress Harrisburg Meetup - Best Practices
WordPress Harrisburg Meetup - Best Practicesryanduff
 
Angular mobile angular_u
Angular mobile angular_uAngular mobile angular_u
Angular mobile angular_uDoris Chen
 

What's hot (20)

Django introduction @ UGent
Django introduction @ UGentDjango introduction @ UGent
Django introduction @ UGent
 
Front End Web Development Basics
Front End Web Development BasicsFront End Web Development Basics
Front End Web Development Basics
 
Web Ninja
Web NinjaWeb Ninja
Web Ninja
 
Css
CssCss
Css
 
JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)
 
Html5 Brown Bag
Html5 Brown BagHtml5 Brown Bag
Html5 Brown Bag
 
Advanced jQuery (Ajax Exp 2007)
Advanced jQuery (Ajax Exp 2007)Advanced jQuery (Ajax Exp 2007)
Advanced jQuery (Ajax Exp 2007)
 
SilverStripe From a Developer's Perspective
SilverStripe From a Developer's PerspectiveSilverStripe From a Developer's Perspective
SilverStripe From a Developer's Perspective
 
Tech Gupshup Meetup On MongoDB - 24/06/2016
Tech Gupshup Meetup On MongoDB - 24/06/2016Tech Gupshup Meetup On MongoDB - 24/06/2016
Tech Gupshup Meetup On MongoDB - 24/06/2016
 
doing_it_right() with WordPress
doing_it_right() with WordPressdoing_it_right() with WordPress
doing_it_right() with WordPress
 
Introduction to jQuery (Ajax Exp 2006)
Introduction to jQuery (Ajax Exp 2006)Introduction to jQuery (Ajax Exp 2006)
Introduction to jQuery (Ajax Exp 2006)
 
HTML 5 Drupalcamp Ireland Dublin 2010
HTML 5 Drupalcamp Ireland Dublin 2010HTML 5 Drupalcamp Ireland Dublin 2010
HTML 5 Drupalcamp Ireland Dublin 2010
 
Real World REST with Atom/AtomPub
Real World REST with Atom/AtomPubReal World REST with Atom/AtomPub
Real World REST with Atom/AtomPub
 
Fronttechnieken met HTML5 en de Slice-template
Fronttechnieken met HTML5 en de Slice-templateFronttechnieken met HTML5 en de Slice-template
Fronttechnieken met HTML5 en de Slice-template
 
iOS & Drupal
iOS & DrupaliOS & Drupal
iOS & Drupal
 
Building Web Sites that Work Everywhere
Building Web Sites that Work EverywhereBuilding Web Sites that Work Everywhere
Building Web Sites that Work Everywhere
 
Extending Stash - Jason Hinch
Extending Stash - Jason HinchExtending Stash - Jason Hinch
Extending Stash - Jason Hinch
 
WordPress Harrisburg Meetup - Best Practices
WordPress Harrisburg Meetup - Best PracticesWordPress Harrisburg Meetup - Best Practices
WordPress Harrisburg Meetup - Best Practices
 
Angular mobile angular_u
Angular mobile angular_uAngular mobile angular_u
Angular mobile angular_u
 
Php reports sumit
Php reports sumitPhp reports sumit
Php reports sumit
 

Similar to Drupal Security from Drupalcamp Bratislava

Drupal security
Drupal securityDrupal security
Drupal securityJozef Toth
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPOscar Merida
 
Drupal campleuven: Secure Drupal Development
Drupal campleuven: Secure Drupal DevelopmentDrupal campleuven: Secure Drupal Development
Drupal campleuven: Secure Drupal DevelopmentSteven Van den Hout
 
OWASP Top 10 vs Drupal - OWASP Benelux 2012
OWASP Top 10 vs Drupal - OWASP Benelux 2012OWASP Top 10 vs Drupal - OWASP Benelux 2012
OWASP Top 10 vs Drupal - OWASP Benelux 2012ZIONSECURITY
 
Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)Oscar Merida
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Drupalcon Paris
 
Drupal security
Drupal securityDrupal security
Drupal securityTechday7
 
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICES
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICESONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICES
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICESDrupalCamp Kyiv
 
Drupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesDrupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesShabir Ahmad
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to TornadoGavin Roy
 
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...LEDC 2016
 
Migrate yourself. code -> module -> mind
Migrate yourself. code -> module -> mindMigrate yourself. code -> module -> mind
Migrate yourself. code -> module -> mindValentine Matsveiko
 
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)cgmonroe
 
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsDrupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsLuís Carneiro
 
Django Overview
Django OverviewDjango Overview
Django OverviewBrian Tol
 
Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8Angela Byron
 
Making Joomla Insecure - Explaining security by breaking it
Making Joomla Insecure - Explaining security by breaking itMaking Joomla Insecure - Explaining security by breaking it
Making Joomla Insecure - Explaining security by breaking itTim Plummer
 

Similar to Drupal Security from Drupalcamp Bratislava (20)

Drupal security
Drupal securityDrupal security
Drupal security
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
 
Drupal Security Hardening
Drupal Security HardeningDrupal Security Hardening
Drupal Security Hardening
 
Drupal Security Hardening
Drupal Security HardeningDrupal Security Hardening
Drupal Security Hardening
 
Drupal campleuven: Secure Drupal Development
Drupal campleuven: Secure Drupal DevelopmentDrupal campleuven: Secure Drupal Development
Drupal campleuven: Secure Drupal Development
 
OWASP Top 10 vs Drupal - OWASP Benelux 2012
OWASP Top 10 vs Drupal - OWASP Benelux 2012OWASP Top 10 vs Drupal - OWASP Benelux 2012
OWASP Top 10 vs Drupal - OWASP Benelux 2012
 
Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)Staying Sane with Drupal (A Develper's Survival Guide)
Staying Sane with Drupal (A Develper's Survival Guide)
 
Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3Staging Drupal 8 31 09 1 3
Staging Drupal 8 31 09 1 3
 
Drupal security
Drupal securityDrupal security
Drupal security
 
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICES
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICESONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICES
ONE MORE TIME ABOUT CODE STANDARDS AND BEST PRACTICES
 
Drupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesDrupal 8 - Core and API Changes
Drupal 8 - Core and API Changes
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to Tornado
 
Rails Security
Rails SecurityRails Security
Rails Security
 
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
Валентин Мацвейко та Владислав Мойсеєнко — D8: Migrate Yourself: code->module...
 
Migrate yourself. code -> module -> mind
Migrate yourself. code -> module -> mindMigrate yourself. code -> module -> mind
Migrate yourself. code -> module -> mind
 
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
Tips on Securing Drupal Sites - DrupalCamp Atlanta (DCA)
 
Drupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First StepsDrupal Camp Porto - Developing with Drupal: First Steps
Drupal Camp Porto - Developing with Drupal: First Steps
 
Django Overview
Django OverviewDjango Overview
Django Overview
 
Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8
 
Making Joomla Insecure - Explaining security by breaking it
Making Joomla Insecure - Explaining security by breaking itMaking Joomla Insecure - Explaining security by breaking it
Making Joomla Insecure - Explaining security by breaking it
 

More from Gábor Hojtsy

Open source project management at scale
 Open source project management at scale Open source project management at scale
Open source project management at scaleGábor Hojtsy
 
Drupal 8.3.0: the features are ready, are you?
Drupal 8.3.0: the features are ready, are you?Drupal 8.3.0: the features are ready, are you?
Drupal 8.3.0: the features are ready, are you?Gábor Hojtsy
 
Drupal 8 multilingual APIs
Drupal 8 multilingual APIsDrupal 8 multilingual APIs
Drupal 8 multilingual APIsGábor Hojtsy
 
A Drupal 8 jövője és az oda vezető út
A Drupal 8 jövője és az oda vezető útA Drupal 8 jövője és az oda vezető út
A Drupal 8 jövője és az oda vezető útGábor Hojtsy
 
Everything multilingual in Drupal 8
Everything multilingual in Drupal 8Everything multilingual in Drupal 8
Everything multilingual in Drupal 8Gábor Hojtsy
 
Everything multilingual in Drupal 8 (2015 November)
Everything multilingual in Drupal 8 (2015 November)Everything multilingual in Drupal 8 (2015 November)
Everything multilingual in Drupal 8 (2015 November)Gábor Hojtsy
 
All the language support in Drupal 8 - At Drupalaton 2014
All the language support in Drupal 8 - At Drupalaton 2014All the language support in Drupal 8 - At Drupalaton 2014
All the language support in Drupal 8 - At Drupalaton 2014Gábor Hojtsy
 
Drupal 8 Multilingual - what to look forward to
Drupal 8 Multilingual - what to look forward toDrupal 8 Multilingual - what to look forward to
Drupal 8 Multilingual - what to look forward toGábor Hojtsy
 
Drupal security - Configuration and process
Drupal security - Configuration and processDrupal security - Configuration and process
Drupal security - Configuration and processGábor Hojtsy
 
Backstage with Drupal localization - Part 1
Backstage with Drupal localization - Part 1Backstage with Drupal localization - Part 1
Backstage with Drupal localization - Part 1Gábor Hojtsy
 
Come for the software, stay for the community
Come for the software, stay for the communityCome for the software, stay for the community
Come for the software, stay for the communityGábor Hojtsy
 
Come for the software, stay for the community - How Drupal improves and evolves
Come for the software, stay for the community - How Drupal improves and evolvesCome for the software, stay for the community - How Drupal improves and evolves
Come for the software, stay for the community - How Drupal improves and evolvesGábor Hojtsy
 
Here comes localize.drupal.org!
Here comes localize.drupal.org!Here comes localize.drupal.org!
Here comes localize.drupal.org!Gábor Hojtsy
 
Translate Drupal from Drupalcamp Vienna
Translate Drupal from Drupalcamp ViennaTranslate Drupal from Drupalcamp Vienna
Translate Drupal from Drupalcamp ViennaGábor Hojtsy
 
Translate Drupal from Drupalcamp Prague
Translate Drupal from Drupalcamp PragueTranslate Drupal from Drupalcamp Prague
Translate Drupal from Drupalcamp PragueGábor Hojtsy
 
Multilingual Drupal presentation from "Do it With Drupal"
Multilingual Drupal presentation from "Do it With Drupal"Multilingual Drupal presentation from "Do it With Drupal"
Multilingual Drupal presentation from "Do it With Drupal"Gábor Hojtsy
 

More from Gábor Hojtsy (17)

Open source project management at scale
 Open source project management at scale Open source project management at scale
Open source project management at scale
 
Drupal 8.3.0: the features are ready, are you?
Drupal 8.3.0: the features are ready, are you?Drupal 8.3.0: the features are ready, are you?
Drupal 8.3.0: the features are ready, are you?
 
Drupal 8 multilingual APIs
Drupal 8 multilingual APIsDrupal 8 multilingual APIs
Drupal 8 multilingual APIs
 
A Drupal 8 jövője és az oda vezető út
A Drupal 8 jövője és az oda vezető útA Drupal 8 jövője és az oda vezető út
A Drupal 8 jövője és az oda vezető út
 
Everything multilingual in Drupal 8
Everything multilingual in Drupal 8Everything multilingual in Drupal 8
Everything multilingual in Drupal 8
 
Everything multilingual in Drupal 8 (2015 November)
Everything multilingual in Drupal 8 (2015 November)Everything multilingual in Drupal 8 (2015 November)
Everything multilingual in Drupal 8 (2015 November)
 
All the language support in Drupal 8 - At Drupalaton 2014
All the language support in Drupal 8 - At Drupalaton 2014All the language support in Drupal 8 - At Drupalaton 2014
All the language support in Drupal 8 - At Drupalaton 2014
 
Drupal 8 Multilingual - what to look forward to
Drupal 8 Multilingual - what to look forward toDrupal 8 Multilingual - what to look forward to
Drupal 8 Multilingual - what to look forward to
 
Multilingual Drupal
Multilingual DrupalMultilingual Drupal
Multilingual Drupal
 
Drupal security - Configuration and process
Drupal security - Configuration and processDrupal security - Configuration and process
Drupal security - Configuration and process
 
Backstage with Drupal localization - Part 1
Backstage with Drupal localization - Part 1Backstage with Drupal localization - Part 1
Backstage with Drupal localization - Part 1
 
Come for the software, stay for the community
Come for the software, stay for the communityCome for the software, stay for the community
Come for the software, stay for the community
 
Come for the software, stay for the community - How Drupal improves and evolves
Come for the software, stay for the community - How Drupal improves and evolvesCome for the software, stay for the community - How Drupal improves and evolves
Come for the software, stay for the community - How Drupal improves and evolves
 
Here comes localize.drupal.org!
Here comes localize.drupal.org!Here comes localize.drupal.org!
Here comes localize.drupal.org!
 
Translate Drupal from Drupalcamp Vienna
Translate Drupal from Drupalcamp ViennaTranslate Drupal from Drupalcamp Vienna
Translate Drupal from Drupalcamp Vienna
 
Translate Drupal from Drupalcamp Prague
Translate Drupal from Drupalcamp PragueTranslate Drupal from Drupalcamp Prague
Translate Drupal from Drupalcamp Prague
 
Multilingual Drupal presentation from "Do it With Drupal"
Multilingual Drupal presentation from "Do it With Drupal"Multilingual Drupal presentation from "Do it With Drupal"
Multilingual Drupal presentation from "Do it With Drupal"
 

Recently uploaded

Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Recently uploaded (20)

Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

Drupal Security from Drupalcamp Bratislava

  • 1. Drupal security Gábor Hojtsy , Acquia February 27. 2010, Drupalcamp Bratislava With special thanks to Four Kitchens, Greg Knaddison and Jakub Suchy
  • 2. Why I’m here? • Stepping in for Jakub Suchy • Co-maintainer to Drupal 6 • De-facto member of the security team
  • 4. With relatively simple holes, your administrator user can be taken over.
  • 5. Open Web Application Security Project’s Top 10 risks http://www.owasp.org/images/0/0f/OWASP_T10_-_2010_rc1.pdf
  • 7. Secure server • Avoid using FTP at all cost (Total Commander is the enemy) • Who do you share your server with? Are you confident? • Keep your OS, PHP, SQL server, etc. up to date
  • 8. Secure Drupal • Is your admin password “admin”? • Look at all “administer *” permissions • “administer filters” can take over a site • Use update.module, watch the security news (Wednesdays)
  • 9. Secure Drupal • Avoid any kind of PHP input, write your own modules instead • Watch your input formats (you can be googled)
  • 11. index.php?id=12 mysql_query(“UPDATE mytable SET value = ‘”. $value .”’ WHERE id = ”. $_GET[‘id’]);
  • 12. Drupal approach • db_query(“UPDATE {mytable} SET value = ‘%s’ WHERE id = %d”, $value, $id); • If you need to include dynamic table or column names in your query, see db_escape_table()
  • 14. index.php?id=12 print $_GET[‘id’]; $output .= $node->title; Giving full HTML access.
  • 15. 66% likeliness a website has Cross site scripting issues http://www.whitehatsec.com/home/assets/presentations/09PPT/PPT_statsfall09_8th.pdf
  • 16. jQuery.get('/user/1/edit', function (data, status) { if (status == 'success') { var p = /id="edit-user-edit-form-token" value="([a-z0-9]*)"/; var matches = data.match(p); var token = matches[1]; var payload = { "form_id": 'user_edit', "form_token": token, "pass[pass1]": 'hacked', "pass[pass2]": 'hacked' }; jQuery.post('/user/1/edit', payload); } } ); Example from Heine Deelstra, Drupal Security team lead http://heine.familiedeelstra.com/change-password-xss
  • 17. Drupal approach • check_plain() to escape text to HTML • check_markup() to format text to HTML • filter_xss() to filter text to HTML • filter_xss_admin() to filter admin text to HTML • node_view($node) instead of $node->body
  • 18. Drupal approach • t(), format_plural() placeholders: %name, @url, !insecure t(‘%name has a blog at <a href=”@url”>@url</a>’, array(‘@url’ => valid_url($user->profile_blog), ‘%name’ => $user->name)); • Use Drupal.t(), Drupal.formatPlural() in JS.
  • 20. • Weak password storage and account management • Session hijacking / fixation • Lack of session timeout / logout
  • 21. Drupal approach • Passwords are stored encrypted • Session IDs changed when permissions change • Drupal works with Apache’s SSL transport • Modules to set certain URLs to use SSL
  • 22. Common problem global $user; // .... $user = user_load($uid);
  • 23. Proper solution global $user; // .... $account = user_load($uid);
  • 25. index.php?id=12 db_query(“SELECT * FROM {user} WHERE id = %d”, $_GET[‘id’]);
  • 26. Drupal approach • Menu system handles permission checking • user_access(‘administer nodes’, $account) • node_access(‘edit’, $node, $account); • db_query(db_rewrite_sql(‘SELECT title FROM {node} n’)); • Form API checks for data validity
  • 27. Cross Site Request Forgery (CSRF)
  • 29. Drupal approach • Form API works with POST submissions by default (makes it harder) • Form API includes form tokens, requires form retrieval before submission, checks valid values • drupal_valid_token() provided to generate/validate tokens for GET requests
  • 30. Failure to restrict URL access
  • 31. Drupal approach • Menu system uses access callback and access arguments • Continually review permissions
  • 32. Common problem $items[‘myitem’] = array( ‘page callback’ => ‘myfunc’, ‘access callback’ => user_access(‘access content’), );
  • 33. Proper solution $items[‘myitem’] = array( ‘page callback’ => ‘myfunc’, ‘access callback’ => ‘user_access’, ‘access arguments’ => array (‘access content’), );
  • 36. Drupal approach • Drupal has various internal redirections, which use local paths and generate URLs based on them • Look for use of drupal_goto() and Form API #redirect instances in your modules to validate their compliance
  • 38. Drupal approach • Drupal stores user passwords encrypted with a one-way hash • Different randomly generated private key is provided on each site, which can be used to do reversible encryption • Up to you to ensure backups are properly protected
  • 40. Drupal approach • Run Drupal on top of full SSL • Use securepages and securepages_prevent_hijack to wall your important pages • http://crackingdrupal.com/blog/ greggles/drupal-and-ssl-multiple- recipes-possible-solutions • Use a valid certificate
  • 41. Is Open Source secure?
  • 42. “Open Source is secure” • Open Source makes people look at it • Popularity gets more eyes • There are always more smart people to find and fix problems
  • 43. “Open Source is insecure” • People can equally find holes • Some people (inadvertently) disclose issues in the public • Fix becomes public and can / will be reviewed
  • 45. Developers and users • Drupal APIs are designed to be secure • It is eventually up to programmers to use them that way • http://drupal.org/writing-secure-code • Tools designed for security can still be misconfigured
  • 46. Drupal security team A team of volunteers working to ensure best security of Drupal and thousands of contributed modules
  • 48. What’s supported? • Drupal core and all(!) contributed project on drupal.org • Not actively looking for vulnerabilities in contributed modules • Stable releases and development versions (for very popular modules) • Only current and one earlier versions are supported: now 6.x, 5.x
  • 49. Points of contact • Releases at http://drupal.org/security • Reporting issues: http://drupal.org/ node/101494 • Reporting cracked sites: http:// drupal.org/node/213320
  • 50.
  • 51. These slides are (CC) Images used: http://www.flickr.com/photos/rtv/2398561954/ http://www.flickr.com/photos/jonk/19422564/ http://www.flickr.com/photos/duncan/2693141693/ http://www.flickr.com/photos/duncan/2742371814 http://www.flickr.com/photos/jontintinjordan/3736095793/ http://www.flickr.com/photos/djbrady/2304740173/ http://www.flickr.com/photos/inkytwist/2654071573/ http://www.flickr.com/photos/duncan/2741594585/ http://www.flickr.com/photos/shellysblogger/2924699161/ http://www.flickr.com/photos/blogumentary/434097609/ http://www.flickr.com/photos/glamhag/2214986176/ http://www.flickr.com/photos/duncan/2693140217/ This presentation is © Gábor Hojtsy Licensed: Licensed: http://creativecommons.org/licenses/by-nc-sa/2.0/
  • 53. Thank you! Gábor Hojtsy, Acquia http://twitter.com/gaborhojtsy