## https://sploitus.com/exploit?id=267A765B-AF6E-5280-849A-0BDCD33EBD9F
# STS-PR-13: Code Review CTF โ Writeups
Writeups for **STS-PR-13: Conduct Security-Focused Code Review with Justification**,
a 3-challenge CTF built around auditing a vulnerable Flask code-review portal
([source](https://github.com/elanthriyan/Phantom_Commits)).
Each challenge presents a developer who believes a specific security control
(checksum, autoescape, HMAC) makes their code safe. The job is to prove why
it doesn't, and to exploit the running application to retrieve the flag โ
not just read the vulnerability out of the source.
## Challenges
| # | Name | Category | Flag |
|---|------|----------|------|
| 1 | [Temporal Blindness](challenges/01-temporal-blindness.md) | Authentication Bypass / Logic Flaw | `CTF_CR1{T1M3ST4MP_1S_NOT_4_S1GN4TURE}` |
| 2 | [Phantom Patch](challenges/02-phantom-patch.md) | SSTI (Server-Side Template Injection) | `CTF_CR2{SSTI_BEATS_AUT0ESCAPE_EVERY_T1ME}` |
| 3 | [Trust The Process](challenges/03-trust-the-process.md) | Insecure Deserialization | `CTF_CR3{H4RDC0DED_S3CRET_K1LLS_HMAC_TRUST}` |
## Repo layout
```
.
โโโ README.md
โโโ challenges/
โ โโโ 01-temporal-blindness.md
โ โโโ 02-phantom-patch.md
โ โโโ 03-trust-the-process.md
โโโ exploits/
โโโ c1_exploit.py
โโโ c2_exploit.py
โโโ c3_exploit.py
```
Each challenge writeup follows the same structure: **Vulnerability โ Why the
code fails โ Impact โ Exploit โ Remediation**. Each exploit script is
runnable standalone against a local instance of the target app
(`python app.py`, default `http://localhost:5001`).
## Running the target locally
```bash
git clone https://github.com/elanthriyan/Phantom_Commits.git
cd Phantom_Commits
pip install -r requirements.txt
python setup_ctf.py # one-time DB init
python app.py # serves on :5001
```
Then run any exploit script from `exploits/` against it.
## Core theme across all three challenges
Every vulnerability here comes from the same root mistake: **conflating a
security control that proves one property with a control that proves a
different property the developer actually needed.**
- A checksum proves *consistency*, not *authenticity*.
- Autoescaping proves safe *output rendering*, not safe *template compilation*.
- An HMAC signature proves *the signer knew the key*, not *the signer is
trustworthy* โ especially when the key itself isn't actually secret.
In each case the fix is the same shape: use the primitive that actually
matches the threat model (a real server-side-keyed signature for
authentication, no user input in template source for SSTI, no
deserialization of untrusted bytes regardless of signing for the RCE chain).