henrikwm @ bekk

Kodeknekking for spioner

Hvem er jeg?

I ❤️ CTF-er

Mangel på hackere/spioner i PST?

Vi må møte en økende trussel for dataangrep mot Norge og norske interesser.

Store mediesaker i 2019:

Kina anklages for å hacke Visma

Bitcoin Norge hevder å ha bli hacket
Forsiden på Dagbladet hacket 😱

Dataangrep mot Hydro

Haien i rommet

Stor takk til Roy Solberg

PST fjernet gåten i våres

Uten Roys filer ville det ikke blitt noe foredrag

😍👏 @roysolberg

Jobbannonsen

?

E

ER

ERT

ERTH

ERTHA

ERTHAI

ERTHAII

ERTHAIIT

ERTHAIITW

ERTHAIITWT

ERTHAIITWTE

ERTHAIITWTEU

ERTHAIITWT.EU

http://ERTHAIITWT.EU ➡

Blindspor!

http://ERTHAIITWT.EU ➡

ERTHAIITWT.EU

=

ERTHAIITWT.EU


👍

TWITTERHAI.EU

Steganografi-analyse: Stegsolve

Linux: kjør install-script

Windows: last ned stegsolve.jar

              root@c04ddcc8bccd:~# java -jar stegsolve.jar
            
http://twitterhai.eu/robots.txt ➡

?

shark.html

http://twitterhai.eu/shark.html ➡
http://twitterhai.eu/Shark.html ➡

🤔

🤔🤔🤔

1337_shrk.jpg

Linux: binæranalyse med binwalk


                root@c04ddcc8bccd:~# binwalk 1337_shrk.jpg

                DECIMAL       HEXADECIMAL     DESCRIPTION
                --------------------------------------------------------------------------------
                0             0x0             JPEG image data, JFIF standard 1.01
                30            0x1E            TIFF image data, big-endian, offset of first image directory: 8
              

Linux: binæranalyse med strings


              root@c04ddcc8bccd:~# strings -10 1337_shrk.jpg

              [...] (klippet vekk XML og tom data)
              [...] (klippet vekk tom data)

              8Photoshop 3.0
              /haitech_secure.html
              %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz
              &'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz
              NE/i}N|xSP
              E-A#uYM6'=E`
              kNP5k+a1XZ
              Ql`T>^GLUd
            

Linux: binæranalyse med file


              root@c04ddcc8bccd:~# file 1337_shrk.jpg

              1337_shrk.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, /
              density 72x72, segment length 16, Exif Standard: [TIFF image data, /
              big-endian, direntries=3, PhotometricIntepretation=RGB, /
              orientation=upper-left], comment: "/haitech_secure.html", /
              baseline, precision 8, 851x514, components 3
            

Windows: binæranalyse med filegenskaper

http://twitterhai.eu/haitech_secure.html ➡

👍

Sårbar innlogging

Det vil si... på tide å hacke 😎

For å komme videre må vi ha riktig passord

Passordvalidering i login():

              
              password.charCodeAt(0) == 8 * 8 + 8 &&
              password.charCodeAt(1) == Math.pow(9, 2) - 29 &&
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) &&
              password.charCodeAt(3) == password.charCodeAt(2) &&
              password.substring(4, 5) == 3 &&
              password.charCodeAt(5) == 7 * 17 - 5 &&
              password.charCodeAt(6) == password.charCodeAt(0) &&
              password.charCodeAt(7) == password.charCodeAt(1) &&
              password.charCodeAt(8) == 0x69
              
            
ASCII-til-hex/bin/dec-converter
              
              password.charCodeAt(0) == 8 * 8 + 8 &&
              password.charCodeAt(1) == Math.pow(9, 2) - 29 &&
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) &&
              password.charCodeAt(3) == password.charCodeAt(2) &&
              password.substring(4, 5) == 3 &&
              password.charCodeAt(5) == 7 * 17 - 5 &&
              password.charCodeAt(6) == password.charCodeAt(0) &&
              password.charCodeAt(7) == password.charCodeAt(1) &&
              password.charCodeAt(8) == 0x69
              
            

?

              
              password.charCodeAt(0) == 8 * 8 + 8 && // 72 = H
              password.charCodeAt(1) == Math.pow(9, 2) - 29 &&
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) &&
              password.charCodeAt(3) == password.charCodeAt(2) &&
              password.substring(4, 5) == 3 &&
              password.charCodeAt(5) == 7 * 17 - 5 &&
              password.charCodeAt(6) == password.charCodeAt(0) &&
              password.charCodeAt(7) == password.charCodeAt(1) &&
              password.charCodeAt(8) == 0x69
              
            

H

              
              password.charCodeAt(0) == 8 * 8 + 8 && // 72 = H
              password.charCodeAt(1) == Math.pow(9, 2) - 29 &&
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) &&
              password.charCodeAt(3) == password.charCodeAt(2) &&
              password.substring(4, 5) == 3 &&
              password.charCodeAt(5) == 7 * 17 - 5 &&
              password.charCodeAt(6) == password.charCodeAt(0) &&
              password.charCodeAt(7) == password.charCodeAt(1) &&
              password.charCodeAt(8) == 0x69
              
            

H

              
              password.charCodeAt(0) == 8 * 8 + 8 && // 72 = H
              password.charCodeAt(1) == Math.pow(9, 2) - 29 && // 52 = 4
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) &&
              password.charCodeAt(3) == password.charCodeAt(2) &&
              password.substring(4, 5) == 3 &&
              password.charCodeAt(5) == 7 * 17 - 5 &&
              password.charCodeAt(6) == password.charCodeAt(0) &&
              password.charCodeAt(7) == password.charCodeAt(1) &&
              password.charCodeAt(8) == 0x69
              
            

H4

              
              password.charCodeAt(0) == 8 * 8 + 8 && // 72 = H
              password.charCodeAt(1) == Math.pow(9, 2) - 29 && // 52 = 4
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) &&
              password.charCodeAt(3) == password.charCodeAt(2) &&
              password.substring(4, 5) == 3 &&
              password.charCodeAt(5) == 7 * 17 - 5 &&
              password.charCodeAt(6) == password.charCodeAt(0) &&
              password.charCodeAt(7) == password.charCodeAt(1) &&
              password.charCodeAt(8) == 0x69
              
            

H4

              
              password.charCodeAt(0) == 8 * 8 + 8 && // 72 = H
              password.charCodeAt(1) == Math.pow(9, 2) - 29 && // 52 = 4
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) && // 109 = m
              password.charCodeAt(3) == password.charCodeAt(2) &&
              password.substring(4, 5) == 3 &&
              password.charCodeAt(5) == 7 * 17 - 5 &&
              password.charCodeAt(6) == password.charCodeAt(0) &&
              password.charCodeAt(7) == password.charCodeAt(1) &&
              password.charCodeAt(8) == 0x69
              
            

H4m

              
              password.charCodeAt(0) == 8 * 8 + 8 && // 72 = H
              password.charCodeAt(1) == Math.pow(9, 2) - 29 && // 52 = 4
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) && // 109 = m
              password.charCodeAt(3) == password.charCodeAt(2) &&
              password.substring(4, 5) == 3 &&
              password.charCodeAt(5) == 7 * 17 - 5 &&
              password.charCodeAt(6) == password.charCodeAt(0) &&
              password.charCodeAt(7) == password.charCodeAt(1) &&
              password.charCodeAt(8) == 0x69
              
            

H4m

              
              password.charCodeAt(0) == 8 * 8 + 8 && // 72 = H
              password.charCodeAt(1) == Math.pow(9, 2) - 29 && // 52 = 4
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) && // 109 = m
              password.charCodeAt(3) == password.charCodeAt(2) && // 109 = m
              password.substring(4, 5) == 3 &&
              password.charCodeAt(5) == 7 * 17 - 5 &&
              password.charCodeAt(6) == password.charCodeAt(0) &&
              password.charCodeAt(7) == password.charCodeAt(1) &&
              password.charCodeAt(8) == 0x69
              
            

H4mm

              
              password.charCodeAt(0) == 8 * 8 + 8 && // 72 = H
              password.charCodeAt(1) == Math.pow(9, 2) - 29 && // 52 = 4
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) && // 109 = m
              password.charCodeAt(3) == password.charCodeAt(2) && // 109 = m
              password.substring(4, 5) == 3 &&
              password.charCodeAt(5) == 7 * 17 - 5 &&
              password.charCodeAt(6) == password.charCodeAt(0) &&
              password.charCodeAt(7) == password.charCodeAt(1) &&
              password.charCodeAt(8) == 0x69
              
            

H4mm

              
              password.charCodeAt(0) == 8 * 8 + 8 && // 72 = H
              password.charCodeAt(1) == Math.pow(9, 2) - 29 && // 52 = 4
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) && // 109 = m
              password.charCodeAt(3) == password.charCodeAt(2) && // 109 = m
              password.substring(4, 5) == 3 && // 3
              password.charCodeAt(5) == 7 * 17 - 5 &&
              password.charCodeAt(6) == password.charCodeAt(0) &&
              password.charCodeAt(7) == password.charCodeAt(1) &&
              password.charCodeAt(8) == 0x69
              
            

H4mm3

              
              password.charCodeAt(0) == 8 * 8 + 8 && // 72 = H
              password.charCodeAt(1) == Math.pow(9, 2) - 29 && // 52 = 4
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) && // 109 = m
              password.charCodeAt(3) == password.charCodeAt(2) && // 109 = m
              password.substring(4, 5) == 3 && // 3
              password.charCodeAt(5) == 7 * 17 - 5 &&
              password.charCodeAt(6) == password.charCodeAt(0) &&
              password.charCodeAt(7) == password.charCodeAt(1) &&
              password.charCodeAt(8) == 0x69
              
            

H4mm3

              
              password.charCodeAt(0) == 8 * 8 + 8 && // 72 = H
              password.charCodeAt(1) == Math.pow(9, 2) - 29 && // 52 = 4
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) && // 109 = m
              password.charCodeAt(3) == password.charCodeAt(2) && // 109 = m
              password.substring(4, 5) == 3 && // 3
              password.charCodeAt(5) == 7 * 17 - 5 && // 114 = r
              password.charCodeAt(6) == password.charCodeAt(0) &&
              password.charCodeAt(7) == password.charCodeAt(1) &&
              password.charCodeAt(8) == 0x69
              
            

H4mm3r

              
              password.charCodeAt(0) == 8 * 8 + 8 && // 72 = H
              password.charCodeAt(1) == Math.pow(9, 2) - 29 && // 52 = 4
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) && // 109 = m
              password.charCodeAt(3) == password.charCodeAt(2) && // 109 = m
              password.substring(4, 5) == 3 && // 3
              password.charCodeAt(5) == 7 * 17 - 5 && // 114 = r
              password.charCodeAt(6) == password.charCodeAt(0) &&
              password.charCodeAt(7) == password.charCodeAt(1) &&
              password.charCodeAt(8) == 0x69
              
            

H4mm3r

              
              password.charCodeAt(0) == 8 * 8 + 8 && // 72 = H
              password.charCodeAt(1) == Math.pow(9, 2) - 29 && // 52 = 4
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) && // 109 = m
              password.charCodeAt(3) == password.charCodeAt(2) && // 109 = m
              password.substring(4, 5) == 3 && // 3
              password.charCodeAt(5) == 7 * 17 - 5 && // 114 = r
              password.charCodeAt(6) == password.charCodeAt(0) && // 72 = H
              password.charCodeAt(7) == password.charCodeAt(1) &&
              password.charCodeAt(8) == 0x69
              
            

H4mm3rH

              
              password.charCodeAt(0) == 8 * 8 + 8 && // 72 = H
              password.charCodeAt(1) == Math.pow(9, 2) - 29 && // 52 = 4
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) && // 109 = m
              password.charCodeAt(3) == password.charCodeAt(2) && // 109 = m
              password.substring(4, 5) == 3 && // 3
              password.charCodeAt(5) == 7 * 17 - 5 && // 114 = r
              password.charCodeAt(6) == password.charCodeAt(0) && // 72 = H
              password.charCodeAt(7) == password.charCodeAt(1) &&
              password.charCodeAt(8) == 0x69
              
            

H4mm3rH

              
              password.charCodeAt(0) == 8 * 8 + 8 && // 72 = H
              password.charCodeAt(1) == Math.pow(9, 2) - 29 && // 52 = 4
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) && // 109 = m
              password.charCodeAt(3) == password.charCodeAt(2) && // 109 = m
              password.substring(4, 5) == 3 && // 3
              password.charCodeAt(5) == 7 * 17 - 5 && // 114 = r
              password.charCodeAt(6) == password.charCodeAt(0) && // 72 = H
              password.charCodeAt(7) == password.charCodeAt(1) && // 52 = 4
              password.charCodeAt(8) == 0x69
              
            

H4mm3rH4

              
              password.charCodeAt(0) == 8 * 8 + 8 && // 72 = H
              password.charCodeAt(1) == Math.pow(9, 2) - 29 && // 52 = 4
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) && // 109 = m
              password.charCodeAt(3) == password.charCodeAt(2) && // 109 = m
              password.substring(4, 5) == 3 && // 3
              password.charCodeAt(5) == 7 * 17 - 5 && // 114 = r
              password.charCodeAt(6) == password.charCodeAt(0) && // 72 = H
              password.charCodeAt(7) == password.charCodeAt(1) && // 52 = 4
              password.charCodeAt(8) == 0x69
              
            

H4mm3rH4

              
              password.charCodeAt(0) == 8 * 8 + 8 && // 72 = H
              password.charCodeAt(1) == Math.pow(9, 2) - 29 && // 52 = 4
              password.charCodeAt(2) == Math.pow(10, 2) + Math.pow(3, 2) && // 109 = m
              password.charCodeAt(3) == password.charCodeAt(2) && // 109 = m
              password.substring(4, 5) == 3 && // 3
              password.charCodeAt(5) == 7 * 17 - 5 && // 114 = r
              password.charCodeAt(6) == password.charCodeAt(0) && // 72 = H
              password.charCodeAt(7) == password.charCodeAt(1) && // 52 = 4
              password.charCodeAt(8) == 0x69 // 105 = i
              
            

H4mm3rH4i 🦈

uggc:// = http:// med 13 rotasjoner

Ceasar chiffer?

altså ROT-13 Ceasar chiffer

uggc://gjvggreunv.grpu/unv_gurer.ugzy

uggc://gjvggreunv.grpu/unv_gurer.ugzy

👍

http://twitterhai.tech/hai_there.html ➡


👌

TWITT3RHAI

La oss først se etter robots.txt

http://twitterhai.tech/robots.txt ➡

👍

*klipper ut og limer inn en og en tweet til Sublime*

              
              
            

2 funn å ta med oss videre:



😃

haimat

Linux: binæranalyse med file

              
                root@c04ddcc8bccd:~# file haimat

                pcap-ng capture file - version 1.0
              
            

Windows: binæranalyse med filegenskaper/Notepad

              
                  C:\haimat>notepad haimat

                  [...] Dumpcap (Wireshark) 2.4.6 [...]
              
            

haimat er en pcap fil!

Brukes til å lagre nettverkstrafikk

Vi har ca 400 TCP-pakker å analysere

Linux

Nettverksanalyse med tcpdump/NetworkMiner

Windows

Nettverksanalyse med Wireshark/tshark/NetworkMiner

Første observasjon

I nettverkspakke 146 gjøres det en HTTP-forespørsel mot http://192.168.230.129

HTTP-svaret inneholder teksten "Her er dataene dine, passordet har du allerede" og link til secret_data.zip

Andre observasjon

I nettverkspakke 326 og 362 er det henholdsvis en HTTP-forespørsel og -svar på å laste ned zip-filen: http://192.168.230.129/secret_data.zip

Trafikken er over TCP-port 80 og dermed ukryptert 👍

La oss plukke ut zip-filen for nærmere analyse

Forresten...

Siste observasjon fra nettverkstrafikken:

Et forsøk på å laste siden http://192.168.230.129/trying_to_hide gir

404 Not Found 😜

Vi henter ut secret_data.zip med Wireshark

Vi finner et bilde i secret_data.zip:



😀

secret_data.zip

Åpner bildet insignificant_shark.png:

Passordbeskyttet! 😢

🤔

Vi fikk beskjed om at vi allerede hadde passordet...

Hva hvis vi prøver HAI1337 som passord?

Insignifikant hai

Vi kikker nærmere på filen insignificant_shark.png

Legger merke til kryptiske tegn på haien

Ligner litt på runer?

?

L

LS

LSB

LSB betyr i IT-sammenheng ofte:

Least Significant Bit

(i motsetning til MSB: Most Significant Bit)

Alle filer består av binærdata (Bytes) med "0" og "1"-tall

Vi blir sterkt oppfordret til å se på siste Bit av hver Byte (LSB-dekoding)

Det vil si...

Plukk ut siste Bit i hver Byte

10101011

og sett de sammen til ny fil

"You thought we would hide anything of SIGNIFICANCE? Not the LEAST..."

Runene hintet om LSB-dekoding

Skjult QR-kode hintet også om LSB-dekoding

🤷‍♂️

Hva med MSB-dekoding? 😄

Det vil si...

Plukk ut første Bit i hver Byte

11010101

og sett de sammen til en ny fil

http://twitterhai.tech/u_are_th3_winrar.jpg ➡

👍

u_are_th3_winrar.jpg

2 observasjoner...

8,56 MB stort JPG-bilde!

Filnavnet inneholder rar (kompresjonsformat)

Linux: binæranalyse med file


              root@c04ddcc8bccd:~# file u_are_th3_winrar.jpg

              u_are_th3_winrar.jpg: JPEG image data, JFIF standard 1.01, \
              resolution (DPI), density 96x96, segment length 16, \
              Exif Standard: [TIFF image data, big-endian, direntries=1, \
              orientation=upper-left], \
              comment: "CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 82", \
              baseline, precision 8, 664x636, components 3
            

Windows: binæranalyse med filegenskaper

Ingen ledetråder så langt

Linux: binæranalyse med binwalk


              root@c04ddcc8bccd:~# binwalk u_are_th3_winrar.jpg

              DECIMAL       HEXADECIMAL     DESCRIPTION
              --------------------------------------------------------------------------------
              0             0x0             JPEG image data, JFIF standard 1.01
              30            0x1E            TIFF image data, big-endian, offset of first image directory: 8
              66398         0x1035E         RAR archive data, version 5.x
              2552386       0x26F242        Certificate in DER format (x509 v3), header length: 4, sequence length: 30088
            

I ❤️ binwalk

❤️ Open Source ❤️

Ekstraherer RAR-filen ut av u_are_th3_winrar.jpg med dd i Linux


              root@c04ddcc8bccd:~# dd
              if=u_are_th3_winrar.jpg \
              of=u_are_th3_winrar.rar \
              bs=1 \
              skip=66398

              8914231+0 records in
              8914231+0 records out
              8914231 bytes (8.9 MB, 8.5 MiB) copied, 11.1746 s, 798 kB/s
            

Ny fil: u_are_th3_winrar.rar

Vi pakker ut u_are_th3_winrar.rar med WinRAR på Windows

Tilsvarer unrar på Linux

Vi klarte det!

👏👏

Hva finner vi i gratulerer.txt?

Gratulerer, du har løst de oppgavene vi hadde i denne omgang. Hvis du har lyst på reelle utfordringer og å løse oppgaver som kan bidra til å utgjøre en forskjell så håper vi at du tar deg tid til å søke. Bruk gjerne kodeordet [FJERNET, red.anm.] i søknaden din, så vi vet at du har fullført challengen! Vi ser frem til å høre fra deg! [...]

Hva har vi lært?

Kodeknekking

lærerikt

utfordrende

tålmodighetsprøve

dopamin-kick!

Prøv selv!

Hacker101 CTF

TGHack

Hackthebox

hack-yourself-first.com

OWASP Juice Shop

Løs CTF-er som lag:
Real World CTF, Google CTF

Konferanser

OWASP Norway Day

OWASP Internasjonalt

Sikkerhetsfestivalen

BlackHat

Bug-bounties! 🐛

Registrer deg på HackerOne og følg @Hacker0x01

Les reglene og slå deg løs! 🤑

IT-sikkerhet er alles ansvar

Øk sikkerhetskompetansen

Prioriter sikkerhet

Typisk norsk å være god

...også på IT-sikkerhet?

Bli en etisk hacker 🕵️‍♂️

- gjør Norge sikrere!

Takk!



henrik.walker.moe@bekk.no