osec.one case analysis cover: Authy 2024: an open API endpoint that confirmed 33 million phone numbers

In late June 2024 the extortion group ShinyHunters posted a CSV file with 33,420,546 rows. Each row was a phone number registered with Twilio's Authy, the two-factor authentication app, with an Authy account ID, the account's status and how many devices it had. Nobody had broken into Twilio. The group had taken big lists of phone numbers from elsewhere, asked an Authy API endpoint about each one, and kept the ones it said yes to.

On 1 July 2024 Twilio confirmed it: "threat actors were able to identify data associated with Authy accounts, including phone numbers, due to an unauthenticated endpoint." The endpoint was closed to unauthenticated requests, and Twilio asked all users to update to Authy Android 25.1.0 and iOS 26.1.0. No accounts were taken over. But a list of 33 million people who use a 2FA app, with their phone numbers, is a ready target list for text-message phishing and SIM swaps.

This case analysis is about the endpoint, not the people: how an account-existence check turns into a data leak, why per-IP rate limits didn't save Authy, Trello or Twitter, and how to build a lookup that can't be used this way. It's the other side of 0ktapus 2022, where phished Twilio staff gave attackers 93 Authy accounts; this time the reach was 33 million numbers and nobody was phished.

Attack chain: attacker collects phone number lists from older leaks; feeds them to an Authy API endpoint that needs no sign-in; the endpoint answers with account details for numbers that are registered; requests spread over many IPs; 33,420,546 matches compiled; list posted in late June 2024 and Twilio closes the endpoint on 1 July
No password, no code, no account taken over: just a yes or no, asked 33 million times or more.

The timeline

text
Twilio Authy, 2022-2024

Aug 2022          0ktapus: phished Twilio staff; 93 Authy users get extra devices added
                  (out of about 75 million Authy users), 209 Twilio customers affected
Feb 2024          Twilio announces the Authy desktop app's end of life
19 Mar 2024       desktop app end of life (forced log-out followed around 1 Aug)
late Jun 2024     ShinyHunters posts 33,420,546 rows: account_id, phone_number,
                  over_the_top, account_status, device_count
1 Jul 2024        Twilio security alert: unauthenticated endpoint, now closed;
                  update to Android 25.1.0 / iOS 26.1.0
3 Jul 2024        BleepingComputer: lists of numbers were fed into the endpoint
23 Jul 2024       CISA adds CVE-2024-39891 (the Authy app flaw) to its known-exploited list

33.4 million matches against about 75 million users (Twilio's own 2022 figure) is up to 45% of the user base. Twilio never published how many numbers were checked or for how long the endpoint was used.

Step 1: a list of phone numbers

An existence check is only useful with something to check. Phone numbers are easy to come by in bulk: earlier breaches (the 533 million Facebook profiles scraped through its contact importer before September 2019 included phone numbers), marketing lists, and plain number ranges. For the whole US the space is finite and small:

text
How big is the space? (NANP numbering plan)

geographic US area codes            317 (plus 18 non-geographic)
central office codes per area code  up to 800 (200-999)
line numbers per office code        10,000
upper bound, US geographic          317 x 800 x 10,000 = 2,536,000,000 numbers

at 1,000 lookups a second           2.536 billion / 1,000 = 2,536,000 s = 29.4 days
at 10,000 lookups a second          2.9 days
from a breach list of 100 million   at 1,000/s: 27.8 hours

A lookup endpoint without a meaningful limit can test every possible US number in about a month at 1,000 requests a second, and a pre-filtered list of real numbers in about a day. Ten million to a hundred million requests isn't a big attack; it's an afternoon of cheap cloud servers.

Step 2: an endpoint that answered without a sign-in

The Authy app had a request it made when registering a device: give it a phone number and it tells you about the Authy account behind it. That's useful when a user is setting up a new phone. The endpoint didn't require the caller to be signed in, so anyone could ask, and the answer for a registered number was different from the answer for an unregistered one. Different answers are the whole leak. OWASP calls this an observable response discrepancy (CWE-204), and its Authentication Cheat Sheet is direct about it: an application "should respond (both HTTP and HTML) in a generic manner", whether the account exists or not.

Authy's answer was worse than a yes or no: it returned the account ID, status and device count. A device count of 1 versus 3 is a hint about how hard an account would be to take over.

Step 3: spread over many addresses

BleepingComputer reported that the lists were "fed" into the endpoint in bulk. Twilio didn't say whether a rate limit was in place. In the closest parallel, Trello in January 2024, an attacker fed about 500 million email addresses into a public API that needed no sign-in and got 15,115,516 matching accounts back, rotating proxy servers to get around the per-IP rate limit. A per-IP limit counts the wrong thing when the attacker has thousands of IPs.

text
Account-existence leaks with numbers

case              what was checked        endpoint                       matches          how it ended
Facebook, -2019   phone numbers           contact importer (app API)     533 million      importer changed Sep 2019
Twitter, 2021-22  phone numbers, emails   login flow lookup              5.4M (sold 2022) fixed Jan 2022; 200M dump Jan 2023
Trello, 2024      ~500M emails            public API, no sign-in         15,115,516       sign-in required for email lookups
Authy, 2024       phone numbers           device registration, no sign-in 33,420,546      sign-in required, app update

The pattern is the same each time: a feature built to help a legitimate user find their own account, or their friends, answers anyone who asks, and the answer differs when the account exists.

Worked example: what per-IP limits buy

Say the endpoint allows 10 requests a minute per IP, a common setting. Checking 100 million numbers from one IP takes 100,000,000 / 10 = 10 million minutes: 19 years. From a residential proxy pool of 10,000 IPs, it takes 1,000 minutes: 16.7 hours. The limit that does work counts what the attacker can't spread: distinct identifiers asked about, across all callers, and the share of them that come back as "exists".

Step 4: why the list is worth stealing

Twilio's own alert named the risk: "threat actors may try to use the phone number associated with Authy accounts for phishing and smishing attacks". The list tells an attacker three things about each number: it's a real, active phone; its owner uses 2FA and probably holds something worth protecting; and which messages will look plausible ("Your Authy account: new device added. Not you? Tap here"). Matched against other breach data with names and email addresses, it's a SIM swap shortlist: move the number to a new SIM, receive the SMS codes, reset the accounts.

NIST's rule for authentication, at most 100 consecutive failed attempts on a single account, doesn't touch this at all. An existence oracle asks once per number, never fails, and never touches the same account twice.

How to build a lookup that can't be used this way

1. Ask whether the endpoint needs to exist without sign-in. Twilio's and Trello's fixes were the same: require authentication. Device registration can happen after the user proves the number (a code sent to it), not before.
2. Same answer either way. "If this number has an account, we've sent it a code" for both cases, with the same status code, the same body and the same timing (do the same work, or wait the same time, on both paths).
3. Return nothing you don't need. Never account IDs, status or device counts to a caller who hasn't proved they own the number.
4. Count distinct identifiers, not requests per IP. Alert when the number of distinct phone numbers or emails looked up in an hour, across all callers, rises above its usual level, and when the share that exist moves away from your normal rate.
5. Make bulk asking expensive: a proof-of-work or invisible captcha on unauthenticated lookups costs a person nothing and costs a list of 100 million a lot.
6. Plant canaries: a handful of fake numbers or emails that look real. Any lookup of one is someone working through a list.

sql
-- lookups(at, ip, identifier, existed): one row per unauthenticated lookup
-- Distinct identifiers in the last hour against the same hour over the past 14 days.
WITH now_h AS (
  SELECT count(DISTINCT identifier) AS ids,
         avg(existed::int)          AS hit_rate
  FROM lookups WHERE at > now() - interval '1 hour'
), base AS (
  SELECT avg(ids) AS ids, avg(hit_rate) AS hit_rate FROM (
    SELECT date_trunc('hour', at) AS h, count(DISTINCT identifier) AS ids, avg(existed::int) AS hit_rate
    FROM lookups
    WHERE at > now() - interval '14 days' AND at < now() - interval '1 hour'
      AND extract(hour FROM at) = extract(hour FROM now())
    GROUP BY 1) t
)
SELECT now_h.ids, base.ids AS usual_ids, now_h.hit_rate, base.hit_rate AS usual_hit_rate
FROM now_h, base
WHERE now_h.ids > 3 * base.ids
   OR abs(now_h.hit_rate - base.hit_rate) > 0.2;

The hit-rate check matters as much as the volume: a real user typing their own number gets "exists" most of the time; a list from a breach gets it a few percent of the time (Trello: 15.1 million of about 500 million, 3%).

If you're one of the 33 million

1. Ask your mobile carrier for a SIM lock or port-out PIN, so your number can't be moved without it.
2. Move important accounts off SMS codes to an authenticator app, a passkey or a security key.
3. Treat any text about Authy, your 2FA app or a "new device" as phishing until you've checked in the app itself.

For your own sign-in, osec Login Protection counts per email address and per wrong code, not only per IP, so a list being worked through shows up even when every request comes from a different address.

osec Login Protection adds sign-in rules to your app that count by email and by wrong codes, not just by IP: the limits that hold when requests come from thousands of addresses. No DNS move.

See Login Protection

Sources

• Twilio: Security Alert, update to the Authy Android (v25.1.0) and iOS app (v26.1.0) (1 Jul 2024): https://www.twilio.com/en-us/changelog/Security_Alert_Authy_App_Android_iOS
• BleepingComputer: Hackers abused API to verify millions of Authy MFA phone numbers (3 Jul 2024): https://www.bleepingcomputer.com/news/security/hackers-abused-api-to-verify-millions-of-authy-mfa-phone-numbers/
• Twilio: August 2022 social engineering attack (updated 27 Oct 2022; 93 Authy users of about 75 million): https://www.twilio.com/en-us/blog/august-2022-social-engineering-attack
• Twilio support: end of life for the Authy desktop app: https://support.twilio.com/hc/en-us/articles/22771146070299-User-guide-End-of-Life-EOL-for-Twilio-Authy-Desktop-app
• Security Affairs: CISA adds Twilio Authy bug to the known-exploited catalog (Jul 2024): https://securityaffairs.com/166126/breaking-news/u-s-cisa-adds-microsoft-internet-explorer-and-twilio-authy-bugs-known-exploited-vulnerabilities-catalog.html
• BleepingComputer: Trello API abused to link email addresses to 15 million accounts (23 Jan 2024): https://www.bleepingcomputer.com/news/security/trello-api-abused-to-link-email-addresses-to-15-million-accounts/
• Meta: the facts on news reports about Facebook data (6 Apr 2021): https://about.fb.com/news/2021/04/facts-on-news-reports-about-facebook-data/
• Malwarebytes: Twitter confirms July 2022 data breach affecting 5.4M users: https://www.malwarebytes.com/blog/news/2022/08/twitter-confirmed-july-2022-data-breach-affecting-5.4m-users and BleepingComputer on the 200 million dump (4 Jan 2023): https://www.bleepingcomputer.com/news/security/200-million-twitter-users-email-addresses-allegedly-leaked-online/
• OWASP Authentication Cheat Sheet (authentication and error messages): https://cheatsheetseries.owasp.org/cheatsheets/Authentication_Cheat_Sheet.html
• OWASP API Security Top 10 2023, API4 Unrestricted Resource Consumption: https://api-security.owasp.org/editions/2023/en/0xa4-unrestricted-resource-consumption
• NIST SP 800-63B Rev. 4, rate limiting: https://pages.nist.gov/800-63-4/sp800-63b.html
• Twilio glossary: North American area codes (317 geographic, 18 non-geographic): https://twilio.com/docs/glossary/north-american-area-codes