This shows you the differences between two versions of the page.
|
isc:lab-test [2026/10/01 16:58] florin.stancu |
isc:lab-test [2026/10/01 17:59] (current) florin.stancu |
||
|---|---|---|---|
| Line 51: | Line 51: | ||
| The struggle is an actual point: peeking is free, learning is earned. | The struggle is an actual point: peeking is free, learning is earned. | ||
| Official solutions will be released officially after the lab deadline. | Official solutions will be released officially after the lab deadline. | ||
| + | |||
| + | Also, in CTF competitions, a **task's name** is often **an important hint** to the technique(s) used! | ||
| </note> | </note> | ||
| - | ===== Python Warmup ===== | + | We recommend doing the following tasks using ''python3'' and/or ''bash''. Though feel free to explore the files and their contents using shell tools (e.g., ''xxd'', ''file'') or any GUI viewer (especially for images / PDF / audio documents) beforehand! |
| - | We recommend doing the following tasks using ''python3'' and ''bash''. Though feel free to explore the files and their contents using shell tools (e.g., ''xxd'', ''file'') beforehand! | ||
| ==== 01. Decode 'til You Drop ==== | ==== 01. Decode 'til You Drop ==== | ||
| - | |||
| - | {{page>:isc:agents_h&nofooter&noeditbutton&noheader}} | ||
| * One of your friends gave you this string which looks encoded... Figure out what encoding was used and decode it. Be patient, it may take a couple of decoding rounds :) | * One of your friends gave you this string which looks encoded... Figure out what encoding was used and decode it. Be patient, it may take a couple of decoding rounds :) | ||
| - | * Spot the encoding: chars //A-Z a-z 0-9 + / =// with length a multiple of 4 => **base64**. | + | * **Hint**: Spot the encoding: chars //A-Z a-z 0-9 + / =// with length a multiple of 4 :? ... |
| + | <spoiler SPOILER! scratch to reveal..> | ||
| + | * The encoding is... 🥁... [[https://en.wikipedia.org/wiki/Base64|base64]]! | ||
| * Do one round by hand: <code bash>echo 'Vm0weE5GVXhTWGhpUm...' | base64 -d</code> | * Do one round by hand: <code bash>echo 'Vm0weE5GVXhTWGhpUm...' | base64 -d</code> | ||
| * If the output is //still// base64-looking, run it again! | * If the output is //still// base64-looking, run it again! | ||
| + | * Please automate it [[https://www.geeksforgeeks.org/python/encoding-and-decoding-base64-strings-in-python/|using Python]]: | ||
| * Python <code python> | * Python <code python> | ||
| import base64 | import base64 | ||
| Line 72: | Line 73: | ||
| while True: | while True: | ||
| try: | try: | ||
| - | s = base64.b64decode(s) | + | s = your_decode_snippet(s) |
| except Exception: | except Exception: | ||
| break | break | ||
| - | print(s) | + | print(s) # print at each step |
| </code> | </code> | ||
| - | Expected: 5 rounds; the last printed line is the flag. | + | </spoiler> |
| - | ==== 02. Zip it good ==== | + | <note tip> |
| + | Also check out ''ex1-encodings/'' for a quick python3 tutorial on encodings. | ||
| + | This is especially important when manipulating binary data using Python! | ||
| + | </note> | ||
| - | {{page>:isc:agents_h&nofooter&noeditbutton&noheader}} | + | ==== 02. Zip it good ==== |
| * The archive contains the flag. What is the password? | * The archive contains the flag. What is the password? | ||
| - | * **Hint:** the password is in the wordlist | + | * **Hint:** the password is in the wordlist => dictionary attack! |
| + | * You have a helper Python skeleton for this (using the [[https://docs.python.org/3/library/zipfile.html|zipfile module]]), or you can use a classic CLI tool (//the ripper//)! | ||
| - | ===== CTF Tasks () ===== | + | <spoiler SPOILER: Useful Python zip snippets + CLI tool...> |
| + | * Using Python3's ''zipfile'' module: | ||
| + | * you can [[https://docs.python.org/3/library/zipfile.html#zipfile.ZipFile.setpassword|set the zip password]] in code: ''z.setpassword(bytes(test_passwd, "ASCII"))'' (remember encodings? this function requires ''bytes''!); | ||
| + | * then try to extract either | ||
| + | * As mentioned before, you can also use a classic cracking tool called ''john''! You must first extract the password hash using ''ziptojohn ZIP_FILENAME > hash.txt'' then simply call it using the ''%%--%%wordlist=..'' + hash.txt command-line arguments ;) | ||
| + | </spoiler> | ||
| ==== 03. Find the impostor ==== | ==== 03. Find the impostor ==== | ||
| + | |||
| * The flag for this exercise is found in a file under the inhere directory. The file has the following properties: | * The flag for this exercise is found in a file under the inhere directory. The file has the following properties: | ||
| * human-readable | * human-readable | ||