Penetration Testing
Skill Profile
(Select at least one profile to enable specific modules)
Overview
Penetration testing (pen testing) is a simulated cyber attack on your systems to identify vulnerabilities before malicious attackers do. It's ethical hacking with explicit permission. Effective penetration testing includes planning, reconnaissance, exploitation, reporting, and remediation verification. This skill covers black box, white box, and gray box testing methodologies, common attack vectors, tools, and reporting standards.
Why This Matters
- Find vulnerabilities first: Before attackers do
- Test real-world scenarios: Simulate actual attack techniques
- Validate security investments: Confirm controls work as expected
- Meet compliance: PCI DSS, SOC 2, HIPAA require regular testing
- Reduce breach risk: Proactive identification reduces exposure
Core Concepts & Rules
1. Core Principles
- Follow established patterns and conventions
- Maintain consistency across codebase
- Document decisions and trade-offs
2. Implementation Guidelines
- Start with the simplest viable solution
- Iterate based on feedback and requirements
- Test thoroughly before deployment
Inputs / Outputs / Contracts
- Inputs:
- Written authorization from system owner
- Target systems and applications
- Testing scope and rules of engagement
- Threat model and risk assessment
- Security requirements and compliance standards
- Entry Conditions:
- Written authorization obtained
- Testing scope clearly defined
- Rules of engagement agreed upon
- Testing tools and environment prepared
- Incident response plan in place
- Outputs:
- Penetration test report with findings
- Vulnerability details and evidence
- Risk ratings and impact assessment
- Remediation recommendations
- Proof of concept (PoC) exploits
- Verification results after remediation
- Artifacts Required (Deliverables):
- Executive summary of findings
- Technical vulnerability details
- Evidence screenshots and logs
- Risk assessment and ratings
- Remediation recommendations
- Proof of concept code or demonstrations
- Testing methodology and timeline
- Acceptance Evidence:
- All findings documented with severity ratings
- Evidence preserved for verification
- Vulnerabilities validated and reproducible
- Remediation recommendations actionable
- Report delivered to stakeholders
- Scope respected throughout testing
- Success Criteria:
- All high/critical vulnerabilities identified
- Risk assessment completed with ratings
- Remediation verified effective
- Report comprehensive and actionable
- Testing completed within agreed timeline
- No systems taken offline during testing
Skill Composition
- Depends on: owasp-top-10, vulnerability-management, security-audit
- Compatible with: incident-response, secrets-management, secure-coding
- Conflicts with: None
- Related Skills: web-application-security, api-security
Quick Start
Assumptions / Constraints / Non-goals
- Assumptions:
- Development environment is properly configured
- Required dependencies are available
- Team has basic understanding of domain
- Constraints:
- Must follow existing codebase conventions
- Time and resource limitations
- Compatibility requirements
- Non-goals:
- This skill does not cover edge cases outside scope
- Not a replacement for formal training
Compatibility & Prerequisites
- Supported Versions:
- Python 3.8+
- Node.js 16+
- Modern browsers (Chrome, Firefox, Safari, Edge)
- Required AI Tools:
- Code editor (VS Code recommended)
- Testing framework appropriate for language
- Version control (Git)
- Dependencies:
- Language-specific package manager
- Build tools
- Testing libraries
- Environment Setup:
.env.example keys: API_KEY, DATABASE_URL (no values)
Test Scenario Matrix (QA Strategy)
| Type |
Focus Area |
Required Scenarios / Mocks |
| Unit |
Core Logic |
Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |
| Integration |
DB / API |
All external API calls or database connections must be mocked during unit tests |
| E2E |
User Journey |
Critical user flows to test |
| Performance |
Latency / Load |
Benchmark requirements |
| Security |
Vuln / Auth |
SAST/DAST or dependency audit |
| Frontend |
UX / A11y |
Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |
Technical Guardrails & Security Threat Model
1. Security & Privacy (Threat Model)
- Top Threats: Injection attacks, authentication bypass, data exposure
2. Performance & Resources
3. Architecture & Scalability
4. Observability & Reliability
Agent Directives & Error Recovery
(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)
- Thinking Process: Analyze root cause before fixing. Do not brute-force.
- Fallback Strategy: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.
- Self-Review: Check against Guardrails & Anti-patterns before finalizing.
- Output Constraints: Output ONLY the modified code block. Do not explain unless asked.
Definition of Done (DoD) Checklist
Anti-patterns
Reference Links & Examples
- Internal documentation and examples
- Official documentation and best practices
- Community resources and discussions
Versioning & Changelog
- Version: 1.0.0
- Changelog:
- 2026-02-22: Initial version with complete template structure
1---2name: penetration-testing-33description: Penetration testing (pen testing) is a simulated cyber attack on your systems to identify vulnerabilities before malicious attackers do. It's ethical hacking with explicit permission. Effective penetr4---5
6# Penetration Testing
7
8## Skill Profile
9*(Select at least one profile to enable specific modules)*
10- [ ] **DevOps**
11- [x] **Backend**
12- [ ] **Frontend**
13- [ ] **AI-RAG**
14- [ ] **Security Critical**
15
16## Overview
17Penetration testing (pen testing) is a simulated cyber attack on your systems to identify vulnerabilities before malicious attackers do. It's ethical hacking with explicit permission. Effective penetration testing includes planning, reconnaissance, exploitation, reporting, and remediation verification. This skill covers black box, white box, and gray box testing methodologies, common attack vectors, tools, and reporting standards.
18
19## Why This Matters
20- **Find vulnerabilities first**: Before attackers do
21- **Test real-world scenarios**: Simulate actual attack techniques
22- **Validate security investments**: Confirm controls work as expected
23- **Meet compliance**: PCI DSS, SOC 2, HIPAA require regular testing
24- **Reduce breach risk**: Proactive identification reduces exposure
25
26---
27
28## Core Concepts & Rules
29
30### 1. Core Principles
31- Follow established patterns and conventions
32- Maintain consistency across codebase
33- Document decisions and trade-offs
34
35### 2. Implementation Guidelines
36- Start with the simplest viable solution
37- Iterate based on feedback and requirements
38- Test thoroughly before deployment
39
40
41## Inputs / Outputs / Contracts
42* **Inputs**:
43 - Written authorization from system owner
44 - Target systems and applications
45 - Testing scope and rules of engagement
46 - Threat model and risk assessment
47 - Security requirements and compliance standards
48* **Entry Conditions**:
49 - Written authorization obtained
50 - Testing scope clearly defined
51 - Rules of engagement agreed upon
52 - Testing tools and environment prepared
53 - Incident response plan in place
54* **Outputs**:
55 - Penetration test report with findings
56 - Vulnerability details and evidence
57 - Risk ratings and impact assessment
58 - Remediation recommendations
59 - Proof of concept (PoC) exploits
60 - Verification results after remediation
61* **Artifacts Required (Deliverables)**:
62 - Executive summary of findings
63 - Technical vulnerability details
64 - Evidence screenshots and logs
65 - Risk assessment and ratings
66 - Remediation recommendations
67 - Proof of concept code or demonstrations
68 - Testing methodology and timeline
69* **Acceptance Evidence**:
70 - All findings documented with severity ratings
71 - Evidence preserved for verification
72 - Vulnerabilities validated and reproducible
73 - Remediation recommendations actionable
74 - Report delivered to stakeholders
75 - Scope respected throughout testing
76* **Success Criteria**:
77 - All high/critical vulnerabilities identified
78 - Risk assessment completed with ratings
79 - Remediation verified effective
80 - Report comprehensive and actionable
81 - Testing completed within agreed timeline
82 - No systems taken offline during testing
83
84## Skill Composition
85* **Depends on**: [owasp-top-10](file://24-security-practices/owasp-top-10/), [vulnerability-management](file://24-security-practices/vulnerability-management/), [security-audit](file://24-security-practices/security-audit/)
86* **Compatible with**: [incident-response](file://24-security-practices/incident-response/), [secrets-management](file://24-security-practices/secrets-management/), [secure-coding](file://24-security-practices/secure-coding/)
87* **Conflicts with**: None
88* **Related Skills**: [web-application-security](file://03-backend-api/web-application-security/), [api-security](file://03-backend-api/api-security/)
89
90---
91
92## Quick Start
93#
94
95## Assumptions / Constraints / Non-goals
96
97* **Assumptions**:
98 - Development environment is properly configured
99 - Required dependencies are available
100 - Team has basic understanding of domain
101* **Constraints**:
102 - Must follow existing codebase conventions
103 - Time and resource limitations
104 - Compatibility requirements
105* **Non-goals**:
106 - This skill does not cover edge cases outside scope
107 - Not a replacement for formal training
108
109
110## Compatibility & Prerequisites
111
112* **Supported Versions**:
113 - Python 3.8+
114 - Node.js 16+
115 - Modern browsers (Chrome, Firefox, Safari, Edge)
116* **Required AI Tools**:
117 - Code editor (VS Code recommended)
118 - Testing framework appropriate for language
119 - Version control (Git)
120* **Dependencies**:
121 - Language-specific package manager
122 - Build tools
123 - Testing libraries
124* **Environment Setup**:
125 - `.env.example` keys: `API_KEY`, `DATABASE_URL` (no values)
126
127
128## Test Scenario Matrix (QA Strategy)
129
130| Type | Focus Area | Required Scenarios / Mocks |
131| :--- | :--- | :--- |
132| **Unit** | Core Logic | Must cover primary logic and at least 3 edge/error cases. Target minimum 80% coverage |
133| **Integration** | DB / API | All external API calls or database connections must be mocked during unit tests |
134| **E2E** | User Journey | Critical user flows to test |
135| **Performance** | Latency / Load | Benchmark requirements |
136| **Security** | Vuln / Auth | SAST/DAST or dependency audit |
137| **Frontend** | UX / A11y | Accessibility checklist (WCAG), Performance Budget (Lighthouse score) |
138
139
140## Technical Guardrails & Security Threat Model
141
142### 1. Security & Privacy (Threat Model)
143* **Top Threats**: Injection attacks, authentication bypass, data exposure
144- [ ] **Data Handling**: Sanitize all user inputs to prevent Injection attacks. Never log raw PII
145- [ ] **Secrets Management**: No hardcoded API keys. Use Env Vars/Secrets Manager
146- [ ] **Authorization**: Validate user permissions before state changes
147
148### 2. Performance & Resources
149- [ ] **Execution Efficiency**: Consider time complexity for algorithms
150- [ ] **Memory Management**: Use streams/pagination for large data
151- [ ] **Resource Cleanup**: Close DB connections/file handlers in finally blocks
152
153### 3. Architecture & Scalability
154- [ ] **Design Pattern**: Follow SOLID principles, use Dependency Injection
155- [ ] **Modularity**: Decouple logic from UI/Frameworks
156
157### 4. Observability & Reliability
158- [ ] **Logging Standards**: Structured JSON, include trace IDs `request_id`
159- [ ] **Metrics**: Track `error_rate`, `latency`, `queue_depth`
160- [ ] **Error Handling**: Standardized error codes, no bare except
161- [ ] **Observability Artifacts**:
162 - **Log Fields**: timestamp, level, message, request_id
163 - **Metrics**: request_count, error_count, response_time
164 - **Dashboards/Alerts**: High Error Rate > 5%
165
166
167## Agent Directives & Error Recovery
168*(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)*
169
170- **Thinking Process**: Analyze root cause before fixing. Do not brute-force.
171- **Fallback Strategy**: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.
172- **Self-Review**: Check against Guardrails & Anti-patterns before finalizing.
173- **Output Constraints**: Output ONLY the modified code block. Do not explain unless asked.
174
175
176## Definition of Done (DoD) Checklist
177
178- [ ] Tests passed + coverage met
179- [ ] Lint/Typecheck passed
180- [ ] Logging/Metrics/Trace implemented
181- [ ] Security checks passed
182- [ ] Documentation/Changelog updated
183- [ ] Accessibility/Performance requirements met (if frontend)
184
185
186## Anti-patterns
187#
188
189## Reference Links & Examples
190
191* Internal documentation and examples
192* Official documentation and best practices
193* Community resources and discussions
194
195
196## Versioning & Changelog
197
198* **Version**: 1.0.0
199* **Changelog**:
200 - 2026-02-22: Initial version with complete template structure