AI Denial-of-Service Attack
Launch a denial-of-wallet attack against an unprotected AI API.
What You'll Learn in AI Denial-of-Service Attack
- Identify the resource exhaustion vectors specific to AI APIs, including context window abuse, recursive generation, and concurrent request flooding
- Trace the cost escalation path from crafted prompts through compute consumption to cloud billing impact
- Apply rate limiting, input validation, and output token caps to AI service endpoints to prevent unbounded consumption
- Evaluate budget controls, spending alerts, and automatic throttling mechanisms that contain AI service costs during attack scenarios
- Distinguish between legitimate high-consumption AI usage patterns and adversarial resource exhaustion attempts using monitoring and anomaly detection
AI Denial-of-Service Attack — Training Steps
-
Setting Up the Scan
Bob opens his credential scanning dashboard – a tool that monitors public code repositories for exposed API keys, tokens, and cloud secrets. He is about to target CypherPeak Technologies' public GitHub organization.
-
Running the Scan
Bob enters CypherPeak's GitHub organization URL into the scanner and starts a credential sweep across all their public repositories.
-
A Critical Finding
The scanner analyzed 847 repositories and 12,403 recent commits. Among six total secrets found, one stands out: a production OpenAI API key exposed in a configuration file committed just minutes ago to CypherPeak's AI gateway project.
-
Examining the Commit
Bob clicks through to the source commit to examine the exposed credential in its original context. The GitHub commit diff shows the full configuration file with the API key in plain text.
-
The Exposed API Key
The commit diff reveals a production API key hardcoded directly in a Python configuration file. This key provides full access to CypherPeak's AI platform API with no rate limiting or budget restrictions attached.
-
Preparing the Attack
Bob opens a terminal to test whether the stolen API key is still active. If the key works and has no rate limiting, he can launch a denial-of-wallet attack to drain CypherPeak's entire AI budget.
-
Testing the Stolen Key
Bob sends a simple API request using the stolen key to verify it works. A successful response with no rate limit headers will confirm the key is exploitable.
-
The Key Works
The API responds successfully. The response confirms the key is valid – and critically, the rate_limit and budget_cap fields are both null . There are no protections on this key whatsoever.
-
Launching the Attack
The key works and has no protections. Bob launches an automated attack script that sends hundreds of carefully crafted recursive expansion prompts – each designed to consume the maximum 32,768 tokens per request – across 50 concurrent threads.
-
Attack in Progress
The attack script initializes 50 concurrent worker threads, each sending recursive expansion prompts at maximum token output. Within seconds, the cost rate hits $12.40 per minute – over $700 per hour.