Listen to this Post

Introduction:
The breakneck race to adopt artificial intelligence has created a lucrative new attack surface: API tokens that grant programmatic access to frontier AI models. Cybercriminals are stealing these credentials through phishing, credential theft, and software supply chain attacks, then funneling them into gray-market “transfer stations” that resell AI compute at a fraction of retail cost. What makes this threat particularly insidious is the billing model—most AI providers tally usage cyclically, meaning victims often discover the theft only after attackers have generated hundreds of thousands of dollars in charges.
Learning Objectives:
- Understand the mechanics of token jacking and how stolen API keys are monetized through transfer stations
- Identify common attack vectors including npm supply chain poisoning, exposed credentials in code repositories, and phishing campaigns
- Implement practical mitigation strategies including spending limits, short-lived tokens, AI gateways, and CI/CD pipeline hardening
You Should Know:
1. The Anatomy of a Token Jacking Attack
Token jacking is a modern twist on credential theft, specifically targeting the API keys—referred to as tokens—that developers use to authenticate with AI platforms like OpenAI, Anthropic, and Google Vertex AI. Unlike traditional session-based authentication, these tokens enable automated, programmatic access without interactive logins, making them ideal for attackers seeking to scale their operations.
The attack chain typically unfolds as follows:
- Credential Harvesting: Attackers obtain privileged developer accounts through information stealers, phishing campaigns, or by purchasing them from access brokers on dark web marketplaces.
-
Token Extraction: Once inside, attackers create new API keys, provision additional models, remove billing limits, and disable usage alerts to avoid detection.
-
Integration into Transfer Stations: Stolen tokens are fed into proxy services like new-api or one-api—open-source platforms that handle credential rotation, obfuscation, billing, and model routing.
-
Monetization: These transfer stations resell AI compute capacity on marketplaces like Taobao, generating tens of millions of API calls per day and racking up hundreds of thousands of dollars in fees before the victim notices.
Unit 42 has responded to cases where attackers integrated exposed credentials into a transfer station within minutes, resulting in nearly one million dollars in charges before containment.
- The Transfer Station Economy: A Thriving Gray Market
Skyrocketing costs for frontier AI models and regional usage restrictions have spawned a massive gray market of vendors selling AI computing capacity at a fraction of retail cost. These “transfer stations” act as intermediaries between official AI providers and end users, often advertising on Chinese-language marketplaces.
The economics are straightforward: transfer station operators require access to a large pool of discounted legitimate tokens to remain profitable. Since purchasing tokens at full price to resell them at a discount isn’t viable, operators turn to stolen credentials. This creates a self-sustaining criminal ecosystem where stolen tokens fuel discounted AI access, which in turn attracts more users and generates more revenue for the operators.
Indicators of Compromise (IoCs): Recent token jacking activity has been associated with specific user agents and IP addresses. Security teams should monitor for:
– User Agent: `Go-http-client/2.0,gzip(gfe)`
– Malicious API call origins: 3.235.109[.]125, 116.105.166[.]148, 172.96.142[.]186, `38.46.219[.]166`
– Transfer station infrastructure: amutes[.]com, `abb1[.]life`
3. Supply Chain Poisoning: The npm Threat Vector
One of the most concerning attack vectors involves poisoned, self-propagating npm packages downloaded by unsuspecting developers. Once installed, these packages infect any other code releases the developer builds, stealing credentials and access tokens from each environment along the way.
Notable campaigns like Shai-Hulud and Miasma demonstrate the scale of this threat—attackers could use the huge number of credentials stolen in these campaigns to fuel transfer stations for years. The stolen tokens provide attackers with unlimited programmatic access that can be resold or used directly.
Detection Commands (Linux/macOS):
Scan for exposed API keys in your codebase
grep -r --include=".{js,py,json,env,yml,yaml}" -E "(sk-[a-zA-Z0-9]{20,}|AIza[0-9A-Za-z_-]{35}|[a-zA-Z0-9_-]{30,}.[a-zA-Z0-9_-]{6,}.[a-zA-Z0-9_-]{27,})" .
Check for suspicious npm packages in your dependencies
npm audit --production
npm list --depth=6 | grep -E "(shai-hulud|miasma|@[a-z0-9-]+)"
Windows (PowerShell):
Search for potential API keys in files
Get-ChildItem -Recurse -Include .js,.py,.json,.env,.yml,.yaml | Select-String -Pattern "(sk-[a-zA-Z0-9]{20,}|AIza[0-9A-Za-z_-]{35})"
Check npm packages
npm audit --production
npm list --depth=6 | findstr /i "shai-hulud miasma"
4. Mitigation: Building a Defense-in-Depth Strategy
Organizations can protect themselves against token jacking through a multi-layered approach:
A. Implement Spending Limits and Alerts
- Set hard spending caps on AI usage per account
- Configure alerts that trigger when usage deviates significantly from established baselines
- Review all privileged accounts that can provision resources or adjust spending limits
B. Adopt Short-Lived Bearer Tokens
- Migrate from long-term access keys to short-lived bearer tokens to limit the potential window of damage
- Implement just-in-time (JIT) secret retrieval so tokens are only available when needed
C. Deploy an AI Gateway
- Use an AI gateway in combination with a machine authentication platform to ensure all LLM traffic is tied to a verified and managed machine identity
- Centralize API key management to remove sensitive credentials from developer environments and build systems
- Gain full visibility into model usage, agent actions, and token spend across teams
D. Harden Development Pipelines
- Tightly manage development environments to prevent malicious packages from entering the pipeline
- Monitor CI/CD pipelines for malicious code execution
- Implement runtime security to detect and block suspicious npm packages
E. Enforce Network Boundaries
- Ensure compute resources include network boundaries that restrict access to corporate infrastructure, preventing compromised keys from being used in a transfer station scenario
5. AI Gateway Deployment: A Practical Guide
An AI gateway serves as a central control plane for securing and governing enterprise AI traffic. Here’s how to implement one effectively:
Step 1: Centralize API Key Management
- Store all API keys in a secure secrets manager (e.g., HashiCorp Vault, AWS Secrets Manager)
- Remove hardcoded credentials from application code and environment variables
- Use the AI gateway to inject credentials at runtime, not in the application itself
Step 2: Enforce Access Policies
- Define which users, teams, and applications can access which AI models
- Implement role-based access control (RBAC) for model invocation
- Set proactive budget limits per team or project
Step 3: Monitor and Detect Anomalies
- Establish baseline usage patterns for each team and application
- Configure alerts for:
- Sudden spikes in token consumption
- Access from unusual geographic locations
- Calls to models not typically used by a team
- Abnormal request patterns (e.g., repetitive prompts, unusual prompt lengths)
Step 4: Implement Real-Time Guardrails
- Prevent data leaks by scanning prompts and responses for sensitive information
- Block access to known malicious domains and transfer station infrastructure
- Enforce content moderation policies to prevent misuse
6. Identity Security for Agentic AI
As AI agents become more autonomous, identity security becomes paramount. Organizations should implement:
Agentic Identity Management:
- Maintain a central registry of agents with cryptographically verifiable identities
- Enforce strong authentication and zero standing privileges for agents
- Maintain comprehensive audit trails of agent actions
Just-in-Time Secrets:
- Enable agents to secretly retrieve and use API tokens just in time, reducing the attack surface
- Rotate credentials automatically after each session or on a regular schedule
Continuous Discovery and Governance:
- Discover all software on endpoints, including binary and non-binary artifacts like AI packages
- Govern package versions by holding new releases back until they’ve established a reputation under public scrutiny
What Undercode Say:
- Token jacking is not a theoretical risk—it’s an active, financially devastating threat. Unit 42 has documented cases with nearly $1 million in fraudulent charges within minutes of credential exposure. The combination of unlimited token consumption by default and cyclical billing creates a perfect storm for attackers.
-
The supply chain is the new frontier for credential theft. Poisoned npm packages represent a particularly insidious vector because they target developers directly, stealing credentials from multiple environments and amplifying the impact across the entire software ecosystem.
The AI gold rush has created a parallel criminal economy where stolen compute is the currency. Transfer stations thrive because they offer a frictionless way to monetize stolen tokens, and the demand for cheap AI access ensures a steady stream of buyers. Organizations that treat AI tokens as they would any other critical credential—with strict rotation policies, least-privilege access, and continuous monitoring—will be best positioned to avoid becoming the next victim. The challenge is that AI adoption often outpaces security controls, and the “fail fast” mindset that drives innovation also creates gaps that attackers are exploiting with surgical precision.
Prediction:
- -1 Token jacking will escalate into a mainstream criminal enterprise within the next 12–18 months, with specialized access brokers offering “AI compute as a service” on underground markets, complete with SLAs and customer support.
-
+1 The emergence of AI gateways and agentic identity solutions will mature rapidly, with major cloud providers embedding token governance and anomaly detection directly into their AI platforms, making it harder for attackers to operate undetected.
-
-1 Smaller organizations and startups will be disproportionately affected, as they lack the security maturity to implement robust token management and may face bankruptcy from a single token jacking incident.
-
+1 Regulatory bodies will likely introduce mandatory reporting requirements for AI token theft, similar to data breach notification laws, driving greater awareness and investment in preventive controls.
-
-1 Supply chain attacks targeting AI development tools will become more sophisticated, with attackers using AI itself to generate more convincing poisoned packages and evade detection by security scanners.
-
+1 The cybersecurity industry will develop specialized AI security frameworks and certifications, creating a new category of security professionals focused exclusively on AI infrastructure protection.
-
-1 As transfer stations become more prevalent, nation-state actors will leverage them to circumvent export controls and sanctions, accessing cutting-edge AI models for military and intelligence applications at a fraction of the development cost.
▶️ Related Video (82% Match):
https://www.youtube.com/watch?v=5BsiziyU_34
🎯Let’s Practice For Free:
🎓 Live Courses & Certifications:
Join Undercode Academy for Verified Certifications
🚀 Request a Custom Project:
Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands
IT/Security Reporter URL:
Reported By: Ctaearlyshares Threatintelligence – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅


