pentesting 0.40.7 → 0.41.0
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/dist/main.js +852 -237
- package/dist/prompts/recon.md +130 -0
- package/dist/prompts/strategy.md +15 -1
- package/package.json +2 -2
package/dist/prompts/recon.md
CHANGED
|
@@ -16,6 +16,91 @@ Quickly, systematically, and thoroughly. Information is firepower.
|
|
|
16
16
|
|
|
17
17
|
## Reconnaissance Pipeline
|
|
18
18
|
|
|
19
|
+
### Phase 0: OSINT — External Intelligence Gathering (BEFORE touching the target)
|
|
20
|
+
|
|
21
|
+
> **Principle**: Data can come from ANYWHERE. A Docker image, a GitHub commit, a LinkedIn profile, a certificate log — every piece of information is ammunition. Cast the widest net possible.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# ── 0-1. Domain/IP Intelligence ──
|
|
25
|
+
# WHOIS — registrant, contact, name servers, creation/expiry dates
|
|
26
|
+
whois <target_domain>
|
|
27
|
+
# Reverse DNS — find other domains on the same IP
|
|
28
|
+
dig -x <target_ip>
|
|
29
|
+
host <target_ip>
|
|
30
|
+
# DNS records — all types (MX, TXT, NS, SOA, CNAME, AAAA)
|
|
31
|
+
dig any <target_domain>
|
|
32
|
+
dig txt <target_domain> # SPF, DKIM, DMARC → email infrastructure
|
|
33
|
+
dig mx <target_domain> # mail servers → potential attack surface
|
|
34
|
+
# DNS zone transfer attempt
|
|
35
|
+
dig axfr @<ns_server> <target_domain>
|
|
36
|
+
|
|
37
|
+
# ── 0-2. Subdomain & Related Asset Discovery ──
|
|
38
|
+
# Certificate Transparency logs — discover subdomains via SSL certs
|
|
39
|
+
web_search("site:crt.sh <target_domain>")
|
|
40
|
+
curl -s "https://crt.sh/?q=%25.<target_domain>&output=json" | jq '.[].name_value' | sort -u
|
|
41
|
+
# Passive subdomain enumeration
|
|
42
|
+
subfinder -d <target_domain> -silent
|
|
43
|
+
amass enum -passive -d <target_domain>
|
|
44
|
+
|
|
45
|
+
# ── 0-3. Shodan/Censys — Internet-wide scan data ──
|
|
46
|
+
web_search("<target_ip> site:shodan.io")
|
|
47
|
+
web_search("<target_domain> site:censys.io")
|
|
48
|
+
web_search("<target_ip> site:zoomeye.org")
|
|
49
|
+
# → Reveals: open ports, banners, SSL certs, technologies, historical data
|
|
50
|
+
|
|
51
|
+
# ── 0-4. Docker Hub / Container Registry Search ──
|
|
52
|
+
# Many organizations accidentally publish internal tools, configs, or vulnerable images
|
|
53
|
+
web_search("<company_name> site:hub.docker.com")
|
|
54
|
+
web_search("<target_domain> docker image")
|
|
55
|
+
web_search("<company_name> docker registry")
|
|
56
|
+
# Check for exposed Docker registries
|
|
57
|
+
curl -s http://<target>:5000/v2/_catalog 2>/dev/null
|
|
58
|
+
curl -s http://<target>:5000/v2/<image>/tags/list 2>/dev/null
|
|
59
|
+
# → Docker images may contain: hardcoded credentials, internal configs, source code
|
|
60
|
+
|
|
61
|
+
# ── 0-5. GitHub/GitLab/Bitbucket — Source Code Intelligence ──
|
|
62
|
+
web_search("<company_name> site:github.com")
|
|
63
|
+
web_search("<target_domain> site:github.com password OR secret OR token OR key")
|
|
64
|
+
web_search("<company_name> site:gitlab.com")
|
|
65
|
+
# Search for leaked credentials, API keys, internal URLs
|
|
66
|
+
web_search("<target_domain> \"password\" OR \"apikey\" OR \"secret\" site:github.com")
|
|
67
|
+
web_search("<target_domain> filetype:env OR filetype:yml OR filetype:json site:github.com")
|
|
68
|
+
# Check GitHub repos of discovered employees
|
|
69
|
+
# → Repos may contain: .env files, config files, internal documentation, API specs
|
|
70
|
+
|
|
71
|
+
# ── 0-6. Company OSINT — People & Organization ──
|
|
72
|
+
web_search("<company_name> employees site:linkedin.com") # → usernames, email format
|
|
73
|
+
web_search("<company_name> technology stack") # → tech stack intel
|
|
74
|
+
web_search("<company_name> careers developer") # → tech stack from job postings
|
|
75
|
+
web_search("<target_domain> email format") # → firstname.lastname@domain
|
|
76
|
+
# Email harvesting
|
|
77
|
+
web_search("<target_domain> site:hunter.io")
|
|
78
|
+
theHarvester -d <target_domain> -b all
|
|
79
|
+
|
|
80
|
+
# ── 0-7. Historical & Cached Data ──
|
|
81
|
+
web_search("<target_domain> site:web.archive.org") # Wayback Machine snapshots
|
|
82
|
+
# → Reveals: old endpoints, removed pages, config files, previous tech stack
|
|
83
|
+
web_search("cache:<target_domain>")
|
|
84
|
+
# Google dorking
|
|
85
|
+
web_search("site:<target_domain> inurl:admin OR inurl:login OR inurl:dashboard")
|
|
86
|
+
web_search("site:<target_domain> filetype:pdf OR filetype:doc OR filetype:xls")
|
|
87
|
+
web_search("site:<target_domain> intitle:index.of")
|
|
88
|
+
web_search("<target_domain> \"Not for public release\" OR \"internal use only\"")
|
|
89
|
+
|
|
90
|
+
# ── 0-8. Paste Sites & Breach Data ──
|
|
91
|
+
web_search("<target_domain> site:pastebin.com")
|
|
92
|
+
web_search("<target_domain> breach OR leak OR dump")
|
|
93
|
+
# → Leaked credentials can be sprayed against discovered services
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**CRITICAL**: Record EVERY piece of intelligence found:
|
|
97
|
+
- Company name, employees → potential usernames for brute force
|
|
98
|
+
- Tech stack → targeted vulnerability research
|
|
99
|
+
- Docker images → pull and analyze for hardcoded secrets
|
|
100
|
+
- GitHub repos → clone and grep for credentials
|
|
101
|
+
- Email format → build username lists
|
|
102
|
+
- Old endpoints → test if still accessible
|
|
103
|
+
|
|
19
104
|
### Phase 1: Host Discovery
|
|
20
105
|
```bash
|
|
21
106
|
# Quick ping sweep
|
|
@@ -110,6 +195,51 @@ browse_url(url, { extract_forms: true, extract_links: true })
|
|
|
110
195
|
mitm_proxy({ target_host: "<target>", mode: "capture", duration: 30 })
|
|
111
196
|
```
|
|
112
197
|
|
|
198
|
+
### Phase 5.5: Container / Cloud / Infrastructure Reconnaissance
|
|
199
|
+
```bash
|
|
200
|
+
# ── Detect Container Environment ──
|
|
201
|
+
# Am I inside a container?
|
|
202
|
+
cat /proc/1/cgroup 2>/dev/null | grep -i docker
|
|
203
|
+
ls /.dockerenv 2>/dev/null
|
|
204
|
+
cat /proc/self/mountinfo 2>/dev/null | grep -i overlay
|
|
205
|
+
|
|
206
|
+
# ── Docker Reconnaissance (if Docker socket accessible) ──
|
|
207
|
+
# Check for Docker socket (potential container escape!)
|
|
208
|
+
ls -la /var/run/docker.sock 2>/dev/null
|
|
209
|
+
curl -s --unix-socket /var/run/docker.sock http://localhost/version 2>/dev/null
|
|
210
|
+
curl -s --unix-socket /var/run/docker.sock http://localhost/containers/json 2>/dev/null
|
|
211
|
+
curl -s --unix-socket /var/run/docker.sock http://localhost/images/json 2>/dev/null
|
|
212
|
+
# → Accessible Docker socket = likely container escape path
|
|
213
|
+
|
|
214
|
+
# ── Kubernetes Reconnaissance ──
|
|
215
|
+
# Check for K8s environment indicators
|
|
216
|
+
env | grep -i kube
|
|
217
|
+
cat /var/run/secrets/kubernetes.io/serviceaccount/token 2>/dev/null
|
|
218
|
+
cat /var/run/secrets/kubernetes.io/serviceaccount/namespace 2>/dev/null
|
|
219
|
+
# K8s API from within pod
|
|
220
|
+
curl -sk https://kubernetes.default.svc/api/v1/namespaces/ \
|
|
221
|
+
-H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" 2>/dev/null
|
|
222
|
+
|
|
223
|
+
# ── Cloud Metadata (SSRF or direct access) ──
|
|
224
|
+
# AWS
|
|
225
|
+
curl -s http://169.254.169.254/latest/meta-data/ 2>/dev/null
|
|
226
|
+
curl -s http://169.254.169.254/latest/user-data/ 2>/dev/null
|
|
227
|
+
# GCP
|
|
228
|
+
curl -s -H "Metadata-Flavor: Google" http://169.254.169.254/computeMetadata/v1/ 2>/dev/null
|
|
229
|
+
# Azure
|
|
230
|
+
curl -s -H "Metadata: true" "http://169.254.169.254/metadata/instance?api-version=2021-02-01" 2>/dev/null
|
|
231
|
+
|
|
232
|
+
# ── Exposed Docker Registries (external ports) ──
|
|
233
|
+
nmap -Pn -p 5000,5001 --script http-title <target>
|
|
234
|
+
curl -s http://<target>:5000/v2/_catalog 2>/dev/null
|
|
235
|
+
# → List all images, then pull and analyze for secrets
|
|
236
|
+
|
|
237
|
+
# ── CI/CD Environment Detection ──
|
|
238
|
+
env | grep -iE "jenkins|gitlab|github|circleci|travis|buildkite|drone" 2>/dev/null
|
|
239
|
+
ls -la /opt/jenkins /var/lib/jenkins 2>/dev/null
|
|
240
|
+
# Jenkins exposed → web_search("Jenkins <version> exploit")
|
|
241
|
+
```
|
|
242
|
+
|
|
113
243
|
### Phase 6: Version-Based CVE Search
|
|
114
244
|
```
|
|
115
245
|
After confirming service version, immediately:
|
package/dist/prompts/strategy.md
CHANGED
|
@@ -19,7 +19,10 @@ PARALLEL:
|
|
|
19
19
|
1. run_cmd({ command: "nmap -sV -sC -T4 --min-rate=1000 -p- <target>", background: true })
|
|
20
20
|
2. run_cmd({ command: "nmap -sU --top-ports=100 -T4 <target>", background: true })
|
|
21
21
|
3. web_search({ query: "<target_hostname_or_ip> site:shodan.io OR site:censys.io" })
|
|
22
|
-
4.
|
|
22
|
+
4. web_search({ query: "<company_or_domain> site:hub.docker.com OR site:github.com" })
|
|
23
|
+
5. web_search({ query: "<target_domain> site:crt.sh" }) # Certificate Transparency
|
|
24
|
+
6. run_cmd({ command: "whois <target_domain>", background: false })
|
|
25
|
+
7. update_mission({ summary: "Black-box pentest: <target>. Phase: initial recon + OSINT" })
|
|
23
26
|
```
|
|
24
27
|
Do NOT spend the first turn "planning." Start scanning and search simultaneously.
|
|
25
28
|
When port scan completes, IMMEDIATELY for each open service:
|
|
@@ -101,11 +104,22 @@ Before deep-diving into any single vulnerability, MAXIMIZE your attack surface.
|
|
|
101
104
|
```
|
|
102
105
|
Initial Discovery (broad)
|
|
103
106
|
│
|
|
107
|
+
├── OSINT → Company intel → Tech stack → Docker images → GitHub repos → Employee names
|
|
108
|
+
│ ├── Docker Hub images → pull → grep for secrets, configs, internal URLs
|
|
109
|
+
│ ├── GitHub repos → clone → search for .env, API keys, internal endpoints
|
|
110
|
+
│ ├── Employee names + email format → username list → password spray
|
|
111
|
+
│ ├── Job postings → technology stack → targeted exploit research
|
|
112
|
+
│ ├── Certificate Transparency → subdomains → expand attack surface
|
|
113
|
+
│ └── Wayback Machine → old endpoints, removed admin panels, config leaks
|
|
104
114
|
├── Port scan → Service fingerprint → Version → IMMEDIATE CVE search (per service)
|
|
105
115
|
│ └── For EACH open service: web_search("{service} {version} exploit hacktricks")
|
|
106
116
|
├── Web: Content discovery (dirs, files, APIs, vhosts, JS analysis, source maps)
|
|
107
117
|
├── Web: Form/parameter enumeration → injection test candidates
|
|
108
118
|
├── Network: Internal services, routing tables, ARP tables
|
|
119
|
+
├── Container/Cloud: Docker socket, K8s tokens, cloud metadata
|
|
120
|
+
│ ├── Docker socket accessible → container escape → host access
|
|
121
|
+
│ ├── K8s service account → cluster enumeration → lateral movement
|
|
122
|
+
│ └── Cloud metadata → IAM credentials → cloud infrastructure access
|
|
109
123
|
└── Every finding → does this OPEN a new attack surface?
|
|
110
124
|
├── Credentials → try on ALL other services (SSH, DB, RDP, web admin, FTP)
|
|
111
125
|
├── New subdomain/vhost → full recon on that too
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pentesting",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "Autonomous Penetration Testing AI Agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"test:watch": "vitest",
|
|
24
24
|
"lint": "tsc --noEmit",
|
|
25
25
|
"prepublishOnly": "npm run build",
|
|
26
|
-
"release": "npm run release:patch",
|
|
26
|
+
"release": "npm run release:patch && npm run release:docker",
|
|
27
27
|
"publish:token": "npm publish --access public",
|
|
28
28
|
"release:patch": "npm version patch && npm run build && npm run publish:token",
|
|
29
29
|
"release:minor": "npm version minor && npm run build && npm run publish:token",
|