From appsec
This skill should be used when the user asks to "check for privilege escalation", "analyze authorization risks", "find access control vulnerabilities", or mentions "elevation of privilege" in a security context. Maps to STRIDE category E.
npx claudepluginhub florianbuetow/claude-code --plugin appsecThis skill uses the workspace's default tool permissions.
Analyze source code for privilege escalation threats where attackers can gain unauthorized capabilities or access. Maps to **STRIDE E** -- violations of the **Authorization** security property.
Acquire memory dumps from live systems/VMs and analyze with Volatility 3 for processes, networks, DLLs, injections in incident response or malware hunts.
Provides x86-64/ARM disassembly patterns, calling conventions, control flow recognition for static analysis of executables and compiled binaries.
Identifies anti-debugging checks like IsDebuggerPresent, NtQueryInformationProcess in Windows binaries; suggests bypasses via patches/hooks/scripts for malware analysis, CTFs, authorized RE.
Analyze source code for privilege escalation threats where attackers can gain unauthorized capabilities or access. Maps to STRIDE E -- violations of the Authorization security property.
Read ../../shared/schemas/flags.md for the full flag specification. This skill supports all cross-cutting flags including --scope, --depth, --severity, --format, --fix, --quiet, and --explain.
Read ../../shared/frameworks/stride.md, specifically the E - Elevation of Privilege section, for the threat model backing this analysis. Key concerns: broken access control (IDOR), missing function-level access control, JWT manipulation, role confusion, privilege escalation.
Parse flags and resolve the target file list per the flags spec. Filter to files implementing authorization:
For each in-scope file, apply the Analysis Checklist below. At --depth standard, examine authorization logic in each file. At --depth deep, map the full authorization architecture: who can access what, where checks are enforced, where gaps exist between routes, and whether authorization is consistently applied at every layer.
Output findings per ../../shared/schemas/findings.md using the PRIV ID prefix (e.g., PRIV-001). Set references.stride to "E" on every finding.
Work through these questions against the scoped code. Each "yes" may produce a finding.
isAdmin, requireRole('admin'), or @permission_required, identify sibling routes that should but do not have equivalent guards. Map all endpoints and flag gaps in the authorization layer.findById(req.params.id), getRecord(id) where the result is not checked against the requesting user's permissions or tenant. Test: can user A access user B's resources by changing the ID?jwt.decode without verify, or role checks solely from token claims.role, isAdmin, canAccess in frontend code and verify equivalent checks exist server-side.isAdmin, permissions, or group fields through API requests? Look for ORM .create(req.body) or .update(req.body) without excluding privilege-related fields. Check for attr_accessible, fillable, $guarded, or DTO validation that strips role fields.role: 'admin' combined with password: in seed data. Check if these are gated behind environment checks (if NODE_ENV === 'development').WHERE user_id = ? or WHERE org_id = ?) or if they rely solely on the resource ID from the request. Multi-tenant applications must enforce tenant isolation on every query.editor can perform admin actions, or if role inheritance has gaps. Look for permission checks using string comparison (if role === 'admin') instead of hierarchical evaluation that accounts for role inheritance.next() called unconditionally in auth middleware./api/admin/../user/settings to bypass admin-only middleware, or using URL encoding tricks to evade path-based access rules.scope: *, full permissions, or if fine-grained scopes are available but not enforced. Look for scope validation at the endpoint level, not just at token issuance.findById(req.params.id) is an IDOR -- some resources are intentionally public (e.g., blog posts, product listings). Focus on resources that contain user-private data.admin / user) is not a finding. Flag only when the code shows evidence of an intended hierarchy that is inconsistently enforced.Concrete code patterns and grep heuristics to surface privilege escalation risks:
/admin, /manage, /internal, /dashboard, /settings without auth middleware. Compare middleware chains between admin and public routes. Grep: (admin|manage|internal|dashboard) in route definitions.Model.findById(req.params.id) or db.query("SELECT ... WHERE id = $1", [req.params.id]) without a user_id or org_id filter joined to the session user. Grep: findById\s*\(\s*req\.(params|query)|WHERE id\s*= without ownership clause.req.body.role, request.data['is_admin'], params[:role] used in user creation or update without stripping. Also req.user.role derived solely from JWT without server-side lookup. Grep: req\.(body|query|params)\.(role|isAdmin|is_admin|permissions|group).app.use(authMiddleware) placement relative to route definitions. Grep: app\.(get|post|put|delete|use)\s*\( to map registration order.permission: '*', role: 'superadmin' granted broadly, if (user.role) { allow } checking role existence rather than specific role value. Grep: permission.*\*|role.*super|if\s*\(\s*user\.(role|admin).authorized: true as default, access: 'public' on sensitive resources, missing else deny in conditional authorization. Grep: authorized.*true|access.*public|default.*allow..create(req.body), Object.assign(user, req.body), **request.data without exclude_fields or pick for role/permission attributes. Grep: \.create\(\s*req\.body|Object\.assign\(.*req\.body|\.update\(\s*\{.*\.\.\.req.Each finding must conform to ../../shared/schemas/findings.md.
id: PRIV-<NNN>
severity: critical | high | medium | low
confidence: high | medium | low
location: file, line, function, snippet
description: What the privilege escalation path is and how it can be exploited
impact: What unauthorized capabilities an attacker gains
fix: Concrete remediation with diff when possible
references:
stride: "E"
cwe: CWE-269 (Improper Privilege Mgmt), CWE-639 (IDOR), or relevant CWE
metadata:
tool: privilege-escalation
framework: stride
category: E
| Severity | Criteria |
|---|---|
critical | Admin endpoints without auth, mass assignment allowing role escalation to admin, IDOR on sensitive resources (financial data, PII, other users' accounts) |
high | Missing function-level access control on data modification endpoints, JWT role trust without server-side verification, broken tenant isolation |
medium | Horizontal privilege escalation on non-sensitive resources, client-only authorization, inconsistent permission checks across sibling endpoints |
low | Default admin in dev seeds, overly broad wildcard permissions in non-production config, missing deny-by-default on low-impact routes |
| CWE | Description |
|---|---|
| CWE-269 | Improper Privilege Management |
| CWE-639 | Authorization Bypass Through User-Controlled Key (IDOR) |
| CWE-862 | Missing Authorization |
| CWE-863 | Incorrect Authorization |
| CWE-285 | Improper Authorization |
| CWE-915 | Improperly Controlled Modification of Dynamically-Determined Object Attributes (Mass Assignment) |
| CWE-284 | Improper Access Control |