Skip to content
Detectors

Scanner deep dive

Overview

Azure Entra ID refresh tokens provide long-lasting access to an account.
TruffleHog’s own description of this detector

How sure this page is

  • 1 detail on this page was read from the source with low confidence. The maintainer view shows which.
Provider and detector details

Summary

ProviderNo provider details added yet.

Runs on any connection. Triggered by keywords in the content, after decoding.How TruffleHog works

How detection works

The Refreshtoken detector checks decoded text containing “0.A” or “1.A” for a possible credential.

Matching rules and source
Detector-wide rules and behavior

How it works

  1. Values below an entropy threshold are skipped. The threshold differs by version; How it behaves lists each one.
  2. Reports each remaining match as a possible Azure Refresh Token credential. It isn’t known to work until it’s verified.
Regular expression
One value
5 regexes shared across variants

Used by more than one variant, or not tied to one variant’s files in what was read from source (shared files: common.go).

  • Regex 1

    ([\w-]+\.onmicrosoft\.com)
    Show as a diagram
  • Regex 2

    \b[01]\.A[\w-]{50,}(?:\.\d)?\.Ag[\w-]{250,}(?:\.A[\w-]{200,})?
    Show as a diagram
  • v1 regex 1

    (?i)(?:secret|password| -p[ =]).{0,80}?([\w~@[\]:.?*/+=-]{31,34}
  • v1 regex 2

    (?i)(?:secret|password| -p[ =]).{0,80}[^A-Za-z0-9!#$%&()*+,\-./:;<=>?@[\\\]^_{|}~]([A-Za-z0-9!#$%&()*+,\-./:;<=>?@[\\\]^_{|}~]{31,34})[^A-Za-z0-9!#$%&()*+,\-./:;<=>?@[\\\]^_{|}~]
  • v2 regex

    (?:[^a-zA-Z0-9_~.-]|\A)([a-zA-Z0-9_~.-]{3}\dQ~[a-zA-Z0-9_~.-]{31,34})(?:[^a-zA-Z0-9_~.-]|\z)
    Show as a diagram
Guards against false matches
Differs by version; How it behaves lists each threshold
Not found in source

How it behaves

What this detector does at each step of the TruffleHog pipeline.

Keywords

Any one of these in the decoded text wakes the detector.

  • 0.A
  • 1.A

refreshtoken.go line 45 (opens TruffleHog source on GitHub)

Behavior

Multi-part
Yes, pairs two parts such as an ID and a secret
refreshtoken.go line 26 (opens TruffleHog source on GitHub)
Match window
4096 bytes before and 2048 after a keyword
multi_part_credential_provider.go line 13 (opens TruffleHog source on GitHub)
Custom endpoints
No
Cloud endpoint
None
Randomness check
Skips values with entropy below 4
refreshtoken.go line 301 (opens TruffleHog source on GitHub)
False-positive check
The shared word lists

Verification. When a scan allows it, TruffleHog tests a match by calling the provider. A scan can turn this off for every detector or for this one. Atlas only describes this; it never tests credentials. How the verify decision works

Analyzer.None in the open-source code.

In short

  • Refreshtoken: Wakes on “0.A” or “1.A”, reads 4096 bytes around each hit to pair two parts and tests matches with the provider. A default scan runs it.
  • Serviceprincipal: Wakes on “azure”, “az”, “entra”, “msal”, “login.microsoftonline.com” or “.onmicrosoft.com”, reads 1024 bytes around each hit to pair two parts and tests matches with the provider. A default scan runs it.
  • Serviceprincipal: Wakes on “q~”, reads 1024 bytes around each hit to pair two parts and tests matches with the provider. A default scan runs it.

How verification works

Each variant checks a found key its own way. Compare their requests and how answers are judged below.

The detection and verification evidence on this page comes from the Open Source implementation. Check the Enterprise coverage guide for product availability.

Does checking a key change anything at the provider?

Not expected to: it’s a GET request, which reads without changing anything, and the source declares no changes.

Files
refreshtoken/refreshtoken.go
Request
POSThttps://login.microsoftonline.com/%s/oauth2/v2.0/tokenrefreshtoken.go:192 (opens TruffleHog source on GitHub)
Key is sent as
OAuth2 client credentials form
How answers are judged
Troubleshoot this check

If a result looks wrong, work through these steps. They’re built from the request and status rules above. The Atlas doesn’t send anything.

1. Send the same request yourself

Each variant checks keys its own way. Use the one that matches your key’s format (see Detection above).

  • Refreshtoken

    No command for this check. The check first trades the key for a token, so it takes more than one request.

  • Serviceprincipal

    No command for this check. The check first trades the key for a token, so it takes more than one request.

2. Likely causes

  • The scanner couldn't reach the provider. The scanner needs outbound HTTPS access to login.microsoftonline.com. A firewall, proxy or DNS problem is reported as an error, not a rejection, and the key can be checked again.
  • The provider rejected the key. TruffleHog counts these as not verified (Refreshtoken: 400 and 401; Serviceprincipal: 400 and 401): usually a revoked, expired or mistyped key.
  • Rate limit or provider problem. TruffleHog counts these as an error, not a rejection (Refreshtoken: any other status; Serviceprincipal: any other status). A rate limit (429) or an outage lands here; the key can be checked again later.
  • The provider changed its API. If the provider answers differently from the table above, its API may have changed since this check was written. Compare against the provider's docs.

3. Check the provider’s docs

No provider doc recorded for this check yet. Look up the API docs for login.microsoftonline.com and compare what they say each status means.

4. Still stuck

Report it to TruffleHog

Include the status code and response you got. Never include the key.

Errors, timeouts and rate limits
Not found in source
Not found in source
If the provider can’t be reached
The result is an error, not a rejection, and the key can be checked again.

All URLs found in source

  • https://learn.microsoft.com/en-us/partner-center/account-settings/find-ids-and-domain-names#find-the-microsoft-azure-ad-tenant-id-and-primary-domain-name
  • https://learn.microsoft.com/en-us/microsoft-365/admin/setup/domains-faq?view=o365-worldwide#why-do-i-have-an--onmicrosoft-com--domain
  • https://www.codingexplorations.com/blog/understanding-singleflight-in-golang-a-solution-for-eliminating-redundant-work
  • https://login.microsoftonline.com/%s/.well-known/openid-configuration
  • https://learn.microsoft.com/en-us/advertising/guides/authentication-oauth-get-tokens?view=bingads-13#refresh-accesstoken
  • https://graph.microsoft.com/.default
  • https://login.microsoftonline.com/%s/oauth2/v2.0/token
  • https://login.microsoftonline.com/error?code=9002313
  • https://login.microsoftonline.com/error?code=70008
  • https://login.microsoftonline.com/error?code=700082
  • https://login.microsoftonline.com/error?code=70043
  • https://login.microsoftonline.com/error?code=50173
  • https://login.microsoftonline.com/error?code=700016
  • https://login.microsoftonline.com/error?code=90002
  • https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-client-creds-grant-flow#get-a-token
  • https://howtorotate.com/docs/tutorials/azure/
  • https://github.com/Azure/azure-sdk-for-js/issues/30557
  • https://login.microsoftonline.com/error?code=7000215
  • https://login.microsoftonline.com/error?code=7000222
  • https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-client-creds-grant-flow#second-case-access-token-request-with-a-certificate
  • https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-client-creds-grant-flow#third-case-access-token-request-with-a-federated-credential

Verified findings

Open Source · Standard output (stdout)

The CLI prints verified findings to stdout. Use --json for structured output.

Example scan output · credential redacted

✅ Found verified result 🐷🔑
Detector Type: AzureRefreshToken
Decoder Type: PLAIN
Raw result: [redacted]
Terminal printer source
CI formats

With --github-actions, GitHub Actions displays this workflow command as a warning on the indicated file and line.

::warning file=config/example.env,line=8,endLine=8::Found verified AzureRefreshToken result 🐷🔑
GitHub Actions printer source

Legacy compatibility. --json-legacy writes pre-v3 JSON for Git, GitLab, and GitHub sources only.

Enterprise alerts

When Enterprise verifies that a secret is live, a configured notifier can alert your team. The finding is also available through the Enterprise API.

Optional analysis

No analyzer is recorded for this detector, so Atlas shows no access assessment.

Rotation resources

Use the provider’s instructions for this credential.

Rotation and revocation instructions

Microsoft documents app client-secret rotation and user refresh-token revocation separately. Revoking all refresh tokens for a user can also invalidate their browser sessions.

Different credential. The tutorial rotates a Storage account access key. This detector covers Entra credentials. View original tutorial

Provider documentation checked by Atlas on .

See it in the rotation directory

Token types

TruffleHog’s source looks for 2 token types, by prefix. It doesn’t name them.

Token types: from TruffleHog’s source, and what the vendor says
Prefix
0.A
1.A
Pages TruffleHog’s source links to (18)

Coverage in other scanners

4 scanners have a confirmed match.

Changes

1 recorded change since Sep 18, 2026; 1 still needs review.

Source

Facts on this page were read from trufflesecurity/trufflehog at commit 2325546.

2325546
2921dcc