Unit 42 has identified an emerging threat trend named "token jacking," where cybercriminals steal API keys (tokens) for artificial intelligence (AI) services. These stolen tokens are used to fuel a gray market of "transfer stations," which resell access to premium AI models at discounted rates. Attackers employ various methods, including malicious npm packages, phishing campaigns, and information stealers, to harvest developer credentials and API keys. The consequences for victim organizations can be financially catastrophic, as attackers can consume vast, unmonitored AI computing resources, leading to exorbitant and unexpected bills. This threat highlights a critical security gap in the rapidly expanding AI development ecosystem, demanding immediate attention to secrets management, usage monitoring, and supply chain security.
Token jacking is a modern variant of resource hijacking, specifically targeting the burgeoning AI industry. The high cost and regional restrictions associated with frontier AI models have created a lucrative opportunity for criminals. They establish illicit services, referred to as "transfer stations," which act as proxies between end-users and official AI providers like OpenAI or Anthropic.
These transfer stations, often advertised on Chinese-language marketplaces like Taobao, offer access to multiple AI services using anonymously purchased credits. To be profitable, these operators cannot purchase tokens at retail value; instead, they rely on a steady supply of stolen API keys. Once an attacker compromises a developer's API key, they gain potentially unlimited access to that developer's account, which they can then use for their own purposes or resell through the transfer station network. The cyclical billing models and default unlimited usage policies of many AI providers mean that a breach can go unnoticed for weeks, allowing attackers to accumulate massive charges against the victim's account.
Attackers employ a multi-pronged approach to acquire AI API tokens. The methods are not novel in themselves but are newly applied to the AI development lifecycle.
Credential Harvesting: Attackers use traditional methods like phishing campaigns targeting developers or deploy information-stealing malware to harvest credentials from developer machines. These compromised developer accounts, often sold by access brokers on dark web markets, can be used to generate new API keys.
Code Repository Mining: A common and direct method involves scanning public and private code repositories (e.g., GitHub, GitLab) for hardcoded API keys. Developers who improperly secure secrets in configuration files, scripts, or environment files (.env) are prime targets.
Software Supply Chain Attacks: A more insidious vector involves poisoning open-source packages, particularly on registries like npm. Attackers publish malicious packages that unsuspecting developers install. These packages can contain code to steal credentials, environment variables, and API tokens from the developer's machine and any continuous integration/continuous deployment (CI/CD) environments. The report highlights campaigns like Shai-Hulud and Miasma as examples of large-scale credential theft that could fuel token jacking operations.
Transfer stations are typically built on open-source proxy platforms like new-api or one-api. These platforms are designed to manage multiple AI provider APIs, handle user authentication, and route requests. The operators of these stations simply need to populate the platform with a pool of stolen, legitimate API keys to begin reselling access.
The tactics, techniques, and procedures (TTPs) associated with token jacking include:
T1496 - Resource Hijacking: The core objective of the attack is to use stolen AI resources.T1134 - Access Token Manipulation: The theft and use of API tokens is a form of access token manipulation.T1552 - Unsecured Credentials: Specifically, mining hardcoded keys from code repositories and configuration files.T1598 - Phishing for Information: Targeting developers to steal account credentials.T1555 - Credentials from Password Stores: Using information stealers to harvest saved credentials and tokens.T1199 - Trusted Relationship: Exploiting the trust developers place in open-source registries like npm to deliver malicious code.T1078 - Valid Accounts: Using the stolen API keys to authenticate to AI services legitimately.The primary impact of token jacking is financial. Organizations can face bills amounting to tens or even hundreds of thousands of dollars from a single incident. Because many AI platforms bill based on token consumption without hard limits, the financial exposure is significant and immediate.
Beyond direct financial loss, there are secondary impacts:
No specific Indicators of Compromise (IOCs) such as IP addresses, domains, or file hashes were provided in the source article.
Security teams may want to hunt for the following patterns that could indicate token jacking activity:
sk-[a-zA-Z0-9]{48}npm install [package-name]npm install commands in CI/CD logs and developer endpoints for packages that are typosquatted, new, or have low download counts.~/.npmrc, ~/.docker/config.json, .envDetecting token jacking requires a focus on credential hygiene and anomalous activity monitoring.
API Usage Monitoring: Implement robust monitoring of AI service usage. Establish baselines for normal token consumption and alert on significant deviations, off-hours activity, or usage from unexpected geographic locations. Use the billing and monitoring tools provided by AI vendors.
Secret Scanning: Continuously scan all code repositories, including private and public ones, for hardcoded secrets like API keys. Tools like git-secrets or commercial SaaS platforms can automate this process.
Honeypot Tokens: Consider placing decoy API keys (honeypot tokens) in public code repositories. These tokens should have no permissions but should trigger high-priority alerts if used, providing an early warning of scanning and theft activity.
Endpoint and Network Detection: Use Endpoint Detection and Response (EDR) to monitor developer workstations for signs of information stealers. Analyze network traffic from developer environments for connections to suspicious domains or large data transfers inconsistent with normal development work. This can be achieved through D3-NTA: Network Traffic Analysis.
Preventing token jacking involves a combination of technical controls and developer best practices.
Secrets Management: The most critical mitigation is to never hardcode API keys or other credentials in source code. Use a dedicated secrets management solution like HashiCorp Vault, AWS Secrets Manager, or Azure Key Vault to store and dynamically inject secrets at runtime.
Least Privilege Access: Configure API keys with the minimum required permissions. If a key only needs to access one specific model, restrict it to that model. Avoid using master keys with broad permissions in applications.
Billing and Usage Controls: Set hard spending limits and billing alerts on all AI service accounts. This acts as a crucial safety net to cap the financial damage if a key is compromised. This is a form of D3-ACH: Application Configuration Hardening.
IP Allowlisting: Whenever possible, restrict API key usage to a specific set of trusted IP addresses, such as corporate office or production server IPs. This can prevent a stolen key from being used by an attacker in a different location.
Software Supply Chain Security: Vet all third-party dependencies. Use tools like npm audit and commercial software composition analysis (SCA) tools to identify vulnerabilities or malicious code in open-source packages before they are integrated into projects.
Implement secrets management solutions to prevent hardcoding of API keys in source code.
Continuously monitor and audit AI service API usage for anomalies in consumption, source IP, or time of day.
Apply the principle of least privilege to API keys, granting them only the permissions necessary for their specific function.
Configure billing alerts and hard spending limits on AI service provider accounts to cap financial exposure.
Use IP address allowlisting to restrict API key usage to trusted locations.
Train developers on secure coding practices, secrets management, and how to identify phishing attempts.

Cybersecurity professional with over 10 years of specialized experience in security operations, threat intelligence, incident response, and security automation. Expertise spans SOAR/XSOAR orchestration, threat intelligence platforms, SIEM/UEBA analytics, and building cyber fusion centers. Background includes technical enablement, solution architecture for enterprise and government clients, and implementing security automation workflows across IR, TIP, and SOC use cases.
CyberNetSec.io uses automation to assist source monitoring, deduplication, observable extraction, and structured intelligence generation. Published analysis follows human-defined editorial standards and adds defensive context including MITRE ATT&CK, D3FEND, STIX, and Sigma where applicable. Read our editorial policy.
Every tactic, technique, and sub-technique used in this threat has been identified and mapped to the MITRE ATT&CK framework for consistent, actionable threat language.
Observables and indicators of compromise (IOCs) have been extracted and cataloged. Risk has been assessed and correlated with known threat actors and historical campaigns.
Detection rules, incident response steps, and D3FEND-aligned mitigation strategies are included so your team can act on this intelligence immediately.
Structured threat data is packaged as a STIX 2.1 bundle and can be visualized as an interactive graph — relationships between actors, malware, techniques, and indicators.
Sigma detection rules are derived from the threat techniques in this article and can be converted for deployment across any major SIEM or EDR platform.