SlideShare a Scribd company logo
Secure	
  Drupal	
  Development	
  
Steven	
  Van	
  den	
  Hout	
  
@stevenvdhout
http://dgo.to/@svdhout
Steven Van den Hout
IS DRUPAL SECURE?
1
MANY EYES MAKE FOR SECURE CODE
IS OPEN SOURCE SECURE?
-  Security by obscurity
-  Open code does not make it easier for hackers
-  Open Source makes people look at it
-  Popularity gets more eyes and more peer-reviews
•  Bad open-source software as bad
•  as bad private software.
VULNERABILITIES
OWASP
-  Injection
-  Cross Site Scripting - XSS
-  Broken Authentication and Session Management
-  Cross Site Request Forgery - CSRF
-  Security Misconfguration
-  Failure to Restrict URL Access	
  
-  Access bypas
REPORTED VULNERABILITIES
IS DRUPAL SECURE?
-  Safe by design (Core and API)
-  Security Team
-  Highly organised
-  Documented process for Security Advisories and Updates
-  Thousands of maintainers, users and experts
-  Support: Drupal 6/7, Core & Contributed Modules
KEEP YOUR 
DRUPAL WEBSITE
SECURE
2
SECURITY IS A PROCESS 
NOT AN EVENT
•  FROM REPORTED ISSUE TO SECURITY UPDATE
A DRUPAL SECURITY RELEASE
YOU’RE SAFE UNTIL RELEASE SECURITY UPDATE
PRIVATE DISCLOSURE
UPDATES	
  
Always stay up to date
-  Keep up with latest security releases
Update Workflow
-  Hacked module + diff
-  Drush up
KNOW WHEN AN UPDATE IS NEEDED
UPDATE MANAGER
INSIGHT INTO HEALTH OF YOUR DRUPAL WEBSITE
STATUS MONITORING
Tools
-  Droptor.com (https://drupal.org/project/droptor)
-  Acquia Insight (https://drupal.org/project/
acquia_connector)
-  Nagios (https://drupal.org/project/nagios)
-  Drupalmonitor.com (https://drupal.org/project/
drupalmonitor)
-  …
BUILD A SECURE
DRUPAL WEBSITE
3
CONTRIBUTED
MODULES
CONTRIBUTED MODULES
Quality assurance
-  Usage
-  Number of open issues
-  Closed/Open ratio
-  Response time
	
  
Good quality usually means good security	
  
	
  
Manual code reviews for less used modules	
  
	
  
	
  
UPDATES	
  
Always stay up to date
-  Keep up with latest security releases
Update Workflow
-  Hacked module + diff
-  Drush up
PATCHES	
  
Contrib patches	
  
Read the entire issue
	
  
	
  
Commit custom patches	
  
Help out	
  
Feedback from other users (maintainers)	
  
Patch might get commited	
  
	
  
	
  Patch management	
  
Move module to patched	
  
Create a patches.txt	
  
Keep patches	
  
	
  
	
  
CUSTOM
MODULES
SECURITY PYRAMID	
  
Menu & Node Access	
  
Form API	
  
DB API	
  
Theme	
  
	
  	
  	
  
HACKS
AND HOW TO PREVENT THEM
SQL INJECTION	
  
"SELECT * FROM user WHERE name = '$name'"	
  
	
  
"SELECT * FROM user WHERE name = 'Robert'; DROP TABLE students;'"	
  
	
  
	
  
h4p://xkcd.com/327/	
  
SQL INJECTION
	
  
Placeholders	
  
	
  
	
   db_query(“SELECT * FROM users WHERE name = :user”, array(':user' => $user);	
  
	
  
	
  
Dynamic Queries	
  
	
  
	
  
	
  
$query = db_select('user', 'u')	
  
->fields('u')	
  
->where('name', $user)	
  
->execute();	
  
XSS (cross site scripting)	
  
EXECUTING ABRITRARY JAVASCRIPT CODE ON THE PAGE
XSS (cross site scripting)	
  
User Input	
  
	
  
	
   Title	
  
Body	
  
Log message	
  
Url	
  
Post	
  
User-Agent	
  
Headers	
  
	
  
	
  
XSS (cross site scripting)	
  
Validate forms	
  
	
  
	
   User input should never contain javascript	
  
	
  
	
  
Form api	
  
	
  
	
  
	
  
Never use $_POST variables	
  
$form_state['values']	
  
	
  
Form caching	
  
XSS (cross site scripting)	
  
Input formats	
  
Never use full_html	
  
	
  
	
  
Filter Functions	
  
	
  
	
  
	
  
	
  
	
  
check_url()	
  
check_plain()	
  
check_markup()	
  
filter_xss()	
  
XSS (cross site scripting)	
  
h4p://drupalscout.com/knowledge-­‐base/drupal-­‐text-­‐filtering-­‐cheat-­‐sheet-­‐drupal-­‐6	
  
XSS (cross site scripting)	
  
Functions	
  
	
  
	
   t()	
  
	
  
l()
drupal_set_title()	
  
	
  
	
  
	
  
@var => plain text	
  
%var => plain text	
  
!var => full html!	
  
CSRF (cross site request forgery)	
  
Taking action without confirming intent	
  
	
  
	
  
<a href=”/delete/user/1”>Delete user 1</a>	
  
	
  
	
  
Image Tag	
  
	
  
	
  
	
  
<img src=”/delete/user/1”>	
  
A hacker posts a comment to the administrator.	
  
When the administrator views the image, user 1 gets deleted	
  
	
  
	
  
CSRF (cross site request forgery)	
  
Token (aka Nonce)	
  
	
  
	
  
ACCESS BYPASS	
  
VIEW CONTENT A USER IS NOT SUPPOSED TO
ACCESS BYPASS	
  
View content a user is not supposed to	
  
	
  
	
  
$query = db_select('node', 'n')->fields('n');	
  
Also shows nodes that user doesn't have acces to	
  
	
  
	
  
$query->addTag('node_access')	
  
	
  
	
  
	
  
Rewrite the query based on the node_access table	
  
ACCESS BYPASS	
  
Bad custom caching	
  
	
  
	
  
Administrator visits a block listing nodes.	
  
The block gets cached	
  
	
  
The cached block with all nodes is shown to the anonymous user	
  
	
  
Add role id to custom caching	
  
ACCESS BYPASS	
  
Rabbit_hole module	
  
	
  
	
  
Rabbit Hole is a module that adds the ability to control what should happen
when an entity is being viewed at its own page.
Page manager can do the same.	
  
Field access	
  
	
  
	
  
	
  
$form['#access'] = custom_access_callback();	
  
Menu access	
  
	
  
	
  
	
  
$item['access callback'] = 'custom_access_callback',	
  
CORRECT USE OF API	
  
Form API	
  
Validation
Form state
Drupal_valid_token
	
  
	
  DB API	
  
db_select, db_insert, placeholders	
  
$query->addTag(‘node_access’);	
  
	
  
	
  Filter	
  
check_url, check_plain, check_markup, filter_xss, …	
  
t(), l(), drupal_set_title(), …	
  
	
  
	
  
THEMES
THEMES	
  
Themer not responsible	
  
	
  
	
  Preprocess functions	
  
	
  
	
  
CONFIGURATION
PERMISSIONS
	
  
Permission management	
  
	
  
	
  If Joe from advertising can give the full html filter format to anonymous user,
don't bother to think about security	
  
	
  
	
  
Split up permissions	
  
	
  
	
  The default permissions don't cover every use case	
  
	
  
	
  
PERMISSIONS
	
  
FILTER FORMATS	
  
Never use full_html	
  
	
  
	
  
Use filtered_html instead.	
  
	
  
	
  
Never use phpfilter	
  
	
  
	
   Use a custom module for code	
  
Versioning	
  
Bad performance (eval)	
  
	
  
	
  
CHECKLIST
CHECKLIST	
  
Never use	
  
full_html
Php filter	
  
	
  
	
  
Permissions	
  
	
  
	
  
	
  
	
  
	
  
Trusted users only
Split up permissions
	
  
API
	
  
	
  
	
  
	
  
	
  
	
  
Preprocess functions
check_plain, filter_xss
DB API
Form API
Tokens
Menu/Node Access
	
  
GREAT	
  
HOW ABOUT DRUPAL 8?
FURTHER READING
FURTHER READING	
  
Books	
  
Cracking Drupal !!	
  
Pro Drupal Development
Online	
  
https://drupal.org/writing-secure-code	
  
https://drupal.org/node/360052	
  
http://munich2012.drupal.org/program/sessions/think-hacker-secure-drupal-code.html	
  
http://drupalscout.com/knowledge-base	
  
Video	
  
How to avoid All your base are belong to us (drupalcon Denver)	
  
	
  
	
  

More Related Content

Similar to Drupal campleuven: Secure Drupal Development

Drupal Security from Drupalcamp Bratislava
Drupal Security from Drupalcamp BratislavaDrupal Security from Drupalcamp Bratislava
Drupal Security from Drupalcamp Bratislava
Gábor Hojtsy
 
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
ZIONSECURITY
 
Drupal Security Seminar
Drupal Security SeminarDrupal Security Seminar
Drupal Security Seminar
Calibrate
 
Rails Security
Rails SecurityRails Security
Rails Security
Wen-Tien Chang
 
Drupal Security Hardening
Drupal Security HardeningDrupal Security Hardening
Drupal Security Hardening
Gerald Villorente
 
Drupal Security Hardening
Drupal Security HardeningDrupal Security Hardening
Drupal Security Hardening
Gerald Villorente
 
Doing Drupal security right
Doing Drupal security rightDoing Drupal security right
Doing Drupal security right
Gábor Hojtsy
 
Drupal security
Drupal securityDrupal security
Drupal security
Jozef Toth
 
Doing Drupal security right from Drupalcon London
Doing Drupal security right from Drupalcon LondonDoing Drupal security right from Drupalcon London
Doing Drupal security right from Drupalcon London
Gábor Hojtsy
 
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
 
Applications secure by default
Applications secure by defaultApplications secure by default
Applications secure by default
Slawomir Jasek
 
Applications secure by default
Applications secure by defaultApplications secure by default
Applications secure by default
SecuRing
 
4 andrii kudiurov - web application security 101
4   andrii kudiurov - web application security 1014   andrii kudiurov - web application security 101
4 andrii kudiurov - web application security 101
Ievgenii Katsan
 
Web Security 101
Web Security 101Web Security 101
Web Security 101
Michael Peters
 
Web Application Security in Rails
Web Application Security in RailsWeb Application Security in Rails
Web Application Security in Rails
Uri Nativ
 
null Bangalore meet - Php Security
null Bangalore meet - Php Securitynull Bangalore meet - Php Security
null Bangalore meet - Php Security
n|u - The Open Security Community
 
The top 10 security issues in web applications
The top 10 security issues in web applicationsThe top 10 security issues in web applications
The top 10 security issues in web applications
Devnology
 
PHP Secure Programming
PHP Secure ProgrammingPHP Secure Programming
PHP Secure Programming
Balavignesh Kasinathan
 
DDD17 - Web Applications Automated Security Testing in a Continuous Delivery...
 DDD17 - Web Applications Automated Security Testing in a Continuous Delivery... DDD17 - Web Applications Automated Security Testing in a Continuous Delivery...
DDD17 - Web Applications Automated Security Testing in a Continuous Delivery...
Fedir RYKHTIK
 
Web Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or SucceedWeb Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or Succeed
Prathan Phongthiproek
 

Similar to Drupal campleuven: Secure Drupal Development (20)

Drupal Security from Drupalcamp Bratislava
Drupal Security from Drupalcamp BratislavaDrupal Security from Drupalcamp Bratislava
Drupal Security from Drupalcamp Bratislava
 
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
 
Drupal Security Seminar
Drupal Security SeminarDrupal Security Seminar
Drupal Security Seminar
 
Rails Security
Rails SecurityRails Security
Rails Security
 
Drupal Security Hardening
Drupal Security HardeningDrupal Security Hardening
Drupal Security Hardening
 
Drupal Security Hardening
Drupal Security HardeningDrupal Security Hardening
Drupal Security Hardening
 
Doing Drupal security right
Doing Drupal security rightDoing Drupal security right
Doing Drupal security right
 
Drupal security
Drupal securityDrupal security
Drupal security
 
Doing Drupal security right from Drupalcon London
Doing Drupal security right from Drupalcon LondonDoing Drupal security right from Drupalcon London
Doing Drupal security right from Drupalcon London
 
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)
 
Applications secure by default
Applications secure by defaultApplications secure by default
Applications secure by default
 
Applications secure by default
Applications secure by defaultApplications secure by default
Applications secure by default
 
4 andrii kudiurov - web application security 101
4   andrii kudiurov - web application security 1014   andrii kudiurov - web application security 101
4 andrii kudiurov - web application security 101
 
Web Security 101
Web Security 101Web Security 101
Web Security 101
 
Web Application Security in Rails
Web Application Security in RailsWeb Application Security in Rails
Web Application Security in Rails
 
null Bangalore meet - Php Security
null Bangalore meet - Php Securitynull Bangalore meet - Php Security
null Bangalore meet - Php Security
 
The top 10 security issues in web applications
The top 10 security issues in web applicationsThe top 10 security issues in web applications
The top 10 security issues in web applications
 
PHP Secure Programming
PHP Secure ProgrammingPHP Secure Programming
PHP Secure Programming
 
DDD17 - Web Applications Automated Security Testing in a Continuous Delivery...
 DDD17 - Web Applications Automated Security Testing in a Continuous Delivery... DDD17 - Web Applications Automated Security Testing in a Continuous Delivery...
DDD17 - Web Applications Automated Security Testing in a Continuous Delivery...
 
Web Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or SucceedWeb Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or Succeed
 

Recently uploaded

Gen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needsGen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needs
Laura Szabó
 
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
cuobya
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
zyfovom
 
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
ukwwuq
 
7 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 20247 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 2024
Danica Gill
 
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
CIOWomenMagazine
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
cuobya
 
Explore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories SecretlyExplore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories Secretly
Trending Blogers
 
Understanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdfUnderstanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdf
SEO Article Boost
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
ufdana
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
keoku
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
3ipehhoa
 
[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024
hackersuli
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
fovkoyb
 
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
bseovas
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
ysasp1
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
Trish Parr
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
3ipehhoa
 

Recently uploaded (20)

Gen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needsGen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needs
 
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
 
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
 
7 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 20247 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 2024
 
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
Internet of Things in Manufacturing: Revolutionizing Efficiency & Quality | C...
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
 
Explore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories SecretlyExplore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories Secretly
 
Understanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdfUnderstanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdf
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
 
[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
 
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
 

Drupal campleuven: Secure Drupal Development

  • 1. Secure  Drupal  Development   Steven  Van  den  Hout  
  • 4. MANY EYES MAKE FOR SECURE CODE IS OPEN SOURCE SECURE? -  Security by obscurity -  Open code does not make it easier for hackers -  Open Source makes people look at it -  Popularity gets more eyes and more peer-reviews •  Bad open-source software as bad •  as bad private software.
  • 5. VULNERABILITIES OWASP -  Injection -  Cross Site Scripting - XSS -  Broken Authentication and Session Management -  Cross Site Request Forgery - CSRF -  Security Misconfguration -  Failure to Restrict URL Access   -  Access bypas
  • 7. IS DRUPAL SECURE? -  Safe by design (Core and API) -  Security Team -  Highly organised -  Documented process for Security Advisories and Updates -  Thousands of maintainers, users and experts -  Support: Drupal 6/7, Core & Contributed Modules
  • 8. KEEP YOUR DRUPAL WEBSITE SECURE 2
  • 9. SECURITY IS A PROCESS NOT AN EVENT
  • 10. •  FROM REPORTED ISSUE TO SECURITY UPDATE A DRUPAL SECURITY RELEASE
  • 11.
  • 12.
  • 13. YOU’RE SAFE UNTIL RELEASE SECURITY UPDATE PRIVATE DISCLOSURE
  • 14. UPDATES   Always stay up to date -  Keep up with latest security releases Update Workflow -  Hacked module + diff -  Drush up
  • 15. KNOW WHEN AN UPDATE IS NEEDED UPDATE MANAGER
  • 16. INSIGHT INTO HEALTH OF YOUR DRUPAL WEBSITE STATUS MONITORING Tools -  Droptor.com (https://drupal.org/project/droptor) -  Acquia Insight (https://drupal.org/project/ acquia_connector) -  Nagios (https://drupal.org/project/nagios) -  Drupalmonitor.com (https://drupal.org/project/ drupalmonitor) -  …
  • 17.
  • 20. CONTRIBUTED MODULES Quality assurance -  Usage -  Number of open issues -  Closed/Open ratio -  Response time   Good quality usually means good security     Manual code reviews for less used modules      
  • 21. UPDATES   Always stay up to date -  Keep up with latest security releases Update Workflow -  Hacked module + diff -  Drush up
  • 22. PATCHES   Contrib patches   Read the entire issue     Commit custom patches   Help out   Feedback from other users (maintainers)   Patch might get commited      Patch management   Move module to patched   Create a patches.txt   Keep patches      
  • 24. SECURITY PYRAMID   Menu & Node Access   Form API   DB API   Theme        
  • 25. HACKS AND HOW TO PREVENT THEM
  • 26. SQL INJECTION   "SELECT * FROM user WHERE name = '$name'"     "SELECT * FROM user WHERE name = 'Robert'; DROP TABLE students;'"       h4p://xkcd.com/327/  
  • 27. SQL INJECTION   Placeholders       db_query(“SELECT * FROM users WHERE name = :user”, array(':user' => $user);       Dynamic Queries         $query = db_select('user', 'u')   ->fields('u')   ->where('name', $user)   ->execute();  
  • 28. XSS (cross site scripting)   EXECUTING ABRITRARY JAVASCRIPT CODE ON THE PAGE
  • 29. XSS (cross site scripting)   User Input       Title   Body   Log message   Url   Post   User-Agent   Headers      
  • 30. XSS (cross site scripting)   Validate forms       User input should never contain javascript       Form api         Never use $_POST variables   $form_state['values']     Form caching  
  • 31. XSS (cross site scripting)   Input formats   Never use full_html       Filter Functions             check_url()   check_plain()   check_markup()   filter_xss()  
  • 32. XSS (cross site scripting)   h4p://drupalscout.com/knowledge-­‐base/drupal-­‐text-­‐filtering-­‐cheat-­‐sheet-­‐drupal-­‐6  
  • 33. XSS (cross site scripting)   Functions       t()     l() drupal_set_title()         @var => plain text   %var => plain text   !var => full html!  
  • 34. CSRF (cross site request forgery)   Taking action without confirming intent       <a href=”/delete/user/1”>Delete user 1</a>       Image Tag         <img src=”/delete/user/1”>   A hacker posts a comment to the administrator.   When the administrator views the image, user 1 gets deleted      
  • 35. CSRF (cross site request forgery)   Token (aka Nonce)      
  • 36. ACCESS BYPASS   VIEW CONTENT A USER IS NOT SUPPOSED TO
  • 37. ACCESS BYPASS   View content a user is not supposed to       $query = db_select('node', 'n')->fields('n');   Also shows nodes that user doesn't have acces to       $query->addTag('node_access')         Rewrite the query based on the node_access table  
  • 38. ACCESS BYPASS   Bad custom caching       Administrator visits a block listing nodes.   The block gets cached     The cached block with all nodes is shown to the anonymous user     Add role id to custom caching  
  • 39. ACCESS BYPASS   Rabbit_hole module       Rabbit Hole is a module that adds the ability to control what should happen when an entity is being viewed at its own page. Page manager can do the same.   Field access         $form['#access'] = custom_access_callback();   Menu access         $item['access callback'] = 'custom_access_callback',  
  • 40. CORRECT USE OF API   Form API   Validation Form state Drupal_valid_token    DB API   db_select, db_insert, placeholders   $query->addTag(‘node_access’);      Filter   check_url, check_plain, check_markup, filter_xss, …   t(), l(), drupal_set_title(), …      
  • 42. THEMES   Themer not responsible      Preprocess functions      
  • 44. PERMISSIONS   Permission management      If Joe from advertising can give the full html filter format to anonymous user, don't bother to think about security       Split up permissions      The default permissions don't cover every use case      
  • 46. FILTER FORMATS   Never use full_html       Use filtered_html instead.       Never use phpfilter       Use a custom module for code   Versioning   Bad performance (eval)      
  • 48. CHECKLIST   Never use   full_html Php filter       Permissions             Trusted users only Split up permissions   API             Preprocess functions check_plain, filter_xss DB API Form API Tokens Menu/Node Access  
  • 49. GREAT   HOW ABOUT DRUPAL 8?
  • 51. FURTHER READING   Books   Cracking Drupal !!   Pro Drupal Development Online   https://drupal.org/writing-secure-code   https://drupal.org/node/360052   http://munich2012.drupal.org/program/sessions/think-hacker-secure-drupal-code.html   http://drupalscout.com/knowledge-base   Video   How to avoid All your base are belong to us (drupalcon Denver)