← /vaultShipping10 min read

Twenty named attacks, where each one has really happened, how to tell if it applies to you, and the fix. Paste it into Claude Code and it checks your app for all 20.

The prompt is right below. Paste it into Claude Code opened in your project, fill in the first line, and it checks your app against all twenty and reports before it changes anything.
Paste into Claude Code
My app is: [one line on what it does, and the stack: framework, host, database, auth, and whether it uses GraphQL, WebSockets, SAML or XML uploads].

Below are 20 attacks a pen tester checks for. Most won't apply to my app. For each one, tell me whether it applies and how you can tell from the code or config. If it doesn't apply, say so in one line and move on. For the ones that do, tell me what the fix would change. Report on all 20 first. Fix only the ones I approve, one at a time, and run the project's checks after each. Don't install anything, change or rotate any keys, or touch production without asking me first. If one depends on a host, CDN or provider setting, tell me the exact setting to check and I'll do it.

The 20:

1. HTTP/2 Rapid Reset (CVE-2023-44487). If we run our own HTTP/2 server or proxy, check that its version is patched for this CVE.
2. bcrypt's 72-byte limit. If bcrypt hashes anything besides the password on its own (a username, an ID, a pepper in front of it), the end of the input can be ignored. Hash only the password and cap it at 72 bytes.
3. SAML signature bypass (CVE-2024-45409). If we offer SAML sign-in, check that ruby-saml is 1.17.0 or later and omniauth-saml 2.2.1 or later, and that any other SAML library is current.
4. nOAuth. If we offer "Log in with Microsoft", users must be matched on the token's stable IDs (oid with tid, or sub), never the email claim, and accounts must never merge on an unverified email.
5. GraphQL alias batching. If we have GraphQL, check whether one request can carry many copies of a login, 2FA, code or coupon check. Limit those attempts per operation and per account in code.
6. TOTP replay (RFC 6238, section 5.2). If we verify authenticator codes ourselves, a code must be refused once it has been accepted. Store the last accepted time step per user.
7. ReDoS. Find regexes with nested repetition that run on user input. Cap the input length, and rewrite them or replace them with plain string functions.
8. JWT algorithm confusion. If we verify JWTs, pin the allowed algorithm in the verify call and never take it from the token.
9. HTTP request smuggling. If we run our own proxy or load balancer in front of the app, use HTTP/2 end to end where we can, and reject ambiguous requests such as ones carrying both Content-Length and Transfer-Encoding.
10. Web cache poisoning. If a CDN caches HTML or API responses, the app must not build responses from headers like X-Forwarded-Host that aren't part of the cache key.
11. Spoofed X-Forwarded-For. If we rate-limit by IP, set trust proxy (or its equivalent) to the real number of proxies or their addresses, not true, and count attempts per account as well.
12. Postgres views bypassing RLS. If we use Supabase or Postgres row level security, list every view in an exposed schema and set security_invoker = true on it (Postgres 15+), or move it out of the exposed schema.
13. Math.random() tokens. Any token, code or ID that guards something must come from a cryptographic random source (crypto.getRandomValues, or crypto.randomBytes in Node).
14. Timing attacks. Compare secrets (API keys, webhook signatures, tokens) with crypto.timingSafeEqual or the language's constant-time compare, never with ===.
15. Padding oracle. If we encrypt cookies or tokens ourselves in CBC mode, switch to authenticated encryption (AES-GCM) or the framework's encrypted sessions, and return one generic error for any decryption failure.
16. Server-side prototype pollution. If a Node server merges request bodies into objects, validate them against a schema, block the keys __proto__, constructor and prototype, and use a Map for user-keyed data.
17. Server-side template injection. User input goes into templates as data, never into the template's source.
18. XXE. If we parse XML from users (SVG, office files, RSS, SAML), turn off external entities, DTDs and XInclude in the parser.
19. Cross-site WebSocket hijacking. If WebSockets use cookie sessions, the handshake must check the Origin header and carry a CSRF token.
20. Unicode username normalization. If usernames or emails allow Unicode, normalize once at sign-up, store and compare only that form, and refuse any name that changes when normalized a second time.

Run it in Claude Code, Cursor or Codex opened in your project, so it can read the code and the config. Most apps will only hit a handful of these. Several need a specific setup (your own server, SAML, GraphQL, XML uploads), and the prompt tells it to skip what doesn't apply.

Below is what each attack is, where it has really happened, how to tell if it applies to you, and the fix, with the page it comes from under each one. The company bugs named here (Okta, GitLab, Spotify) were fixed long ago. The point is to check yours.

1. Knock you offline with HTTP/2 Rapid Reset

HTTP/2 lets one connection carry many requests at once, and lets the client cancel any of them. Rapid Reset opens a request and cancels it straight away, over and over, so the server keeps starting work nobody waits for. Google Cloud stopped an attack built this way that peaked above 398 million requests per second, and the flaw is tracked as CVE-2023-44487 (CVSS 7.5). If your app sits on a managed host or CDN, their servers take the hit. If you run your own HTTP/2 server or proxy, it's yours to patch.

Fix: Google's advice is to check any HTTP/2 server you run and "apply vendor patches for CVE-2023-44487". Update nginx, your Node runtime or whatever terminates HTTP/2 to a patched release.

2. Log in with a 52-character username

bcrypt only reads the first 72 bytes of what you give it. Okta built a cache key by hashing userId + username + password together with bcrypt. With a username of 52 characters or more, the password landed past the cutoff, so under the right conditions someone could authenticate with just the username and the cached key from an earlier successful login. Okta found and fixed it on Oct 30, 2024. It applies to you if you bcrypt anything besides the password on its own: a username and password together, an ID in front, a pepper.

Fix: hash the password on its own. OWASP's password storage guide says bcrypt "has a maximum length input length of 72 bytes for most implementations", so enforce a 72-byte maximum, and it recommends Argon2id for new systems. If you use an auth provider, let it do the hashing.

3. Forge your SAML login

With SAML single sign-on, the company's identity provider signs a message that says who you are, and your app trusts it. A bug in the Ruby library ruby-saml (CVE-2024-45409) meant, in the advisory's words, that an attacker "with access to any signed saml document (by the IdP) can thus forge a SAML Response/Assertion with arbitrary contents" and "log in as arbitrary user". GitHub's advisory scores it 9.9, and GitLab shipped a critical patch for it. It applies if your app offers SAML sign-in, usually because business customers asked for it.

Fix: GitLab's patch updated "omniauth-saml to version 2.2.1 and ruby-saml to 1.17.0". Whatever SAML library you use, keep it on its latest release.

4. Spoof your Microsoft login email

"Log in with Microsoft" hands your app an email address, and in Azure AD that email can be set to something the account doesn't own. Descope called this nOAuth: "In Microsoft Azure AD, the email claim is both mutable and unverified so it should never be trusted or used as an identifier". An app that finds the user by that email, or merges a Microsoft login into an existing account with the same email, hands the account over. Descope found it in a design app with millions of monthly users, among others.

Fix: Microsoft's own docs say to "use the immutable claim values tid and oid as a combined key", and never to use claims like email "to store or determine whether the user in an access token should have access to data". Match users on those IDs, and never merge accounts on an unverified email.

5. Brute-force 2FA with GraphQL aliases

GraphQL lets one request run the same query many times under different names, called aliases. A rate limiter that counts HTTP requests sees one request while the server checks hundreds of codes. PortSwigger: "Because aliases effectively enable you to send multiple queries in a single HTTP message, they can bypass this restriction." Their example guesses discount codes. A 2FA code, a reset code or a login works the same way. It applies if your app has a GraphQL API.

Fix: OWASP's GraphQL guide says to "put limits on incoming requests at the code level so that they can be applied per request", and to prevent batching for things you don't want brute-forced, naming usernames, passwords and OTPs. Count attempts per account on the server, and cap aliases per request.

6. Replay your 2FA code

An authenticator-app code is valid for its whole time step, 30 seconds by the standard's recommended default. If your server accepts the same code twice, anyone who sees it once (over a shoulder, in a phishing page, in a log) can use it too. The standard that defines these codes, RFC 6238, is direct about it: "The verifier MUST NOT accept the second attempt of the OTP after the successful validation has been issued for the first OTP". It applies if you check authenticator codes in your own code rather than through an auth provider.

Fix: keep the last accepted time step for each user and refuse any code from that step or earlier. That's how you meet the RFC's rule.

7. Freeze your server with a regex

Some regular expressions take exponentially longer on a crafted input, so one request can pin a CPU. OWASP calls it ReDoS and uses (a+)+$ as the example. It happened to Stack Overflow by accident in July 2016: the site was down for 34 minutes, and the postmortem said "The direct cause was a malformed post that caused one of our regular expressions to consume high CPU on our Web servers." It applies if you run regexes with nested repetition on user input: validation, parsing, search.

Fix: Stack Overflow's own: "This regular expression has been replaced with a substring function." Cap input length before any regex runs, and avoid nested quantifiers like (a+)+.

8. Sign a JWT with your public key

A JWT says which algorithm signed it. If your server believes it, an attacker switches RS256 (public and private key) to HS256 (one shared secret) and signs the token with your public key, which anyone can get. PortSwigger: "an attacker could sign the token using HS256 and the public key, and the server will use the same public key to verify the signature." It applies if you verify JWTs yourself with RS256 or ES256 keys.

Fix: pin the algorithm in the verify call, for example algorithms: ['RS256'], and never read it from the token. PortSwigger's advice is to use an up-to-date JWT library and "account for edge-cases such as JWTs signed using unexpected algorithms".

9. Smuggle a request past your proxy

When a front proxy and the server behind it disagree about where one request ends, an attacker can hide a second request inside the first. The classic version sends "both the Content-Length header and the Transfer-Encoding header into a single HTTP/1 request", so "the front-end and back-end servers process the request differently". PortSwigger calls these vulnerabilities "often critical in nature". It applies if you run your own reverse proxy or load balancer over HTTP/1.

Fix: PortSwigger's first recommendation is to "Use HTTP/2 end to end and disable HTTP downgrading if possible." Otherwise, keep the proxy and server patched and have them reject ambiguous requests.

10. Poison your cache with a header

A CDN decides what counts as "the same page" from a few parts of the request, called the cache key. If your app uses a header outside that key, say X-Forwarded-Host to build a script URL, an attacker sends one request with a bad value and the cache stores the result. From then on it "will be served to all users whose requests have the matching cache key." It applies if a CDN caches your HTML or API responses and your app reads headers like X-Forwarded-Host.

Fix: don't build responses from request headers. PortSwigger: "If a header isn't needed for the site to work, then it should be disabled", and restrict caching to purely static responses where you can.

11. Spoof past your rate limit

Behind a proxy, your app learns the visitor's IP from the X-Forwarded-For header. Express's docs say that with trust proxy set to true, the IP "is understood as the left-most entry in the X-Forwarded-For header", and that unless the proxy overwrites it, "it may be possible for the client to provide any value." So each request can claim a new IP, and a per-IP limit never trips. It applies if you rate-limit by IP and trust the header from anyone.

Fix: set trust proxy to the exact number of proxies in front of the app, or their addresses, which the same Express page documents. Limit sensitive actions per account as well as per IP.

12. Read past your RLS with a view

Row level security can be on and still be skipped. In Postgres a view runs with its creator's rights, and Supabase's docs say: "Views bypass RLS by default because they are usually created with the postgres user". They also say "A view over a protected table hands out every row its policies were meant to withhold". It applies if you use Supabase or Postgres RLS and have any views in an exposed schema.

Fix: Supabase's docs say you can "make a view obey the RLS policies of its underlying tables" by setting security_invoker = true (Postgres 15 and later). Or move the view to a schema the API doesn't expose.

13. Predict your Math.random() tokens

Math.random() is built to be fast, and its output can be predicted. MDN: "Math.random() does not provide cryptographically secure random numbers. Do not use them for anything related to security." A password reset token, invite code or session ID made with it can be guessed. It applies if any token, code or ID that guards something comes from Math.random(). Search the project for it.

Fix: MDN's own: "Use the Web Crypto API instead, and more precisely the Crypto.getRandomValues() method." In Node, crypto.randomBytes does the same job.

14. Guess your token by timing

A normal string comparison can stop at the first character that differs, so a guess that gets more characters right takes slightly longer to reject. Measure enough requests and the secret comes out a piece at a time. Node ships crypto.timingSafeEqual for this, which "does not leak timing information that would allow an attacker to guess one of the values". It applies if you compare API keys, webhook signatures or tokens with === or ==.

Fix: compare every secret with crypto.timingSafeEqual in Node, or your language's constant-time compare.

15. Padding-oracle your cookies

If you encrypt a cookie or token yourself in CBC mode, and your server answers differently when the padding is wrong, that difference leaks the plaintext. OWASP's testing guide: "The padding oracle attack enables an attacker to decrypt encrypted data without knowledge of the encryption key and used cipher", and it can encrypt data of the attacker's choosing too. It applies if you encrypt cookies or tokens yourself in CBC mode.

Fix: use authenticated encryption. OWASP's cryptographic storage guide says the authenticated modes "GCM and CCM" "should be used as a first preference". Or use your framework's encrypted sessions. The testing guide adds that a secure implementation gives "only two responses: ok and failed".

16. Pollute your prototype into RCE

In JavaScript every object inherits from a shared prototype. If your server deep-merges a request body into an object, a key named __proto__ writes onto that prototype, and every object in the process picks it up. PortSwigger: "server-side prototype pollution can potentially result in remote code execution (RCE)", through code that starts child processes. It applies if a Node server merges or assigns request bodies into objects.

Fix: validate bodies against a schema and block the keys __proto__, constructor and prototype. PortSwigger's prevention page says an allowlist of permitted keys "is the most effective way to do this", and suggests a Map for options and user-keyed data.

17. Run code in your templates

If user input becomes part of a template, instead of a value passed into it, the template engine runs it. PortSwigger: "an attacker can potentially achieve remote code execution, taking full control of the back-end server". The usual test is typing ${7*7} and seeing 49 come back. It applies if you build template strings from user input: emails, PDFs, custom pages.

Fix: pass input to templates as variables, never into the template text. PortSwigger's advice for user-written templates is a "logic-less" engine such as Mustache, or running them in a sandbox.

18. Read your files with XXE

XML can define an "external entity" that points at a file, and a parser with that feature on will paste the file into the result. PortSwigger: XXE "often allows an attacker to view files on the application server filesystem". It applies if you parse XML from users, which includes SVG and office-file uploads, RSS feeds and SAML.

Fix: PortSwigger: "it is sufficient to disable resolution of external entities and disable support for XInclude." Check your XML library's docs for the setting.

19. Hijack your WebSocket

Browsers send your cookies along when any site opens a WebSocket to your server. If the handshake checks nothing else, a page on another site can open the socket as your logged-in user. PortSwigger: it "arises when the WebSocket handshake request relies solely on HTTP cookies for session handling", and then "the attacker gains two-way interaction with the compromised application." It applies if you use WebSockets with cookie sessions.

Fix: PortSwigger: "Protect the WebSocket handshake message against CSRF". Check the Origin header on the handshake and require a per-session token in it.

20. Clone your username in Unicode

Apps turn usernames into one standard form so BigBird and bigbird count as the same name. Spotify's function gave a different answer the second time it ran on some Unicode names. Someone registered ᴮᴵᴳᴮᴵᴿᴰ, which became BIGBIRD at sign-up and bigbird when the reset link was used, and in Spotify's words "the new password was instead set for the 'bigbird' account". It applies if you allow Unicode in usernames or emails and normalize them in more than one place.

Fix: Spotify's was a wrapper that "rejects a name if old_prepare(old_prepare(name)) != old_prepare(name)". Normalize once at sign-up, store and compare only that form, and refuse any name that changes when normalized a second time.

Save this one. Run the prompt before you ship and again after every big feature. It reports first, so nothing changes until you say so.

Keep reading

Two minutes of questions, and our first call starts with the work instead of an intro.

Tell me about your appBuilds start at $500