SlideShare une entreprise Scribd logo
1  sur  83
Télécharger pour lire hors ligne
Fix me if you can
Fix me, if you can
We prepared you a site to fix.
It has been broken in many, many places.
You will work in teams to fix it.

About the session
We are drupalists, consultants, working in the
Acquia Professional Services team

Alex Ku
Balázs Dianiska
Hernâni Borges de Freitas
Théodore Biadala
About us
Alex
drupal.org: alexku
linkedin: Alex Ku
Balázs
drupal.org: snufkin
twitter: @thesnufkin
Hernâni
drupal.org: hernani
twitter: @hernanibf
drupal.org: nod_
twitter: @nod_
Théodore
LAMP stack
Varnish is installed and set up
We set up a site for each team
Each site is broken in many ways
What is in the box
15:45 - 16:00 - Introduction and setup
16:00 - 16:25 - Site building
16:25 - 16:35 - Break
16:35 - 17:00 - Security
17:00 - 17:10 - Break
17:10 - 17:35 - Performance
17:35 - 18:00 - Wrap up and questions
Lab schedule
http://fixme.acquia-ps.com
What we prepared:
1 site per team
1 login per site
We can create 25 sites, so lets split into teams

Address: http://fixme.acquia-ps.com
Password will be on the site
Setup
http://fixme.acquia-ps.com
Site building
•  Best practices
§  Drupal coding standards
§  Security
§  Performance
•  Code architecture
•  Content architecture
•  Configuration
http://fixme.acquia-ps.com
Review process
1.  Make the site run
2.  Run automated tools
3.  Triage the output
4.  Read all the custom code*
5.  Dig into messy areas
http://fixme.acquia-ps.com
Tools
•  Update
•  Hacked
•  Coder
•  PHP_CodeSniffer 
•  Insight
•  A Brain
http://fixme.acquia-ps.com
Red flags
•  PHP Filter module
•  PHP in templates
•  Many, many template files
•  Many views/blocks/panels with a similar
name
•  Many content types with one or two nodes

http://fixme.acquia-ps.com
Exercise 1- Code hacked
•  Looking for hacked core / contrib
•  Go to hacked report and run it
http://fixme.acquia-ps.com
Exercise 2- Missing updates
•  Run Update module
•  Explain how to keep it up to date

http://fixme.acquia-ps.com
Exercise 3 - Coding standards
•  Coder & PHP Code Sniffer
•  Find jquery_countdown and email_login_link
http://fixme.acquia-ps.com
Exercise 4 - Views architecture
•  Check “News” views
http://fixme.acquia-ps.com
Exercise 5 - Content architecture
- article => 1320
- teaser => 805
- microsite => 273
- …
- sports_homepage => 1
- teams_homepage => 1
- change_password => 1
- login_form => 1
- footer_homepage => 1

http://fixme.acquia-ps.com
Secure your
Drupal site by first
hacking into it
http://fixme.acquia-ps.com
Drupal vulnerabilities by popularity
reported in core and contrib SAs from 6/1/2005 through
3/24/2010
Access Bypass
http://www.flickr.com/photos/nikonvscanon/
1816459664/
Access Bypass
“Inadequate or weak access control over
a resource”
Authentication
Authorization
Access Bypass
When a user can
see something they shouldn’t
perform an action they shouldn’t
Stop Access Bypass
Implement checks
before providing an action
after undertaking an action
Access Bypass Hands-on
First as anonymous user goto:
http://fixme.acquia-ps.com/[teamN]/admin/dashboard/users/all
What’s there:
VBO allows sending an email to any address and blocking
users
How can we fix this?
Access Bypass Hands-on
The problem is in:
●  “Bypass views access control” permission
●  “Actions permissions (VBO)” module
http://www.flickr.com/photos/nathaninsandiego/3757033518/ http://flic.kr/p/6HZMaY
Cross Site Scripting
Cross Site Scripting
XSS
Javascript
Performing actions without your intent
Everything you can do XSS can do faster
Stored XSS Step 1
DrupalAttacker
Reques
t
J
S
DB
J
S
http://fixme.acquia-ps.com
Stored XSS Step 2
DrupalVictim
Reques
t
Respons
e
J
S
J
S
DB
http://fixme.acquia-ps.com
Stored XSS Step 3
DrupalVictim
Reques
t
J
S
DB
J
S
http://fixme.acquia-ps.com
$node = node_load($nid);
$title = $node->title;
drupal_set_title($title);
...
(later, in page.tpl.php)
...
<h1><?php print $title; ?></h1>
http://fixme.acquia-ps.com
XSS Hands-on
First as admin user go to:
http://fixme.acquia-ps.com/[teamN]/user/1 and
notice value for Full Name
Then open this page:
http://fixme.acquia-ps.com/[teamN]/node/56
Now open the first page again and notice the Full
Name has changed
How can we fix this?
http://fixme.acquia-ps.com
XSS Hands-on
The problem is in:
●  Filtered HTML text format allowing <script> tag
●  Security Review module helps detecting issues like
this
http://fixme.acquia-ps.com
http://www.flickr.com/photos/jackofspades/4500411648/
Cross Site
Request Forgery
Cross Site Request
Forgery
CSRF
Taking action without confirming user
intent
Cross Site Request
Forgery
Attacker makes action occur on your
behalf
Using your session
Without you knowing or approving
Cross Site Request
Forgery
/comment/reply/1
Attacker
img
src=delete/1
Drupal
Cross Site Request
Forgery
Victim html
cookie
Drupal
Drupal
/user/login
Cross Site Request
Forgery
Victim DrupalDrupal
/node/1
Cross Site Request
Forgery
Victim html DrupalDrupal
/node/1
/delete/1
validate intent
“Did the user mean to carry-out
action”
or
“Could an attacker execute this on
behalf of a user”
Protecting against CSRF
Something secret, unique to the
action
Shared between trusted user and
server
Validate intent?
only if using Form API
generates form token
checks token when processing form
Drupal protects against
CSRF with Form API
fancy AJAX, GET callbacks
drupal_get_token()
drupal_valid_token()
Generate your own token
attacker identifies weak point
gets authorized account to take action
protect by confirming intent
Cross Site Request Forgery
As anonymous user add a comment with an image like
this:
<img src=”admin/content/unpublish/[nid]”>
Visit the page with the comment as admin
Check if the node is unpublished
How can we fix this?
CSRF Hands-on
A proper fix would require adding protection in callback
function for path: admin/content/unpublish/[nid]
A quick fix would filter img tags in Filtered HTML
CSRF Hands-on
SQL Injection
Mixing data received from the user with
database query allows an attacker to perform
custom actions against the database
As anonymous user go to:
http://fixme.acquia-ps.com/show/node?nid=[nid]
You should see a title and status of a single node
Now append this to the url:
“ union select uid, name, status from users”
You should see names of all users
How can we detect and fix this?
SQL Injection Hands-on
SQL Injection Hands-on
Security Review module helps detect
simple SQL injection vulnerabilities
Fixing this would require rewriting custom code

The vulnerable lines are:
$nid = $_GET['nid'];
$r = db_query("SELECT nid, title, status FROM
{node} WHERE status = 1 AND nid = $nid");

The fix would look something like:
$nid = $_GET['nid'];
$r = db_query("SELECT nid, title, status FROM
{node} WHERE status = 1 AND nid = :nid",
array(“:nid” => $nid));

SQL Injection Hands-on
Automation
http://www.flickr.com/photos/hubmedia/2141860216/
Steps to a mostly automated
reviewSecurity Review: drupal.org/project/security_review
Hacked: drupal.org/project/hacked
Coder: drupal.org/project/coder
Secure Code Review
drupal.org/project/secure_code_review
Vuln: github.com/unn/vuln
HTML Purifier:
drupal.org/project/htmlpurifier
More: http://drupalscout.com/node/11
Performance
http://fixme.acquia-ps.com
Slow? What you mean?
•  Backend slowness
•  Services that website use are slow
or unresponsive (dbs)
•  Application too complex
•  Server resources overload
•  Frontend slowness
•  Too many assets
•  Slow connection between browser
and server.
•  JS slowing the DOM (re)rendering
http://fixme.acquia-ps.com
Profile
Look for pages you suspect
•  Start by easy ones
•  404 page (the fastest page you
can get).
•  Node view page
•  Homepage
•  Continue with the ones your data
marked as slow.
Time for some research
http://fixme.acquia-ps.com
Benchmarks
Ideally your normal pages should
take
•  1 ~ 1.5 sec
•  40 ~ 60 mb of memory
•  100~300 queries per page
Simpler pages like 404 are good
indicators of what is the fastest all
other pages will run.
http://fixme.acquia-ps.com
Profiling tools
Chasing it
•  Use Devel module (
http://drupal.org/project/devel ) to
have a fast indication of page load
times and memory consumption.
•  Use XhProf Module to profile the
page and understand slower
components.
•  Use timer_start(), timer_read()
functions in situations where you are
unsure.
http://fixme.acquia-ps.com
Typical #1 – Slow queries
•  First look to profiling data shows something really slow.
Problem
•  Related to the database (Wall time vs Total Time).
•  Number of queries is low, so probably it’s a single query.
Solution
•  Reduce query time in views ; Use Views Lite Pager
Devel XhPro
f
http://fixme.acquia-ps.com
Problem
•  High number of queries
•  High memory consumption
•  High number of function calls
•  All those little queries and memory consumption mean that
you are loading lots of information from the database.
Solution
•  Look to XhProf and identify the root cause of all the excessive
function calls.
Devel XhPro
f
Typical #2 – Extra complexity
http://fixme.acquia-ps.com
Typical #3 – Edge cases
•  Slow functions only detectable by XhProf
• Eg: When problem is in PHP execution
• Problematic if using popular hooks (hook_init,
hook_node_load).
•  Infrastructure not being properly used
•  Requests bypassing Varnish
•  Not enough APC memory
•  Blocks rendered in all pages and content hidden at template
level.
•  Theme_rebuild and cache_clear_all in middle of code.
http://fixme.acquia-ps.com
Typical #4 – Special tasks
•  Usually a task executed in special situations or in
certain pages that seriously slows down the platform.
•  Synchronizations of thousand of nodes from web
services.
•  Synchronization of all user base from LDAP.
•  Sending thousand of mails via Cron.
•  Even worst when those tasks are called by normal
page views.
http://fixme.acquia-ps.com
Hands On Time
http://fixme.acquia-ps.com
1.  Enable Devel
> Admin / Config / Devel -> Display query log, Display
page timer, Display memory usage
1.  Enable XhProf
> Admin / Config / XHProf
1.  Enable a browser inspector tool (Google Chrome
Developer tools or Firebug or etc..)
Exercise 1 - Enable tools
http://fixme.acquia-ps.com
1.  Go to Drupalistas tab
2.  Click on Demo user and Drupal commits
Exercise 2 - Slow Query
http://fixme.acquia-ps.com
1.  Go to Drupalistas tab
2.  Click on Demo user and Drupal commits
3.  Look to devel query log.
4.  Go to user / uid 1 and see the difference
Exercise 2 - Slow Query
http://fixme.acquia-ps.com
1.  Go to a 404 page ( /prague)
2.  Look to XhProf report
Exercise 3 - Missed blocks
http://fixme.acquia-ps.com
1.  Go to a 404 page ( /prague)
2.  Look to XhProf report
3.  Find the missing blocks (weather)
4.  FIx it by giving the right path
Exercise 3 - Missed blocks
http://fixme.acquia-ps.com
1.  Go to a 404 page ( /prague)
2.  Look to XhProf report
3.  Find the missing blocks (weather)
4.  Fix it by giving the right path
Exercise 3 - Missed blocks
http://fixme.acquia-ps.com
- Go to the sessions tab.
- Look to XhProf and Devel.
- Look to amount of memory and CPU.
Exercise 4 - Complexity
http://fixme.acquia-ps.com
- Go to the sessions page.
- Look to XhProf and Devel.
- Look to amount of memory and CPU.
- Look to code to understand the amount of node_loads.
- Disable custom block and enable views block.
- Enable block cache alter
- Check difference
Exercise 4 - Complexity
http://fixme.acquia-ps.com
- Go to a Drupalcon node
- Refresh a few times the page. Look to headers.
- Look to all requests done by the page.
Exercise 5 - Problems in
infrastructure
http://fixme.acquia-ps.com
- Go to a Drupalcon node
- Refresh a few times the page. Look to headers.
- Look to all requests done by the page.
- Identify missing header in the ajax Call done to get
attendance
- Look to code
Exercise 5 - Problems in
infrastructure
http://fixme.acquia-ps.com
1.  Reduce complexity. Make sure your site is as slim as possible.
2.  Cache where you can. At all levels.
3.  Maintain cache as long as possible as long it is acceptable.
4.  Compute behind the scenes when you can.
5.  Distribute the heavier tasks to larger intervals.
6.  Grow infrastructure if you are reaching server limits.
After you identified the
problems
Caching after optimizing
http://fixme.acquia-ps.com
Performance
Can it be cached? Cache it!
•  Page caching, block caching, panels caching, views
caching, caching API..
•  Review caching strategy:
•  https://www.acquia.com/blog/when-and-how-caching-
can-save-your-site-part-2-authenticated-users
•  Guarantee that caching is effectively helping you.
•  Don’t clear it too often.
•  Not used only by a minority.
http://fixme.acquia-ps.com
Summary
●  Make sure to look for others suffering from the same
problem.
●  Never hesitate to ask the most basic questions.
●  Go step by step, exclude possibilities if uncertain.
●  Learn the tools we introduced you to.
●  Always try to understand the whole system, not just the
part throwing the error.
http://fixme.acquia-ps.com
So, before your questions.
I do have a question.
Would you like to join Acquia?
We are hiring EVERYWHERE in Europe!
• Consultants
• Support
• Sales
• Engineering
http://fixme.acquia-ps.com
Thank you for your attention. Now question time!
THANK YOU!
WHAT DID YOU THINK?
Locate this session at the
DrupalCon Prague website:
http://prague2013.drupal.org/schedule
Click the “Take the survey” link

Contenu connexe

Tendances

Battling the WSOD - A Tech Support Tale
Battling the WSOD - A Tech Support TaleBattling the WSOD - A Tech Support Tale
Battling the WSOD - A Tech Support TaleKayleigh Thorpe
 
Best practices-wordpress-enterprise
Best practices-wordpress-enterpriseBest practices-wordpress-enterprise
Best practices-wordpress-enterpriseTaylor Lovett
 
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programsAEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programsMikhail Egorov
 
Progressive Enhancement 2.0 (Conference Agnostic)
Progressive Enhancement 2.0 (Conference Agnostic)Progressive Enhancement 2.0 (Conference Agnostic)
Progressive Enhancement 2.0 (Conference Agnostic)Nicholas Zakas
 
Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016bugcrowd
 
Hunting for security bugs in AEM webapps
Hunting for security bugs in AEM webappsHunting for security bugs in AEM webapps
Hunting for security bugs in AEM webappsMikhail Egorov
 
HTML5 vs Silverlight
HTML5 vs SilverlightHTML5 vs Silverlight
HTML5 vs SilverlightMatt Casto
 
10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...Otto Kekäläinen
 
Rails security: above and beyond the defaults
Rails security: above and beyond the defaultsRails security: above and beyond the defaults
Rails security: above and beyond the defaultsMatias Korhonen
 
WordPress Security Best Practices 2019 Update
WordPress Security Best Practices 2019 UpdateWordPress Security Best Practices 2019 Update
WordPress Security Best Practices 2019 UpdateZero Point Development
 
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...Otto Kekäläinen
 
Legal and efficient web app testing without permission
Legal and efficient web app testing without permissionLegal and efficient web app testing without permission
Legal and efficient web app testing without permissionAbraham Aranguren
 
High Performance JavaScript (Amazon DevCon 2011)
High Performance JavaScript (Amazon DevCon 2011)High Performance JavaScript (Amazon DevCon 2011)
High Performance JavaScript (Amazon DevCon 2011)Nicholas Zakas
 
XSS Magic tricks
XSS Magic tricksXSS Magic tricks
XSS Magic tricksGarethHeyes
 
Javascript Security - Three main methods of defending your MEAN stack
Javascript Security - Three main methods of defending your MEAN stackJavascript Security - Three main methods of defending your MEAN stack
Javascript Security - Three main methods of defending your MEAN stackRan Bar-Zik
 
Your WordPress Website Is/Not Hacked
Your WordPress Website Is/Not HackedYour WordPress Website Is/Not Hacked
Your WordPress Website Is/Not HackedAngela Bowman
 
When you don't have 0days: client-side exploitation for the masses
When you don't have 0days: client-side exploitation for the massesWhen you don't have 0days: client-side exploitation for the masses
When you don't have 0days: client-side exploitation for the massesMichele Orru
 
Wrangling Large Scale Frontend Web Applications
Wrangling Large Scale Frontend Web ApplicationsWrangling Large Scale Frontend Web Applications
Wrangling Large Scale Frontend Web ApplicationsRyan Roemer
 

Tendances (20)

Battling the WSOD - A Tech Support Tale
Battling the WSOD - A Tech Support TaleBattling the WSOD - A Tech Support Tale
Battling the WSOD - A Tech Support Tale
 
Best practices-wordpress-enterprise
Best practices-wordpress-enterpriseBest practices-wordpress-enterprise
Best practices-wordpress-enterprise
 
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programsAEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
AEM hacker - approaching Adobe Experience Manager webapps in bug bounty programs
 
WordPress Security Best Practices
WordPress Security Best PracticesWordPress Security Best Practices
WordPress Security Best Practices
 
Progressive Enhancement 2.0 (Conference Agnostic)
Progressive Enhancement 2.0 (Conference Agnostic)Progressive Enhancement 2.0 (Conference Agnostic)
Progressive Enhancement 2.0 (Conference Agnostic)
 
Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016
 
Hunting for security bugs in AEM webapps
Hunting for security bugs in AEM webappsHunting for security bugs in AEM webapps
Hunting for security bugs in AEM webapps
 
HTML5 vs Silverlight
HTML5 vs SilverlightHTML5 vs Silverlight
HTML5 vs Silverlight
 
10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...10 things every developer should know about their database to run word press ...
10 things every developer should know about their database to run word press ...
 
Rails security: above and beyond the defaults
Rails security: above and beyond the defaultsRails security: above and beyond the defaults
Rails security: above and beyond the defaults
 
WordPress Security Best Practices 2019 Update
WordPress Security Best Practices 2019 UpdateWordPress Security Best Practices 2019 Update
WordPress Security Best Practices 2019 Update
 
Selenium bootcamp slides
Selenium bootcamp slides   Selenium bootcamp slides
Selenium bootcamp slides
 
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...The 5 most common reasons for a slow WordPress site and how to fix them – ext...
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
 
Legal and efficient web app testing without permission
Legal and efficient web app testing without permissionLegal and efficient web app testing without permission
Legal and efficient web app testing without permission
 
High Performance JavaScript (Amazon DevCon 2011)
High Performance JavaScript (Amazon DevCon 2011)High Performance JavaScript (Amazon DevCon 2011)
High Performance JavaScript (Amazon DevCon 2011)
 
XSS Magic tricks
XSS Magic tricksXSS Magic tricks
XSS Magic tricks
 
Javascript Security - Three main methods of defending your MEAN stack
Javascript Security - Three main methods of defending your MEAN stackJavascript Security - Three main methods of defending your MEAN stack
Javascript Security - Three main methods of defending your MEAN stack
 
Your WordPress Website Is/Not Hacked
Your WordPress Website Is/Not HackedYour WordPress Website Is/Not Hacked
Your WordPress Website Is/Not Hacked
 
When you don't have 0days: client-side exploitation for the masses
When you don't have 0days: client-side exploitation for the massesWhen you don't have 0days: client-side exploitation for the masses
When you don't have 0days: client-side exploitation for the masses
 
Wrangling Large Scale Frontend Web Applications
Wrangling Large Scale Frontend Web ApplicationsWrangling Large Scale Frontend Web Applications
Wrangling Large Scale Frontend Web Applications
 

En vedette

My Site is slow - Drupal Camp London 2013
My Site is slow - Drupal Camp London 2013My Site is slow - Drupal Camp London 2013
My Site is slow - Drupal Camp London 2013hernanibf
 
One Drupal to rule them all - Drupalcamp London
One Drupal to rule them all - Drupalcamp LondonOne Drupal to rule them all - Drupalcamp London
One Drupal to rule them all - Drupalcamp Londonhernanibf
 
One drupal to rule them all - Drupalcamp Caceres
One drupal to rule them all - Drupalcamp CaceresOne drupal to rule them all - Drupalcamp Caceres
One drupal to rule them all - Drupalcamp Cacereshernanibf
 
Drupal content editor flexibility
Drupal content editor flexibilityDrupal content editor flexibility
Drupal content editor flexibilityhernanibf
 
Drupal architectures for flexible content - Drupalcon Barcelona
Drupal architectures for flexible content - Drupalcon BarcelonaDrupal architectures for flexible content - Drupalcon Barcelona
Drupal architectures for flexible content - Drupalcon Barcelonahernanibf
 
Intro to drupal
Intro to drupalIntro to drupal
Intro to drupalhernanibf
 
Drupal + selenium
Drupal + seleniumDrupal + selenium
Drupal + seleniumhernanibf
 
My site is slow
My site is slowMy site is slow
My site is slowhernanibf
 

En vedette (9)

My Site is slow - Drupal Camp London 2013
My Site is slow - Drupal Camp London 2013My Site is slow - Drupal Camp London 2013
My Site is slow - Drupal Camp London 2013
 
One Drupal to rule them all - Drupalcamp London
One Drupal to rule them all - Drupalcamp LondonOne Drupal to rule them all - Drupalcamp London
One Drupal to rule them all - Drupalcamp London
 
One drupal to rule them all - Drupalcamp Caceres
One drupal to rule them all - Drupalcamp CaceresOne drupal to rule them all - Drupalcamp Caceres
One drupal to rule them all - Drupalcamp Caceres
 
Drupal content editor flexibility
Drupal content editor flexibilityDrupal content editor flexibility
Drupal content editor flexibility
 
Drupal architectures for flexible content - Drupalcon Barcelona
Drupal architectures for flexible content - Drupalcon BarcelonaDrupal architectures for flexible content - Drupalcon Barcelona
Drupal architectures for flexible content - Drupalcon Barcelona
 
Intro to drupal
Intro to drupalIntro to drupal
Intro to drupal
 
Rules way
Rules wayRules way
Rules way
 
Drupal + selenium
Drupal + seleniumDrupal + selenium
Drupal + selenium
 
My site is slow
My site is slowMy site is slow
My site is slow
 

Similaire à Fix me if you can - DrupalCon prague

Sql Injections With Real Life Scenarious
Sql Injections With Real Life ScenariousSql Injections With Real Life Scenarious
Sql Injections With Real Life ScenariousFrancis Alexander
 
OSCP Preparation Guide @ Infosectrain
OSCP Preparation Guide @ InfosectrainOSCP Preparation Guide @ Infosectrain
OSCP Preparation Guide @ InfosectrainInfosecTrain
 
(WEB301) Operational Web Log Analysis | AWS re:Invent 2014
(WEB301) Operational Web Log Analysis | AWS re:Invent 2014(WEB301) Operational Web Log Analysis | AWS re:Invent 2014
(WEB301) Operational Web Log Analysis | AWS re:Invent 2014Amazon Web Services
 
Are you ready to be hacked?
Are you ready to be hacked?Are you ready to be hacked?
Are you ready to be hacked?Daniel Kanchev
 
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...DevOpsDays Riga
 
Northeast PHP - High Performance PHP
Northeast PHP - High Performance PHPNortheast PHP - High Performance PHP
Northeast PHP - High Performance PHPJonathan Klein
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeededm00se
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.jsChris Cowan
 
I got 99 trends and a # is all of them
I got 99 trends and a # is all of themI got 99 trends and a # is all of them
I got 99 trends and a # is all of themRoberto Suggi Liverani
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performanceEngine Yard
 
Under the Wire PowerShell workshop - BSides Augusta 2018
Under the Wire PowerShell workshop - BSides Augusta 2018Under the Wire PowerShell workshop - BSides Augusta 2018
Under the Wire PowerShell workshop - BSides Augusta 2018Fernando Tomlinson, CISSP, MBA
 
Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Amazon Web Services
 
OWASP SF - Reviewing Modern JavaScript Applications
OWASP SF - Reviewing Modern JavaScript ApplicationsOWASP SF - Reviewing Modern JavaScript Applications
OWASP SF - Reviewing Modern JavaScript ApplicationsLewis Ardern
 
DevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer ToolsDevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer ToolsAmazon Web Services
 
Cloud Device Insecurity
Cloud Device InsecurityCloud Device Insecurity
Cloud Device InsecurityJeremy Brown
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slidesDocker, Inc.
 
Attack Chaining: Advanced Maneuvers for Hack Fu
Attack Chaining: Advanced Maneuvers for Hack FuAttack Chaining: Advanced Maneuvers for Hack Fu
Attack Chaining: Advanced Maneuvers for Hack FuRob Ragan
 
Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11Combell NV
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfonyFrancois Zaninotto
 

Similaire à Fix me if you can - DrupalCon prague (20)

Sql Injections With Real Life Scenarious
Sql Injections With Real Life ScenariousSql Injections With Real Life Scenarious
Sql Injections With Real Life Scenarious
 
OSCP Preparation Guide @ Infosectrain
OSCP Preparation Guide @ InfosectrainOSCP Preparation Guide @ Infosectrain
OSCP Preparation Guide @ Infosectrain
 
(WEB301) Operational Web Log Analysis | AWS re:Invent 2014
(WEB301) Operational Web Log Analysis | AWS re:Invent 2014(WEB301) Operational Web Log Analysis | AWS re:Invent 2014
(WEB301) Operational Web Log Analysis | AWS re:Invent 2014
 
Are you ready to be hacked?
Are you ready to be hacked?Are you ready to be hacked?
Are you ready to be hacked?
 
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
 
Northeast PHP - High Performance PHP
Northeast PHP - High Performance PHPNortheast PHP - High Performance PHP
Northeast PHP - High Performance PHP
 
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
AD113  Speed Up Your Applications w/ Nginx and PageSpeedAD113  Speed Up Your Applications w/ Nginx and PageSpeed
AD113 Speed Up Your Applications w/ Nginx and PageSpeed
 
Intro To Node.js
Intro To Node.jsIntro To Node.js
Intro To Node.js
 
I got 99 trends and a # is all of them
I got 99 trends and a # is all of themI got 99 trends and a # is all of them
I got 99 trends and a # is all of them
 
6 tips for improving ruby performance
6 tips for improving ruby performance6 tips for improving ruby performance
6 tips for improving ruby performance
 
Under the Wire PowerShell workshop - BSides Augusta 2018
Under the Wire PowerShell workshop - BSides Augusta 2018Under the Wire PowerShell workshop - BSides Augusta 2018
Under the Wire PowerShell workshop - BSides Augusta 2018
 
Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration
 
OWASP SF - Reviewing Modern JavaScript Applications
OWASP SF - Reviewing Modern JavaScript ApplicationsOWASP SF - Reviewing Modern JavaScript Applications
OWASP SF - Reviewing Modern JavaScript Applications
 
DevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer ToolsDevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
DevOps on AWS: Accelerating Software Delivery with the AWS Developer Tools
 
Cloud Device Insecurity
Cloud Device InsecurityCloud Device Insecurity
Cloud Device Insecurity
 
Anatomy of a Drupal Hack - TechKnowFile 2014
Anatomy of a Drupal Hack - TechKnowFile 2014Anatomy of a Drupal Hack - TechKnowFile 2014
Anatomy of a Drupal Hack - TechKnowFile 2014
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
Attack Chaining: Advanced Maneuvers for Hack Fu
Attack Chaining: Advanced Maneuvers for Hack FuAttack Chaining: Advanced Maneuvers for Hack Fu
Attack Chaining: Advanced Maneuvers for Hack Fu
 
Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11Php through the eyes of a hoster phpbnl11
Php through the eyes of a hoster phpbnl11
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfony
 

Plus de hernanibf

Drupal Europe 2018: Hackers automate but the drupal community still downloads...
Drupal Europe 2018: Hackers automate but the drupal community still downloads...Drupal Europe 2018: Hackers automate but the drupal community still downloads...
Drupal Europe 2018: Hackers automate but the drupal community still downloads...hernanibf
 
Aiming for automatic updates - Drupal Dev Days Lisbon 2018
Aiming for automatic updates - Drupal Dev Days Lisbon 2018Aiming for automatic updates - Drupal Dev Days Lisbon 2018
Aiming for automatic updates - Drupal Dev Days Lisbon 2018hernanibf
 
Deployer - Deployment tool for PHP
Deployer - Deployment tool for PHPDeployer - Deployment tool for PHP
Deployer - Deployment tool for PHPhernanibf
 
Oxford DrupalCamp 2012 - The things we found in your website
Oxford DrupalCamp 2012 - The things we found in your websiteOxford DrupalCamp 2012 - The things we found in your website
Oxford DrupalCamp 2012 - The things we found in your websitehernanibf
 
The things we found in your website
The things we found in your websiteThe things we found in your website
The things we found in your websitehernanibf
 
Acquia Commons
Acquia CommonsAcquia Commons
Acquia Commonshernanibf
 
Drupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case StudyDrupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case Studyhernanibf
 
Drupal Recipe
Drupal RecipeDrupal Recipe
Drupal Recipehernanibf
 

Plus de hernanibf (8)

Drupal Europe 2018: Hackers automate but the drupal community still downloads...
Drupal Europe 2018: Hackers automate but the drupal community still downloads...Drupal Europe 2018: Hackers automate but the drupal community still downloads...
Drupal Europe 2018: Hackers automate but the drupal community still downloads...
 
Aiming for automatic updates - Drupal Dev Days Lisbon 2018
Aiming for automatic updates - Drupal Dev Days Lisbon 2018Aiming for automatic updates - Drupal Dev Days Lisbon 2018
Aiming for automatic updates - Drupal Dev Days Lisbon 2018
 
Deployer - Deployment tool for PHP
Deployer - Deployment tool for PHPDeployer - Deployment tool for PHP
Deployer - Deployment tool for PHP
 
Oxford DrupalCamp 2012 - The things we found in your website
Oxford DrupalCamp 2012 - The things we found in your websiteOxford DrupalCamp 2012 - The things we found in your website
Oxford DrupalCamp 2012 - The things we found in your website
 
The things we found in your website
The things we found in your websiteThe things we found in your website
The things we found in your website
 
Acquia Commons
Acquia CommonsAcquia Commons
Acquia Commons
 
Drupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case StudyDrupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case Study
 
Drupal Recipe
Drupal RecipeDrupal Recipe
Drupal Recipe
 

Dernier

Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 

Dernier (20)

Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 

Fix me if you can - DrupalCon prague

  • 1. Fix me if you can
  • 2. Fix me, if you can
  • 3. We prepared you a site to fix. It has been broken in many, many places. You will work in teams to fix it. About the session
  • 4. We are drupalists, consultants, working in the Acquia Professional Services team Alex Ku Balázs Dianiska Hernâni Borges de Freitas Théodore Biadala About us
  • 9. LAMP stack Varnish is installed and set up We set up a site for each team Each site is broken in many ways What is in the box
  • 10. 15:45 - 16:00 - Introduction and setup 16:00 - 16:25 - Site building 16:25 - 16:35 - Break 16:35 - 17:00 - Security 17:00 - 17:10 - Break 17:10 - 17:35 - Performance 17:35 - 18:00 - Wrap up and questions Lab schedule http://fixme.acquia-ps.com
  • 11. What we prepared: 1 site per team 1 login per site We can create 25 sites, so lets split into teams Address: http://fixme.acquia-ps.com Password will be on the site Setup http://fixme.acquia-ps.com
  • 12. Site building •  Best practices §  Drupal coding standards §  Security §  Performance •  Code architecture •  Content architecture •  Configuration http://fixme.acquia-ps.com
  • 13. Review process 1.  Make the site run 2.  Run automated tools 3.  Triage the output 4.  Read all the custom code* 5.  Dig into messy areas http://fixme.acquia-ps.com
  • 14. Tools •  Update •  Hacked •  Coder •  PHP_CodeSniffer •  Insight •  A Brain http://fixme.acquia-ps.com
  • 15. Red flags •  PHP Filter module •  PHP in templates •  Many, many template files •  Many views/blocks/panels with a similar name •  Many content types with one or two nodes http://fixme.acquia-ps.com
  • 16. Exercise 1- Code hacked •  Looking for hacked core / contrib •  Go to hacked report and run it http://fixme.acquia-ps.com
  • 17. Exercise 2- Missing updates •  Run Update module •  Explain how to keep it up to date http://fixme.acquia-ps.com
  • 18. Exercise 3 - Coding standards •  Coder & PHP Code Sniffer •  Find jquery_countdown and email_login_link http://fixme.acquia-ps.com
  • 19. Exercise 4 - Views architecture •  Check “News” views http://fixme.acquia-ps.com
  • 20. Exercise 5 - Content architecture - article => 1320 - teaser => 805 - microsite => 273 - … - sports_homepage => 1 - teams_homepage => 1 - change_password => 1 - login_form => 1 - footer_homepage => 1 http://fixme.acquia-ps.com
  • 21. Secure your Drupal site by first hacking into it http://fixme.acquia-ps.com
  • 22. Drupal vulnerabilities by popularity reported in core and contrib SAs from 6/1/2005 through 3/24/2010
  • 24. Access Bypass “Inadequate or weak access control over a resource” Authentication Authorization
  • 25. Access Bypass When a user can see something they shouldn’t perform an action they shouldn’t
  • 26.
  • 27. Stop Access Bypass Implement checks before providing an action after undertaking an action
  • 28. Access Bypass Hands-on First as anonymous user goto: http://fixme.acquia-ps.com/[teamN]/admin/dashboard/users/all What’s there: VBO allows sending an email to any address and blocking users How can we fix this?
  • 29. Access Bypass Hands-on The problem is in: ●  “Bypass views access control” permission ●  “Actions permissions (VBO)” module
  • 31. Cross Site Scripting XSS Javascript Performing actions without your intent Everything you can do XSS can do faster
  • 32. Stored XSS Step 1 DrupalAttacker Reques t J S DB J S http://fixme.acquia-ps.com
  • 33. Stored XSS Step 2 DrupalVictim Reques t Respons e J S J S DB http://fixme.acquia-ps.com
  • 34. Stored XSS Step 3 DrupalVictim Reques t J S DB J S http://fixme.acquia-ps.com
  • 35. $node = node_load($nid); $title = $node->title; drupal_set_title($title); ... (later, in page.tpl.php) ... <h1><?php print $title; ?></h1> http://fixme.acquia-ps.com
  • 36. XSS Hands-on First as admin user go to: http://fixme.acquia-ps.com/[teamN]/user/1 and notice value for Full Name Then open this page: http://fixme.acquia-ps.com/[teamN]/node/56 Now open the first page again and notice the Full Name has changed How can we fix this? http://fixme.acquia-ps.com
  • 37. XSS Hands-on The problem is in: ●  Filtered HTML text format allowing <script> tag ●  Security Review module helps detecting issues like this http://fixme.acquia-ps.com
  • 39. Cross Site Request Forgery CSRF Taking action without confirming user intent
  • 40. Cross Site Request Forgery Attacker makes action occur on your behalf Using your session Without you knowing or approving
  • 42. Cross Site Request Forgery Victim html cookie Drupal Drupal /user/login
  • 43. Cross Site Request Forgery Victim DrupalDrupal /node/1
  • 44. Cross Site Request Forgery Victim html DrupalDrupal /node/1 /delete/1
  • 45. validate intent “Did the user mean to carry-out action” or “Could an attacker execute this on behalf of a user” Protecting against CSRF
  • 46. Something secret, unique to the action Shared between trusted user and server Validate intent?
  • 47. only if using Form API generates form token checks token when processing form Drupal protects against CSRF with Form API
  • 48. fancy AJAX, GET callbacks drupal_get_token() drupal_valid_token() Generate your own token
  • 49. attacker identifies weak point gets authorized account to take action protect by confirming intent Cross Site Request Forgery
  • 50. As anonymous user add a comment with an image like this: <img src=”admin/content/unpublish/[nid]”> Visit the page with the comment as admin Check if the node is unpublished How can we fix this? CSRF Hands-on
  • 51. A proper fix would require adding protection in callback function for path: admin/content/unpublish/[nid] A quick fix would filter img tags in Filtered HTML CSRF Hands-on
  • 52. SQL Injection Mixing data received from the user with database query allows an attacker to perform custom actions against the database
  • 53. As anonymous user go to: http://fixme.acquia-ps.com/show/node?nid=[nid] You should see a title and status of a single node Now append this to the url: “ union select uid, name, status from users” You should see names of all users How can we detect and fix this? SQL Injection Hands-on
  • 54. SQL Injection Hands-on Security Review module helps detect simple SQL injection vulnerabilities
  • 55. Fixing this would require rewriting custom code The vulnerable lines are: $nid = $_GET['nid']; $r = db_query("SELECT nid, title, status FROM {node} WHERE status = 1 AND nid = $nid"); The fix would look something like: $nid = $_GET['nid']; $r = db_query("SELECT nid, title, status FROM {node} WHERE status = 1 AND nid = :nid", array(“:nid” => $nid)); SQL Injection Hands-on
  • 57. Steps to a mostly automated reviewSecurity Review: drupal.org/project/security_review Hacked: drupal.org/project/hacked Coder: drupal.org/project/coder Secure Code Review drupal.org/project/secure_code_review Vuln: github.com/unn/vuln HTML Purifier: drupal.org/project/htmlpurifier More: http://drupalscout.com/node/11
  • 59. Slow? What you mean? •  Backend slowness •  Services that website use are slow or unresponsive (dbs) •  Application too complex •  Server resources overload •  Frontend slowness •  Too many assets •  Slow connection between browser and server. •  JS slowing the DOM (re)rendering http://fixme.acquia-ps.com
  • 60. Profile Look for pages you suspect •  Start by easy ones •  404 page (the fastest page you can get). •  Node view page •  Homepage •  Continue with the ones your data marked as slow. Time for some research http://fixme.acquia-ps.com
  • 61. Benchmarks Ideally your normal pages should take •  1 ~ 1.5 sec •  40 ~ 60 mb of memory •  100~300 queries per page Simpler pages like 404 are good indicators of what is the fastest all other pages will run. http://fixme.acquia-ps.com
  • 62. Profiling tools Chasing it •  Use Devel module ( http://drupal.org/project/devel ) to have a fast indication of page load times and memory consumption. •  Use XhProf Module to profile the page and understand slower components. •  Use timer_start(), timer_read() functions in situations where you are unsure. http://fixme.acquia-ps.com
  • 63. Typical #1 – Slow queries •  First look to profiling data shows something really slow. Problem •  Related to the database (Wall time vs Total Time). •  Number of queries is low, so probably it’s a single query. Solution •  Reduce query time in views ; Use Views Lite Pager Devel XhPro f http://fixme.acquia-ps.com
  • 64. Problem •  High number of queries •  High memory consumption •  High number of function calls •  All those little queries and memory consumption mean that you are loading lots of information from the database. Solution •  Look to XhProf and identify the root cause of all the excessive function calls. Devel XhPro f Typical #2 – Extra complexity http://fixme.acquia-ps.com
  • 65. Typical #3 – Edge cases •  Slow functions only detectable by XhProf • Eg: When problem is in PHP execution • Problematic if using popular hooks (hook_init, hook_node_load). •  Infrastructure not being properly used •  Requests bypassing Varnish •  Not enough APC memory •  Blocks rendered in all pages and content hidden at template level. •  Theme_rebuild and cache_clear_all in middle of code. http://fixme.acquia-ps.com
  • 66. Typical #4 – Special tasks •  Usually a task executed in special situations or in certain pages that seriously slows down the platform. •  Synchronizations of thousand of nodes from web services. •  Synchronization of all user base from LDAP. •  Sending thousand of mails via Cron. •  Even worst when those tasks are called by normal page views. http://fixme.acquia-ps.com
  • 68. 1.  Enable Devel > Admin / Config / Devel -> Display query log, Display page timer, Display memory usage 1.  Enable XhProf > Admin / Config / XHProf 1.  Enable a browser inspector tool (Google Chrome Developer tools or Firebug or etc..) Exercise 1 - Enable tools http://fixme.acquia-ps.com
  • 69. 1.  Go to Drupalistas tab 2.  Click on Demo user and Drupal commits Exercise 2 - Slow Query http://fixme.acquia-ps.com
  • 70. 1.  Go to Drupalistas tab 2.  Click on Demo user and Drupal commits 3.  Look to devel query log. 4.  Go to user / uid 1 and see the difference Exercise 2 - Slow Query http://fixme.acquia-ps.com
  • 71. 1.  Go to a 404 page ( /prague) 2.  Look to XhProf report Exercise 3 - Missed blocks http://fixme.acquia-ps.com
  • 72. 1.  Go to a 404 page ( /prague) 2.  Look to XhProf report 3.  Find the missing blocks (weather) 4.  FIx it by giving the right path Exercise 3 - Missed blocks http://fixme.acquia-ps.com
  • 73. 1.  Go to a 404 page ( /prague) 2.  Look to XhProf report 3.  Find the missing blocks (weather) 4.  Fix it by giving the right path Exercise 3 - Missed blocks http://fixme.acquia-ps.com
  • 74. - Go to the sessions tab. - Look to XhProf and Devel. - Look to amount of memory and CPU. Exercise 4 - Complexity http://fixme.acquia-ps.com
  • 75. - Go to the sessions page. - Look to XhProf and Devel. - Look to amount of memory and CPU. - Look to code to understand the amount of node_loads. - Disable custom block and enable views block. - Enable block cache alter - Check difference Exercise 4 - Complexity http://fixme.acquia-ps.com
  • 76. - Go to a Drupalcon node - Refresh a few times the page. Look to headers. - Look to all requests done by the page. Exercise 5 - Problems in infrastructure http://fixme.acquia-ps.com
  • 77. - Go to a Drupalcon node - Refresh a few times the page. Look to headers. - Look to all requests done by the page. - Identify missing header in the ajax Call done to get attendance - Look to code Exercise 5 - Problems in infrastructure http://fixme.acquia-ps.com
  • 78. 1.  Reduce complexity. Make sure your site is as slim as possible. 2.  Cache where you can. At all levels. 3.  Maintain cache as long as possible as long it is acceptable. 4.  Compute behind the scenes when you can. 5.  Distribute the heavier tasks to larger intervals. 6.  Grow infrastructure if you are reaching server limits. After you identified the problems Caching after optimizing http://fixme.acquia-ps.com
  • 79. Performance Can it be cached? Cache it! •  Page caching, block caching, panels caching, views caching, caching API.. •  Review caching strategy: •  https://www.acquia.com/blog/when-and-how-caching- can-save-your-site-part-2-authenticated-users •  Guarantee that caching is effectively helping you. •  Don’t clear it too often. •  Not used only by a minority. http://fixme.acquia-ps.com
  • 80. Summary ●  Make sure to look for others suffering from the same problem. ●  Never hesitate to ask the most basic questions. ●  Go step by step, exclude possibilities if uncertain. ●  Learn the tools we introduced you to. ●  Always try to understand the whole system, not just the part throwing the error. http://fixme.acquia-ps.com
  • 81. So, before your questions. I do have a question. Would you like to join Acquia? We are hiring EVERYWHERE in Europe! • Consultants • Support • Sales • Engineering http://fixme.acquia-ps.com
  • 82. Thank you for your attention. Now question time!
  • 83. THANK YOU! WHAT DID YOU THINK? Locate this session at the DrupalCon Prague website: http://prague2013.drupal.org/schedule Click the “Take the survey” link