Overview
TheTargetedPentestAgent is a pentest-focused specialization of the OffensiveSecurityAgent. It performs targeted security assessments against specific objectives, documents vulnerabilities with proof-of-concept exploits, and provides detailed remediation guidance.
Unlike reconnaissance agents that perform broad discovery, the TargetedPentestAgent focuses deeply on testing specific endpoints or objectives that have already been identified.
Key Features
- Objective-Driven Testing: Tests specific objectives (e.g., “Test for SQL injection on /api/users”)
- Blackbox Methodology: No access to source code — tests purely through external interaction
- Automatic PoC Generation: Creates proof-of-concept scripts for confirmed vulnerabilities
- Findings Deduplication: Integrates with FindingsRegistry to prevent duplicate reporting
- Session Management: Supports authenticated testing with session cookies/headers
- Structured Results: Returns typed results with all findings and file paths
Constructor
PentestAgentInput
required
Configuration object for the pentest agent
PentestAgentInput
AIModel
required
AI model identifier (e.g.,
"claude-sonnet-4-20250514")SessionInfo
required
Session providing paths for findings, POCs, logs, etc.
string
required
The URL / host to test
string[]
required
One or more testing objectives (e.g., “Test for SQL injection on /api/users”)
AIAuthConfig
Optional per-provider API key overrides
StreamTextOnStepFinishCallback<ToolSet>
Callback fired after each agent step
AbortSignal
AbortSignal to cancel the agent mid-run
UnifiedSandbox
When set, tools execute inside this sandbox instead of locally
FindingsRegistry
Shared findings registry for cross-agent dedup
ConsumeCallbacks
Callbacks for stream events
CredentialManager
In-memory credential store for secret-free agent prompts
StopCondition<ToolSet>
Override the default stop condition
Result Type
Theconsume() method returns a PentestResult:
Finding[]
All findings discovered during the run
string
Absolute path to the session’s findings directory
string
Absolute path to the session’s POC scripts directory
Finding Object
string
Short descriptive title for the vulnerability
'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW'
Severity level of the vulnerability
string
Detailed description of the vulnerability
string
Explanation of the potential impact if exploited
string
Evidence demonstrating the vulnerability (request/response, screenshots, etc.)
string
The affected endpoint or URL
string
Path to the proof-of-concept script
string
Step-by-step remediation guidance
string
External references (OWASP, CVEs, documentation)
string
Description of why this vulnerability was documented
Active Tools
The TargetedPentestAgent uses the following tools:execute_command- Run exploit scripts and security testing toolshttp_request- Send targeted HTTP requests to test endpointsdocument_vulnerability- Document confirmed vulnerabilitiescreate_poc- Create proof-of-concept exploit scriptsresponse- Submit final testing summary (auto-injected)browser_navigate- Navigate to pages for evidence collectionbrowser_snapshot- Capture DOM snapshotsbrowser_screenshot- Take screenshots for evidencebrowser_click- Interact with page elements for interactive testingbrowser_fill- Fill form fields for form-based attacks (XSS, injection)email_list_inboxes- List available email inboxes (if configured)email_list_messages- List messages (for testing email-based flows)email_search_messages- Search for specific messagesemail_get_message- Retrieve full message content
Usage Examples
Basic Vulnerability Testing
Authenticated Testing
With Findings Registry (Deduplication)
With Sandbox Execution
Exfil Mode (CTF/Red Team)
Custom Stop Condition
Testing Methodology
The TargetedPentestAgent follows a structured testing methodology:1
PLAN
States objectives and outlines testing plan before executing any tools. Describes which attack techniques, payloads, and tools will be used.
2
VERIFY
Confirms the target endpoint exists and is reachable. Understands basic behavior (response format, parameters, auth requirements).
3
PREPARE
Researches applicable payloads and attack techniques. Crafts payloads tailored to the target’s technology and behavior.
4
TEST
Executes targeted attacks methodically, one payload/technique at a time. Observes responses carefully for vulnerability indicators.
5
EXPLOIT
When a vulnerability is confirmed, creates a proof-of-concept script that reliably demonstrates it.
6
DOCUMENT
Documents every confirmed finding with evidence, impact assessment, and remediation steps.
7
FINISH
After testing ALL objectives, calls the response tool to submit final summary.
Testing Modes
- Standard Mode
- Exfil Mode
Standard blackbox penetration testing:
- Test for common vulnerabilities
- Document confirmed findings
- Provide remediation guidance
- No data extraction focus
Rate Limiting Handling
The agent automatically handles rate limiting:- Detects HTTP 429 responses
- Uses exponential backoff:
- First retry: 5 seconds
- Second retry: 30 seconds
- Third retry: 120 seconds
- After 3 attempts, notes rate limiting in summary and moves to next objective
Best Practices
PoC Required: Always create a working proof-of-concept script BEFORE calling
document_vulnerability. The tool is only for confirmed, exploitable vulnerabilities.
