[h1-2006 CTF] Multiple vulnerabilities leading to account takeover and two-factor authentication bypass allows to send pending bounty payments
A capture-the-flag challenge contained a chain of flaws: a two-factor check compared two values the attacker controlled, an SSRF exposed an internal Android app, a leaked staff ID gave staff portal access, a GET request allowed privilege escalation, and CSS injection bypassed 2FA. Together these let an attacker reach the point of processing customer bounty payments.
- Triaged in 20 hours
- Fixed in 7 days
- Disclosed after 26 days
Hi,
First things first, the flag of the CTF challenge.
{{media:0}}
### Write-Up
I've published my write-up at https://kapytein.nl/texts/2020-06-10-h1-2006-ctf-writeup-2cf34abd3ed/, in order to avoid a lengthy report �
.
### TL;DR
1) 2FA bypass as we control both values on the comparison.
2) SSRF to `software.bountypay.h1ctf.com` to discover a BountyPay Android application.
3) Solve Android challenges using deeplinks. Use leaked Authorization token for `api.bountypay.h1ctf.com`.
4) Leaked staff ID on the badge of [Sandra](https://twitter.com/SandraA76708114) allows access to `staff.bountypay.h1ctf.com` via a `POST /api/staff` call on `api.bountypay.h1ctf.com`.
5) Privilege escalation using GET CSRF.
6) 2FA bypass via a CSS injection.
Thank you for organizing this challenge!
## Impact
This allows an attacker to process bounty payments of customers.What the report shows
This is a capture-the-flag submission for the h1-2006 CTF, run against the BountyPay application on *.bountypay.h1ctf.com. The researcher, kapytein, submitted the flag and a short summary of the chain rather than a full report, pointing to a published write-up for the detail. The platform records the severity as critical. The report does not give a bounty amount or describe a fix.
The flag was captured as proof of completion:

The summary lists six steps that together lead to account takeover and a two-factor authentication bypass, ending in the ability to send pending bounty payments.
- A 2FA bypass, because the attacker controls both values that are compared.
- A server-side request forgery to
software.bountypay.h1ctf.com, which revealed a BountyPay Android application. - The Android challenges were solved using deeplinks, and a leaked Authorization token was reused against
api.bountypay.h1ctf.com. - A staff ID leaked on the badge of a BountyPay staff member gave access to
staff.bountypay.h1ctf.comthrough aPOST /api/staffcall onapi.bountypay.h1ctf.com. - Privilege escalation using a GET-based CSRF.
- A second 2FA bypass, this time through a CSS injection.
The report does not include the individual requests, parameters or responses for these steps; the detail sits in the external write-up. What it does state is the impact: an attacker can process bounty payments of customers.
Root cause
The first 2FA bypass is described as control of both values in the comparison, so the check can be satisfied without knowing the real second factor. The first bypass is described exactly that way, as control of both values in the comparison. The second bypass is listed as a 2FA bypass via a CSS injection.
The remaining steps are an SSRF to software.bountypay.h1ctf.com, a leaked Authorization token reused against the API, a staff ID leaked on a badge, and privilege escalation using GET CSRF.
Impact
As the report puts it, the chain allows an attacker to process bounty payments of customers. The title describes the chain as multiple vulnerabilities leading to account takeover and two-factor authentication bypass. The report does not quantify how many accounts or payments were affected.
How this kind of bug works
Two-factor authentication is only as strong as the check that validates the second factor. If the server compares a value the user supplies against another value the user also supplies, or against a value derived from their own session without an independent secret, the check proves nothing. The same applies when the verification step trusts client-side state, such as a hidden field, a cookie the client can set, or content injected into the page. CSS injection matters here because CSS can exfiltrate data through attribute selectors and background requests, and can alter what a victim sees, which is enough to steer a verification flow.
SSRF happens when a server fetches a URL supplied by the user without restricting the destination. It lets an attacker reach internal services that are not exposed publicly, and any credentials or tokens those services return become reachable too. Leaked tokens are dangerous because bearer credentials are often accepted from any client. CSRF on a GET request works because browsers attach cookies to top-level navigations and image or link loads, so a state-changing GET can be triggered from another site without any script. Defence in depth means each of these should fail independently: strict comparison against a server-held secret, destination allowlists for outbound fetches, short-lived scoped tokens, and state-changing actions restricted to non-safe methods with anti-CSRF tokens.
How to test for it
- Map the authentication flow, especially where the second factor is submitted and what the server compares it against. Look for hidden fields, client-set cookies and values reflected back into the page.
- Try submitting a verification request where both the expected and supplied values come from your own input, and observe whether the check passes without a valid code.
- Test whether the verification page reflects any input into a style context. If it does, check whether CSS can read attributes or trigger requests that leak values.
- For SSRF, find parameters that take URLs or hostnames and point them at internal addresses, then watch for responses, timing differences or outbound callbacks that confirm the server made the request.
- For token leakage, inspect responses from internal services reached via SSRF for credentials, and test whether those credentials are accepted by public APIs.
- For CSRF, identify state-changing endpoints reachable by GET and check whether they act on a victim's session when loaded cross-site.
A positive result is a verification that succeeds without the real factor, an internal response returned through an SSRF, a leaked token accepted elsewhere, or a state change triggered cross-site. Common false positives are checks that appear client-side but are re-validated server-side, SSRF that is blocked by egress filtering but returns a generic error, and CSRF on endpoints that require a custom header or token the attacker cannot supply.
How it is fixed
Validate the second factor against a server-held secret tied to the account, never against client-supplied values. Render user input as text, not into style or script contexts, and apply a strict content security policy. Restrict outbound requests to allowlisted destinations and block internal address ranges. Issue short-lived, narrowly scoped tokens and rotate any that may have leaked. Require non-safe HTTP methods with anti-CSRF tokens for state-changing actions, and never perform them on GET.
Hunting notes
To show impact, demonstrate the full path from an unauthenticated position to a concrete privileged action, and keep each step reproducible so the program can follow the chain.
What happened, in plain words
This is a capture-the-flag (CTF) entry for the h1-2006 challenge, run against a fictional product called BountyPay on *.bountypay.h1ctf.com. A CTF is a security exercise: a deliberately vulnerable application is set up, and players try to break into it to find a hidden string of text called a flag. Finding the flag proves you completed the challenge. The researcher, kapytein, submitted the flag plus a short summary of how the chain of bugs fitted together, and linked to a longer write-up for the detail. The platform records the severity as critical. The report does not give a bounty amount or describe a fix.
The flag was captured as proof of completion:

The summary lists six steps that together lead to account takeover (taking control of someone else's account) and a two-factor authentication bypass, ending in the ability to send pending bounty payments.
- A 2FA bypass, because the attacker controls both values that are compared.
- A server-side request forgery to
software.bountypay.h1ctf.com, which revealed a BountyPay Android application. - The Android challenges were solved using deeplinks, and a leaked Authorization token was reused against
api.bountypay.h1ctf.com. - A staff ID leaked on the badge of a BountyPay staff member gave access to
staff.bountypay.h1ctf.comthrough aPOST /api/staffcall onapi.bountypay.h1ctf.com. - Privilege escalation using a GET-based CSRF.
- A second 2FA bypass, this time through a CSS injection.
The report does not include the individual requests, parameters or responses for these steps; the detail sits in the external write-up. What it does state is the impact: an attacker can process bounty payments of customers.
The ideas behind it, from zero
A few concepts appear throughout, so it helps to define them before walking the chain.
A request is what your browser sends to a website when you click a link or submit a form: a message asking the server to do something. A cookie is a small piece of data the server asks your browser to store and send back with every later request, which is how a site remembers that you are logged in. A token is a string of characters that acts like a temporary key: whoever holds it can act as the user it belongs to, without needing a password.
Two-factor authentication (2FA) means logging in needs two things, usually a password plus a short code from your phone. It only helps if the server checks the code against a secret it holds itself. If the server compares a value the user supplies against another value the user also supplies, the check proves nothing, like a bouncer who asks you to write down a password and then reads it back to you.
Server-side request forgery (SSRF) is when a server fetches a web address that the user supplied, without restricting where it may go. It is like asking a receptionist to phone a number for you: if they will dial anything, you can use them to reach internal extensions you could never call yourself.
Cross-site request forgery (CSRF) is when another website makes your browser send a request to a site you are logged into, using your stored cookie. Browsers attach cookies to ordinary page loads and image loads, so a state-changing action reachable by a simple GET request can be triggered just by visiting a malicious page.
CSS injection is when an attacker gets their own styling rules into a trusted page. CSS can change what a victim sees and can trigger requests to load images, which is enough to steer a verification flow.
Privilege escalation means moving from a low level of access, such as a normal user, to a higher one, such as staff.
Why each step matters
The first 2FA bypass is described as control of both values in the comparison, so the check can be satisfied without knowing the real second factor. The first bypass is described exactly that way, as control of both values in the comparison. The second bypass is listed as a 2FA bypass via a CSS injection.
The remaining steps are an SSRF to software.bountypay.h1ctf.com, a leaked Authorization token reused against the API, a staff ID leaked on a badge, and privilege escalation using GET CSRF. The chain ends at the ability to process customer bounty payments. The report does not quantify how many accounts or payments were affected.
In general, how this kind of bug works
In general, 2FA is only as strong as the check that validates the second factor. If the server compares a value the user supplies against another value the user also supplies, or against something derived from their own session without an independent secret, the check proves nothing. The same applies when the verification step trusts client-side state: a hidden field, a cookie the client can set, or content injected into the page. CSS injection matters because CSS can exfiltrate data through attribute selectors and background requests, and can alter what a victim sees, which is enough to steer a verification flow.
SSRF happens when a server fetches a user-supplied URL without restricting the destination. It lets an attacker reach internal services that are not exposed publicly, and any credentials or tokens those services return become reachable too. Leaked tokens are dangerous because bearer credentials are often accepted from any client. CSRF on a GET request works because browsers attach cookies to top-level navigations and image or link loads, so a state-changing GET can be triggered from another site without any script. Defence in depth means each of these should fail independently: strict comparison against a server-held secret, destination allowlists for outbound fetches, short-lived scoped tokens, and state-changing actions restricted to non-safe methods with anti-CSRF tokens.
In general, how to test for it
- Map the authentication flow, especially where the second factor is submitted and what the server compares it against. Look for hidden fields, client-set cookies and values reflected back into the page.
- Try submitting a verification request where both the expected and supplied values come from your own input, and observe whether the check passes without a valid code.
- Test whether the verification page reflects any input into a style context. If it does, check whether CSS can read attributes or trigger requests that leak values.
- For SSRF, find parameters that take URLs or hostnames and point them at internal addresses, then watch for responses, timing differences or outbound callbacks that confirm the server made the request.
- For token leakage, inspect responses from internal services reached via SSRF for credentials, and test whether those credentials are accepted by public APIs.
- For CSRF, identify state-changing endpoints reachable by GET and check whether they act on a victim's session when loaded cross-site.
A positive result is a verification that succeeds without the real factor, an internal response returned through an SSRF, a leaked token accepted elsewhere, or a state change triggered cross-site. Common false positives are checks that appear client-side but are re-validated server-side, SSRF that is blocked by egress filtering but returns a generic error, and CSRF on endpoints that require a custom header or token the attacker cannot supply.
In general, how it is fixed
Validate the second factor against a server-held secret tied to the account, never against client-supplied values. Render user input as text, not into style or script contexts, and apply a strict content security policy. Restrict outbound requests to allowlisted destinations and block internal address ranges. Issue short-lived, narrowly scoped tokens and rotate any that may have leaked. Require non-safe HTTP methods with anti-CSRF tokens for state-changing actions, and never perform them on GET.
In general, where to look when hunting
To show impact, demonstrate the full path from an unauthenticated position to a concrete privileged action, and keep each step reproducible so the program can follow the chain.
Glossary
- CTF (capture the flag): a security exercise with a deliberately vulnerable application and a hidden flag that proves completion.
- Flag: the hidden string of text that proves a CTF challenge was solved.
- Account takeover: gaining control of another person's account.
- 2FA (two-factor authentication): logging in with two separate proofs, usually a password plus a one-time code.
- 2FA bypass: getting past the second factor without supplying a valid one.
- Request: a message a browser sends to a server asking it to do something.
- Cookie: small data a server asks the browser to store and send back on later requests, often used to keep you logged in.
- Token: a string that acts as a temporary key, letting its holder act as a user.
- Authorization token: a token sent with a request to prove which user is making it.
- SSRF (server-side request forgery): making a server fetch a user-supplied address, potentially reaching internal services.
- CSRF (cross-site request forgery): making a logged-in victim's browser send a request to another site using their stored cookie.
- GET request: a request type normally used just to load a page or resource; it should not change anything on the server.
- POST request: a request type used to submit data, often to change something on the server.
- CSS injection: getting attacker-controlled styling rules into a trusted page, which can alter what is shown and trigger requests.
- Privilege escalation: moving from a lower level of access to a higher one.
- Deeplink: a link that opens a specific screen inside a mobile application.
- Staff ID: an identifier for an employee, here exposed on a physical badge.
- Bearer credential: a token accepted from whoever presents it, without further proof of identity.
- Allowlist: a list of destinations or values that are explicitly permitted.
- Defence in depth: layering independent protections so that one failure does not open everything.