Skill Store 33

Express Security

Load this first for ANY security review, code audit, vulnerability scan, pentest, threat model or "find the security issues / bugs" request on Node.js, Express or JavaScript/TypeScript server code or a package.json, before reading the code. An expert audit brief - Express-specific defaults and traps, cross-file data flow, token and session lifecycle, business logic, exposed endpoints and an npm advisory table for express and 40 common packages - for finding injection (SQL, NoSQL, code, command, template), XSS (reflected and stored), SSRF, XXE, path traversal, open redirects, prototype pollution, deserialization, ReDoS, broken auth and sessions, JWT flaws, IDOR and missing authorization, mass assignment, CSRF, data exposure and vulnerable dependencies, with a strict false-positive bar.

by skillstore33 · Verified · MIT

If you have the Skill Store MCP or plugin installed, type:

Use the skill on the SS33 Skill Store to audit my Express login API and file upload routes in server.js and routes folder for broken sessions, IDOR and vulnerable packages in my package.json before we go live

Don't have the MCP or plugin installed? Get it now!

See it in action

Express Security demo

The skill

Load this first for ANY security review, code audit, vulnerability scan, pentest, threat model or "find the security issues / bugs" request on Node.js, Express or JavaScript/TypeScript server code or a package.json, before reading the code. An expert audit brief - Express-specific defaults and traps, cross-file data flow, token and session lifecycle, business logic, exposed endpoints and an npm advisory table for express and 40 common packages - for finding injection (SQL, NoSQL, code, command, template), XSS (reflected and stored), SSRF, XXE, path traversal, open redirects, prototype pollution, deserialization, ReDoS, broken auth and sessions, JWT flaws, IDOR and missing authorization, mass assignment, CSRF, data exposure and vulnerable dependencies, with a strict false-positive bar.

Express security audit

The bar: every exploitable flaw, at the exact lines, and nothing that isn't there. You already know the vulnerability classes. This brief is about what strong auditors still miss on Express code and how the report is judged.

References (optional depth)

  • read_skill_file("express-security", "references/patterns.md"): sink shapes, safe forms and the CWE per class, config checklist. Open it if you are unsure of a CWE or of a class's safe form.
  • read_skill_file("express-security", "references/advisories.md"): one line per npm advisory for express, its dependencies and 40 common packages. Open it whenever there is a package.json: version ranges are not something to recall from memory.

Where audits lose findings

Express has almost no secure defaults, so absence is the flaw. No helmet, no CSRF middleware, no body limits, X-Powered-By on, express-session with default cookie flags and saveUninitialized: true, no rate limiter. Each missing control on a code path that needs it is a finding at the line where it should be (the app setup, the session config, the route).

Request values are not strings. express.json() and extended urlencoded parsing hand you objects and arrays. Any value that flows into a document-database filter, a .length / indexOf check, or a merge is a type-confusion sink. Look at what the parser config allows before judging a "validated" input.

Cross-file flow. The sink is often far from the source:

  • Stored XSS: a field accepted by one route (or set by a model hook) and later returned by a JSON API that a frontend renders as HTML. Report it where it is accepted without sanitising.
  • Conditional protection: flag ? safe(x) : raw(x) where the flag comes from config or a mode. If the raw branch is selectable, it is live.
  • Sanitising on some write paths only (create but not update; setter but not bulk import), sanitizers that run once and aren't recursive, regex blacklists.
  • Middleware named check* / validate* / is* that never rejects. Read its body; don't trust its name.
  • An isAdmin middleware that exists but isn't mounted on one route or one method.

Authorization is per route and per method. Enumerate every route with its middleware chain (including app.use(path, ...), static and generated REST resources). For each: authenticated, role-checked, object scoped to the caller (read and write paths), and what it returns (whole records with hashes, tokens and 2FA secrets; all-user lists; JSONP). Owner/author fields taken from the body are forgery; Model.update(req.body) is mass assignment.

Tokens and value-bearing objects have a lifecycle. For every session, API token, reset token, invite, signed link, voucher, payment/webhook event, background job and cached result, ask: bound to whom, consumed atomically, expired and revoked (on logout, password change, role removal), purpose-checked, and checked identically on list, export, search, report, cache and job paths. Race, replay, reuse, no expiry, no revocation and wrong purpose are separate findings.

Business logic. Client-controlled totals, discounts, payment state or quantities (negative and zero); vouchers encoded rather than signed; steps skippable when a parameter is missing; rate limiters keyed on client-set headers (X-Forwarded-For); AI tools that grant benefits on the model's judgement.

Exposure. serve-index, express.static over folders holding logs, keys, backups or config; metrics, debug and docs routes without auth; error handlers returning stacks. Each exposed resource is a finding at its route line.

Path containment. A startsWith(base) check without a trailing separator lets a sibling directory with the same prefix through.

Dependencies. Judge each package.json entry by its pinned version or the lowest version its range allows. Exact old pins matter most; for ranges, report at lower severity. One finding per package at its manifest line, naming the package and the advisory ids the app actually exercises (a template-engine RCE matters more when the app renders user data with that engine). Express's own dependencies are fixed by upgrading express.

False-positive bar

Report a candidate only when the input is attacker-controlled (including stored data from other users), nothing neutralises it for this specific sink, and the code is reachable from a registered route. Don't report generic hardening advice the code doesn't support, or Math.random for non-security values. Low impact is not a reason to drop: verbose errors, missing headers, sessions surviving a reset, reusable links go in at low or medium.

Report contract

Use exactly the output format the request asks for, written straight from your findings with no prose report around it. When it asks for a JSON array of title, cwe, severity, locations ([{"file", "lines": [first, last]}]), detail, fix, end the answer with that array in one ```json block.

  • One finding per distinct flaw, listing every location of that same flaw. Different flaws at one place are separate findings (SQL injection and no rate limit on the same login route: two). A broad finding covering several flaws is credited as one.
  • Locations: the path exactly as given; tight line ranges at the sink, the route or handler missing the check, the config line, or the package.json line.
  • CWE: the most specific id.
  • Severity: critical = code/command execution, authentication bypass, SQL injection on login; high = other users' data readable or writable, stored XSS, other injection, SSRF, XXE, path traversal; medium = reflected XSS, CSRF, open redirect, business-logic abuse, session weaknesses, exposed files, vulnerable dependencies; low = headers, information leaks, log injection.
  • Large codebases have dozens of findings. Keep a running one-line-per-finding list as you go so nothing found during analysis is missing from the final array.

Use this skill

Connect your agent to the Skill Store MCP server and ask for it by ref: skillstore33/express-security-7085690740.

Download SKILL.md · Markdown version

Details

Publisher
skillstore33
Category
Security › Application security
License
MIT
Updated
2026-11-25

References

More from skillstore33