53
© 2018 Synopsys, Inc. 1 CTF Workshop Solutions Crim2018 2.11.2018

CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 1

CTF Workshop – Solutions

Crim2018 – 2.11.2018

Page 2: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 2

Germany - Keylog

esc h e l a s p k esc i e a esc e o f r i h u n d return

esc a n d esc o up a esc G m a s t e r esc 0 i h u n

esc : % s / h u n / e n / g return esc : 1 return 4 g J

Solution:

Write the above sequence in vi/vim –editor.

Note:

For arrow keys to work as expected, in some

linux distributions you neet to add line: ”set

nocompatible” to configuration file.

vim = ~/.vimrc

vi = ~/.exrc

Page 3: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 3

Page 4: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 4

Canada – Erase/Rewind

Solution:

1. Identify the file format (file -command)

2. Unzip

3. Identify the file format (file -command)

4. Look for hints with strings -command

5. Mount

6. Here be dragons

7. extundelete

8. Open image2_new.jpg on your favorite

image viewer for the flag

Page 5: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 5

Page 6: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 6

Page 7: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 7

Brazil – Hidden message

Solution:

1. Look for hints with strings –command

2. Spot the suspicious string in the end of file.

3. Identify the encoding (Base32)

4. Locate some online base32 decoder

5. Decode x times and strip the plain text

6. Flag is: all_your_base32_are_belong_to_us

Page 8: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 8

Page 9: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 9

Turkey – DoD

Solution:

1. Identify the encoding in the text file (base64)

2. Decode -> see the results

3. Decode x times (online or create a script)

-> Flag is revealed

Page 10: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 10

Page 11: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 11

Greenland – Hidden message 2

Solution:

1. Identify the file format

Looks like animated gif

2. Open it with gimp (frames can be seen as

layers)

3. Last frame reveals text written in black:

ByYourCommand

Page 12: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 12

Alternative tool to use StegSolve, which has a Frame Browser

Page 13: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 13

Greece – Python or not to python

Solution:

1. Identify the file format

(python 2.7 byte-compiled)

2. Rename the file as some versions of

uncompyle6 fails to decompile the file

otherwise (Challenge7.py ->

Challenge7.pyc)

3. Uncompyle6 Challenge7.pyc -> password

and flag is revelead

1. Password = Party0nDud3s!

2. Flag = BeExcellentToEachOther

Page 14: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 14

Page 15: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 15

India – Fix me

Solution:

1. Identify the file format (extension suggest

.png, but the file command thinks it’s .jpg)

Page 16: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 16

2. Closer look with hex editor reveals first three bytes to be JPG header, and bytes after

that are header for a PNG

Page 17: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 17

3. Edit the first three bytes of file from JPG to PNG (FF D8 FF -> 89 50 4e)

4. Open the file, and the flag is revealed

Page 18: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 18

Australia – Fix me 2

Solution:

1. Opening the picture shows blank screen

Page 19: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 19

2. Opening the file in xml editor reveals one block to to be commented out

Page 20: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 20

3. Removing the comments and reopening the file in picture viewer shows still blank screen.

4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in

picture viewer reveals string: ”57 61 78 30 6E 57 61 78 30 66 66”

5. Looks like a ASCII codes!

6. Command: ”echo "57 61 78 30 6E 57 61 78 30 66 66" |

xxd -r –p” reveals the flag: Wax0nWax0ff

Page 21: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 21

Argentina – Reversing 1

Solution:

1. Identify the file format

2. (execute the file)

3. Look for hints with strings –command

4. Spot the password & the flag

5. Password is: s3cr3t!

6. Flag is: ThatWasEasy!

Page 22: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 22

Page 23: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 23

Russia – Reversing 2

Solution:

1. Identify the file format

2. (execute the file)

Page 24: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 24

3. Disassemble with objdump

Page 25: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 25

4. Extract everything else besides the lines where there is comparison made

Page 26: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 26

5. Actually remove everything else besides the ASCII codes and save it to a file

Page 27: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 27

6. Use the xxd to get out the strings

Page 28: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 28

Page 29: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 29

Page 30: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 30

Italy – Reversing 3

Solution:

1. Identify the file format

2. (execute the file)

3. Disassemble with objdump

4. This executable is stripped, so when

debuggin with gdb, we need to:

1. Start the debugger (gdb challenge5)

2. Locate the .text area (info file)

3. Add break point there

(b *0x400950)

4. Run until the break point (run)

5. Disassemble with (x/20i $pc)

Page 31: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 31

Page 32: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 32

1. Print text (”Password:”)

2. Input password

3. Check 2nd char = f (0x66)

4. If not -> jump to exit

5. Check len = 9 chars

6. If not -> jump to exit

7. Check 5th char = r (0x72)

8. Check 6th char = e (0x65)

9. Check 8th char = t (0x74)

Page 33: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 33

10. Compare 1st and 9th char to

each other

11. If not the same -> jump to exit

12. Check 3rd char = o (0x6f)

13. Check 7th char = s (0x73)

13.Check 4th char = r (0x72)

14.Check 1st char = 1 (0x31)

Passwd = 1forrest1

Page 34: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 34

United States – Network traffic 1

Solution:

1. Identify the file format (pcapng)

Page 35: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 35

2. Open the file with Wireshark -> Looks like HTTP traffic

3. File -> Export Objects -> HTTP -> Save All

4. Open the picture -> easy –button is revealed

5. Flag is: easy

Page 36: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 36

United Kingdom – Network traffic 2

Solution:

1. Identify the file format (cap)

Page 37: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 37

2. Open the file with Wireshark -> Looks like a WEP encrypted WIFI traffic

Page 38: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 38

3. Use aircrack-ng to crack the key: ”aircrack-ng Challenge11.cap” = qwert

Page 39: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 39

4. Enable decryption in Wireshark -> Edit -> Preferences -> Protocols -> IEEE 802.11

1. Add the decryption key as ascii code(Edit...)

5. Network traffic is now decrypted and some HTTP traffic can now be seen

6. The flag is found from the index.html: ”WinterIsComing”

Page 40: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 40

Finland – Network traffic 3

Solution:

1. Unzip Challenge13.zip

2. Open wpa_challenge_part1.pcap in

wireshark

Page 41: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 41

2. Hmm... Looks like a wifi router setup pages

3. Locate the wifi password. Search for keywords like ”password, encryption, key, PSK etc.”

1. Password is salasana12345

2. SSID = WIFI_CHALLENGE

Page 42: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 42

4. Open the wpa_challenge_part2.pcap on Wireshark -> Looks like WPA2 encrypted wifi traffic

Page 43: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 43

5. Decrypt with airdecap-ng

Page 44: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 44

6. Open and analyze the decrypted pcap in wireshark -> There is something scetchy in ICMP Ping packets...

Looks like, there is some base64 encoded data in the data field

Page 45: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 45

7. Create a script that reads the decrypted pcap file and each ICMP packet, decodes the data and saves it to binary

file.

Page 46: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 46

8. Identify the file format of the outputfile (zip)

9. Unzip the file & Identify the file format (java class)

10. Rename the file to class and try to run it -> class name is wrong

11. Rename it as the error message suggest and try to run it -> runs ok.

12. Decompile with jad

Page 47: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 47

13. Pick up the password from the source code

Page 48: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 48

14. Execute the program and use the password

Flag is: HolyHandGrenadeOfAntioch

Page 49: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 49

https://ctftime.org/

Page 50: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 50

Page 51: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 51

https://www.holidayhackchallenge.com/2018/

Page 52: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 52

Page 53: CTF Workshop – Solutions · 4. In addition text color seems to be black. Changing the color (000000 -> FFFFFF) and reopening the file in In addition text color seems to be black

© 2018 Synopsys, Inc. 53