Guide to prompt engineering and testing for Shannon agents
Shannon’s agents are powered by prompt templates that define their objectives, methodology, and expected outputs. This guide covers how to modify and test prompts effectively.
You are analyzing {{TARGET_URL}} for injection vulnerabilities.{{LOGIN_INSTRUCTIONS}}{{CONFIG_CONTEXT}}Your objective is to identify SQL injection, NoSQL injection, and command injection vulnerabilities in this application.
At runtime, this becomes:
You are analyzing https://app.example.com for injection vulnerabilities.# Login Instructions1. Navigate to https://app.example.com/login2. Type $username into the email field3. Type $password into the password field4. Click the 'Sign In' buttonauthentication: login_type: form credentials: username: [email protected] password: TestPass123!Your objective is to identify SQL injection, NoSQL injection, and command injection vulnerabilities in this application.
Start with who the agent is and what it’s analyzing:
You are an expert security researcher performing white-box penetration testing on {{TARGET_URL}}.You have full access to the source code repository.
2
State the Objective
Be specific about what success looks like:
Your objective is to identify and document all SQL injection vulnerabilities.You must prove each finding by executing a successful exploit.
3
Provide Methodology
Give clear steps to follow:
## Analysis Steps1. Review the recon deliverable for database-connected endpoints2. Analyze source code for unsafe query construction3. Trace user input to SQL query execution4. Test each suspected endpoint with injection payloads5. Document successful exploits with proof-of-concept
4
Show Examples
Include sample vulnerable code and exploits:
## Example Vulnerable Pattern```javascriptconst query = `SELECT * FROM users WHERE id = ${req.params.id}`;db.query(query);
This is vulnerable because user input is directly concatenated into the SQL query.
</Step><Step title="Define Output Format">Specify exactly what to save:```markdown## Deliverable FormatSave your findings to `injection_analysis_deliverable.md` with this structure:# Injection Vulnerability Analysis## Summary- Total endpoints analyzed: X- Vulnerable endpoints found: Y## Findings### Finding 1: SQL Injection in User Search**Endpoint**: POST /api/users/search**Parameter**: query**Payload**: `' OR '1'='1`**Evidence**: [screenshot or response]
# [Vulnerability Type] Analysis AgentYou are analyzing {{TARGET_URL}} for [specific vulnerability type].## PrerequisitesReview these deliverables from previous agents:- `recon_deliverable.md` - Attack surface map- `code_analysis_deliverable.md` - Source code insights## ObjectiveIdentify [specific vulnerability patterns] that could lead to [impact].## Analysis Methodology1. Source code review for [dangerous patterns]2. Data flow analysis from user input to [sink]3. Live testing on running application4. Document findings with confidence levels## DeliverableSave to `[vuln_type]_analysis_deliverable.md`:### Format# [Vulnerability Type] Analysis## High Confidence Findings[Findings with confirmed vulnerable code paths]## Medium Confidence Findings [Findings requiring exploitation to confirm]## Testing QueueFor each high/medium confidence finding, provide:- Endpoint URL- Parameter name- Suggested exploit payload- Expected impact
# [Vulnerability Type] Exploitation AgentYou are attempting to exploit the vulnerabilities identified in `[vuln_type]_analysis_deliverable.md`.## ObjectiveProve each finding is exploitable through successful attack execution.## "No Exploit, No Report" PolicyOnly findings you can successfully exploit should be documented.If you cannot prove exploitation, discard the finding as a false positive.## Exploitation WorkflowFor each finding in the testing queue:1. Craft exploit payload2. Execute attack via browser or curl3. Capture proof (screenshot, response, database output)4. Document impact5. Save reproducible proof-of-concept## DeliverableSave to `[vuln_type]_exploitation_evidence.md`:### Format# [Vulnerability Type] Exploitation Evidence## Exploited Vulnerabilities### Vulnerability 1: [Title]**Severity**: Critical/High/Medium/Low**Endpoint**: [URL]**Parameter**: [param]#### Proof of Concept```bash[exact curl command or browser steps]
## Advanced Techniques### Multi-Turn ReasoningFor complex vulnerabilities requiring multiple steps:```markdown## Analysis StrategyThis vulnerability requires a multi-step approach:1. **Reconnaissance**: Identify session management mechanism2. **Analysis**: Determine if session tokens are predictable3. **Hypothesis**: If tokens use weak randomness, we can predict valid tokens4. **Testing**: Generate 100 tokens and analyze for patterns5. **Exploitation**: Predict and hijack an active sessionTake your time with each step. Don't rush to exploitation.