CRE-2025-0200
AutoGPT Recursive Self-Analysis Loop Leading to Token Exhaustion and System CrashCriticalImpact: 9/10Mitigation: 3/10
CRE-2025-0200View on GitHub
Description
- AutoGPT enters an infinite recursive loop when attempting to analyze and fix its own execution errors
- The agent repeatedly tries to debug its own code, spawning new analysis tasks for each failure
- Each iteration consumes API tokens and memory, eventually exhausting resources
- The loop accelerates as error messages grow longer, consuming tokens exponentially
- System becomes unresponsive and crashes with out-of-memory errors or API rate limit failures
Cause
- AutoGPT's autonomous reasoning incorrectly identifies its own execution as a problem to solve
- Lack of loop detection mechanisms allows unlimited recursive task spawning
- Error context accumulation causes exponential growth in prompt size
- Missing safeguards for self-referential task creation
- Insufficient resource monitoring and circuit breakers for runaway processes
Mitigation
- Implement loop detection to identify and break recursive self-analysis patterns
- Add resource consumption thresholds (tokens, memory, API calls) with automatic shutdown
- Create task depth limits to prevent unlimited recursion
- Implement circuit breakers that trigger after repeated similar failures
- Add explicit blacklist for self-referential task creation
- Monitor token usage rate and implement exponential backoff
- Use separate monitoring process to detect and kill runaway AutoGPT instances
- Implement task deduplication to prevent identical recursive operations