@gpzhang2001/sharpkit-skills 0.2.1
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/LICENSE +201 -0
- package/README.md +12 -0
- package/THIRD_PARTY_NOTICES.md +48 -0
- package/lib/index.d.ts +2027 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +70 -0
- package/lib/index.js.map +1 -0
- package/package.json +46 -0
- package/skills/analysis/counterevidence.md +185 -0
- package/skills/analysis/fix_verification.md +129 -0
- package/skills/analysis/severity_calibration.md +130 -0
- package/skills/analysis/source_aware_discovery.md +211 -0
- package/skills/cloud/aws.md +231 -0
- package/skills/cloud/azure.md +262 -0
- package/skills/cloud/gcp.md +194 -0
- package/skills/cloud/kubernetes.md +223 -0
- package/skills/coordination/root_agent.md +105 -0
- package/skills/coordination/source_aware_whitebox.md +47 -0
- package/skills/custom/api_spec_testing.md +61 -0
- package/skills/custom/dependency_cve_scanning.md +341 -0
- package/skills/custom/npx_confusion.md +233 -0
- package/skills/custom/source_aware_sast.md +192 -0
- package/skills/frameworks/django.md +214 -0
- package/skills/frameworks/fastapi.md +191 -0
- package/skills/frameworks/nestjs.md +225 -0
- package/skills/frameworks/nextjs.md +228 -0
- package/skills/protocols/graphql.md +276 -0
- package/skills/protocols/oauth.md +185 -0
- package/skills/reconnaissance/asset_discovery.md +150 -0
- package/skills/reconnaissance/infrastructure_lifecycle.md +226 -0
- package/skills/scan_modes/deep.md +164 -0
- package/skills/scan_modes/diff.md +86 -0
- package/skills/scan_modes/quick.md +68 -0
- package/skills/scan_modes/standard.md +99 -0
- package/skills/technologies/active_directory.md +233 -0
- package/skills/technologies/auth0.md +188 -0
- package/skills/technologies/electron_desktop_apps.md +181 -0
- package/skills/technologies/firebase.md +263 -0
- package/skills/technologies/grafana_prometheus.md +189 -0
- package/skills/technologies/llm_applications.md +257 -0
- package/skills/technologies/supabase.md +268 -0
- package/skills/tooling/agent_browser.md +551 -0
- package/skills/tooling/ffuf.md +72 -0
- package/skills/tooling/httpx.md +82 -0
- package/skills/tooling/hurl.md +99 -0
- package/skills/tooling/hypothesis.md +100 -0
- package/skills/tooling/katana.md +102 -0
- package/skills/tooling/naabu.md +68 -0
- package/skills/tooling/nmap.md +66 -0
- package/skills/tooling/nuclei.md +67 -0
- package/skills/tooling/python.md +109 -0
- package/skills/tooling/semgrep.md +72 -0
- package/skills/tooling/sqlmap.md +67 -0
- package/skills/tooling/subfinder.md +66 -0
- package/skills/vulnerabilities/agentic_system_security.md +207 -0
- package/skills/vulnerabilities/argument_injection.md +157 -0
- package/skills/vulnerabilities/authentication_jwt.md +166 -0
- package/skills/vulnerabilities/broken_function_level_authorization.md +154 -0
- package/skills/vulnerabilities/browser_security.md +192 -0
- package/skills/vulnerabilities/business_logic.md +178 -0
- package/skills/vulnerabilities/csrf.md +198 -0
- package/skills/vulnerabilities/header_injection.md +216 -0
- package/skills/vulnerabilities/http_request_smuggling.md +255 -0
- package/skills/vulnerabilities/idor.md +217 -0
- package/skills/vulnerabilities/information_disclosure.md +187 -0
- package/skills/vulnerabilities/insecure_deserialization.md +210 -0
- package/skills/vulnerabilities/insecure_file_uploads.md +194 -0
- package/skills/vulnerabilities/llm_prompt_injection.md +187 -0
- package/skills/vulnerabilities/mass_assignment.md +153 -0
- package/skills/vulnerabilities/nosql_injection.md +288 -0
- package/skills/vulnerabilities/open_redirect.md +165 -0
- package/skills/vulnerabilities/path_traversal_lfi_rfi.md +218 -0
- package/skills/vulnerabilities/prototype_pollution.md +142 -0
- package/skills/vulnerabilities/race_conditions.md +181 -0
- package/skills/vulnerabilities/rce.md +250 -0
- package/skills/vulnerabilities/semantic_confusion.md +189 -0
- package/skills/vulnerabilities/sql_injection.md +190 -0
- package/skills/vulnerabilities/ssrf.md +186 -0
- package/skills/vulnerabilities/ssti.md +270 -0
- package/skills/vulnerabilities/subdomain_takeover.md +167 -0
- package/skills/vulnerabilities/weak_password_detection.md +200 -0
- package/skills/vulnerabilities/xss.md +206 -0
- package/skills/vulnerabilities/xxe.md +223 -0
- package/src/index.ts +89 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: severity-calibration
|
|
3
|
+
description: Qualitative rubric for what actually deserves high/critical severity, and an acceptance checklist to apply before rating a finding
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Severity Calibration
|
|
7
|
+
|
|
8
|
+
CVSS gives you a number once you have chosen the metrics. This skill is
|
|
9
|
+
about choosing them honestly — deciding what class of issue genuinely
|
|
10
|
+
belongs at each severity before you fill in the vector.
|
|
11
|
+
|
|
12
|
+
Calibrate severity **after** you have established reachability and run
|
|
13
|
+
the counterevidence pass, never before. Severity is a conclusion, not an
|
|
14
|
+
opening position.
|
|
15
|
+
|
|
16
|
+
## The Test That Matters
|
|
17
|
+
|
|
18
|
+
Before rating anything high or critical, ask:
|
|
19
|
+
|
|
20
|
+
> Would this be accepted as high/critical in serious audit or bug bounty
|
|
21
|
+
> triage, by a firm putting its reputation on the line?
|
|
22
|
+
|
|
23
|
+
If the honest answer is "only if you accept a chain of assumptions", it
|
|
24
|
+
is not high. Rate the weakness you proved, not the worst case you can
|
|
25
|
+
imagine reaching from it.
|
|
26
|
+
|
|
27
|
+
## Critical
|
|
28
|
+
|
|
29
|
+
Reserve for findings where a realistic attacker gets decisive control or
|
|
30
|
+
mass data access, with evidence:
|
|
31
|
+
|
|
32
|
+
- Unauthenticated remote code execution, or command/code execution
|
|
33
|
+
reachable by any user on internet-exposed surface.
|
|
34
|
+
- Full authentication bypass, or trivially forgeable authentication
|
|
35
|
+
(accepted unsigned tokens, `alg: none`, signature not verified).
|
|
36
|
+
- Mass extraction of other users' or other tenants' sensitive data.
|
|
37
|
+
- Compromise of signing keys, control-plane credentials, or credentials
|
|
38
|
+
granting broad infrastructure access.
|
|
39
|
+
- Complete cross-tenant isolation failure in a multi-tenant system.
|
|
40
|
+
|
|
41
|
+
Factors that push a high up to critical: no authentication required,
|
|
42
|
+
internet reachable, zero user interaction, wormable/self-propagating,
|
|
43
|
+
or the impact spans all tenants rather than one.
|
|
44
|
+
|
|
45
|
+
## High
|
|
46
|
+
|
|
47
|
+
- Authenticated RCE, or RCE requiring a common non-privileged role.
|
|
48
|
+
- Privilege escalation crossing a real trust boundary (user → admin,
|
|
49
|
+
tenant → tenant, read → write on protected objects).
|
|
50
|
+
- Object-level authorization failures exposing or modifying other users'
|
|
51
|
+
sensitive data at scale.
|
|
52
|
+
- SQL injection or equivalent injection reaching real data.
|
|
53
|
+
- SSRF that demonstrably reaches internal services, cloud metadata, or
|
|
54
|
+
credentials.
|
|
55
|
+
- Sensitive credential or PII exposure that an attacker can actually
|
|
56
|
+
reach.
|
|
57
|
+
|
|
58
|
+
## Medium
|
|
59
|
+
|
|
60
|
+
- Stored XSS in a limited context, or reflected XSS requiring user
|
|
61
|
+
interaction.
|
|
62
|
+
- CSRF on a meaningful state-changing action.
|
|
63
|
+
- Authorization gaps on lower-value objects.
|
|
64
|
+
- Information disclosure that materially aids a further attack.
|
|
65
|
+
- Findings whose high-impact version is blocked by a real constraint you
|
|
66
|
+
confirmed (internal-only exposure, a required privileged role, a
|
|
67
|
+
narrow precondition).
|
|
68
|
+
|
|
69
|
+
## Low / Informational
|
|
70
|
+
|
|
71
|
+
- Missing security headers, cookie flag issues, verbose errors.
|
|
72
|
+
- Self-XSS, or XSS requiring the victim to paste a payload.
|
|
73
|
+
- Open redirect with no credential or token leakage.
|
|
74
|
+
- Rate-limiting and enumeration issues without a demonstrated impact.
|
|
75
|
+
- Defense-in-depth gaps with no reachable exploitation path.
|
|
76
|
+
|
|
77
|
+
## Usually NOT High or Critical
|
|
78
|
+
|
|
79
|
+
These are over-rated constantly. Each needs unusual, demonstrated
|
|
80
|
+
circumstances to exceed medium:
|
|
81
|
+
|
|
82
|
+
- Self-XSS and clickjacking on non-sensitive actions.
|
|
83
|
+
- Missing headers, cookie attributes, TLS configuration nits.
|
|
84
|
+
- Open redirect on its own.
|
|
85
|
+
- Theoretical memory-safety issues with no reachable attacker input.
|
|
86
|
+
- "Could matter if chained with several unproven assumptions."
|
|
87
|
+
- Anything already requiring admin, shell, or physical access — if the
|
|
88
|
+
attacker already has that, the finding adds little.
|
|
89
|
+
- Session-management weaknesses that require the attacker to already
|
|
90
|
+
hold a victim secret (a stolen cookie, an intercepted link). The
|
|
91
|
+
acquisition of that secret is not free; unless the *same* finding shows
|
|
92
|
+
how to obtain it, this is usually low/medium.
|
|
93
|
+
- Enumeration that only confirms an account, domain, or version exists.
|
|
94
|
+
|
|
95
|
+
## Downgrade, Don't Delete
|
|
96
|
+
|
|
97
|
+
A finding that turns out to be constrained gets a lower severity — not a
|
|
98
|
+
silent drop. Internal-only reachability, a required privileged role, or a
|
|
99
|
+
narrow precondition are all reasons to reduce severity and say so in the
|
|
100
|
+
report. They are not reasons to withhold the finding.
|
|
101
|
+
|
|
102
|
+
Equally: missing evidence about deployment or exposure lowers your
|
|
103
|
+
**confidence**, not the severity floor. Do not treat "I could not confirm
|
|
104
|
+
this is internet-facing" as if it were "this is internal-only".
|
|
105
|
+
|
|
106
|
+
## Acceptance Checklist for High / Critical
|
|
107
|
+
|
|
108
|
+
All of these must be true. If any is not, drop a level:
|
|
109
|
+
|
|
110
|
+
- [ ] The attack path is realistic and in scope — not a lab-only
|
|
111
|
+
condition, not dependent on an unproven prior compromise.
|
|
112
|
+
- [ ] The attacker position required is one an attacker can actually
|
|
113
|
+
obtain, and the CVSS `privileges_required` / `attack_complexity`
|
|
114
|
+
reflect that honestly.
|
|
115
|
+
- [ ] The impact is material and demonstrated, not asserted — `C:H` /
|
|
116
|
+
`I:H` mean proven broad or systemic read/write, not one record.
|
|
117
|
+
- [ ] The counterevidence pass found no constraint that meaningfully
|
|
118
|
+
limits exploitation, or you have explained why the constraint does
|
|
119
|
+
not hold.
|
|
120
|
+
- [ ] You have concrete evidence of reachability, not an assumption
|
|
121
|
+
about how the application is deployed.
|
|
122
|
+
- [ ] You would defend this rating in a client debrief.
|
|
123
|
+
|
|
124
|
+
## Output
|
|
125
|
+
|
|
126
|
+
Severity still comes from the CVSS vector — this rubric decides which
|
|
127
|
+
vector is honest. When your intuitive rating and the computed CVSS
|
|
128
|
+
severity disagree, re-examine the metrics: usually one of
|
|
129
|
+
`privileges_required`, `attack_complexity`, or the impact triad was set
|
|
130
|
+
optimistically. Fix the metric, do not override the result.
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: source-aware-discovery
|
|
3
|
+
description: Enumeration discipline for reading code — which locations to keep as separate candidates, which safe siblings prove nothing, and the per-family sweeps that are routinely missed
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Source-Aware Discovery
|
|
7
|
+
|
|
8
|
+
Reading code for bugs fails in two directions. You collapse many real
|
|
9
|
+
instances into one candidate and under-report, or you stop at the loudest
|
|
10
|
+
issue in a file and never sweep the family around it.
|
|
11
|
+
|
|
12
|
+
This skill is about *what to enumerate*, not how to exploit it — the
|
|
13
|
+
vulnerability-class skills cover exploitation. Discovery decides
|
|
14
|
+
plausibility and preserves evidence; severity comes later.
|
|
15
|
+
|
|
16
|
+
## Instance Discipline
|
|
17
|
+
|
|
18
|
+
**One root cause is not one candidate.** If a dangerous helper has six
|
|
19
|
+
call sites and four are independently reachable, that is four candidates
|
|
20
|
+
— not one "the helper is unsafe" note. Each needs its own source, its own
|
|
21
|
+
closest control, and its own line. A reader has to be able to fix them
|
|
22
|
+
individually.
|
|
23
|
+
|
|
24
|
+
**Do not collapse distinct proof tuples that share a route.** Command
|
|
25
|
+
execution, SSRF, path/file write, parser abuse, template execution, and
|
|
26
|
+
authorization bypass on the same endpoint are separate findings when the
|
|
27
|
+
sink, the broken control, or the impact differ. Sharing a URL is not
|
|
28
|
+
sharing a bug.
|
|
29
|
+
|
|
30
|
+
**Keep the wrapper and the shared helper both visible.** When the path
|
|
31
|
+
crosses from an entrypoint into a shared sink or control, record both:
|
|
32
|
+
the wrapper proves reachability, the helper is where the fix goes. Losing
|
|
33
|
+
either one makes the finding unactionable.
|
|
34
|
+
|
|
35
|
+
**A safe sibling is a negative control for itself and nothing else.** A
|
|
36
|
+
correctly-parameterized query three lines above a concatenated one proves
|
|
37
|
+
the developer knew better, not that the concatenated one is safe.
|
|
38
|
+
|
|
39
|
+
**Label your locations.** Mark each as entrypoint, root control, sink, or
|
|
40
|
+
concrete implementation. Multi-location findings that don't say which
|
|
41
|
+
line is which force the reader to re-derive your analysis.
|
|
42
|
+
|
|
43
|
+
## Where the Real Control Lives
|
|
44
|
+
|
|
45
|
+
The most common discovery error is anchoring on the dramatic sink and
|
|
46
|
+
missing the reusable broken control behind it.
|
|
47
|
+
|
|
48
|
+
- When a resolver, allowlist, denylist, class filter, or guard is the
|
|
49
|
+
thing that's wrong, that line is the candidate. The transport that
|
|
50
|
+
reaches it proves reachability — it doesn't replace it.
|
|
51
|
+
- When the same filter or resolver is **duplicated** across core, server,
|
|
52
|
+
client, plugin, or import packages, each copy is its own candidate.
|
|
53
|
+
Fixing one leaves the others live.
|
|
54
|
+
- In a concrete strategy / handler / converter / operation subclass, read
|
|
55
|
+
the specialized helper, not just the top-level `handle` / `apply` /
|
|
56
|
+
`perform` override. If the subclass splits, filters, canonicalizes, or
|
|
57
|
+
rebuilds attacker input before delegating to a shared evaluator, the
|
|
58
|
+
subclass line is the root control.
|
|
59
|
+
- Branch-specific transforms — append, wildcard, fallback, copy/move
|
|
60
|
+
`from`, default-value, type-resolution — routinely bypass or narrow the
|
|
61
|
+
shared validator. Keep the branch predicate as its own location. A
|
|
62
|
+
finding on the shared helper does not close them.
|
|
63
|
+
|
|
64
|
+
## Family Sweeps
|
|
65
|
+
|
|
66
|
+
When you find one instance of these, sweep the whole family before
|
|
67
|
+
closing it out.
|
|
68
|
+
|
|
69
|
+
**Deserialization / object construction.** Enumerate every registered
|
|
70
|
+
codec, deserializer, converter, and container handler — array,
|
|
71
|
+
collection, map, bean, enum, throwable, generic object. A top-level
|
|
72
|
+
parser-config finding does not close a concrete codec that recursively
|
|
73
|
+
re-invokes parsing or type resolution on attacker data.
|
|
74
|
+
|
|
75
|
+
**XML / parsers.** Enumerate parser factories, readers, converters,
|
|
76
|
+
validators, transformers, and unmarshal entrypoints independently.
|
|
77
|
+
Hardening that is best-effort does not suppress anything: a
|
|
78
|
+
secure-processing flag alone, a `setFeature` call whose failure is
|
|
79
|
+
swallowed or logged, or a safe default factory all leave
|
|
80
|
+
caller-supplied factories and converter paths open.
|
|
81
|
+
|
|
82
|
+
**Object models for untrusted formats.** Sweep the primitive and
|
|
83
|
+
container helpers that traverse or convert attacker-controlled documents
|
|
84
|
+
— `to*Array`, `get*`, numeric conversion, `parse*`, iterators, size
|
|
85
|
+
accessors, unchecked casts, allocation loops. Missing type, size, shape,
|
|
86
|
+
recursion, or numeric guards here cause type confusion, unbounded
|
|
87
|
+
traversal, and resource exhaustion. These sweeps create candidate rows,
|
|
88
|
+
not automatic findings — promote one only when malformed input plausibly
|
|
89
|
+
reaches it and the missing guard has a concrete security effect.
|
|
90
|
+
|
|
91
|
+
**Archive extraction and import/restore.** Keep four things visible per
|
|
92
|
+
operation: the member name, the destination join, the containment check,
|
|
93
|
+
and the extract/write call. A later copy step, manifest gate, or UUID
|
|
94
|
+
check does not close it if the write already happened. "The stdlib
|
|
95
|
+
normalizes paths" is not containment evidence — the code must show
|
|
96
|
+
per-entry containment *before* the write, including symlink, hardlink,
|
|
97
|
+
and recursive-copy paths. The write does not need to escape the app root
|
|
98
|
+
to matter: overwriting config, a peer tenant's directory, or a shared
|
|
99
|
+
imported subtree is still file impact.
|
|
100
|
+
|
|
101
|
+
**Path-sensitive filesystem operations.** Enumerate each exported
|
|
102
|
+
operation separately — restore, import, export, backup, copy, move,
|
|
103
|
+
download, open, key/config fetch. For each, keep the decode, join,
|
|
104
|
+
normalize, canonicalize, strip-prefix, extension-check, and
|
|
105
|
+
destination-selection lines candidate-visible.
|
|
106
|
+
|
|
107
|
+
**Static-file and resource serving.** The candidate is the line that
|
|
108
|
+
decides whether an attacker-chosen path is allowed: the allowlist, the
|
|
109
|
+
matcher, the canonicalization, the URL decode, the resource selection. Do
|
|
110
|
+
not substitute a safer sibling handler for the vulnerable legacy one.
|
|
111
|
+
|
|
112
|
+
**Outbound requests.** For URL importers, webhook and callback clients,
|
|
113
|
+
preview/render fetchers, `downloadFrom`-style helpers, and
|
|
114
|
+
redirect-following clients: enumerate each attacker-controlled
|
|
115
|
+
destination and its closest allow/deny/redirect control. Do not drop the
|
|
116
|
+
row because the fetch is an intended feature, because the filter is
|
|
117
|
+
operator-configured or empty by default, or because it only runs
|
|
118
|
+
pre-request.
|
|
119
|
+
|
|
120
|
+
**Command and action runners.** Enumerate every attacker-controllable
|
|
121
|
+
argument type and execution mode before you call command injection
|
|
122
|
+
covered. Type-safety maps, unsafe-type denylists, template substitution,
|
|
123
|
+
shell wrapping, direct-exec branches, and API-side argument ingestion are
|
|
124
|
+
each separate controls. A denylist covering three types says nothing
|
|
125
|
+
about the no-op typecheck branches that still render into a shell string.
|
|
126
|
+
Frontend widget constraints are not controls at all.
|
|
127
|
+
|
|
128
|
+
**Query APIs (SQL, NoSQL, LDAP, XPath, and friends).** Do not suppress
|
|
129
|
+
because the endpoint is already user-facing, because it's an insert
|
|
130
|
+
rather than a read, or because a later business check appears to limit
|
|
131
|
+
the effect. If attacker input reaches query syntax or selector operators,
|
|
132
|
+
carry it forward and record the later check as counterevidence.
|
|
133
|
+
|
|
134
|
+
**Structured patch / edit APIs.** For JSON Patch, document edits, and
|
|
135
|
+
config mutations, enumerate the request-selected operations — add,
|
|
136
|
+
remove, replace, move, copy, test. Operation-specific path transforms,
|
|
137
|
+
array-append handling, and wildcard selection stay candidate-visible when
|
|
138
|
+
they feed a shared evaluator or binder.
|
|
139
|
+
|
|
140
|
+
**Authentication state machines.** The candidate is the line that
|
|
141
|
+
installs or reuses a principal, credential, token, issuer, or protocol
|
|
142
|
+
state *after* a transition — pre-auth to authenticated, TLS upgrade,
|
|
143
|
+
redirect, assertion consumption, IdP handoff. Missing rebind or
|
|
144
|
+
reauthentication at that seam authenticates the wrong identity.
|
|
145
|
+
|
|
146
|
+
**SSO / SAML / federation.** Keep response and assertion validators
|
|
147
|
+
distinct from generic claims authorizers and from service-method
|
|
148
|
+
authorization; they fail differently. Include the lines doing assertion
|
|
149
|
+
selection, list indexing, DOM access, node cloning, signed-object lookup,
|
|
150
|
+
subject confirmation, recipient, audience, destination, ACS URL, and
|
|
151
|
+
issuer binding — each decides *which* assertion is trusted.
|
|
152
|
+
|
|
153
|
+
The signature failure to watch for: a validation loop or a
|
|
154
|
+
`foundValid`-style flag, followed by a **separate** fixed-index,
|
|
155
|
+
first-element, clone, re-serialization, or return path. Treat that later
|
|
156
|
+
selection line as the broken control until you have proven the validated
|
|
157
|
+
object and the consumed object are byte-identical and equally bound. This
|
|
158
|
+
is the validated-vs-consumed mismatch, and it is invisible if you only
|
|
159
|
+
read the validator.
|
|
160
|
+
|
|
161
|
+
**Realms and authenticators.** Enumerate the concrete implementations —
|
|
162
|
+
LDAP, Kerberos, PAM, SAML, OAuth/OIDC, custom realms — before promoting a
|
|
163
|
+
generic HTTP auth finding. In multi-step or TLS-upgraded binds, keep the
|
|
164
|
+
bind/rebind and credential-installation line visible.
|
|
165
|
+
|
|
166
|
+
**Self-service update routes.** Include the guard that compares the
|
|
167
|
+
requested object against the persisted one. Missing checks on
|
|
168
|
+
security-sensitive scalars and collection aliases let a user change their
|
|
169
|
+
own identity, roles, group membership, tenancy, or account-recovery
|
|
170
|
+
properties.
|
|
171
|
+
|
|
172
|
+
**Protocol utility code.** In protocol-heavy repositories, read the
|
|
173
|
+
version, capability, feature, and negotiation helpers even when the
|
|
174
|
+
obvious candidates are REST and admin routes. Look for `Version`,
|
|
175
|
+
`versionCompare`, `Capability`, `Feature`, `Negotiation`, and the
|
|
176
|
+
comparator methods around them — downgrade and confusion bugs live there,
|
|
177
|
+
and nobody looks.
|
|
178
|
+
|
|
179
|
+
**Public webhook / status / callback endpoints.** Enumerate these
|
|
180
|
+
independently from nearby credential bugs whenever they read protected
|
|
181
|
+
objects, trigger jobs, or mutate protected state.
|
|
182
|
+
|
|
183
|
+
## Cross-Boundary Inputs
|
|
184
|
+
|
|
185
|
+
In frameworks and libraries, stored client, tenant, application, IdP,
|
|
186
|
+
exception, and imported-configuration values are attacker-controlled when
|
|
187
|
+
they are later rendered, evaluated, parsed, or used for authorization —
|
|
188
|
+
provided there is a plausible runtime path from some boundary. Do not
|
|
189
|
+
suppress just because the writer lives outside this repository. That
|
|
190
|
+
requires evidence the value is trusted-only in normal deployments, not an
|
|
191
|
+
assumption.
|
|
192
|
+
|
|
193
|
+
Similarly, do not suppress a high-impact candidate because the API is
|
|
194
|
+
deprecated, opt-in, or documented as dangerous. Record that as a
|
|
195
|
+
precondition and keep the candidate — shipped code with a bypassable
|
|
196
|
+
control is shipped code.
|
|
197
|
+
|
|
198
|
+
## The Finding Bar
|
|
199
|
+
|
|
200
|
+
Worth opening a candidate: authorization bypass, confused deputy, SSRF,
|
|
201
|
+
path traversal, injection with a real sink, cross-tenant exposure,
|
|
202
|
+
sensitive state change without enforcement, sandbox or trust-boundary
|
|
203
|
+
escape.
|
|
204
|
+
|
|
205
|
+
Not worth it: "this could use more validation" with no path, style and
|
|
206
|
+
maintainability complaints, and cosmetic variants of a candidate you
|
|
207
|
+
already opened.
|
|
208
|
+
|
|
209
|
+
Keep reading until no distinct plausible candidate remains — then record
|
|
210
|
+
what you swept with `record_coverage`, including the families that came
|
|
211
|
+
back clean.
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: aws
|
|
3
|
+
description: AWS cloud security testing covering IAM misconfigurations, S3 exposure, metadata abuse, and privilege escalation paths
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AWS Cloud Security
|
|
7
|
+
|
|
8
|
+
AWS misconfigurations frequently expose credentials, data, and lateral movement paths. This skill covers direct AWS API testing and post-compromise enumeration from EC2/Lambda/container workloads. For SSRF-mediated metadata access, combine with the ssrf skill.
|
|
9
|
+
|
|
10
|
+
## Attack Surface
|
|
11
|
+
|
|
12
|
+
**Identity**
|
|
13
|
+
- IAM users, roles, groups, policies (inline and managed)
|
|
14
|
+
- Access keys, session tokens, SSO/SAML federation
|
|
15
|
+
- Cross-account roles, trust policies, permission boundaries
|
|
16
|
+
|
|
17
|
+
**Storage & Data**
|
|
18
|
+
- S3 buckets, objects, bucket policies, ACLs, Block Public Access settings
|
|
19
|
+
- EBS snapshots, RDS snapshots, AMIs shared publicly
|
|
20
|
+
- Secrets Manager, SSM Parameter Store, KMS keys
|
|
21
|
+
|
|
22
|
+
**Compute**
|
|
23
|
+
- EC2 instances, Lambda functions, ECS/EKS tasks
|
|
24
|
+
- Instance metadata service (IMDSv1/v2) at `169.254.169.254`
|
|
25
|
+
- User data, launch templates, AMIs
|
|
26
|
+
|
|
27
|
+
**Network**
|
|
28
|
+
- Security groups, NACLs, VPC endpoints, public subnets
|
|
29
|
+
- ELB/ALB/CloudFront misconfigurations
|
|
30
|
+
|
|
31
|
+
**Management**
|
|
32
|
+
- CloudTrail, Config, GuardDuty gaps
|
|
33
|
+
- Cognito user pools, API Gateway, AppSync
|
|
34
|
+
|
|
35
|
+
## Reconnaissance
|
|
36
|
+
|
|
37
|
+
**Credential Discovery**
|
|
38
|
+
- Environment variables: `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`
|
|
39
|
+
- `~/.aws/credentials`, `~/.aws/config`, CI/CD env vars, `.env` files
|
|
40
|
+
- Hardcoded keys in source, mobile apps, JavaScript bundles
|
|
41
|
+
|
|
42
|
+
**Unauthenticated Enumeration**
|
|
43
|
+
|
|
44
|
+
Use two separate checks — they answer different questions and must not be conflated:
|
|
45
|
+
|
|
46
|
+
**1. Bucket existence (does the name resolve?)**
|
|
47
|
+
|
|
48
|
+
Goal: learn whether a bucket name exists in AWS, without needing `s3:ListBucket`.
|
|
49
|
+
- `head-bucket` or `curl -I` HTTP status is the signal — not `aws s3 ls`.
|
|
50
|
+
- `403 Forbidden` → bucket exists but you lack access (private or wrong account).
|
|
51
|
+
- `404 Not Found` → bucket does not exist in that region, or name is wrong.
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
aws s3api head-bucket --bucket target-bucket --no-sign-request 2>&1
|
|
55
|
+
curl -I https://target-bucket.s3.amazonaws.com/
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**2. Public listing (is ListBucket granted to anonymous users?)**
|
|
59
|
+
|
|
60
|
+
Goal: confirm `s3:ListBucket` is publicly granted — a separate and stronger finding than existence alone.
|
|
61
|
+
- Only run `aws s3 ls` for this step; a successful listing returns object keys/prefixes.
|
|
62
|
+
- Failure here does not disprove existence (a private bucket still returns 403 on list).
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
aws s3 ls s3://target-bucket --no-sign-request
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Authenticated Enumeration (with any credentials)**
|
|
69
|
+
```
|
|
70
|
+
aws sts get-caller-identity
|
|
71
|
+
aws iam get-account-authorization-details 2>/dev/null
|
|
72
|
+
aws iam list-users
|
|
73
|
+
aws iam list-roles
|
|
74
|
+
aws iam list-attached-user-policies --user-name <user>
|
|
75
|
+
aws s3 ls
|
|
76
|
+
aws ec2 describe-instances
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Key Vulnerabilities
|
|
80
|
+
|
|
81
|
+
### S3 Misconfigurations
|
|
82
|
+
|
|
83
|
+
- Public read/write buckets (ACL `public-read`, policy `"Principal":"*"`)
|
|
84
|
+
- AuthenticatedUsers group grants (`http://acs.amazonaws.com/groups/global/AuthenticatedUsers`)
|
|
85
|
+
- ListBucket enabled publicly → object key enumeration
|
|
86
|
+
- Sensitive object keys guessable: `backup/`, `db/`, `.env`, `config/`, `logs/`
|
|
87
|
+
|
|
88
|
+
**Test:**
|
|
89
|
+
```
|
|
90
|
+
aws s3 ls s3://BUCKET --no-sign-request
|
|
91
|
+
aws s3 cp s3://BUCKET/sensitive-file . --no-sign-request
|
|
92
|
+
curl https://BUCKET.s3.amazonaws.com/
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### IAM Privilege Escalation
|
|
96
|
+
|
|
97
|
+
Common escalation paths (verify with `aws iam simulate-principal-policy` when possible):
|
|
98
|
+
|
|
99
|
+
| Permission | Escalation |
|
|
100
|
+
|------------|------------|
|
|
101
|
+
| `iam:CreatePolicyVersion` | Attach admin policy version to self |
|
|
102
|
+
| `iam:SetDefaultPolicyVersion` | Roll back to older permissive policy version |
|
|
103
|
+
| `iam:PassRole` + `lambda:CreateFunction` | Create Lambda with admin role, invoke |
|
|
104
|
+
| `iam:PassRole` + `ec2:RunInstances` | Launch EC2 with instance profile |
|
|
105
|
+
| `sts:AssumeRole` on overprivileged role | Cross-account or same-account pivot |
|
|
106
|
+
| `iam:UpdateAssumeRolePolicy` | Add self to trust policy of privileged role |
|
|
107
|
+
| `iam:AttachUserPolicy` / `PutUserPolicy` | Self-grant admin |
|
|
108
|
+
|
|
109
|
+
**Test:**
|
|
110
|
+
```
|
|
111
|
+
aws iam list-attached-user-policies --user-name $(aws sts get-caller-identity --query Arn --output text | cut -d/ -f2)
|
|
112
|
+
aws iam simulate-principal-policy --policy-source-arn <arn> --action-names iam:CreateAccessKey --resource-arns "*"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Instance Metadata Abuse
|
|
116
|
+
|
|
117
|
+
**IMDSv1 (no token required)**
|
|
118
|
+
```
|
|
119
|
+
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/
|
|
120
|
+
curl http://169.254.169.254/latest/meta-data/iam/security-credentials/<role-name>
|
|
121
|
+
curl http://169.254.169.254/latest/user-data
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**IMDSv2 bypass contexts**
|
|
125
|
+
- SSRF with header injection if server forwards `X-aws-ec2-metadata-token`
|
|
126
|
+
- Container sidecars without hop limit enforcement
|
|
127
|
+
- Misconfigured proxies allowing link-local access
|
|
128
|
+
|
|
129
|
+
### Snapshot and Backup Exposure
|
|
130
|
+
|
|
131
|
+
- Public EBS/RDS snapshots: `aws ec2 describe-snapshots --restorable-by-user-names all`
|
|
132
|
+
- AMIs with `Public` launch permission containing secrets or keys
|
|
133
|
+
- Backup vaults cross-account without proper isolation
|
|
134
|
+
|
|
135
|
+
### Lambda and Serverless
|
|
136
|
+
|
|
137
|
+
- Overprivileged execution roles (`AdministratorAccess` on Lambda role)
|
|
138
|
+
- Environment variables containing secrets (visible via `lambda:GetFunctionConfiguration`)
|
|
139
|
+
- Function URLs or API Gateway without auth
|
|
140
|
+
- Event source mappings triggering on attacker-controlled events
|
|
141
|
+
|
|
142
|
+
### Cognito Misconfigurations
|
|
143
|
+
|
|
144
|
+
- Self-signup enabled with elevated default group membership
|
|
145
|
+
- Missing app client secret on confidential flows
|
|
146
|
+
- Custom attribute write permissions allowing privilege fields (`custom:role`, `custom:admin`)
|
|
147
|
+
- ID token custom claims trusted by backend without verification
|
|
148
|
+
|
|
149
|
+
### KMS and Secrets
|
|
150
|
+
|
|
151
|
+
- KMS key policies allowing `Principal: *` or overly broad accounts
|
|
152
|
+
- Secrets Manager secrets readable by unintended roles
|
|
153
|
+
- SSM parameters under `/` with `GetParameter` for unauthenticated or low-priv callers
|
|
154
|
+
|
|
155
|
+
## Advanced Techniques
|
|
156
|
+
|
|
157
|
+
**Cross-Account Role Assumption**
|
|
158
|
+
- Find roles trusting `*` or external accounts broadly
|
|
159
|
+
- Confused deputy: service assumes role without external ID validation
|
|
160
|
+
|
|
161
|
+
**CloudFront Origin Exposure**
|
|
162
|
+
- Origin pointing directly to S3 website or ALB bypassing WAF
|
|
163
|
+
- Signed URL/cookie misconfiguration allowing object access
|
|
164
|
+
|
|
165
|
+
**Resource-Based Policy Gaps**
|
|
166
|
+
- S3 bucket policy allowing `s3:GetObject` from unintended principals
|
|
167
|
+
- Lambda resource policy `Principal: *` with weak condition keys
|
|
168
|
+
|
|
169
|
+
## Testing Methodology
|
|
170
|
+
|
|
171
|
+
1. **Discover credentials** — Keys in code, env, metadata, or SSRF
|
|
172
|
+
2. **Identify principal** — `get-caller-identity`, map effective permissions
|
|
173
|
+
3. **Enumerate resources** — S3, EC2, IAM, Lambda within policy bounds
|
|
174
|
+
4. **Escalation paths** — Run escalation checklist against attached policies
|
|
175
|
+
5. **Data exposure** — Public buckets, snapshots, secrets, user-data scripts
|
|
176
|
+
6. **Persistence** — New access keys, backdoor roles, Lambda triggers (only in authorized scope)
|
|
177
|
+
|
|
178
|
+
## Validation
|
|
179
|
+
|
|
180
|
+
1. Demonstrate unauthorized read/write of S3 objects or snapshots with evidence (object keys, ETags)
|
|
181
|
+
2. Show IAM escalation from low-priv to higher-priv with exact API calls and resulting permissions
|
|
182
|
+
3. Prove metadata credential theft path (SSRF or IMDS) with redacted temporary credentials scope
|
|
183
|
+
4. Document resource ARN, policy statement, and misconfiguration root cause
|
|
184
|
+
5. Confirm fix would block the specific principal/action/resource combination
|
|
185
|
+
|
|
186
|
+
## False Positives
|
|
187
|
+
|
|
188
|
+
- Intentionally public static assets bucket with no sensitive keys
|
|
189
|
+
- Read-only `s3:ListBucket` on empty marketing bucket
|
|
190
|
+
- Metadata endpoint unreachable from tested context (no SSRF, IMDSv2 enforced with hop limit)
|
|
191
|
+
- Simulated escalation blocked by permission boundary or SCP
|
|
192
|
+
- 403 on S3 that indicates existence but not readable content (still note for recon, not data breach)
|
|
193
|
+
|
|
194
|
+
## Impact
|
|
195
|
+
|
|
196
|
+
- Mass data exfiltration from S3/RDS/snapshots
|
|
197
|
+
- Full account or organization compromise via IAM escalation
|
|
198
|
+
- Persistent backdoor access through new keys or roles
|
|
199
|
+
- Regulatory exposure (PII/PCI in unencrypted public buckets)
|
|
200
|
+
|
|
201
|
+
## Pro Tips
|
|
202
|
+
|
|
203
|
+
1. Always run `get-caller-identity` first to know your effective principal
|
|
204
|
+
2. Distinguish 403 vs 404 on S3 — both are useful, mean different things
|
|
205
|
+
3. Check instance profile role, not just user credentials, from metadata
|
|
206
|
+
4. Review trust policies on roles, not just permission policies
|
|
207
|
+
5. Combine with subdomain takeover — dangling S3 bucket names in DNS CNAMEs
|
|
208
|
+
|
|
209
|
+
## Tooling
|
|
210
|
+
|
|
211
|
+
Prefer credential-light, install-once CLIs. The sandbox has `awscli`/`python`/`pipx`/`go` and build-time egress.
|
|
212
|
+
|
|
213
|
+
- **awscli** — the primary enumeration tool (used throughout this skill). Always start with `aws sts get-caller-identity`.
|
|
214
|
+
- **enumerate-iam** (andresriancho) — tiny script that brute-forces which API calls a set of keys can make when you can't read your own policy:
|
|
215
|
+
```
|
|
216
|
+
git clone https://github.com/andresriancho/enumerate-iam && cd enumerate-iam
|
|
217
|
+
pip install -r requirements.txt
|
|
218
|
+
python enumerate-iam.py --access-key AKIA... --secret-key ...
|
|
219
|
+
```
|
|
220
|
+
- **cloudsplaining** (Salesforce) — offline IAM policy risk analysis; finds privilege-escalation/resource-exposure in the auth-details JSON:
|
|
221
|
+
```
|
|
222
|
+
pipx install cloudsplaining
|
|
223
|
+
aws iam get-account-authorization-details > auth.json
|
|
224
|
+
cloudsplaining scan --input-file auth.json
|
|
225
|
+
```
|
|
226
|
+
- **CloudFox** (BishopFox) — single Go binary for fast post-compromise inventory and "what can I do from here" surfacing: `cloudfox aws --profile <profile> all-checks`
|
|
227
|
+
- **Pacu** (Rhino Security Labs) — the standard AWS exploitation framework; heavier, but its `iam__privesc_scan` module automates the escalation table above. Use for a full exploitation session (`run iam__enum_permissions`, then `run iam__privesc_scan`).
|
|
228
|
+
|
|
229
|
+
## Summary
|
|
230
|
+
|
|
231
|
+
AWS security requires least-privilege IAM, blocked public data paths, IMDSv2 with hop limits, and tight resource policies. Enumerate from any credential found — even limited read access often reveals escalation chains.
|