De presentatie wordt gedownload. Even geduld aub

De presentatie wordt gedownload. Even geduld aub

Drupal Security Awareness (2). Disclaimer De informatie in deze cursus is bedoeld om veiligere Drupal websites te bouwen, niet om andere Drupal websites.

Verwante presentaties


Presentatie over: "Drupal Security Awareness (2). Disclaimer De informatie in deze cursus is bedoeld om veiligere Drupal websites te bouwen, niet om andere Drupal websites."— Transcript van de presentatie:

1 Drupal Security 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 1.Injection 2.Broken Authentication and Session Management 3.Cross-Site Scripting (XSS) 4.Insecure Direct Object References 5.Security Misconfiguration 6.Sensitive Data Exposure 7.Missing Function Level Access Control 8.Cross-Site Request Forgery (CSRF) 9.Using Known Vulnerable Components 10.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 Resultaat in pagina: Zoekresultaten U heeft gezocht op test 3 resultaten

24 3. XSS - aanval Kwaadaardige zoekterm: alert(document.cookie);

25 3. XSS - aanval Resultaat:

26 3. XSS - aanval Resultaat in pagina: Zoekresultaten U heeft gezocht op alert(document.cookie); 0 resultaten

27 3. XSS - aanval Kwaadaardige zoekterm: document.write(' ');

28 3. XSS - aanval Resultaat in pagina:

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. KarakterEntiteit << >> "" '&apos;

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 html tags toegevoegd. !Er wordt geen filtering toegepast.

33 3. XSS - demo

34 3. XSS – code voorbeeld • Bezichtingslo caties

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 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) 1.Ingelogd als admin in Drupal 2.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) Het formulier wordt alleen geaccepteerd als er een geldige token wordt meegestuurd. Data-mutaties altijd door een submit handler uitvoeren i.c.m. formulier.

48 8. Cross-Site Request Forgery (CSRF) •Bescherming tegen verkeerde data 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

51 9.Using Components with Known Vulnerabilities •Module gepatcht? >Voeg patch bestand toe in module directory. >Module niet verplaatsen naar patched directory!

52 10. Unvalidated Redirects and Forwards http://example.com/index.php?redir=evil.com Lok een gebruiker via een vertrouwde site naar een kwaadwillende site. http://localhost/admin http://localhost/user/login?destination=/admin drupal_goto( $url, array('external' => FALSE) );

53 Security modules •Coder (code review)

54 Security modules •Security_review (controles)

55 Security modules •Encrypt (Beveiligde opslag) •Secure login (SSL) •PCI Update (no autocomplete) •Remove Generator (HTML Meta tag) •Security kit (XSS, XSRF, Clickjacking, SSL)

56


Download ppt "Drupal Security Awareness (2). Disclaimer De informatie in deze cursus is bedoeld om veiligere Drupal websites te bouwen, niet om andere Drupal websites."

Verwante presentaties


Ads door Google