ljagiello/ctf-skills / ctf-web
ctf-web
FlaggedProvides web exploitation techniques for CTF challenges. Use when the target is primarily an HTTP application, API, browser client, template engine, identity flow, or smart-contract frontend/backend surface, including XSS, SQLi, SSTI, SSRF, XXE, JWT, auth bypass, file upload, request smuggling, OAuth/OIDC, SAML, prototype pollution, and similar web bugs. Do not use it for native binary memory corruption, reverse engineering of standalone executables, disk or memory forensics, or pure cryptanalysis unless the web flaw is still the main path to the flag.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 16.8 KB |
| auth-and-access-2.md | markdown | 5.1 KB |
| auth-and-access.md | markdown | 58.6 KB |
| auth-infra.md | markdown | 16.5 KB |
| auth-jwt.md | markdown | 11.1 KB |
| client-side-advanced.md | markdown | 39.0 KB |
| client-side.md | markdown | 23.6 KB |
| cves.md | markdown | 15.9 KB |
| field-notes.md | markdown | 42.9 KB |
| node-and-prototype.md | markdown | 6.7 KB |
| pat-reference.md | markdown | 12.7 KB |
| python-requests.md | markdown | 20.4 KB |
| scripts/async_fuzz.pyexecutable | script | 6.9 KB |
| server-side-2.md | markdown | 15.5 KB |
| server-side-advanced-2.md | markdown | 25.7 KB |
| server-side-advanced-3.md | markdown | 6.9 KB |
| server-side-advanced-4.md | markdown | 21.7 KB |
| server-side-advanced.md | markdown | 15.8 KB |
| server-side-deser.md | markdown | 21.9 KB |
| server-side-exec-2.md | markdown | 38.7 KB |
| server-side-exec.md | markdown | 21.5 KB |
| server-side.md | markdown | 29.7 KB |
| sql-injection.md | markdown | 38.1 KB |
| tools-mcp.md | markdown | 35.0 KB |
| web3.md | markdown | 17.0 KB |
auth-and-access-2.md
View on GitHub# CTF Web - Auth & Access Control Attacks (Part 2)
2018-era additions: bucket-collision hash auth bypass, Unicode username homograph collision, SRP A=0/A=N bypass, ArangoDB AQL MERGE privilege escalation. For foundational auth/access techniques see [auth-and-access.md](auth-and-access.md). For JWT attacks see [auth-jwt.md](auth-jwt.md). For OAuth/OIDC/SAML/CI-CD, see [auth-infra.md](auth-infra.md).
## Table of Contents
- [std::unordered_set Bucket Collision Auth Bypass (Hackover 2018)](#stdunordered_set-bucket-collision-auth-bypass-hackover-2018)
- [nodeprep.prepare Homograph Username Collision (HCTF 2018)](#nodeprepprepare-homograph-username-collision-hctf-2018)
- [SRP A=0, A=N Auth Bypass (OTW Advent 2018)](#srp-a0-an-auth-bypass-otw-advent-2018)
- [ArangoDB AQL MERGE Injection for Privilege Escalation (P.W.N. CTF 2018)](#arangodb-aql-merge-injection-for-privilege-escalation-pwn-ctf-2018)
---
## std::unordered_set Bucket Collision Auth Bypass (Hackover 2018)
**Pattern:** A C++ backend stores credential hashes in `std::unordered_set<std::string>`. The set's bucket index is derived from only the first bytes of a SHA-512 digest (truncated `size_t` hash). The lookup loop aborts early after a bounded number of bucket probes (`MAX_LOOKUPS = 1000`). Flood the set with 1000+ entries that all collide in the same bucket as the `root` account — the compare for the correct entry never executes and the call returns "found" on an attacker-chosen password.
```cpp
// Vulnerable shape
std::unordered_set<std::string> users;
auto it = users.find(login_key); // probes at most MAX_LOOKUPS
if (it != users.end()) { /* accepted */ }
```
```python
# Flood registration: every entry collides in root's bucket
import requests
for i in range(1100):
requests.post("http://target/register",
data={"name": f"ro{i:04d}", "password": "ot1"})
# Log in as root with an arbitrary password — loop gives up before compare
requests.post("http://target/login", data={"name": "root", "password": "anything"})
```
**Key insight:** Hash-table implementations that truncate digests into bucket indices expose a second-preimage surface: the attacker only has to match the bucket, not the full hash. When the data structure also has a bounded probe count (DoS guard), flooding the bucket turns an authentication check into an unconditional accept. Any `unordered_map`/`unordered_set` keyed on low-entropy derivations of user input is suspect — watch for `std::hash<std::string>` implementations that reduce to `size_t` via XOR-folding.
**References:** Hackover CTF 2018 — secure-hash, writeup 11502
---
## nodeprep.prepare Homograph Username Collision (HCTF 2018)
**Pattern:** Registration calls Node's `node-xmpp-server` `nodeprep.prepare(username)` which runs RFC-3491/Stringprep normalization. Unicode characters like `ᴬ` (U+1D2C Modifier Letter Capital A) normalize to ASCII `A`, then the existing user lookup finds the already-registered `admin`. Register `ᴬdmin` with any password, and the lookup returns the real admin row — set a new password via a password-reset flow.
```text
username: \u1D2Cdmin # ᴬdmin
nodeprep.prepare("ᴬdmin") == "admin"
```
**Key insight:** Any pipeline that (1) normalizes usernames before lookup but (2) stores the pre-normalized form separately is vulnerable. Normalize once at write-time and never accept users whose pre-normalized form collides with an existing row. Libraries to audit: `nodeprep`, `icu.normalize`, `unicodedata.normalize`, `golang.org/x/text/secure/precis`.
**References:** HCTF 2018 — admin, writeup 12132
---
## SRP A=0, A=N Auth Bypass (OTW Advent 2018)
**Pattern:** SRP (Secure Remote Password) implementations that do not validate `A % N != 0` allow the client to send `A = 0` (or `A = k*N`). The server computes `S = (A * v^u)^b mod N = 0`, so the session key is `H(0)` — known to the attacker. Bypass login without knowing the password.
```text
Client: sends A = 0
Server: computes S = 0
Session key: K = H(0) # attacker knows this
```
**Key insight:** SRP, DH, and similar group-based protocols need explicit validation that public values are nontrivial. Spec-compliant SRP rejects `A % N == 0`; buggy implementations don't. Same attack works for `A = N, 2N, ...`.
**References:** OverTheWire Advent Bonanza 2018 — writeup 12750
---
## ArangoDB AQL MERGE Injection for Privilege Escalation (P.W.N. CTF 2018)
**Pattern:** ArangoDB's AQL query language accepts user-supplied fragments that are concatenated into `FILTER` clauses. Inject `' || 1 == 1 LET newitem = MERGE(u, {'role':'admin'}) RETURN newitem //` to turn a login check into an in-memory role upgrade — the server returns the modified user object without touching the real record.
```text
username: x' || 1 == 1 LET newitem = MERGE(u, {'role':'admin'}) RETURN newitem //
password: anything
```
**Key insight:** NoSQL databases each have their own injection grammar. AQL's `MERGE` creates a new document inheriting the found record's fields, bypassing any ACL that only checks persistent storage. Always use parameterised bind variables.
**References:** P.W.N. CTF 2018 — H!pster Startup, writeup 12067
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |