Disclosed ServiceNow credentials leading to data leak
Credentials for a production ServiceNow instance were found through GitHub reconnaissance. Because API calls did not require MFA, an attacker could query all incidents, problems, changes and configuration items from the instance.
Originally disclosed on Bugcrowd
- Accepted in 18 days
- Fixed in 19 days
- Disclosed after 9 months
Summary by cjfairhead
Credentials to a Production Service-Now instance were located through some crafty GitHub Recon. While the organization used MFA to log in to the service directly, there was no such requirement in place for API calls.
As a result, it was possible to query all Incidents, Problems, Changes and Configuration Items from the Service-Now Instance.
The code was VERY quickly removed (within hours) and MFA is now required for API calls to Service-Now in Prod and DEV (Yep, I've tried there too).
What the report shows
The target was a production ServiceNow instance belonging to Tesla. The researcher, cjfairhead, found credentials to that instance through what the summary calls "crafty GitHub Recon". The report does not name the repository, the file, the account or the credential type, and it contains no request, payload or command to reproduce.
The organisation did require MFA to log in to ServiceNow directly, but the same requirement was not applied to API calls. That gap is what turned the leaked credentials into access: with them, the researcher could query the instance through its API without satisfying MFA.
Step by step, as the report describes it:
- Search GitHub and locate credentials for a production ServiceNow instance.
- Note that interactive login is protected by MFA, but API access is not.
- Use the credentials against the API to query the instance.
- Confirm that all Incidents, Problems, Changes and Configuration Items could be read.
The outcome: the code was removed within hours, and MFA is now required for API calls to ServiceNow in both production and development. The researcher notes having tried the development instance's MFA as well.
Root cause
The likely root cause is a mismatch between two authentication paths to the same system. The interactive login enforced MFA, but the API authentication path accepted the leaked credentials on their own. A secret that leaks into a public repository therefore became a complete key to the instance, because nothing else was required to use it.
A second contributing factor is that the credentials reached a public code host at all. The report does not say how they were stored or why they were committed.
Impact
The report states that it was possible to query all Incidents, Problems, Changes and Configuration Items from the instance. In ServiceNow terms these are the core operational records: incident tickets, problem records, change requests and the configuration management database. Read access to them can expose internal infrastructure details, staff and customer information, and operational processes.
The report describes querying the records and does not describe any further escalation.
How this kind of bug works
Secrets committed to source code are copied wherever the repository goes: forks, mirrors, CI logs, package registries and search engine caches. Once a credential is public, the only remaining control is what the credential is allowed to do and what else the service demands alongside it.
MFA is usually enforced at the interactive login layer, for example a browser session with a second factor. API authentication is often a separate code path that validates a token, a basic auth header or an OAuth client credential. If that path does not check for a second factor, or if the credential type is exempt from MFA by design, then possession of the secret is sufficient. Service accounts and integration users are frequently configured this way, because automated clients cannot answer a push notification.
The defences that stop this are layered: keep secrets out of repositories (secret scanning, pre-commit hooks, short-lived credentials), scope credentials to the minimum the integration needs, and enforce MFA or a strong equivalent such as certificate-based or IP-restricted authentication on every path into the system, including the API.
How to test for it
This is a recon-led bug class. The method is to find a secret, then find out what it unlocks.
- Search public code hosts for strings tied to the target: hostnames, product names, internal domains, and configuration file patterns for the product in question. Search results and commit history both matter, because a secret removed in a later commit is still in history.
- Identify the credential type and the endpoint it belongs to. Configuration files often pair a URL with a username, password, token or client ID and secret.
- Authenticate to the API with the credential alone, without any interactive login or second factor. A positive result is a successful authenticated response, for example a listing of records or a profile endpoint returning the account identity.
- Establish the scope carefully: read one record or list endpoint to prove access, and stop there. Do not modify data.
- Check whether the same credential works against other environments, since development and production often share configuration patterns.
Common false positives: example or placeholder credentials in documentation, credentials for a decommissioned or sandbox instance, keys that authenticate but are scoped to nothing useful, and tokens that are already expired or revoked. Verify that the response comes from the target's real system and contains real data before reporting.
How it is fixed
The standard fixes are:
- Revoke and rotate the exposed credential immediately, and purge it from repository history.
- Require MFA, or an equivalent strong control, on API authentication as well as interactive login.
- Scope service credentials to the minimum permissions needed, so a leak exposes as little as possible.
- Add secret scanning and pre-commit checks to catch credentials before they are pushed.
- Prefer short-lived, automatically rotated credentials over long-lived static secrets.
Hunting notes
This bug class hides where code and configuration meet: repositories for integrations, scripts and infrastructure, CI configuration, and documentation with setup examples. Signals worth following are internal hostnames in public code, product-specific configuration keys, and accounts whose names suggest automation or integration. When a leaked credential authenticates, the strongest report shows the exact endpoint reached, the kind of data returned, and a clear statement that no data was modified. Programs accept these reports when the access is demonstrated against production with real records and the credential is handled responsibly, which usually means reporting quickly and not exfiltrating more than needed to prove the point.
What happened, in plain words
A security researcher named cjfairhead found a way into a production ServiceNow system that belonged to Tesla. ServiceNow is a web application that companies use to track their day-to-day work: support tickets, known problems, planned changes and an inventory of their equipment and services. "Production" means the live system that staff actually use, not a test copy.
The way in was a set of login credentials (a username and password, or something similar) that someone had left in code published on GitHub. GitHub is a website where developers store and share source code, and much of it is public. The summary calls the search for this "crafty GitHub Recon". Recon, short for reconnaissance, means looking around publicly available information before attacking anything, a bit like checking which windows of a house are open before trying a door. The report does not name the repository, the file, the account or the type of credential.
Tesla did protect the normal login with MFA. MFA, multi-factor authentication, means you need more than a password: usually a second step such as a code from a phone app. The problem was that this second step was only asked for when a person logged in through the browser. The API did not ask for it. An API is the machine-to-machine door into the same system: instead of a web page for a human, it accepts requests from software and returns data. Think of a building with a guarded front entrance and a side door for deliveries: the guard checks everyone at the front, but the side door was left unlocked.
So the leaked credentials were enough on their own. Using them against the API, the researcher could query the instance and read all Incidents, Problems, Changes and Configuration Items. In ServiceNow terms, incidents are the tickets staff raise when something breaks, problems are the underlying causes of repeated incidents, changes are planned modifications to systems, and configuration items are the records of the equipment and services the company runs. Reading all of these can reveal how a company's infrastructure is built and what is going wrong inside it.
Step by step, as the report describes it:
- Search GitHub and locate credentials for a production ServiceNow instance.
- Notice that the normal login is protected by MFA, but API access is not.
- Use the credentials against the API to query the instance.
- Confirm that all Incidents, Problems, Changes and Configuration Items could be read.
The code was removed within hours. The code was removed within hours, and MFA is now required for API calls to ServiceNow in both production and development. The researcher notes having tried the development instance's MFA as well.
The report contains no request, payload or command, so there is no code to walk through here.
In general, how this kind of bug works
Secrets written into source code travel with the code. When a repository is copied, forked (copied to another account), mirrored or indexed by search engines, the secret goes along with it. Deleting the line later does not always help, because the old version usually remains in the commit history, the record of every change ever made.
Once a credential is public, the only things standing between a stranger and the system are what the credential is allowed to do and what else the service demands alongside it. That is why the MFA gap mattered so much: the password alone was a complete key.
MFA is usually enforced where a human logs in, for example a browser session with a code from a phone. API authentication is often a separate path in the software that checks a token, a basic auth header or an OAuth client credential. A token is a string that stands in for a login, like a cloakroom ticket: whoever holds it gets the coat. An OAuth client credential is a pair of values that lets one program identify itself to another. If that path does not check for a second factor, or if the credential type is exempt by design, then simply holding the secret is enough. Automated accounts and integration users are often set up this way, because a machine cannot answer a push notification on a phone.
The defences are layered: keep secrets out of repositories in the first place, give each credential only the permissions it truly needs, and demand MFA or a strong equivalent on every way into the system, including the API.
In general, how to test for it
This is a recon-led bug class: you find a secret, then find out what it unlocks.
- Search public code hosts for strings tied to the target: hostnames, product names, internal domains and configuration file patterns. Search results and commit history both matter, because a secret removed in a later commit is still in history.
- Identify the credential type and the endpoint it belongs to. Configuration files often pair a URL with a username, password, token or client ID and secret.
- Authenticate to the API with the credential alone, without any interactive login or second factor. A positive result is a successful authenticated response, for example a listing of records.
- Establish the scope carefully: read one record or list endpoint to prove access, and stop there. Do not modify data.
- Check whether the same credential works against other environments, since development and production often share configuration patterns.
Common false positives: example or placeholder credentials in documentation, credentials for a decommissioned or sandbox instance, keys that authenticate but are scoped to nothing useful, and tokens that are already expired or revoked. Verify that the response comes from the target's real system and contains real data before reporting.
In general, how it is fixed
- Revoke and rotate the exposed credential immediately, and purge it from repository history.
- Require MFA, or an equivalent strong control, on API authentication as well as interactive login.
- Scope service credentials to the minimum permissions needed, so a leak exposes as little as possible.
- Add secret scanning and pre-commit checks to catch credentials before they are pushed.
- Prefer short-lived, automatically rotated credentials over long-lived static secrets.
Glossary
- API: the machine-to-machine interface of a system, used by software rather than people.
- Basic auth header: a way of sending a username and password with a request.
- Bounty: a reward paid for reporting a security problem responsibly.
- Commit history: the record of every change ever made to a code repository.
- Configuration item: in ServiceNow, a record of a piece of equipment or service the company runs.
- Credential: a secret that proves identity, such as a password or token.
- Development instance: a test copy of a system, separate from the live one.
- Endpoint: a specific address in an API that accepts requests.
- False positive: a finding that looks real but is not.
- Fork: a copy of someone else's repository into another account.
- GitHub: a website for storing and sharing source code.
- Incident: in ServiceNow, a ticket raised when something breaks.
- MFA: multi-factor authentication, requiring more than a password, such as a code from a phone.
- OAuth client credential: a pair of values that lets one program identify itself to another.
- Production: the live system that real users and staff depend on.
- Recon: reconnaissance, gathering public information before attacking.
- Repository: a project's folder of code and its history on a code host.
- ServiceNow: a web application for tracking tickets, problems, changes and equipment.
- Token: a string that stands in for a login, like a cloakroom ticket.