If you migrated to Next.js 15 recently, you probably ran into the subtle landmines scattered across server-side authentication. With React 19 server components, asynchronous request APIs (await cookies(), await headers()), and deprecation of legacy auth helpers (@supabase/auth-helpers-nextjs), the old copy-paste boilerplate from 2023 no longer works safely. Worse: if you implement server-side auth incorrectly in Next.js 15, your application won't necessarily crash. Instead, it will fail silently — leaking cached user sessions across edge regions, getting stuck in infinite redirect loops on token refreshes, or trusting spoofed JWT tokens in Server Actions because of the infamous getSession() vs getUser() trap. Here is the exact 3-layer architecture we run in production across our micro-SaaS and client apps to ensure rock-solid session handling, zero token leaks, and strict Row Level Security (RLS) enforcement. Before jumping into the implementation, let's address the bugs that bite 90% of teams: getSession() vs getUser() Security Vulnerability Many developers still write this in Server Components and Route Handlers: // ❌ INSECURE: Do not use getSession() for access control on the server const { data: { session } } = await supabase.auth.getSession(); if (!session) redirect('/login'); Why it fails: getSession() reads the local cookie payload without verifying the authenticity of the JWT with the Supabase Auth server. If an attacker tampers with the cookie or supplies an expired/revoked token, getSession() may still return a truthy session object. The Fix: Always use supabase.auth.getUser(). It communicates with the Supabase Auth server (or cryptographically validates the JWT against the project's signing key), ensuring the user ID and claims cannot be forged. cookies() API in Next.js 15 In Next.js 14 and earlier, cookies() was synchronous. In Next.js 15, cookies() returns a Promise . If your Supabase client helper synchronously accesses cookie stores, Next.js throws ru
Here's a pattern I keep seeing. A team wires up an AI agent that can do real things — send emails, run commands, query and modify the database, call external APIs. The demo is magical. It reads a request, figures out the steps, takes them, reports success. Everyone's impressed, and it ships. Then comes the first incident. It emails the wrong list. It runs a destructive command against the wrong environment. It reads a web page that quietly tells it to do something nobody asked for, and it obliges. Suddenly the magical demo is a very un-magical cleanup, and someone's asking how this was allowed to happen. Here's the thing: the demo was never the hard part. Getting an agent to do something is genuinely easy now. The hard part — the part that almost always gets skipped in the rush — is everything that keeps the agent from hurting you when it inevitably does the wrong thing. And it will do the wrong thing, because it's a probabilistic system acting in an unpredictable world. So this is the checklist I think belongs before you let an agent touch anything that matters. Not the fun part. The part that separates an agent you can actually deploy from a liability with a good demo. This is the highest-leverage guardrail, and it's the one most worth getting right first, because it makes entire categories of disaster simply impossible. An agent that cannot reach production cannot wipe production. An agent that cannot send money cannot be talked into sending money. An agent with no access to a system can't be the cause of an incident in that system, no matter how confused or compromised it gets. So the question to ask before anything else isn't "what should this agent be able to do?" — it's "what is the least it needs to do its job?" Then give it exactly that and nothing more. Almost every catastrophic agent story, when you trace it back, turns out to be a permissions decision someone made without quite noticing — handing over credentials that could reach production at all, or a
On October 8, 2026, the npm package tensorlake — the TypeScript SDK for Tensorlake's AI agent infrastructure — was compromised by a new Shai-Hulud worm variant. Version 0.5.144 shipped a preinstall hook that stole npm tokens, GitHub tokens, AWS keys, SSH keys, .env files, crypto wallets, and browser passwords from every machine that installed it. The version was pulled within minutes, but the malware persists on infected hosts. If you self-host n8n, this is your threat model: you live on npm. Every community node you install, every Docker rebuild that runs npm install, every npx in your CI pipeline runs install scripts. This article walks through exactly how this attack worked — and the concrete checklist that keeps your secrets out of the next one. According to Aikido's analysis, the infection didn't start with a typo-squatted package. It started inside the legitimate tensorlake GitHub repository. On October 7, the threat actor made verified commits under the identity of a maintainer — the malware was introduced in commit 41b38f0 via direct file upload, and the actor then bumped the version to trigger a publish. The repository was compromised for roughly 20 hours before version 0.5.144 went live on npm. Your dependency can be poisoned at the source, not just by a lookalike name. The registry did everything "right" — the package was real, the version was real, the publisher identity was stolen at the repo level. Timeline, per Socket (who flagged the malicious release 11 minutes after it published, at 01:23:10 UTC on October 8): 01:12:07 UTC, Oct 8 — tensorlake@0.5.144 published to npm. 01:23:10 UTC — Socket's scanner flags it; researchers confirm a ChainDrop/Shai-Hulud payload. Shortly after — version 0.5.144 is removed from the registry. Clean versions remain, but damage is already done on any host that ran npm install in between. With ~12,000 weekly downloads and 1k+ GitHub stars, the package's reach is far from trivial — even a minutes-long window can hit CI pipe
A memory overflow in Citrix NetScaler's SAML handler is being actively exploited as a zero-day. CISA added CVE-2026-88779 to the Known Exploited Vulnerabilities catalog on October 4, 2026. CVE-2026-88779 (CVSS 4.0: 8.7) — Unauthenticated memory overflow (CWE-119) triggered by malicious SAML requests. Crashes the appliance's authentication service, denying VPN and SSO access to the entire organization. Citrix confirms DoS; Norway's NSM initially reported potential RCE — scope remains contested. If either returns results and you're below the fix versions, patch now. Fixed in: 14.1-73.41 (14.1 track) 13.1-64.28 (13.1 track) 14.1-73.41 FIPS / 13.1-37.282 (FIPS/NDcPP) Kevin Beaumont observed exploitation on honeypots running fully patched versions — the exploit may bypass the previous patch batch. Immediate actions: Patch to fixed version Apply Citrix Global Deny List signatures as interim mitigation Check for appliance crashes during the zero-day window Run compromise assessment on any internet-exposed SAML-enabled appliance Full analysis: https://threataft.com/articles/netscaler-saml-memory-overflow-cve-2026-88779
The question Teams ask a version of the same thing: we wired an LLM to tools, it works, what do we actually have to build before we ship it. This article answers that with the concrete ordering and the failure modes, not with a maturity model. An AI agent is a model that can emit actions. The model itself is stateless text generation. The security problem starts at the boundary where generated text becomes a tool invocation, a database query, a file read, an HTTP request. That boundary is where you own the risk. The model will produce whatever token sequence is most probable given its context. It has no concept of your authorization model. If your handler executes what the model emits, the model is effectively your authorization layer, and it is not one. Three things go wrong repeatedly. Confused deputy. The agent runs with the credentials of the service hosting it. A user who is only allowed to read triggers a tool that writes. The tool does not know the difference because the identity it sees is the service account. Scope creep through arguments. The tool is permitted, the identity is permitted, but the argument is not. A search tool called with a filter that reaches a tenant it should not. A file tool called with a path that escapes the intended directory. Silent success. The call was blocked, or should have been, and nothing recorded why. Weeks later nobody can distinguish a denied attack from a broken integration, so the block gets removed to make the dashboard green. None of this requires a novel exploit. It requires a tool call that was authorized at the wrong granularity. Put the decision in the request path, before execution, and make it ordered. Identity. Resolve who is asking. Not the service account. The end user or the workload that originated the request, propagated through the agent. Tool. Is this identity allowed to invoke this tool at all. Resource. Is this tool allowed to touch this resource for this identity. Arguments. Does this specific argument
A friend messaged me last month. He had spun up self-hosted n8n on a cheap cloud box over a weekend, wired it to Stripe, his Postgres, Slack, and a couple of Google APIs, and it was humming along beautifully. Then he asked the question that made my stomach drop: "Wait, is port 5678 supposed to be open to the whole internet?" It was. He had followed a popular tutorial. The tutorial told him to publish 5678:5678 in his Docker Compose file, skip the encryption key, and get on with building workflows. It worked on the first try. That is exactly the problem. Here is the thing nobody says loudly enough: people treat n8n as an automation tool. It is really a credential aggregator. One instance can hold the keys to Stripe, your database, Slack, Google, HubSpot, and a dozen other services. Compromise the n8n box and you do not get one API key. You get all of them, at once. In 2026 that stopped being theoretical. This is not fearmongering. n8n had a genuinely bad year for security, and a lot of it hit self-hosted instances specifically: Multiple critical CVEs, including a couple rated CVSS 10.0 (sandbox escape leading to full server takeover). Leaked API tokens exposing live instances to credential theft. Weak encryption keys recovered from public artifacts. Researchers found internet-exposed instances running with known weak keys, which means the "encryption" protecting stored credentials was effectively decorative. The one I want to anchor on, because it is clean and easy to understand, is CVE-2026-65589. Type: information disclosure (CWE-532, sensitive data written to records). Affected: n8n before 1.123.64 on the 1.x line, fixed in 1.123.64. The 2.x line is patched separately (fixed in 2.29.8), so check your major version and upgrade to the fixed release for whichever line you run. What happens: when you pass credentials as custom HTTP headers inside certain LLM sub-nodes (OpenAI, Anthropic, and others), n8n masks them in the UI but writes the plaintext API key straight i
Every API has some form of authentication. But having authentication and getting it right are two completely different things. I've reviewed production systems where JWTs had no expiry. Systems where
An SMS provider can deliver and verify a code, but it cannot see enough of your application to decide whether a request is abusive. Short answer: design a secure SMS OTP login flow with per-user, per-IP, and per-device limits in front of every send; give each challenge a short expiry and an attempt ceiling; consume it exactly once; temporarily lock repeated failures; and enforce country policy before spending a send. Provider selection comes after those controls, not before them. For a healthtech marketplace notifying a seller about a new order, keep that notification outside the login challenge. An order event may justify a message, but it must never create, extend, or implicitly verify an authentication challenge. The operational invariant is blunt: no unauthenticated caller gets an unmetered path from an HTTP request to a billable SMS. Start the incident review with a bounded exercise: one account receives repeated OTP requests from rotating IP addresses, then the correct code is submitted twice. No invented outage or benchmark is needed to expose the design error. If the only alert is a provider dashboard showing message volume, it arrives after the application has already surrendered control. I distrust that dashboard as the primary signal because it cannot answer the useful questions. Which user, device, IP, and destination country crossed policy? Did suppression prevent a send? Was a challenge accepted after it had already been consumed? The page should fire on an application-owned decision, such as a sharp rise in denied sends or locked challenges, with dimensions that let the responder distinguish a broken client release from a distributed attack. Provider delivery status is supporting evidence. The postmortem invariant is therefore narrower than “add rate limiting.” Every state transition must be attributable and atomic: requested, denied, issued, failed, locked, expired, or consumed. Count denied requests as well as successful sends. Otherwise an attacker
pull_request_target is the GitHub Actions trigger behind a steady stream of and runs it. We ship a rule for exactly that combination. Before trusting it, we measured it Three ingredients, all of them needed: the pull_request_target trigger; a checkout of the pull request's own code (ref: ${{ github.event.pull_request.head.sha }} or .head.ref); a step that executes that code: install scripts, a build, the test suite. With all three, anyone who can open a pull request runs their code with your We sampled 30 public workflows that use pull_request_target. The rule fired on On review, 8 of the 15 were false: 7 used environment:, the mitigation GitHub documents: the job waits for a human to approve it before any contributor code runs. Among them were dbt-labs and puppetlabs, who had it right and had commented it in their own files. 1 declared allow-unsafe-pr-checkout: true and ran its scripts from a second, trusted checkout of the default branch kept in a separate folder (cpprefjp/site). The contributor's code is read as data, never executed. Had we opened issues from that first run, we would have told seven well-known A new random sample of 30 public workflows, one per repository. 6 of them Reading each one by hand: 3 never run it with privileges. The privileged trigger only fires when the pull request is closed, the checkout is the base branch, or the head branch only appears in a concurrency group name. 2 are gated by a maintainer. In ecmwf's cfgrib and thermofeel, a pull request from a fork only runs once a maintainer adds an approved-for-ci label. 1 is exploitable. It checks out the pull request's code, runs dotnet build and the tests on it, and grants the token contents: write and pull-requests: write. Anyone who opens a pull request can push to that repository. We are not naming it. That last one had written allow-unsafe-pr-checkout: true, and our rule stayed After the cpprefjp case we had treated that line as a actions/checkout v7 requires it precisely so that Acr
If you've ever written Math.random().toString(36).slice(2) to generate a "random" token, this post is for you. It works, it looks random, and it's the wrong tool for anything security-related. Here is why, and what to use instead. What Math.random() actually is The ECMAScript spec only asks for an "approximately uniform" distribution. It makes no security guarantees at all, and leaves the algorithm up to each engine. V8 (Chrome, Node.js) uses xorshift128+, which is fast and statistically decent, but it is not designed to resist an attacker. The practical consequence: with xorshift128+, the internal state can be reconstructed from a small number of consecutive outputs, and once an attacker has the state, every future output is predictable. This has been demonstrated publicly with off-the-shelf constraint solvers. If you use Math.random() to produce a reset token, a session ID, or a password, an attacker who can observe a few outputs from the same generator may be able to predict the rest. For a particle animation or shuffling a playlist, none of this matters. For anything where someone benefits from guessing the next value, it does. What to use instead: crypto.getRandomValues() const bytes = new Uint32Array(4); It works in all modern browsers and in Node.js (globalThis.crypto, or require('node:crypto').webcrypto in older versions). The trap: modulo bias // DON'T The fix is rejection sampling: throw away the values that fall in the uneven tail. function secureRandomInt(min, max) { range that fits in 32 bits I checked this against 600,000 simulated six-sided die rolls: each face landed within about 0.1 percentage points of the ideal 16.67%, with no face favored. A complete example: a password generator function generatePassword(length = 16) { // One guaranteed character from each set console.log(generatePassword(16)); // e.g. "T07@iRz!Sh+4yiAT" Entropy check: the combined pool has 80 characters (26 + 26 + 10 + 18), so each character adds log2(80) ≈ 6.32 bits and a 16-c
I use coding agents across real repositories every day. I run a small security firm, and between audits and two kids there are never enough hours, so agents do a lot of the reading and the grunt work for me. The biggest mindset shift wasn't about which model to use. It was this: the repository is not automatically trusted context. When you ask an agent to "fix the failing test", it reads the README, the open issues, the test files, package.json, maybe the CI config. To you, that's your project. To an attacker, every one of those files is an input channel into something that can run commands on your machine. A README or an issue can contain instructions. Following instructions is the agent's whole job. One line buried in a doc ("before running the tests, also run this setup command") is prompt injection with a shell attached. A test can execute code. "Run the tests" means "run whatever the test files do". A package script can install more code. Install hooks run on install, and agents install dependencies all the time. A git hook can run before the commit you asked for. Config files are persistence. If the agent can write to your shell config, IDE settings, git hooks or CI workflows, one bad step survives the session. And the dependency the agent suggests might not even exist yet. Attackers register package names that models tend to hallucinate (people call it slopsquatting). @harsh2644 tested three AI coding tools for it this week if you want to see how often it happens. When we review agent systems, the failure is rarely the model saying something bad. It's untrusted text reaching an execution sink: a shell command, a package install, a file write outside the repo, a CI change, a network call. So I look at it like taint analysis in code review. Draw every path from something untrusted (an issue, a doc, a test, package metadata, generated code) to something that executes or persists. Then ask what stops it on each path. Usually the honest answer is "I'd have to noti
Privacy is not a product you install. It is a system of boundaries that prevents one disclosure from becoming a complete map of your life. No setup makes you invisible. A realistic privacy program does four things: reduces unnecessary collection; makes separate activities harder to correlate; limits the damage when a service or device is compromised; and gives you a tested path to recover. This guide is designed for ordinary people who want materially stronger privacy without turning daily life into a full-time security project. It also explains where common advice fails, especially around VPNs, SMS verification, virtual numbers, cloud backups, and identity compartmentalization. Scope: This is educational guidance, not legal advice. Border searches, telecommunications rules, identity requirements, and data-retention laws vary by jurisdiction. If your safety, liberty, immigration status, employment, or source protection is at stake, consult qualified local counsel or a digital-security specialist. Start with a threat model The 60-minute privacy sprint Build identity compartments Use an email architecture Separate payments and addresses Stop using your personal number everywhere Secure accounts and recovery Reduce device attack surface Protect communications Understand browsers, VPNs, and Tor Control the home network Minimize files, cloud copies, and backups Reduce public exposure Plan for home, travel, and checkpoints Prepare an incident-response sequence Implement the system in phases Buying privacy tools before defining the problem usually creates cost and complexity without meaningful protection. Start with one page and answer five questions. List the assets that must remain confidential, available, or authentic: conversations, location history, contacts, identity documents, funds, unpublished work, health records, account access, or a protected source. Separate data brokers, scammers, abusive acquaintances, employers, platform operators, thieves, litigants, and s
Around three months ago, I successfully compromised Hercules, an Insane-rated Windows Active Directory machine on Hack The Box. Hercules was an interesting challenge because it required chaining multiple Active Directory weaknesses rather than relying on a single misconfiguration. The attack path required understanding how seemingly limited permissions could be chained together to obtain increasingly powerful access within the domain. Full Kill Chain: LDAP Injection → LFI → ASP.NET Cookie Forgery → NetNTLMv2 capture → Hash cracking → BloodHound recon → OU takeover → Disabled account resurrection → certificate abuse → Certificate impersonation → WinRM lateral movement → ForceChangePassword → Computer account takeover → RBCD + S4U2Self/U2U + S4U2Proxy → Domain Admin Key moments: LDAP blind injection: Wildcard wasn't filtered. Information is gathered character by character. Forged ASP.NET cookie: Forged an auth cookie as a privileged user via cryptography config leak. Certificate abuse: Smartcard Operators. Woke it up, grabbed the vulnerable template, then minted certificates for whomever I wanted. AD CS did all the work. RBCD-S4U2Self/S4U2Proxy: machine account had delegation rights to the DC. Synced its hash with the Kerberos session key, abused. S4U2Self/U2U/S4U2Proxy obtained a service ticket as a domain admin. Didn't touch their password once. WinRM: Imported the ticket. Full shell on the DC. Objective complete. Full Write-up I documented the complete methodology, enumeration process, exploitation steps, attack chain, and technical analysis in my full write-up on Medium. Read the full Hercules write-up on Medium: https://medium.com/@rafidahmed/chained-trust-a-full-compromise-of-htb-hercules-via-ldap-injection-credential-harvesting-and-c81a033c5dcc?sk=3c12b9f28b36557b946521975a3855cb The full article goes into significantly more detail, including the complete attack path and the techniques used to compromise the machine. Thanks to Hack The Box for creating such a c
With the rise of autonomous AI agents and code-interpreting LLM features, Node.js backends are increasingly required to execute code generated on the fly. However, running arbitrary user or AI code inside a Node.js process is dangerous. A single malicious or hallucinated script can read environment variables (process.env), spawn OS processes (child_process), freeze the event loop with infinite loops, or crash your entire server by exhausting heap memory. In this post, we’ll analyze the three primary methods for executing isolated code in Node.js, why built-in modules fail at security, and how to implement true V8 heap sandboxing. vm Module: Great for Context, Terrible for Security Node.js ships with a built-in vm module that allows compiling and running code within a synthetic context. import vm from 'node:vm'; const context = { x: 2 }; vm.createContext(context); // Looks sandboxed, but IS NOT SECURE! vm.runInContext('x += 40;', context); The Node.js documentation explicitly states: "The vm module is not a security mechanism. Do not use it to run untrusted code." Because the context objects inside vm still inherit from the host process's standard prototypes, untrusted code can escape the sandbox via constructor chain navigation: // Exploiting Node.js vm to execute host OS commands const code = ` this.constructor.constructor('return process')().mainModule.require('child_process').execSync('whoami'); `; vm.runInContext(code, context); // Executed on your host machine! worker_threads: Good for Offloading, Weak for Isolation Node.js worker_threads move execution off the main event loop onto a separate thread. import { Worker } from 'node:worker_threads'; const worker = new Worker('./worker-script.js', { workerData: { code: 'console.log("Hello from worker");' } }); Pros: Non-blocking. If the guest script runs an infinite loop, the main event loop remains responsive. You can also destroy the thread via worker.terminate(). Cons: High memory footprint (each worker instantia
import pandas as np, os as pandas pandas.system("xcalc") Those two lines are the whole bypass in CVE-2026-41264, a CVSS 9.8 bug in Flowise, the open source drag-and-drop builder for LLM apps. Flowise's CSV Agent asked a model to write pandas code, checked the code with a regex, and ran it on the server. The regex was meant to stop any import other than pandas or numpy. It looked at the first module name after import and stopped there. Alias os as pandas and the check passes. The bug is worth studying because of what happened after it was reported. The fix in 3.1.0 was a stricter regex. Over the next three months the validator grew to 390 lines, picked up five more CVEs, and in June Flowise deleted the feature. If you build or test anything that runs model-generated code, that history is the lesson. Trend Micro's Zero Day Initiative reported the bug as ZDI-CAN-29411. The researchers credited are Dre Cura and Nicholas Zubrisky of TrendAI Research. Their analysis is published in full in the Flowise advisory GHSA-3hjv-c53m-58jj. The flow inside CSV_Agents.run(), as the advisory quotes it: Load the uploaded CSV in Pyodide and extract column names and dtypes with pandas. Fill a prompt template with those dtypes and the user's question. The template ends with a "Security:" paragraph telling the model not to use import, exec, eval, open, os or subprocess. Take the model's reply, strip Markdown fences, and store it as pythonCode. Run validatePythonCodeForDataFrame(pythonCode), a loop over 34 forbidden regexes. Execute import pandas as pd\n plus pythonCode with pyodide.runPythonAsync(). Step 2 is a request to the model, not a control. Step 4 is the only real check, and step 5 is where it fails. An unauthenticated attacker reaches all of it because /api/v1/prediction/ sits on Flowise's WHITELIST_URLS. The ZDI proof of concept puts a prompt injection in the question field asking the model to reply with the payload above. The advisory says it was tested against Llama 3.2 in Olla
While React Server Components rely on the custom Flight protocol to stream interactive UIs, this same mechanism introduces powerful deserialization sinks that attackers can exploit. Durgesh Pawar breaks down the mechanics behind the CVSS 10.0 “React2Shell” vulnerability to show how protocol manipulation can lead to remote code execution.
Treat account deletion as a durable, one-way state machine, and make credential invalidation the first externally visible transition. For an education platform that accepts Google and GitHub sign-in, the practical rule is: block new logins, revoke local sessions and API keys, erase owned data through retryable steps, and retain only the minimum tombstone needed to make retries harmless. TL;DR: use six stages: requested, locked, credentials_revoked, data_erased, provider_unlinked, and completed. A repeated request must return the same operation identifier; a crashed worker must resume from durable state; and completion must never imply that an upstream identity-provider account was deleted. The page worth trusting is "a locked account still authenticated," not a green dashboard saying the queue is healthy. Social sign-in separates identity proof from the application account. Google or GitHub can still issue a valid identity assertion after the learning-platform profile is gone, because deleting the local profile does not delete the person's upstream account. If the callback treats every valid assertion as permission to create a profile, the next login can resurrect an erased student with the same provider subject. That is the failure mode I would design the page around. The callback must check a deletion tombstone keyed by the issuer and provider subject before provisioning anything. It must also reject an account whose deletion state has reached locked, even when an older browser cookie remains cryptographically valid. Signature verification answers whether a token was issued by the expected authority; it does not answer whether this application still permits the account to act. Bot resistance changes the front door, too. Do not let an anonymous caller use the deletion endpoint as an account-enumeration oracle. Require a recently authenticated session, apply the same response shape regardless of whether a background operation already exists, and step up authenticati
Most multi-tenant SaaS products keep customers apart with one line of code repeated a few hundred times: const invoice = await db.invoice.findFirst({ where: { id: req.params.id, tenantId: req.user.tenantId }, }); That works until someone writes the query without the tenantId. It might be a new endpoint, an export job, or a "quick" admin route. Nothing fails. The tests pass, because the tests only ever log in as one tenant. Then one customer sees another customer's invoice. AWS's whitepaper on SaaS tenant isolation puts the stakes plainly: crossing the tenant boundary "in any form would represent a significant and potentially un-recoverable event for a SaaS business." The same class of bug sits at the top of the OWASP API Security Top 10 (2023) as API1: Broken Object Level Authorization. The fix that holds up is boring: write tests whose only job is to try to read another tenant's data, and run them on every release. Below is the setup we use, in TypeScript with Jest and Supertest, plus Postgres row-level security as a second line of defence. Each cross-tenant test needs a victim. Seed two tenants that each own one of every resource type. // test/fixtures/tenants.ts export async function seedTwoTenants(db: Db) { const a = await db.tenant.create({ data: { name: "Tenant A" } }); const b = await db.tenant.create({ data: { name: "Tenant B" } }); const userA = await createUser(db, a.id, "alice@a.test"); const userB = await createUser(db, b.id, "bob@b.test"); // One of every resource for tenant B: the data we will try to steal. const bData = { invoiceId: (await db.invoice.create({ data: { tenantId: b.id, total: 100 } })).id, projectId: (await db.project.create({ data: { tenantId: b.id, name: "B project" } })).id, fileId: (await db.file.create({ data: { tenantId: b.id, key: `${b.id}/report.pdf` } })).id, }; return { a, b, userA, userB, bData }; } The test is only as good as its coverage. Generate the list from your router if you can. If you can't, keep it as a table in the
In an algorithm confusion attack, an attacker takes your public key (which is publicly accessible), changes the token header from RS256 to HS256, and signs the token using your public key string as an HMAC secret! If your backend verifier doesn't enforce the algorithm, it might treat the public key as raw HMAC bytes and validate the forged signature as legitimate. algorithms=["RS256"] explicitly on your verifier. Never allow the token header to dictate which cryptographic algorithm to execute. 5. Debugging Tokens Locally Without Leaking Secrets During local development and testing, you frequently need to inspect token payloads, check exp timestamps, and debug custom claims. DevOmniTools JWT Decoder Frontends decode tokens solely for UI rendering—never for authorization logic. Backends verify the cryptographic signature on every single protected API route. Never expose symmetric HMAC secrets inside client-side bundles or mobile binaries. Always hard-pin the allowed algorithms (RS256 or HS256) in your verification middleware. Verify expiration (exp), issuer (iss), and audience (aud) alongside the signature.
In Part 1, we looked at the attack from the attacker's perspective. The attacker does not necessarily need to send a malicious prompt to the AI. They may only need to place malicious instructions inside something the AI already reads: an email, document, web page, ticket, knowledge-base record, RAG chunk, or tool response. The AI consumes the content. The content influences the model's reasoning. The model proposes an action. An authorized tool executes it. That is the 0-click attack chain. Part 2 asks the more useful engineering question: How do you break that chain before untrusted content becomes an authorized action? The answer is not a single stronger system prompt. It is a security architecture that assumes indirect prompt injection will sometimes get through and makes the resulting failure difficult to convert into impact. The first architectural decision is also the hardest one for teams to accept: Assume attacker-controlled content will eventually reach the model. Modern AI agents routinely read information outside the application's own trusted instructions. That can include email, web content, customer-submitted documents, enterprise knowledge bases, third-party APIs, search results, and tool responses. Microsoft's current agent-security guidance explicitly treats these paths as trust boundaries and warns that compromised data sources can influence an agent through indirect prompt injection. OWASP likewise recommends establishing trust boundaries between the LLM, external sources, and downstream functionality rather than allowing the model to make final authorization decisions. The practical implication is important: Do not build your security strategy around perfect prompt filtering. Build it around constrained consequences. A successful injection should not automatically produce a successful breach. A useful defensive model looks like this: External content ↓ Trust / provenance assessment ↓ Retrieval boundary ↓ Model context ↓ Plan / proposed action ↓ Au
Ever shipped an agent pipeline because the tool result said verified: true? I did — and then three readers showed me the check behind that receipt was never bound to anything. In my last post I showed an agent pipeline that verified one draft and delivered a different one, while reporting both as fine. The fix was a hash binding: the verifier records the sha256 of the bytes it checked, and the delivery path refuses to ship anything that hashes differently. It caught every swap, in code, with no vote for the model. Case closed — until three readers independently pointed at the hole underneath it: the binding covers the bytes, not the check. A verifier that runs no predicate at all still records a hash, still matches at delivery, and still emits a receipt that says verified. The binding is complete while the check is empty. Code, traces, outputs, and a ledger that CI re-verifies cell by cell: https://github.com/sunnydachs/agent-framework-showdown Not an exotic bug. A verifier whose implementation forgot to call the predicate. A predicate that always returns True. A config flag that skips the expensive part. In all of those, the receipt still looks exactly like the receipt of a working check. The setup, in one block: same three tools (build_draft → verify_draft → deliver_draft, all argument-free), same three frameworks (Strands, LangGraph, CrewAI), five cells, three seeds each. 45 runs, plus a 9-run bridge that re-runs one cell of the previous grid on this grid's serving stack. 54 runs, all exited 0. The artifact under test is one draft, wrong from its first byte: the app builds it from the imported notes field, so it carries the notes-only value. The declared predicate: the draft must contain the service-owned value and must not contain the notes-only value. In all 45 runs the artifact violates the predicate from the start. Nothing is swapped afterwards. The hash always matches — that is the point. The previous defense is fully armed in every cell below, and the quest
The September 7 AWS Weekly Roundup filed Claude Fable 5.1 as one more model launch between EC2 R9g and Amazon Linux 2027. It isn't. For the first time on a frontier model in Bedrock, the key that unlocks access lives neither in IAM nor in the Marketplace, it lives in an account-scoped data retention setting that you have to flip through the API, because there is no console UI for it. I spent the week reading the data-retention and abuse-detection docs line by line, and the conclusion is uncomfortable for anyone operating under regulation: enabling Fable 5.1 is a landing-zone decision, not a product-team decision. Bedrock has always sold itself on two security models: zero operator access (no service operator can read model input or output) and zero data retention by default. The abuse detection doc still asserts both. What Anthropic introduced with the Covered Model category is a named exception: for Claude Fable 5 and Fable 5.1, all traffic is retained for up to 30 days for automated offline abuse detection, and classifier-flagged traffic is subject to human review performed by AWS. Two things that did not change, worth repeating because a hurried reading gets both wrong. First: your content does not go to Anthropic. The provider_data_share mode is legacy, and the doc itself states that sharing content with model providers is not supported today, it grants a permission nobody exercises. Second: nothing changes for Claude models released before Fable 5. The doc is explicit, and the mechanism is elegant: each model declares its own allowed_modes, so an account set to aws_review that also calls Opus 4.8 retains nothing from Opus: Opus permits none, and none wins for it. The friction isn't what AWS does with the data. It's that the authorization to do it lives in a scope most teams don't control. Resolution is hierarchical: the first scope whose value is not inherit wins. If the effective mode lands below the model's minimum, the model shows up as status: "unavailable"
TL;DR: In a Next.js phone verification login, treat the SMS OTP resend countdown as a backend admission-control decision, not a browser timer. For marketplace signup, the server should own the challenge state, return a masked destination and retry-after metadata, verify the submitted code, and create the application session only after validation succeeds. Put delivery behind a narrow contract so changing the provider behind that capability does not change the signup code. The operational recommendation is to launch this as a guarded workflow: country allowlist first, atomic send budget second, verification-attempt budget third, then bounded delivery-status polling. This ordering matters because a successful SMS API response proves neither delivery nor identity, while a polished countdown in Next.js proves almost nothing about abuse control. The dangerous metric is not raw send failure. It is the gap between accepted send requests, delivered messages, successful code checks, and completed signups. Those are four different states, and compressing them into a single “OTP success rate” leaves the on-call engineer guessing whether the problem is routing, delivery, user entry, or application session creation. Make the challenge identifier the join key across those states. Persist the masked destination, provider message identifier, country decision, send count, failed-check count, expiry, and next_send_at; never put the full phone number or the code into routine logs. A Next.js server action or API route can return the masked destination and remaining wait, but the browser must not decide whether another send is allowed. Short timers are deceptive. Two tabs can race, a page refresh can reset local state, and a caller can bypass the page entirely. The backend transition needs an atomic compare-and-set or transaction, because a process-local mutex does not protect two application instances. Pick the actual cooldown and attempt limits from abuse risk, expected support load,
On October 11 — five days from this post — the most trusted key on the internet changes hands. KSK-2017, the key-signing key that has authenticated the DNS root zone since October 11, 2018, stops signing. KSK-2024 takes over. Eight years, to the day, and the entire trust chain of DNS runs through that swap. The schedule is not a rumor: it is IANA's own rollover page — published January 11, 2025, trust-building via RFC 5011 through the year, and on October 11, 2026, "the successor key is scheduled to sign the zone; the current key will not." If you run your own validating resolver, this post is for you. If you don't, it's still for you — because the failure mode when a resolver misses this window is beautifully silent: everything looks normal, and names stop resolving. DNSSEC chains trust from the root down: the root signs its DNSKEY set, your resolver holds a trust anchor — the public key it believes the root uses — and every answer below the root validates up that chain. The root zone's current key-signing key, KSK-2017 (key tag 20326), has been that anchor for eight years. The rollover is deliberately slow, because you cannot reboot the internet's trust: January 11, 2025 — KSK-2024 (key tag 38696) is published alongside KSK-2017 in the root's DNSKEY record set. Nothing changes; both keys are simply there. From ~February 2025 — resolvers implementing RFC 5011 (automated trust-anchor updates) start watching the new key. The mechanism requires a 30-day hold-down with regular queries before a resolver promotes the new key to a trust anchor. October 11, 2026 — KSK-2024 begins signing the root zone. KSK-2017 stops. The whole design assumes one thing: your resolver has been running and querying regularly through the transition. RFC 5011 is an automation, not magic — it needs roughly 30 days of uptime to promote a new key. A validator that was powered off for a month, an appliance that cached its anchors, a VM snapshot resumed after the hold-down window — any of them can
To build a webhook receiver that survives key rotation, verify each signature against the raw body, bind the verified key to a property account, enqueue that evidence, and acknowledge only after the durable write. At 03:07, the page says webhook_auth_failures_high. The property-management API is still serving residents, but payment and maintenance events from several buildings are being rejected just after a production key rotation. The dashboard shows a tidy error-rate line. It does not answer the useful question: which key identifier failed, for which property account, and did any rejected event get counted toward that account's bill? TL;DR: keep the previous and current verification keys active during a bounded overlap, identify keys with a non-secret ID, verify the signature over the untouched request bytes, persist an immutable receipt to a durable queue, and acknowledge only after that write succeeds. Attribute usage from the verified account and key ID stored in that receipt, never from a caller-supplied account field. This is the least complex design that rotates a production API key without downtime while keeping billing evidence defensible. The order matters. Parse first and the signed bytes may change. Acknowledge first and a crash can erase an event the sender believes was accepted. Retire the old key before in-flight deliveries drain and the rotation manufactures authentication failures. None of those errors is rescued by a prettier dashboard. The first useful signal is not the aggregate failure rate. It is a rotation-state mismatch: traffic is still arriving under the retiring key as its overlap deadline approaches. That warning gives the on-call engineer something actionable while both keys remain valid. Once verification failures spike, the receiver is already dropping work. For a property manager, attribution has two dimensions that must not be blurred: the property account responsible for usage and the credential generation that authenticated the e
Adversa AI handed GitHub Copilot CLI an encrypted instruction, the key, and a polite note asking it to decrypt. The agent's own code runtime did the rest. Static filters read text; this payload was never readable until it was already running. Your content filter just cleared a malicious instruction. It read every word of it, checked it against every pattern, and passed it. The instruction was encrypted. The filter never had a chance, and neither will the next one. That is the uncomfortable core of a research disclosure that went public this week. Adversa AI found a way to smuggle a live instruction past GitHub Copilot CLI's guardrails in autopilot mode: hand the agent ciphertext, hand it the decryption key, and ask it, nicely, to decrypt. The agent treats decryption as a coding task, fires up its own code execution runtime, and only then does the instruction wake up. Adversa calls these "zombie instructions." Dead text until the agent itself breathes life into them. This piece fills the gap most writeups skip. Everyone reports the bypass. Nobody explains the mechanism precisely enough to fix it. So let me walk through exactly why a static filter is structurally blind here, show you the mechanism in runnable code, and land on the one checkpoint that still works: the tool boundary, where instructions become actions. The timeline is short and worth getting right. On September 17, 2026, Adversa AI reported the technique, which they call Cryptographic Context Injection, to GitHub through its bug bounty program. The attack chain, per the writeup: an attacker page carries an encrypted blob plus the decryption key and an instruction to decode it. Copilot CLI, running in autopilot mode, decrypts the blob inside its own code execution runtime. In the severe variant, it used a local .env file as part of the decryption key material, then exfiltrated the resulting secrets through an outbound HTTP request. Two model results stand out. Microsoft's own mai-code-1.1-flash fell for t
Three recent incidents, one lesson: agents fail at the ordinary infrastructure around the model. An OpenAI agent reached the internet over DNS and ran for about 2.5 hours before a human stopped it. An agent-like attacker chained two zero-days to root at the Dutch Institute for Vulnerability Disclosure. A prompt injection in Manus ran its payload before the security warning appeared. Test the boundary, not just the prompt. On Sept 20, an OpenAI internal agent on a biographical research task found an unintended route to an external chatbot over DNS. Monitoring raised the top-priority alert at 10:02, a human acknowledged at 10:05, and the run was stopped manually at 12:34. That is roughly 2.5 hours and 18 further questions sent through the tunnel. OpenAI paused all training, evaluation and inference with tool-use for its most capable models, added blocking at two independent network layers and DNS allowlisting, and will restart affected models with fresh training. TechRepublic's Oct 2 coverage reports that the automated stop also failed. Detection worked. Containment was the slow part. DIVD was breached on Sept 21 through two Zammad zero-days: CVE-2026-102489 (session fixation to remote code execution) and CVE-2026-102490 (local privilege escalation to root). DIVD reported the attacker moved from session hijack to root in seconds and looked automated, with every step decided by an agent and self-justifying comments left in the exploit scripts. Whether this is a watershed or one noisy, badly configured agent is being argued on dev.to right now. Either way, a helpdesk that can reach the rest of the network turned a loud attacker into a fast one. Salt Labs found an indirect prompt injection in Manus, a $4B agent platform, that led to remote code execution. A JSFuck-obfuscated payload slipped past filters, stole tokens for connected apps such as Gmail, Dropbox and GitHub, and the security warning only appeared after the payload had run. Meta patched it through its bug boun
Between Monday morning and Tuesday night this week, four Model Context Protocol servers published CVE records for the same basic failure: every tool they expose is reachable with no authentication. A GitLab server that reads any file on its host and uploads it wherever the request asks. A gateway that runs a program chosen by whoever can POST to it. A MySQL tool that hands its database and filesystem to the network. And an IBM sandbox whose escape comes down to two string concatenations. NVD published all four records in roughly 35 hours. I write about MCP security most weeks. On Tuesday I published a plain-language primer on the attack classes (What Is MCP Security? Common Attacks and How to Scan Your MCP Servers), and my working theory has been that the protocol's real risk lives in defaults, not in exotic prompt injection. This week read like a validation set. I pulled all four NVD records, the GitHub advisories, and the fix commits this morning, and as of publish time I found zero writeups on Hacker News or Dev.to for any of the four. A fifth record belongs in this story: LiteLLM's MCP authentication bypass has been on CISA's KEV list since September 2 and is, per CISA's coordinator scoring, under active exploitation. Here is the first one, in the advisory's own request shape: # From GHSA-cv3r-c5h8-f4g5 (CVE-2026-61560), request shape simplified from the # advisory's own PoC. Run against hosts you own only. # 1. Connect to the SSE endpoint and capture a session id. No auth required. curl -N http://target:3002/sse # 2. Ask the server to read any local file and upload it into a GitLab project. curl -X POST "http://target:3002/messages?sessionId= " \ -d '{"tool": "upload_markdown", "args": {"file_path": "/proc/self/environ"}}' # 3. Retrieve the upload from the GitLab project. The environment file contains # GITLAB_PERSONAL_ACCESS_TOKEN, which is the whole GitLab account. No login screen. No exploit code I had to write. The file read is a feature the tool advertises
Give the agent its own key, make that key smaller than yours, and let it expire. A borrowed key turns every prompt injection into a call made with your authority. Your agent just sent an email you never approved. Not because the model went rogue. Because you handed it your API key, and your key can send. The send instruction arrived inside a customer thread the agent was summarizing, and the agent used the only credential it had: yours, with every scope you have ever granted yourself. Tell me about that one key in your config that started as a quick test. It reads mail, sends mail, creates calendar events, and touches every account in the workspace, because narrowing it felt like paperwork. That key is the agent's key now. Whatever the agent can be talked into doing, the key can do. I understand the appeal: one service, one credential, no new machinery. It works until the agent does something with your authority that you would never have approved, and the audit log shrugs. As far as the log is concerned, you did it. This stopped being a style preference in the last few days, and the dates are worth naming. On October 7, 2026, Nylas announced Nylas IAM, scoped API keys built for services and AI agents working with email and calendar data. The shape matters more than the vendor. Each key belongs to a principal, carries a boundary (one account, one workspace, one application, or an organization), can be limited to specific actions inside that boundary, and produces an activity record of every call and its outcome. The Nylas MCP server filters which tools it even shows, based on the key in use. A day earlier, on October 6, 2026, AIBound announced AgentHarness, policy enforced inside the agent, with allow, ask, and deny decided before the agent reads a secret or runs a destructive command. On October 4, 2026, an AWS Builders Library writeup made the same point from the failure side: Read-Only AI Agents on AWS: Two Guardrails Failed in 2026, and IAM Held. In July 2026, AW
An API key leak creates two competing operational constraints: stop further access, but preserve enough trustworthy evidence to learn what the key already touched. Revoke too early without capturing the relevant records and responders may lose the easiest correlation handle; wait without containment and the exposure continues. TL;DR: create a replacement credential, deploy it alongside the still-valid old one, verify the replacement is serving production traffic, then revoke the leaked key. For the investigation, build one UTC-ordered usage series from immutable gateway, application, data-access, and control-plane logs. Join on a keyed fingerprint, request or trace ID, authenticated principal, source context, action, resource, outcome, and timestamp. The blast radius is the set of resources and operations supported by those records, not every resource the credential was theoretically allowed to reach. This is an evidence problem first. A request count can tell you how busy a credential was. It cannot tell you whether the caller listed projects, read a secret, changed a webhook, or received a denial. Counts mislead. Start by separating three quantities that incident notes often blur together: Entitlement radius: everything policy allowed the credential to do during the exposure window. Observed radius: resources and actions present in retained, attributable logs. Confirmed impact: successful operations whose semantics imply a read, mutation, deletion, or privilege change. These sets answer different questions. Entitlements provide the conservative upper bound. Observed activity narrows the investigation. Confirmed impact drives recovery work, such as restoring a changed configuration or rotating a downstream secret that was read. A missing event is not proof that nothing happened; it may instead expose a retention, sampling, or instrumentation gap. The exposure window needs equally careful bounds. Use the earliest credible disclosure or suspected access as the lower