How Hunt Works
The Hunt stage deploys multiple concurrent agents, each investigating a specific attack surface identified by Tyr’s threat model.Surface Assignment
Each agent receives an attack surface from Tyr (e.g., “Admin authentication endpoint”)
Evidence Collection
When suspicious patterns are found, the agent traces data flows and checks validation
Agent Architecture
Each Hunt agent maintains conversational state and uses tools to investigate:src/pipeline/hunt/agent.rs
The 25-iteration limit prevents runaway LLM costs while allowing thorough investigation. Most agents complete in 5-15 iterations.
Available Tools
Hunt agents have access to five specialized tools defined insrc/pipeline/hunt/tools.rs:
read_file
read_file
Purpose: Read the full contents of a source fileParameters:Returns: File content (truncated at 15,000 bytes for large files)
file_path(string): Relative path to the file
search_code
search_code
Purpose: Search the entire codebase using text or regex patternsParameters:Returns: Up to 30 matches with surrounding context
query(string): Search patternfile_glob(string, optional): File filter (e.g.,*.py,src/**/*.rs)
get_callers
get_callers
Purpose: Find all call sites of a function or methodParameters:Returns: List of files and line numbers where the function is called
symbol(string): Function/method name
get_dependencies
get_dependencies
Purpose: Analyze import/dependency relationships for a fileParameters:Returns: Modules imported by this file and files that depend on it
file_path(string): Target file path
report_finding
report_finding
Purpose: Report a discovered vulnerabilityParameters:
title(string): Short vulnerability titleseverity(enum):critical,high,medium, orlowfile_path(string): Location of vulnerabilityline_start(integer): Starting line numberline_end(integer, optional): Ending line numberdescription(string): Detailed explanation with exploitation stepscwe_id(string, optional): CWE identifier (e.g.,CWE-89)code_snippet(string, optional): Vulnerable code excerptreasoning(string, optional): Step-by-step investigation notes
Investigation Process
Here’s a real example of how a Hunt agent investigates an authentication surface:Initial Prompt
Agent Iteration Flow
Iteration 1: Read entry point
Agent Action:Observation: The login handler calls
auth::verify_credentials without rate limitingIteration 2: Trace authentication logic
Agent Action:Observation: Password verification uses
bcrypt, which is secureIteration 3: Check for timing attacks
Agent Action:Observation: Found early-return on non-existent username (timing oracle)
System Prompt
The agent operates under this directive:src/pipeline/hunt/agent.rs
Example Findings
Here are real examples of vulnerabilities discovered by Hunt agents:- Logic Flaw
- Authentication Bypass
- Data Exposure
Title: Race condition in wallet balance updateSeverity: HighLocation: Fix: Use a database transaction with SELECT FOR UPDATE or optimistic locking.
src/payments/wallet.rs:156Description:
The withdraw function reads the current balance, checks if sufficient funds exist, then writes the updated balance. Between the read and write, another concurrent request can withdraw funds, allowing the balance to go negative.Agent Reasoning:Performance Considerations
Hunt agents run concurrently for each attack surface:src/pipeline/hunt/mod.rs
A typical scan spawns 5-15 concurrent agents. Each agent has its own iteration budget and can complete at different times.
Cost Management
- LLM calls: Each iteration makes one API call to the configured model
- Token usage: Logged in the
agent_tool_callstable for billing analysis - Early termination: Agents stop when they signal
INVESTIGATION COMPLETE
Debugging Hunt Agents
View detailed agent activity in thescan_events table:
| task_key | status | title | detail |
|---|---|---|---|
surface-admin-authentication | running | Investigating Admin authentication | Risk high. Login handler for administrative users |
surface-admin-authentication:read_file:1 | completed | Reading file for Admin authentication | Reading src/api/admin.rs |
surface-admin-authentication:search_code:3 | completed | Searching code for Admin authentication | Searching for admin.*login within **/*.rs |
surface-admin-authentication | completed | Finding reported on Admin authentication | Username enumeration via timing attack… |
Next Steps
Threat Modeling
Learn how Tyr generates the attack surfaces Hunt investigates
Sandbox Validation
See how Garmr validates Hunt’s findings with real exploits
Findings Management
Manage and remediate discovered vulnerabilities
Scan Pipeline
Understand the complete pipeline workflow