Offensive Security
AI-powered security testing patterns for authorized engagements.
how to use
when to apply
Reference these guidelines when:
- conducting authorized penetration tests
- participating in CTF competitions
- building security testing automation
- reviewing code for exploitable vulnerabilities
- designing red team exercises
- building honeypots or deception technology
authorization requirements
CRITICAL: All offensive security activities require explicit authorization.
Before any engagement:
- Verify written authorization (scope document, rules of engagement)
- Confirm target scope boundaries
- Establish communication channels with asset owners
- Document all activities for audit trail
- Integration: Use the operator's PostToolUse hook (audit.log) for activity logging
methodology: PTES framework
Phase 1: Pre-Engagement
- Define scope, rules of engagement, emergency contacts
- Legal review and authorization documentation
- Tool preparation and environment setup
Phase 2: Intelligence Gathering
- Passive OSINT: See
osint-recon skill for detailed workflows
- Active scanning: Nmap, Masscan for service enumeration
- Web enumeration: Directory brute-force, subdomain discovery
- Integration: Use
memory MCP server to store findings as entities/relations
Phase 3: Threat Modeling
- Map attack surface from gathered intelligence
- Identify high-value targets and likely attack paths
- Prioritize by impact × probability
- Integration: Use
sequential MCP thinking for complex threat models
Phase 4: Vulnerability Analysis
- Automated scanning (Nessus, OpenVAS, Nuclei)
- Manual code review (see
security-review skill)
- Configuration audit
- API security testing
Phase 5: Exploitation
- Proof-of-concept development
- Privilege escalation chains
- Lateral movement mapping
- Data exfiltration simulation (authorized only)
Phase 6: Post-Exploitation
- Persistence mechanism analysis
- Credential harvesting assessment
- Impact demonstration
- Clean-up and evidence removal
Phase 7: Reporting
- Executive summary with business impact
- Technical findings with CVSS scores
- Remediation recommendations with priority
- Evidence documentation (screenshots, logs, PoC code)
AI-powered security testing patterns
Automated Reconnaissance (from HexStrike-AI concepts)
# Pattern: AI-driven target profiling
from typing import TypedDict
class ReconProfile(TypedDict):
target: str
open_ports: list[int]
services: dict[str, str]
technologies: list[str]
potential_vulns: list[str]
attack_surface_score: float # 0.0 - 10.0
def ai_recon_pipeline(target: str) -> ReconProfile:
"""AI-enhanced reconnaissance pipeline."""
# 1. Port scan → service detection
# 2. Technology fingerprinting
# 3. CVE correlation
# 4. Attack surface scoring
# 5. AI-generated attack path suggestions
...
Vulnerability Prioritization
# Pattern: ML-based vulnerability prioritization
def prioritize_vulns(vulns: list[dict]) -> list[dict]:
"""Prioritize vulnerabilities using CVSS + contextual factors."""
for vuln in vulns:
base_score = vuln['cvss_score']
# Contextual adjustments
if vuln['exploitable_remotely']:
base_score *= 1.3
if vuln['has_public_exploit']:
base_score *= 1.5
if vuln['affects_auth']:
base_score *= 1.4
vuln['priority_score'] = min(base_score, 10.0)
return sorted(vulns, key=lambda v: v['priority_score'], reverse=True)
web application testing checklist
Authentication Testing
Authorization Testing
Injection Testing
Business Logic
CTF patterns
Common Challenge Categories
| Category |
Techniques |
Tools |
| Web |
SQL injection, XSS, SSRF, deserialization |
Burp Suite, sqlmap, ffuf |
| Crypto |
RSA attacks, padding oracle, hash collisions |
CyberChef, SageMath, hashcat |
| Pwn |
Buffer overflow, ROP, format strings, heap |
GDB, pwntools, Ghidra |
| Rev |
Disassembly, decompilation, anti-debug |
Ghidra, IDA, radare2 |
| Forensics |
Memory analysis, disk forensics, PCAP |
Volatility, Autopsy, Wireshark |
| OSINT |
See osint-recon skill |
Sherlock, theHarvester |
Quick pwntools Template
from pwn import *
# Connect
context.binary = elf = ELF('./challenge')
p = remote('target.ctf', 1337) # or process('./challenge')
# Exploit pattern
payload = flat(
b'A' * offset,
p64(rop_gadget),
p64(target_function),
)
p.sendlineafter(b'> ', payload)
p.interactive()
social engineering awareness
Patterns to test (from SET concepts):
- Phishing email templates (for authorized awareness testing)
- Credential harvesting page detection
- Pretexting scenarios
- USB drop simulation
- Vishing call scripts
Integration: CoreMind GAOS output_validator (Layer 4) should detect and block phishing content in agent outputs.
tool integration map
| Tool |
Purpose |
the operator's Integration |
| Nmap/Masscan |
Port scanning |
Bash tool |
| Nuclei |
Vulnerability scanning |
Bash tool |
| Burp Suite |
Web app testing |
Manual |
| sqlmap |
SQL injection |
Bash tool with caution |
| ffuf |
Fuzzing |
Bash tool |
| Ghidra |
Reverse engineering |
Manual |
| pwntools |
Binary exploitation |
Python scripts |
cross-references
- osint-recon skill: OSINT investigation workflows
- security-review skill: Code-level security analysis
- security-auditor agent: Automated vulnerability scanning
- security-engineer agent: Compliance and hardening
- SECURITY_PLAYBOOK.md: 36 rules across 8 categories
- SECURITY_ARSENAL.md: Tool inventory reference
- CoreMind GAOS: 5-layer safety stack for agent security
1---2name: offensive-security3description: AI-powered offensive security testing patterns. Penetration testing methodology, vulnerability assessment workflows, CTF challenges, and security tool integration. Use for authorized security testing, CTF competitions, and defensive security research.4---56# Offensive Security78AI-powered security testing patterns for authorized engagements.910## how to use1112- `/offensive-security`13 Apply offensive security methodology to the current engagement.1415- `/offensive-security <target-context>`16 Plan a security assessment for the given context.1718## when to apply1920Reference these guidelines when:21- conducting authorized penetration tests22- participating in CTF competitions23- building security testing automation24- reviewing code for exploitable vulnerabilities25- designing red team exercises26- building honeypots or deception technology2728## authorization requirements2930**CRITICAL: All offensive security activities require explicit authorization.**3132Before any engagement:331. Verify written authorization (scope document, rules of engagement)342. Confirm target scope boundaries353. Establish communication channels with asset owners364. Document all activities for audit trail375. Integration: Use the operator's PostToolUse hook (audit.log) for activity logging3839## methodology: PTES framework4041### Phase 1: Pre-Engagement42- Define scope, rules of engagement, emergency contacts43- Legal review and authorization documentation44- Tool preparation and environment setup4546### Phase 2: Intelligence Gathering47- **Passive OSINT**: See `osint-recon` skill for detailed workflows48- **Active scanning**: Nmap, Masscan for service enumeration49- **Web enumeration**: Directory brute-force, subdomain discovery50- Integration: Use `memory` MCP server to store findings as entities/relations5152### Phase 3: Threat Modeling53- Map attack surface from gathered intelligence54- Identify high-value targets and likely attack paths55- Prioritize by impact × probability56- Integration: Use `sequential` MCP thinking for complex threat models5758### Phase 4: Vulnerability Analysis59- Automated scanning (Nessus, OpenVAS, Nuclei)60- Manual code review (see `security-review` skill)61- Configuration audit62- API security testing6364### Phase 5: Exploitation65- Proof-of-concept development66- Privilege escalation chains67- Lateral movement mapping68- Data exfiltration simulation (authorized only)6970### Phase 6: Post-Exploitation71- Persistence mechanism analysis72- Credential harvesting assessment73- Impact demonstration74- Clean-up and evidence removal7576### Phase 7: Reporting77- Executive summary with business impact78- Technical findings with CVSS scores79- Remediation recommendations with priority80- Evidence documentation (screenshots, logs, PoC code)8182## AI-powered security testing patterns8384### Automated Reconnaissance (from HexStrike-AI concepts)85```python86# Pattern: AI-driven target profiling87from typing import TypedDict8889class ReconProfile(TypedDict):90 target: str91 open_ports: list[int]92 services: dict[str, str]93 technologies: list[str]94 potential_vulns: list[str]95 attack_surface_score: float # 0.0 - 10.09697def ai_recon_pipeline(target: str) -> ReconProfile:98 """AI-enhanced reconnaissance pipeline."""99 # 1. Port scan → service detection100 # 2. Technology fingerprinting101 # 3. CVE correlation102 # 4. Attack surface scoring103 # 5. AI-generated attack path suggestions104 ...105```106107### Vulnerability Prioritization108```python109# Pattern: ML-based vulnerability prioritization110def prioritize_vulns(vulns: list[dict]) -> list[dict]:111 """Prioritize vulnerabilities using CVSS + contextual factors."""112 for vuln in vulns:113 base_score = vuln['cvss_score']114 # Contextual adjustments115 if vuln['exploitable_remotely']:116 base_score *= 1.3117 if vuln['has_public_exploit']:118 base_score *= 1.5119 if vuln['affects_auth']:120 base_score *= 1.4121 vuln['priority_score'] = min(base_score, 10.0)122 return sorted(vulns, key=lambda v: v['priority_score'], reverse=True)123```124125## web application testing checklist126127### Authentication Testing128- [ ] Brute force protection (rate limiting, lockout)129- [ ] Password policy enforcement130- [ ] Session management (token entropy, expiration, fixation)131- [ ] Multi-factor authentication bypass attempts132- [ ] OAuth/OIDC misconfiguration133- [ ] JWT algorithm confusion (none, HS256/RS256 swap)134135### Authorization Testing136- [ ] IDOR (Insecure Direct Object Reference)137- [ ] Privilege escalation (horizontal and vertical)138- [ ] Function-level access control139- [ ] API endpoint authorization140141### Injection Testing142- [ ] SQL injection (union, blind, time-based, error-based)143- [ ] XSS (reflected, stored, DOM-based)144- [ ] Command injection145- [ ] SSTI (Server-Side Template Injection)146- [ ] LDAP injection147- [ ] XML/XXE injection148149### Business Logic150- [ ] Race conditions (TOCTOU)151- [ ] Integer overflow/underflow152- [ ] Price manipulation153- [ ] Workflow bypass154155## CTF patterns156157### Common Challenge Categories158| Category | Techniques | Tools |159|----------|-----------|-------|160| Web | SQL injection, XSS, SSRF, deserialization | Burp Suite, sqlmap, ffuf |161| Crypto | RSA attacks, padding oracle, hash collisions | CyberChef, SageMath, hashcat |162| Pwn | Buffer overflow, ROP, format strings, heap | GDB, pwntools, Ghidra |163| Rev | Disassembly, decompilation, anti-debug | Ghidra, IDA, radare2 |164| Forensics | Memory analysis, disk forensics, PCAP | Volatility, Autopsy, Wireshark |165| OSINT | See osint-recon skill | Sherlock, theHarvester |166167### Quick pwntools Template168```python169from pwn import *170171# Connect172context.binary = elf = ELF('./challenge')173p = remote('target.ctf', 1337) # or process('./challenge')174175# Exploit pattern176payload = flat(177 b'A' * offset,178 p64(rop_gadget),179 p64(target_function),180)181p.sendlineafter(b'> ', payload)182p.interactive()183```184185## social engineering awareness186187Patterns to test (from SET concepts):188- Phishing email templates (for authorized awareness testing)189- Credential harvesting page detection190- Pretexting scenarios191- USB drop simulation192- Vishing call scripts193194**Integration**: CoreMind GAOS output_validator (Layer 4) should detect and block phishing content in agent outputs.195196## tool integration map197198| Tool | Purpose | the operator's Integration |199|------|---------|---------------------|200| Nmap/Masscan | Port scanning | Bash tool |201| Nuclei | Vulnerability scanning | Bash tool |202| Burp Suite | Web app testing | Manual |203| sqlmap | SQL injection | Bash tool with caution |204| ffuf | Fuzzing | Bash tool |205| Ghidra | Reverse engineering | Manual |206| pwntools | Binary exploitation | Python scripts |207208## cross-references209210- **osint-recon** skill: OSINT investigation workflows211- **security-review** skill: Code-level security analysis212- **security-auditor** agent: Automated vulnerability scanning213- **security-engineer** agent: Compliance and hardening214- **SECURITY_PLAYBOOK.md**: 36 rules across 8 categories215- **SECURITY_ARSENAL.md**: Tool inventory reference216- **CoreMind GAOS**: 5-layer safety stack for agent security