ructfe 2015 services write-ups

88
ON

Upload: mikhail-vyatskov

Post on 14-Apr-2017

2.618 views

Category:

Education


3 download

TRANSCRIPT

Page 1: RuCTFE 2015 Services Write-Ups

ON

Page 2: RuCTFE 2015 Services Write-Ups

SERVICES WRITE-UPSMikhail Vyatskov aka Tris and more

Page 3: RuCTFE 2015 Services Write-Ups

MOTIVATION“The main goal of RuCTFE is to share experience

and knowledge in the computer security and to

have some fun together.”

— RuCTFE Rules

Page 4: RuCTFE 2015 Services Write-Ups

RULES• Each team has an image

• There are some services on this image

• There are some vulnerabilities

• Hack em’ all!

Page 5: RuCTFE 2015 Services Write-Ups

MINISTRY OF LOVEMaxim Muzafarov aka m_messiah

Page 6: RuCTFE 2015 Services Write-Ups

ABOUT SERVICE• Python

• Tornado web server

• Momoko

• WebSockets

Page 7: RuCTFE 2015 Services Write-Ups

WATCH CRIMES• image

Page 8: RuCTFE 2015 Services Write-Ups

REPORT A CRIME• image

Page 9: RuCTFE 2015 Services Write-Ups

AUTHENTICATE• image

Page 10: RuCTFE 2015 Services Write-Ups

HACK IT!

Page 11: RuCTFE 2015 Services Write-Ups

SQL INJECTION

Page 12: RuCTFE 2015 Services Write-Ups

SQL INJECTION

Page 13: RuCTFE 2015 Services Write-Ups

SQL INJECTION

Page 14: RuCTFE 2015 Services Write-Ups

PROFILE SPOOFING

Bind profilewithout authentication

Page 15: RuCTFE 2015 Services Write-Ups

PROFILE SPOOFINGProfile ids are visible

in open crimes

Page 16: RuCTFE 2015 Services Write-Ups

SAME DATABASE• Each team has similar database

• Each team has all authentication data

Page 17: RuCTFE 2015 Services Write-Ups

“BACKDOOR”

Page 18: RuCTFE 2015 Services Write-Ups

bit.ly/ructfe_mol_sploit

Page 19: RuCTFE 2015 Services Write-Ups

MINISTRY OF TAXESPavel Blinov aka pahaz

Page 20: RuCTFE 2015 Services Write-Ups

ABOUT SERVICE• Node.js

• Koa web framework

• Custom router

Page 21: RuCTFE 2015 Services Write-Ups

ADD PERSONAL DATA• image

Page 22: RuCTFE 2015 Services Write-Ups

UPLOAD REPORT• image

Page 23: RuCTFE 2015 Services Write-Ups

UPLOAD REPORT• image

Page 24: RuCTFE 2015 Services Write-Ups

HACK IT!

Page 25: RuCTFE 2015 Services Write-Ups

WEAK ID GENERATION

So what?

Page 26: RuCTFE 2015 Services Write-Ups

WEAK ID GENERATION

Page 27: RuCTFE 2015 Services Write-Ups

REMOTE CODE EXECUTION

Page 28: RuCTFE 2015 Services Write-Ups

REMOTE CODE EXECUTION

Page 29: RuCTFE 2015 Services Write-Ups

bit.ly/ructfe_tax_sploit

Page 30: RuCTFE 2015 Services Write-Ups

ELECTIONS FOR E-DEMOCRACYKonstantin Plotnikov aka kost

Page 31: RuCTFE 2015 Services Write-Ups

ABOUT SERVICE• C# + Mono

• Homomorphic encryption

Page 32: RuCTFE 2015 Services Write-Ups

ELECTIONS• TODO

Page 33: RuCTFE 2015 Services Write-Ups

NOMINATE• image

Page 34: RuCTFE 2015 Services Write-Ups

VOTE• image

Page 35: RuCTFE 2015 Services Write-Ups

GET ELECTED• image

Page 36: RuCTFE 2015 Services Write-Ups

HACK IT!

Page 37: RuCTFE 2015 Services Write-Ups

UNFILTERED INPUT• Client-side vote generation & encryption

• Vote – vector of integers

• Election result – sum of votes

Page 38: RuCTFE 2015 Services Write-Ups

UNFILTERED INPUT

break & hack

Page 39: RuCTFE 2015 Services Write-Ups

UNFILTERED INPUT• Calculations are made modulo 243

• Overflow competitor's value

• Let the battle begins!

Page 40: RuCTFE 2015 Services Write-Ups

WEAK PRIVATE KEY GENERATOR

• Calculations are made modulo 243 = 35

• Private key – random number

• Chance of them being non-coprime

• 3 divides private key can decrypt⇒

Page 41: RuCTFE 2015 Services Write-Ups

WEAK PRIVATE KEY GENERATOR

• image

Page 42: RuCTFE 2015 Services Write-Ups

WEAK PRIVATE KEY GENERATOR

• image

Page 43: RuCTFE 2015 Services Write-Ups

WEAK PRIVATE KEY GENERATOR

• image

Page 44: RuCTFE 2015 Services Write-Ups

NASA RASAAndrey Gein aka andgein

Page 45: RuCTFE 2015 Services Write-Ups

ABOUT SERVICE• PHP

• MySQL

Page 46: RuCTFE 2015 Services Write-Ups

REPORT A PLANET• image

Page 47: RuCTFE 2015 Services Write-Ups

BROWSE DISCOVERED PLANETS

• image

Page 48: RuCTFE 2015 Services Write-Ups

BROWSE USERS• image

Page 49: RuCTFE 2015 Services Write-Ups

HACK IT!

Page 50: RuCTFE 2015 Services Write-Ups

HARDCODED DB CREDENTIALS

Remember about RCE?

Page 51: RuCTFE 2015 Services Write-Ups

PADSPACE COLLATION• todo

⇒2

Page 52: RuCTFE 2015 Services Write-Ups

bit.ly/ructfe_collations

Page 53: RuCTFE 2015 Services Write-Ups

HEALTH MONITORPolina Zonova aka Klyaksa

Page 54: RuCTFE 2015 Services Write-Ups

ABOUT SERVICE• Go

• SQLite

Page 55: RuCTFE 2015 Services Write-Ups

REPORT YOUR HEALTH• todo

Page 56: RuCTFE 2015 Services Write-Ups

BROWSE YOUR PROGRESS• todo

Page 57: RuCTFE 2015 Services Write-Ups

HACK IT!

Page 58: RuCTFE 2015 Services Write-Ups

AUTHENTICATION

Page 59: RuCTFE 2015 Services Write-Ups

HARDCODED SALT

Plan:1. Set up vulnbox2. Change all passwords & keys3. Win

Page 60: RuCTFE 2015 Services Write-Ups

LENGTH EXTENSION ATTACK• uids are serial – we can guess

• Over 9k tools to perform MD5 LEA

Page 61: RuCTFE 2015 Services Write-Ups

INTERPLANETARY MIGRATION AUTHORITYDmitry Titarenko aka dscheg

Page 62: RuCTFE 2015 Services Write-Ups

ABOUT SERVICE• Nim

• Redis

Page 63: RuCTFE 2015 Services Write-Ups

KNOW CITIZENS• TODO

Page 64: RuCTFE 2015 Services Write-Ups

FILL MIGRATION FORM…• фы

Page 65: RuCTFE 2015 Services Write-Ups

…BUT NOT QUITE• фыв

Page 66: RuCTFE 2015 Services Write-Ups

HACK IT!

Page 67: RuCTFE 2015 Services Write-Ups

HARDCODED DB CREDENTIALS

And again

Page 68: RuCTFE 2015 Services Write-Ups

HMAC USING EXTERNAL LIBRARY

zero-padded userhas the same HMAC

Page 69: RuCTFE 2015 Services Write-Ups

HMAC USING EXTERNAL LIBRARY

• Login as one of citizens

• Steal flag from the filled form

Page 70: RuCTFE 2015 Services Write-Ups

MODIFYING LOCAL DATA• Form data stored on client side

• Form data is encrypted

• AES encryption in CBC mode

• No integrity checks

Page 71: RuCTFE 2015 Services Write-Ups

MODIFYING LOCAL DATA• We know plaintext – JSON with filled data

• We can modify ciphertext

Page 72: RuCTFE 2015 Services Write-Ups

MODIFYING LOCAL DATA• todo

Page 73: RuCTFE 2015 Services Write-Ups

MITM• On step 3 we need to sign up a random value

• Only checker has the private key

• Let’s hack value generation function

• Check will sign everything for us

Page 74: RuCTFE 2015 Services Write-Ups

bit.ly/ructfe_mig_sploit

Page 75: RuCTFE 2015 Services Write-Ups

THE BANKAlexander Bersenev aka bay

Page 76: RuCTFE 2015 Services Write-Ups

ABOUT SERVICE• C

• Mongoose

• Custom dictionary

Page 77: RuCTFE 2015 Services Write-Ups

CREATE ACCOUNTS• todo

Page 78: RuCTFE 2015 Services Write-Ups

TRANSFER MONEY• todo

Page 79: RuCTFE 2015 Services Write-Ups

HACK IT!

Page 80: RuCTFE 2015 Services Write-Ups

ACCESS LOGSbank.teamX.e.ructf.org/access.log

Page 81: RuCTFE 2015 Services Write-Ups

DICTIONARY

Binary Search TreePosition

Independent Code

Page 82: RuCTFE 2015 Services Write-Ups

DICTIONARY• Key in BST – SHA256 from key in dict

• Value – amount of money (8 bytes)

• BST stored in array

Page 83: RuCTFE 2015 Services Write-Ups

DICTIONARYBuffer overflow

Remote code execution

Page 84: RuCTFE 2015 Services Write-Ups

DICTIONARYShell

jmp to shell

Page 85: RuCTFE 2015 Services Write-Ups

bit.ly/ructfe_bank_sploit

Page 86: RuCTFE 2015 Services Write-Ups

RECOMMENDATIONS• Always change keys and passwords

• Learn Linux administration

• Stay positive & have fun!

Page 87: RuCTFE 2015 Services Write-Ups

Questions?

Page 88: RuCTFE 2015 Services Write-Ups

Thanks!