FlitDocs

Stop account takeover

A takeover is somebody else getting into a customer's account and then making it theirs. Tell Flit about every moment an account's credentials are used or changed, and it refuses the patterns a takeover leaves behind.

What to send

All of these go to audit-authentication, with the account's id as client_id and what happened as action:

ActionSend it when
loginA sign-in succeeded.
login_failedA sign-in was refused by you: wrong password, wrong code.
password_reset_requestedSomeone asked for a reset link or code.
password_reset_completedThe reset was used and a new password set.
password_change, email_change, phone_changeA signed-in user changed one of them.
two_factor_enabled, two_factor_disabledThe second factor was turned on or off.
new_device_loginA sign-in from a device you have not seen on this account. Use it in place of login.

Any other action is refused with an error, so a typo cannot go unnoticed. Beside the action, send what you know:

FieldWhat it is
ip_address, user_agentThe user's, not your server's. Most of what follows cannot run without them.
statussuccess, or anything else for a failure. Left out, it is a success unless the action is login_failed.
second_factortrue when the user passed one. A script that passes a second factor is worse news than one that does not, and Flit scores it that way.
visit_tokenFrom Flit's browser SDK; see Identify the device.
Send the failures and the resets, not only the logins. A takeover is a sequence. Flit can only see the sequence you send it.

A reset, then a login

The commonest takeover of all: the attacker controls the victim's inbox or phone, asks for a reset, and is in within seconds. A person takes longer than that to find the email. First the reset:

POST /api/v1/applications/$APP/audit-authentication
curl -s -X POST "$FLIT/api/v1/applications/$APP/audit-authentication" \
  -H "Authorization: Bearer $KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "id": "reset_3001",
    "client_id": "user_301",
    "action": "password_reset_requested",
    "ip_address": "102.91.133.202",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
  }'
200 Answer the fields this page talks about
{
  "data": {
    "audit_id": "3efdd3bf-0156-4b49-825f-c179a4b65660",
    "verdict": "allow",
    "risk_score": 0.0,
    "risk_level": "low",
    "factors": []
  }
}
The whole answer
{
  "data": {
    "audit_id": "3efdd3bf-0156-4b49-825f-c179a4b65660",
    "device_id": null,
    "identity": {
      "rungs": [
        "ip"
      ],
      "coverage": 0.15,
      "missing": [
        "device",
        "email_root",
        "asn"
      ],
      "strongest": "ip"
    },
    "risk_score": 0.0,
    "risk_level": "low",
    "rules": [
      "IPReputationRule",
      "BotSignalRule",
      "NetworkReputationRule",
      "ChallengeEvasionRule",
      "ChallengePassedRule",
      "MultiAccountingRule",
      "AccountSharingRule",
      "AccountFarmingRule",
      "AutomatedCredentialActionRule",
      "CredentialResetStormRule",
      "SessionShapeRule",
      "BlockStreakRule",
      "ProbingSessionRule"
    ],
    "reasons": [],
    "enforcement": "enforcing",
    "verdict": "allow",
    "should_block": false,
    "should_challenge": false,
    "should_review": false,
    "would_block": false,
    "would_challenge": false,
    "recommendation": "ALLOW: Low risk. Proceed with standard processing.",
    "confidence": 0.5,
    "coverage": 0.15,
    "factors": [],
    "degraded": [],
    "disabled_rules": [],
    "policy_matches": {},
    "block_streak": 0,
    "shadow": [],
    "hook": null,
    "challenge": null,
    "step_up_method": null,
    "agent": null
  },
  "errors": []
}

Nothing wrong with that on its own. Then the login that follows it:

POST /api/v1/applications/$APP/audit-authentication
curl -s -X POST "$FLIT/api/v1/applications/$APP/audit-authentication" \
  -H "Authorization: Bearer $KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "id": "login_3002",
    "client_id": "user_301",
    "action": "login",
    "status": "success",
    "ip_address": "102.91.133.202",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
  }'
200 Answer the fields this page talks about
{
  "data": {
    "audit_id": "64839693-0012-4cdc-bce0-c874d7a9d9eb",
    "verdict": "block",
    "risk_score": 0.9000000000000001,
    "risk_level": "critical",
    "factors": [
      "reset_then_login"
    ],
    "reasons": [
      {
        "code": "reset_then_login",
        "path": "action",
        "context": {
          "rule": "ResetToLoginRule",
          "history_independent": true,
          "severity": 1.0,
          "seconds_since_reset_request": 0.0,
          "fast_seconds": 90,
          "reset_requested_from": "102.91.133.202",
          "same_origin_as_reset": true,
          "second_factor": null,
          "auth_method": null
        },
        "text": "Password reset requested 0s before this login — faster than a person reads an email"
      }
    ]
  }
}
The whole answer
{
  "data": {
    "audit_id": "64839693-0012-4cdc-bce0-c874d7a9d9eb",
    "device_id": null,
    "identity": {
      "rungs": [
        "ip"
      ],
      "coverage": 0.15,
      "missing": [
        "device",
        "email_root",
        "asn"
      ],
      "strongest": "ip"
    },
    "risk_score": 0.9000000000000001,
    "risk_level": "critical",
    "rules": [
      "IPReputationRule",
      "BotSignalRule",
      "NetworkReputationRule",
      "ChallengeEvasionRule",
      "ChallengePassedRule",
      "MultiAccountingRule",
      "AccountSharingRule",
      "AccountFarmingRule",
      "ResetToLoginRule",
      "AutomatedCredentialActionRule",
      "CredentialResetStormRule",
      "SessionShapeRule",
      "BlockStreakRule",
      "ProbingSessionRule",
      "CredentialSprayRule"
    ],
    "reasons": [
      {
        "code": "reset_then_login",
        "path": "action",
        "context": {
          "rule": "ResetToLoginRule",
          "history_independent": true,
          "severity": 1.0,
          "seconds_since_reset_request": 0.0,
          "fast_seconds": 90,
          "reset_requested_from": "102.91.133.202",
          "same_origin_as_reset": true,
          "second_factor": null,
          "auth_method": null
        },
        "text": "Password reset requested 0s before this login — faster than a person reads an email"
      }
    ],
    "enforcement": "enforcing",
    "verdict": "block",
    "should_block": true,
    "should_challenge": false,
    "should_review": true,
    "would_block": true,
    "would_challenge": false,
    "recommendation": "BLOCK: High-risk activity detected. Recommend blocking transaction and triggering manual review.",
    "confidence": 0.6,
    "coverage": 0.15,
    "factors": [
      "reset_then_login"
    ],
    "degraded": [],
    "disabled_rules": [],
    "policy_matches": {},
    "block_streak": 1,
    "shadow": [],
    "hook": null,
    "challenge": null,
    "step_up_method": null,
    "agent": null
  },
  "errors": []
}

The finding is reset_then_login, and the reason carries the evidence: how many seconds passed, and whether the login came from the address that asked for the reset. Flit looks at the 90 seconds after a reset is requested. Inside 60 seconds the login is refused; between 60 and 90 it scores lower and comes back as a step-up instead.

This finding is one of several that a good history does not soften. The account being taken over is usually an old, well-behaved one; that is what makes it worth taking.

One address, many accounts

An attacker working through a list resets one account after another from the same place. Two accounts have already asked for a reset from this address in the last hour. This is the third:

POST /api/v1/applications/$APP/audit-authentication
curl -s -X POST "$FLIT/api/v1/applications/$APP/audit-authentication" \
  -H "Authorization: Bearer $KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "id": "reset_313",
    "client_id": "user_313",
    "action": "password_reset_requested",
    "ip_address": "197.210.54.8",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
  }'
200 Answer the fields this page talks about
{
  "data": {
    "audit_id": "e5f1f0cb-07c4-4e3d-936b-bff9c2e3e104",
    "verdict": "challenge",
    "risk_score": 0.68,
    "risk_level": "high",
    "factors": [
      "credential_reset_storm"
    ],
    "reasons": [
      {
        "code": "credential_reset_storm",
        "path": "ip_address",
        "context": {
          "rule": "CredentialResetStormRule",
          "history_independent": true,
          "severity": 0.8,
          "accounts": 3,
          "accounts_with_reset": 3,
          "minimum": 3,
          "ip_address": "197.210.54.8",
          "key": "ip"
        },
        "text": "3 accounts' credentials touched from 197.210.54.8 in the last 60 minutes"
      }
    ]
  }
}
The whole answer
{
  "data": {
    "audit_id": "e5f1f0cb-07c4-4e3d-936b-bff9c2e3e104",
    "device_id": null,
    "identity": {
      "rungs": [
        "ip"
      ],
      "coverage": 0.15,
      "missing": [
        "device",
        "email_root",
        "asn"
      ],
      "strongest": "ip"
    },
    "risk_score": 0.68,
    "risk_level": "high",
    "rules": [
      "IPReputationRule",
      "BotSignalRule",
      "NetworkReputationRule",
      "ChallengeEvasionRule",
      "ChallengePassedRule",
      "MultiAccountingRule",
      "AccountSharingRule",
      "AccountFarmingRule",
      "AutomatedCredentialActionRule",
      "CredentialResetStormRule",
      "SessionShapeRule",
      "BlockStreakRule",
      "ProbingSessionRule"
    ],
    "reasons": [
      {
        "code": "credential_reset_storm",
        "path": "ip_address",
        "context": {
          "rule": "CredentialResetStormRule",
          "history_independent": true,
          "severity": 0.8,
          "accounts": 3,
          "accounts_with_reset": 3,
          "minimum": 3,
          "ip_address": "197.210.54.8",
          "key": "ip"
        },
        "text": "3 accounts' credentials touched from 197.210.54.8 in the last 60 minutes"
      }
    ],
    "enforcement": "enforcing",
    "verdict": "challenge",
    "should_block": false,
    "should_challenge": true,
    "should_review": true,
    "would_block": false,
    "would_challenge": true,
    "recommendation": "CHALLENGE: Step up verification before proceeding (credential_reset_storm). Evidence is short of a block but the action should cost more than one request.",
    "confidence": 0.6,
    "coverage": 0.15,
    "factors": [
      "credential_reset_storm"
    ],
    "degraded": [],
    "disabled_rules": [],
    "policy_matches": {},
    "block_streak": 0,
    "shadow": [],
    "hook": null,
    "challenge": null,
    "step_up_method": null,
    "agent": null
  },
  "errors": []
}

credential_reset_storm is reported from the third account in 60 minutes. Here the verdict is challenge: three people behind one office address do sometimes forget their passwords on the same morning, so Flit asks for more proof instead of refusing. More accounts, or automation on top, takes it to a block.

Scripts on the credential paths

The refused login in Your first decision was this: automated_credential_action, a login, reset or credential change made by an HTTP library, a headless browser or anything else that is not a person's browser. It weighs more when the address belongs to a hosting company, and more again when second_factor is true.

After they are in

A takeover that got past the login shows itself in what happens next. When a password, email or phone is changed, a second factor is turned off, or money moves, Flit looks back over the account's last 24 hours and reports account_takeover_risk when enough of these are there:

  • a password reset
  • a change of password, email or phone, or the second factor turned off
  • a new_device_login
  • a login Flit scored as risky
  • three or more failed sign-ins

This is why the change events matter. A login from a new device, then the email changed, then a payout, is three ordinary events and one obvious story.

Identify the device

An IP address is weak evidence of who someone is: it is shared, and it changes. Flit's browser SDK collects enough about the browser to recognise it again, and gives you a token to send with the event.

import { collect } from "@flit/browser";

const { visitToken } = await collect({ key: "flit_pk_…" });
// send visitToken to your server with the login form

The key is your application's public one, collect_key in the answer to signing up; it is safe in a page. Your server passes the token on as visit_token. A token lasts 30 minutes.

With a device, the identity part of the answer gains a device rung and coverage rises, findings about one origin follow the device instead of the address, and Flit can report a browser that contradicts itself (automation_markers, platform_mismatch).

What Flit does not work out for you. On a login it does not decide by itself that a device or a country is new for this account. If you know, say so with new_device_login.

What your login does with the verdict

VerdictOn a login or a reset
blockRefuse it, with the same message as a wrong password.
challengeAsk for a second factor, even if the account does not normally need one. For a reset, hold the new password until they pass.
review, allowLet them in.

A session that Flit let in is not cleared for everything. Ask again when the money moves: Step up at payout.