drupal security from drupalcamp cologne 2009

29
Drupal Security 2009. January 17., Drupalcamp Cologne With special thanks to Kuai Hinojosa and Greg Knaddison

Upload: gabor-hojtsy

Post on 13-Dec-2014

1.175 views

Category:

Technology


2 download

DESCRIPTION

Drupal security presentation from Drupalcamp Cologne 2009.

TRANSCRIPT

Page 1: Drupal Security from Drupalcamp Cologne 2009

Drupal Security2009. January 17., Drupalcamp CologneWith special thanks to Kuai Hinojosa and Greg Knaddison

Page 2: Drupal Security from Drupalcamp Cologne 2009

Who cares?

• With relatively simple holes, your administrator user can be taken over

• From there, people will easily “use” your site: place spam links, get user data, distribute viruses

Page 3: Drupal Security from Drupalcamp Cologne 2009

Relatively simple?

WhiteHat security research collected data through vulnerability assessment of the largest and most popular websites in the retail, financial, insurance, education and social networks.

Page 4: Drupal Security from Drupalcamp Cologne 2009

of websites haveCross site scripting issues

67%http://www.whitehatsec.com/home/assets/presentations/PPTstats082708.pdf

Page 5: Drupal Security from Drupalcamp Cologne 2009

What can XSS do?

Example from Heine Deelstra, security team lead

Page 6: Drupal Security from Drupalcamp Cologne 2009

Easy to loose credibility, hard to

regain it

Page 7: Drupal Security from Drupalcamp Cologne 2009

So what are these issues?

Page 8: Drupal Security from Drupalcamp Cologne 2009

Common issues

• Client-side attacks

• Cross site scripting (XSS)

• Cross site request forgery (CSRF)

Page 9: Drupal Security from Drupalcamp Cologne 2009

Common issues

• Command execution

• SQL injection

Page 10: Drupal Security from Drupalcamp Cologne 2009

Common issues

• Authentication problems

• Authorization problems

• Information disclosure: leakage, directory indexing, known resource locations

Page 11: Drupal Security from Drupalcamp Cologne 2009

Is Open Source secure?

Page 12: Drupal Security from Drupalcamp Cologne 2009

“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

Page 13: Drupal Security from Drupalcamp Cologne 2009

“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

Page 14: Drupal Security from Drupalcamp Cologne 2009

Is Drupal secure?

Page 15: Drupal Security from Drupalcamp Cologne 2009

Secure API design

• Drupal APIs are designed to be secure

• It is eventually up to programmers to use them that way

• http://drupal.org/writing-secure-code

Page 16: Drupal Security from Drupalcamp Cologne 2009

Designed against XSS

• 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.

Page 17: Drupal Security from Drupalcamp Cologne 2009

Designed against XSS

• 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

Page 18: Drupal Security from Drupalcamp Cologne 2009

Designed against CSRF

• Form API checks generated form token

• Token API provided to generate / check eg. for AJAX implementations, see drupal_valid_token()

• Valid choice checker

Page 19: Drupal Security from Drupalcamp Cologne 2009

Designed againstSQL injection

• 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()

Page 20: Drupal Security from Drupalcamp Cologne 2009

Designed to protect content

• user_access(‘administer nodes’, $account)

• node_access(‘edit’, $node, $account);

• db_query(db_rewrite_sql(‘SELECT title FROM {node}’));

Page 21: Drupal Security from Drupalcamp Cologne 2009

Designed against information leakage

• Ensure your .htaccess is effectively working

• Turn off public error reporting

• Avoid using file browser/uploader scripts

Page 22: Drupal Security from Drupalcamp Cologne 2009

Designed to help users be secure

• Password strength checker

• Update notification module

• Know what you run, keep it secure

Page 23: Drupal Security from Drupalcamp Cologne 2009

You are responsible for configuration

• Limit Drupal permissions

• Look at your input formats (you might be easily Googled)

• Instead of using the PHP filter, write your own modules

• Watch for the files you allow to be uploaded

Page 24: Drupal Security from Drupalcamp Cologne 2009

Drupal security team

A team of volunteers working to ensure best security of Drupal and thousands of contributed modules

Page 25: Drupal Security from Drupalcamp Cologne 2009

Design. Educate. Fix.

Page 26: Drupal Security from Drupalcamp Cologne 2009

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

Page 28: Drupal Security from Drupalcamp Cologne 2009

Questions?

Page 29: Drupal Security from Drupalcamp Cologne 2009

Thank you!