Web and Crypto Challenges
Solving common web and crypto puzzles.
Web and Crypto Challenges is a free Cyber Security Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cyber Security Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Two Pillars: Web and Crypto
Web and crypto are the two most common entry points into CTF.
- Web challenges hand you a running web application and ask you to find a flaw in how it handles input, authentication, or trust.
- Crypto challenges hand you ciphertext, a scheme, and sometimes source code, and ask you to recover plaintext or a key by exploiting a flaw in how the cryptography was used.
Both reward methodical observation. This lesson covers the recurring puzzles in each.
First Move on a Web Target
Before exploiting anything, map the application. View the source, inspect responses, and probe hidden content.
# Inspect raw response headers and body
curl -i http://target/
# Look for hidden paths the UI does not link to
gobuster dir -u http://target/ -w wordlist.txt
# Common files worth checking by hand
# /robots.txt /.git/ /backup.zip /adminSQL Injection
SQL injection happens when user input is concatenated into a database query without separation between code and data.
A login that builds a query like SELECT * FROM users WHERE name='INPUT' can be subverted by input that closes the string and alters the logic:
# A classic auth-bypass payload supplied as the username
' OR '1'='1' --
# UNION-based extraction once the column count is known
' UNION SELECT username, password FROM users -- The Real Fix for Injection
CTF teaches you to break injection so you can defend it. The correct defense is parameterized queries (prepared statements), which keep user data out of the query structure entirely.
# Vulnerable: input becomes part of the SQL text
query = "SELECT * FROM users WHERE name='" + name + "'"
# Safe: input is bound as a parameter, never parsed as SQL
cursor.execute("SELECT * FROM users WHERE name = ?", (name,))Cross-Site Scripting (XSS)
XSS occurs when an app reflects or stores attacker-controlled input and a browser executes it as script. In CTF, an XSS challenge often involves a bot that visits your payload while holding the flag in a cookie.
- Reflected — payload in the request is echoed straight back.
- Stored — payload is saved and runs for later visitors.
- DOM-based — client-side JavaScript writes input into the page unsafely.
The defense is context-aware output encoding plus a Content-Security-Policy. A test probe like <script>alert(1)</script> confirms whether input is escaped.
SSRF and Path Traversal
Two more web staples:
- Server-Side Request Forgery (SSRF) — you trick the server into making requests on your behalf, often to internal-only addresses like
http://127.0.0.1or a cloud metadata endpoint, to reach the flag. - Path traversal — you escape an intended directory with sequences like
../to read files outside the web root, for example../../../../etc/passwd.
Both stem from trusting user input to choose a resource. Defenses are strict allowlists and canonicalizing then validating paths before use.
Encoding Is Not Encryption
The most common crypto trap for beginners: confusing encoding with encryption. Encoding is reversible by anyone with no key, so it provides zero confidentiality.
Learn to recognize the formats on sight:
- Base64 — letters, digits,
+ /, often=padding. - Hex — only
0-9 a-f. - ROT13 / Caesar — readable structure, shifted letters.
# Decode base64
echo 'ZmxhZ3toZWxsb30=' | base64 -d
# Decode hex
echo '666c6167' | xxd -r -pClassic and XOR Ciphers
Many crypto challenges use weak historical ciphers or sloppy modern ones:
- Caesar / Vigenere — shift ciphers broken by frequency analysis or trying all 25 shifts.
- Single-byte XOR — the whole message XORed with one byte; brute-force all 256 keys and pick the readable output.
- Repeating-key XOR — broken by finding the key length, then solving each key byte as a single-byte XOR.
The lesson: a custom or classical cipher offers no real security against an analyst.
RSA Pitfalls
RSA is secure only when its parameters are chosen correctly. CTF crypto loves to hand you a broken instance:
- Small modulus — if
nis small enough, factor it directly to recover the private key. - Tiny exponent, no padding — with
e=3and a short message, the ciphertext may be a perfect cube, recoverable by an integer cube root. - Shared factors — if two public keys share a prime, the greatest common divisor of their moduli reveals it instantly.
The defense in the real world: use a vetted library with large keys and proper padding (OAEP), never roll your own.
Hash Cracking
When a challenge gives you a password hash, the goal is to recover the original input. You cannot reverse a hash, but you can guess inputs and compare.
# Identify the hash type first
hashid 5f4dcc3b5aa765d61d8327deb882cf99
# Dictionary attack with hashcat (mode 0 = raw MD5)
hashcat -m 0 hash.txt rockyou.txt
# John the Ripper alternative
john --wordlist=rockyou.txt hash.txtA Repeatable Workflow
Tie it together with a consistent loop for both categories:
- Observe — read the prompt, view source, identify the encoding or scheme.
- Hypothesize — name the likely vulnerability family.
- Test small — send one probe payload, watch the exact response.
- Exploit — escalate the working probe into a full payload that yields the flag.
- Document — record the payload and reasoning while it is fresh.
This loop keeps you out of rabbit holes and produces a writeup almost for free.
Quick Check
Test your grasp of web and crypto fundamentals.
Recap
You covered the recurring web and crypto puzzles:
- Web: map first, then probe for SQL injection, XSS, SSRF, and path traversal - each rooted in unsafe trust of user input, each fixed by separating code from data.
- Crypto: distinguish encoding from encryption, break weak classical and XOR ciphers, exploit RSA parameter mistakes, and crack hashes with wordlists.
- A single observe, hypothesize, test, exploit, document loop works for both.
Next, you move to reverse engineering and binary exploitation.
Frequently asked questions
Is the “Web and Crypto Challenges” lesson free?
Yes — the full text of “Web and Crypto Challenges” is free to read here on the web, and the Cyber Security Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cyber Security Academy course, upgrade to CoddyKit PRO.
What will I learn in “Web and Crypto Challenges”?
Solving common web and crypto puzzles. You practise Cyber Security Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Cyber Security Academy?
No prior experience is required. Cyber Security Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Web and Crypto Challenges” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Cyber Security Academy lesson?
Yes. Every Cyber Security Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- CTF Categories and Mindset
- Web and Crypto Challenges
- Reversing and Pwn Basics
- Tooling and Writeups