
Auditing React Builds for React2Shell Before Rotating Cloud Keys
On this page
Introduction: Close the Exposure Path Before Replacing Credentials
This post is a hands-on audit workflow for React builds tied to the React2Shell flaw behind the React2Keys credential theft campaign: how to establish applicability from a real advisory, inventory what actually ships in your build artifacts, triage which cloud and AI credentials were reachable, and rotate keys in an order that does not hand the replacement to the same foothold.
Two reports in the supplied source set — both timestamped 2026-11-30 — describe a campaign called React2Keys that allegedly abused a flaw called React2Shell to take credentials. Hackread's headline claims more than 50,000 stolen credentials; theoptimist.news frames the same haul as "AI & Cloud keys" and adds an India ranking.
That is enough to start an audit. It is not enough to write a response plan from the headlines alone. The instinct after a story like this is to open the cloud console and start rotating keys. That instinct is backwards, and it is the single most common way teams turn a contained exposure into a second one.
State the technical position: contain affected workloads, verify deployed fixes, and rotate credentials from a trusted environment
Rotation is a write operation into your own secret stores. If the process that read the old credential is still running, still has a route to your secret manager, or still has a compromised build runner, the "new" credential is delivered straight to the same attacker. You have not rotated anything. You have re-keyed their access.
The order I work in, and the order this post follows:
- Contain the workload (stop it reading anything new).
- Establish applicability — does an advisory actually match what you deploy?
- Verify the artifact that ships, not the repository that builds it.
- Investigate which secrets were reachable, separating access from confirmed theft.
- Rotate from clean infrastructure, then convert the whole exercise into a deployment gate.
Rotating a credential while a suspect workload is still executing and still able to reach your secret store can hand the replacement to the same foothold. Contain first. The only exception is active abuse, covered below.
Define the walkthrough scope: a read-only dependency and artifact audit, deployment verification, exposure triage, and a controlled credential cutover
Scope discipline matters here, because "audit the React app" is unbounded. What follows covers:
- A read-only inventory of packages extracted from built artifacts — no importing application modules, no lifecycle scripts, no network.
- Deployment-record verification via image digests and build provenance.
- A credential reachability matrix and a way to tell "possibly reachable" from "evidence of use".
- A provider-neutral cutover state machine with explicit failure branches.
Out of scope: exploit development, payloads against production, and any guessing at advisory identifiers. If the primary advisory for "React2Shell" isn't in front of you, the honest output of step 2 is "no matching advisory found yet" — a finding, not a clearance.
What the React2Keys Reports Establish—and What They Do Not
Attribute the November 30, 2026 reporting: Hackread describes more than 50,000 stolen credentials, while theoptimist.news describes AI and cloud keys
Per the supplied source listings:
| Publisher | Timestamp (per listing) | Claim in the supplied snippet |
|---|---|---|
| Hackread | 2026-11-30T20:51:57Z | React2Keys campaign stole over 50,000 credentials "using React2Shell flaw" |
| theoptimist.news | 2026-11-30T20:19:40Z | 50,000 "AI & Cloud keys"; India ranked #2 |
Both are secondary reporting. Neither snippet attributes a specific advisory, CVE record, vendor bulletin, or original research write-up. I am treating the numbers as claims to be corroborated, not measured facts.
Separate campaign claims from confirmed technical facts: the supplied snippets do not establish affected versions, exploitation mechanics, exposure dates, or whether a particular application was compromised
This distinction decides what you can put in an incident ticket. Writing "we were affected by React2Shell" when no advisory match exists creates a false record that outlives the incident.
| Claim | Source | Status | What would actually confirm it |
|---|---|---|---|
| >50,000 credentials stolen | Hackread | Unverified secondary claim | Victim disclosures, vendor telemetry, law-enforcement or CERT statement |
| Stolen items are AI and cloud keys | theoptimist.news | Unverified secondary claim | Same, plus a sample of affected credential types |
| A flaw named "React2Shell" exists | Both headlines | Name only | A matching advisory with package names, affected ranges, fixed versions |
| Affected React/framework versions | — | Not stated in supplied material | Advisory text |
| Exploitation mechanics | — | Not stated in supplied material | Original research or advisory write-up |
| Exposure window | — | Not stated in supplied material | Incident timeline from a primary source |
| Whether your app was compromised | — | Unknown by definition | Your own logs, audit events, and artifact digests |
The practical consequence: act on the risk immediately, because containment is cheap and reversible, but do not close the ticket on the claim. Match an advisory before you write anything into a compliance record.
Treat the secondary headline's India ranking as an attributed, unverified claim rather than evidence for prioritizing individual deployments
"India #2" is a geographic distribution claim from one secondary outlet. It says nothing about a specific deployment, and it is exactly the kind of detail that gets repeated until it becomes received wisdom. If you operate in the region, that is a reason to check your own telemetry — not a reason to treat your fleet as more exposed than a fleet elsewhere with the same dependency graph and the same public entry points. Prioritize by data you collected, not by a ranking in a headline.
Establish React2Shell Applicability Before Labeling a React Application Vulnerable
Consult the official React and framework advisories to establish the affected server-side functionality, package names, version ranges, and supported fixes
The supplied snippets do not link an advisory, so the first task is locating one. The sources I check, in order:
- The GitHub Advisory Database entry search for the package names you actually depend on.
- The React project's own security/versioning documentation.
- The framework's security advisories page (Next.js, Remix, Astro, Waku — whichever your app uses).
- Your package manager's audit endpoint, which reads from a curated advisory feed and will show the advisory ID it matched.
For each advisory you find, record exactly these fields before touching code:
advisory_id: <the identifier printed by the advisory database>
ecosystem: npm
packages: [<exact package names from the advisory>]
affected: <the range text, verbatim>
fixed_in: <the version text, verbatim>
requires: <server runtime? build tooling? both?>
If a search for "React2Shell" turns up nothing that matches, write advisory_id: none-found and keep looking on a schedule. Two outcomes are more likely than "the flaw is fake": the campaign label differs from the advisory title, or the reporting is imprecise. Either way you keep the applicability question open — you do not declare the fleet clean.
Distinguish client-only bundles, server-rendered applications, and React Server Components deployments without treating React usage alone as proof of exposure
"Runs React" is not a vulnerability class. What matters is which React code executes on infrastructure you control.
| Deployment shape | Runs on your server | Where a server-side flaw could live | What to inventory |
|---|---|---|---|
| Static SPA, client-only bundle | Static files only | Not in React's server runtime; check the same repo for an SSR service | Build output dir, source maps |
SSR (renderToString, renderToPipeableStream) | react-dom/server | Server renderer + your render inputs | Container image, node_modules, entrypoint |
| RSC / framework server runtime | React server renderer + framework router + bundler output | Framework runtime, standalone bundle | .next/standalone, .output/server, .open-next |
| Edge/serverless functions | Bundled function code | Bundled React + framework adapter | Deployment package, layer contents |
A static export genuinely is not exploitable through a server-side React flaw — but the same monorepo often deploys an SSR service from another pipeline. The unit of applicability is the deployed artifact, not the repository.
Build an applicability table linking each service to its framework, runtime packages, public entry points, deployment revision, and advisory status
Fill this in per service. The example rows are illustrative — replace every cell with something you read from your own systems.
| Service | Framework | Server React? | Public entry points | Deployed digest | Advisory status |
|---|---|---|---|---|---|
| storefront-web | static export | no | CDN only | sha256:…a1 | not applicable (verify no SSR sibling) |
| storefront-ssr | Next.js App Router | yes | /, /product/* | sha256:…b7 | unresolved — advisory not yet matched |
| admin-api | Node/Express | no React | /api/* | sha256:…c3 | not applicable |
What makes this table useful is that "unresolved" is a legal, visible state. It stops a team from converting "we didn't find the advisory" into "we're fine".
Contain Suspect Workloads and Preserve Evidence
Restrict or remove exposed workloads using trusted infrastructure controls; explain why key rotation alone cannot stop a compromised process from reading replacements
Containment means cutting the paths a compromised process uses to acquire new material:
- Remove the workload from the load balancer or scale it to zero.
- Apply a default-deny egress policy for the workload's namespace/service account.
- Block the workload's identity from reading the secret manager (policy change, not app change).
- In containers, block the cloud instance metadata endpoint for that pod if your platform allows it.
Only after those are in place does rotation become meaningful. A process that cannot reach the secret store, and is not receiving traffic, cannot harvest the replacement.
Containment is reversible. Secret deletion is not. Do the reversible thing first, while you still have logs and running processes to inspect.
Preserve deployment identifiers, image digests, build records, application logs, and cloud audit events without exporting secrets or executing suspect application code
Capture identifiers before you terminate anything:
## image digest actually running
docker inspect --format '{{.Image}}' storefront-ssr
docker image inspect --format '{{index .RepoDigests 0}}' "$(docker inspect -f '{{.Image}}' storefront-ssr)"
## what the orchestrator thinks it deploys
kubectl get deploy -A -o jsonpath='{range .items[*]}{.metadata.namespace}/{.metadata.name}{"\t"}{.spec.template.spec.containers[*].image}{"\n"}{end}'
## which function versions exist (including rollback candidates)
aws lambda list-versions-by-function --function-name storefront-ssr
## write a filesystem snapshot without starting the entrypoint
docker create --name r2k-snapshot registry.example.com/app@sha256:...
docker export r2k-snapshot -o /evidence/r2k-snapshot.tar
docker create does not run the entrypoint, so docker export gives you the shipped filesystem for offline auditing without executing application code. That is the artifact you inventory in the next section.
When pulling audit events, pull metadata only:
aws cloudtrail lookup-events \
--lookup-attributes AttributeKey=EventName,AttributeValue=GetSecretValue \
--start-time 2026-11-01T00:00:00Z \
--max-results 50
Expect a result set, not a clean bill of health. Two gaps to check explicitly, because they quietly hide the answer: S3 data events are not logged by default, and a trail created in one region will not cover a workload running in another. If either gap exists, note it as an uncertainty — do not substitute "no events" for "no access".
Define the emergency exception: disable actively abused credentials or sessions immediately, accepting service disruption when necessary
The exception is narrow and it is about observed use, not suspicion. If you see the credential being used from an unknown principal, IP, or region right now — deactivate it immediately, before containment completes. Accept the outage. A dead service is recoverable; an active adversary with write access to your artifact registry is not, cheaply.
Everything else follows the ordered path.
Trace Dependencies From the Repository to the Running Release
Record Node.js and package-manager versions, workspace boundaries, lockfiles, build commands, and the commit associated with each deployed artifact
Different npm versions resolve different trees from the same package.json. Capture the toolchain alongside the commit, or your rebuild won't be reproducible:
node --version
npm --version
git rev-parse HEAD
git status --porcelain # a dirty tree means the image is not rebuildable from this commit
npm ls --workspaces --depth=0
Note the lockfileVersion in your lockfile too: a v3 lockfile read by an older client is a classic source of "but it worked locally".
Use npm ls and npm explain to trace advisory-listed packages, including transitive copies, workspace differences, and nonzero exit codes
npm ls react-dom --all
npm explain react-dom
npm ls <pkg> tells you which copies exist and who depends on them; npm explain <pkg> tells you why a particular copy is there. Output shape (versions elided on purpose):
[email protected] /srv/app
├─┬ framework@<v>
│ └── react-dom@<v>
└── react-dom@<v> <- second copy, hoisted differently
Two copies at different versions is the normal failure mode, not an exotic one. One gets patched; the other keeps the vulnerable transitive path alive.
On exit codes: npm ls exits non-zero when the tree doesn't resolve as declared (missing or invalid peers, unmet deps). That nonzero exit is a tree-integrity signal, not a vulnerability signal, and a zero exit is not a clean bill of health either — documented CLI behavior, not a security verdict.
Explain why package.json ranges, a clean npm audit result, and a locally updated lockfile are not sufficient evidence that production is fixed
Three separate reasons, and teams routinely collapse them into one:
- A range is not an installation.
"^1.2.0"describes what may be installed. Only the resolved tree — and the tree inside the built image — is a fact. npm auditanswers a question about the tree you pointed it at, at the moment you ran it. During a fresh disclosure, the advisory feed lags. A clean result on the day of the news is expected, not exculpatory. Re-run it after the advisory lands, against the artifact, not the repo.- A local lockfile update changes nothing in production until an image is rebuilt, pushed, and rolled out. The digest in the orchestrator is the ground truth. I have watched a team "fix" a CVE three times in a week while the running replica kept the original digest, because a deployment gate was quietly pinning an older tag.
Build a Read-Only JavaScript Audit for Extracted Build Artifacts
Present one complete Node.js script that inventories installed package manifests under explicitly supplied artifact roots without importing application modules or running lifecycle scripts
What makes this safe to run on a suspicious artifact: it reads only package.json files, never import()s anything from the artifact, never invokes npm (so no lifecycle scripts), never reads .env, .npmrc, or process environment, and never writes to the artifact.
#!/usr/bin/env node
// Read-only package inventory for extracted build artifacts.
// Usage: node audit-artifacts.mjs <artifact-root> [<artifact-root> ...]
// Emits JSON to stdout. Never imports app code, never runs install scripts.
const MAX_DEPTH = 6;
const roots = process.argv.slice(2);
if (roots.length === 0) {
console.error("usage: node audit-artifacts.mjs <artifact-root> [...]");
process.exit(2);
}
const report = { roots, packages: [], missing: [], errors: [], symlinks: [] };
const rel = (p) => path.relative(process.cwd(), p) || ".";
async function readManifest(pkgDir) {
const manifestPath = path.join(pkgDir, "package.json");
let raw;
try {
raw = await readFile(manifestPath, "utf8");
} catch (err) {
if (err.code === "ENOENT") { report.missing.push(rel(pkgDir)); return; }
report.errors.push({ path: rel(manifestPath), code: err.code ?? "UNKNOWN" });
return;
}
let pkg;
try {
pkg = JSON.parse(raw);
} catch {
report.errors.push({ path: rel(manifestPath), code: "EPARSE" });
return;
}
report.packages.push({
name: typeof pkg.name === "string" ? pkg.name : null,
version: typeof pkg.version === "string" ? pkg.version : null,
manifest: rel(manifestPath),
});
}
async function scanNodeModules(nmDir, depth) {
if (depth > MAX_DEPTH) return;
let entries;
try {
entries = await readdir(nmDir, { withFileTypes: true });
} catch (err) {
report.errors.push({ path: rel(nmDir), code: err.code ?? "UNKNOWN" });
return;
}
for (const entry of entries) {
if (entry.name.startsWith(".")) continue;
const abs = path.join(nmDir, entry.name);
if (entry.name.startsWith("@")) {
let scoped;
try {
scoped = await readdir(abs, { withFileTypes: true });
} catch (err) {
report.errors.push({ path: rel(abs), code: err.code ?? "UNKNOWN" });
continue;
}
for (const s of scoped) {
const scopedAbs = path.join(abs, s.name);
if (s.isSymbolicLink()) report.symlinks.push(rel(scopedAbs));
if (s.isDirectory() || s.isSymbolicLink()) await visitPackage(scopedAbs, depth);
}
continue;
}
if (entry.isSymbolicLink()) report.symlinks.push(rel(abs));
if (entry.isDirectory() || entry.isSymbolicLink()) await visitPackage(abs, depth);
}
}
async function visitPackage(pkgDir, depth) {
await readManifest(pkgDir);
await scanNodeModules(path.join(pkgDir, "node_modules"), depth + 1);
}
for (const root of roots) {
const absRoot = path.resolve(root);
await scanNodeModules(path.join(absRoot, "node_modules"), 0);
// framework output layouts that ship their own dependency tree
for (const candidate of [".next/standalone", ".output/server", "dist/server"]) {
await scanNodeModules(path.join(absRoot, candidate, "node_modules"), 0);
}
}
// duplicate-copy summary: the thing that actually hides a stale version
const byName = new Map();
for (const p of report.packages) {
if (!p.name) continue;
if (!byName.has(p.name)) byName.set(p.name, new Map());
byName.get(p.name).set(p.version, (byName.get(p.name).get(p.version) ?? 0) + 1);
}
report.duplicates = [...byName.entries()]
.map(([name, versions]) => ({
name,
copies: [...versions.values()].reduce((a, b) => a + b, 0),
versions: [...versions.keys()].sort(),
}))
.filter((e) => e.copies > 1)
.sort((a, b) => a.name.localeCompare(b.name));
report.packages.sort((a, b) =>
(a.name ?? "").localeCompare(b.name ?? "") || (a.version ?? "").localeCompare(b.version ?? "")
);
console.log(JSON.stringify(report, null, 2));Report package names, installed versions, manifest paths, missing metadata, and unreadable directories while excluding environment values and credential material
The report is deliberately narrow. It emits name, version, and manifest — nothing else from the file. It does not touch scripts, dependencies metadata, or any dotfile. Two reasons: a manifest can contain publish tokens in publishConfig, and a JSON dump of a suspicious artifact will end up pasted into a ticket.
missing and errors are first-class output, not noise. An unreadable directory (EACCES) or a manifest that won't parse (EPARSE) is a coverage gap, and coverage gaps are exactly how a stale copy survives a dependency audit.
Run the script against a synthetic fixture containing stale and updated package copies; show clearly labeled expected output rather than claiming an unperformed production test
I built a fixture with two extracted artifacts — an old release, and a rebuild that left a stale duplicate behind. Versions below are fixture-only strings, not real releases; the script does not care what they are.
/tmp/r2k-fixture/
├── release-old/node_modules/
│ ├── react/package.json {"name":"react","version":"1.0.0-fixture"}
│ ├── react-dom/package.json {"name":"react-dom","version":"1.0.0-fixture"}
│ └── framework/node_modules/
│ └── react-dom/package.json {"name":"react-dom","version":"1.0.0-fixture"}
├── release-new/node_modules/
│ ├── react/package.json {"name":"react","version":"1.1.0-fixture"}
│ └── react-dom/package.json {"name":"react-dom","version":"1.1.0-fixture"}
├── release-new/node_modules/@scope/linked -> ../../shared/@scope/linked
└── release-new/node_modules/.bin/ (ignored)
node audit-artifacts.mjs /tmp/r2k-fixture
Expected output — derived from the script above and the fixture description, not captured from a production run. Treat it as a specification of what the script prints:
{
"roots": ["/tmp/r2k-fixture"],
"packages": [
{ "name": "react", "version": "1.0.0-fixture", "manifest": "../tmp/r2k-fixture/release-old/node_modules/react/package.json" },
{ "name": "react", "version": "1.1.0-fixture", "manifest": "../tmp/r2k-fixture/release-new/node_modules/react/package.json" },
{ "name": "react-dom", "version": "1.0.0-fixture", "manifest": "../tmp/r2k-fixture/release-old/node_modules/react-dom/package.json" },
{ "name": "react-dom", "version": "1.0.0-fixture", "manifest": "../tmp/r2k-fixture/release-old/node_modules/framework/node_modules/react-dom/package.json" },
{ "name": "react-dom", "version": "1.1.0-fixture", "manifest": "../tmp/r2k-fixture/release-new/node_modules/react-dom/package.json" }
],
"missing": [],
"errors": [],
"symlinks": ["../tmp/r2k-fixture/release-new/node_modules/@scope/linked"],
"duplicates": [
{ "name": "react", "copies": 2, "versions": ["1.0.0-fixture", "1.1.0-fixture"] },
{ "name": "react-dom", "copies": 3, "versions": ["1.0.0-fixture", "1.1.0-fixture"] }
]
}
The duplicates block is the whole point. A version-string grep for one version would have found the fixed copy in release-new and stopped. The inventory shows the stale copy is still present in the old release and nested under framework/ in that release — exactly the kind of tree a "we upgraded react-dom" commit leaves behind.
Document detection limits: bundled or pruned metadata, framework vendoring, symlink boundaries, and why package inventory does not prove exploitability or patch completeness
Be blunt about what this tool cannot see:
- Bundled output has no manifests. A webpack/esbuild/Rollup bundle inlines the code and drops
package.json. You will see zero packages and wrongly conclude zero risk. For bundled artifacts, pair the inventory with a code-level check or the framework's own build metadata. - Pruned and slim images. Distroless or
node:--slim-style production images often strip dev metadata; the remaining manifests are the only ground truth. - Vendored copies. Code copied into
vendor/,lib/vendor, or a framework's own bundled runtime has nonode_modulesparent. The script won't find it. - Symlink boundaries. The script records symlinks but reads through them where they resolve to a manifest. In pnpm and workspace layouts, the "installed" tree is largely symlinks into a shared store — one physical copy can appear under many paths, and a copy in the store outside your roots is invisible.
- Depth cap.
MAX_DEPTH = 6is a deliberate bound. Deep nesting beyond that is unread.
And the boundary that matters most: an inventory is not an exploitability verdict and not a patch-completeness proof. It tells you which version strings are present in the artifact. It does not tell you whether the vulnerable code path is reachable, whether a bundler tree-shook it out, or whether the framework vendors a patched copy internally.
Inspect the Server Artifact That Actually Ships
Compare repository findings with framework standalone output, container contents, serverless bundles, and retained build manifests
Four places the "real" tree hides:
- Framework standalone output —
next buildwithoutput: "standalone"produces.next/standalone/node_modules, a hand-picked subset. It is not your repo's tree. - Container contents — the filesystem you exported above. Authoritative for what runs.
- Serverless bundles — the uploaded zip. Download and extract it rather than trusting the build log.
- Retained build manifests — if your pipeline keeps a dependency manifest per build, diff it against the artifact inventory. A mismatch means one of the two is lying.
Track artifact digests through deployment records and check every active region, replica, traffic split, and rollback candidate for stale releases
The stale releases you miss most often are not running traffic:
- A rollback target: the previous task definition, the previous Lambda version, the previous Helm release.
- A second region that was deployed "for DR" and never updated.
- The small slice of traffic still on a canary from three releases ago.
- A batch/worker service built from the same image but deployed separately.
Record them in a table, one row per running-or-resumable artifact:
| Environment | Region | Workload | Digest | Deployed at | Class |
|---|---|---|---|---|---|
| prod | eu-west-1 | storefront-ssr | sha256:…b7 | 2026-11-18 | affected (unpatched copy present) |
| prod | us-east-1 | storefront-ssr | sha256:…d2 | 2026-11-02 | affected |
| prod | eu-west-1 | storefront-ssr-previous (rollback) | sha256:…91 | 2026-10-30 | affected |
| staging | eu-west-1 | storefront-ssr | sha256:…e8 | 2026-11-29 | fixed |
A rollback candidate that is still "affected" is a live hazard: during an unrelated outage, someone rolls back to it and reopens the incident.
Classify results as affected, fixed, not applicable, or unresolved using advisory evidence rather than filenames or version-string searches alone
| Class | Evidence required | Allowed to serve traffic? |
|---|---|---|
| affected | Advisory-matched package present in artifact | No |
| fixed | Advisory-matched package absent and inventory shows the fixed version | Yes, after smoke tests |
| not applicable | Artifact provably has no server-side React runtime (verified, not assumed) | Yes |
| unresolved | Advisory not yet matched; artifact state unknown | Yes, with a named owner and a deadline |
"Unresolved" must have a name and a date attached. Otherwise it just becomes "fine".
Rebuild and Verify the Patch Without Reusing Untrusted State
Select exact fixed versions from verified primary advisories and apply the framework's supported upgrade path without inventing CVE identifiers or safe-version thresholds
Take the version from the advisory text, verbatim. If the advisory says "fixed in X", install X or later within your supported line — and pin it exactly:
npm install react-dom@<version-from-advisory> --save-exact
If you cannot find the advisory, you cannot name a fixed version, and you should not pretend otherwise in the ticket. "Upgraded to latest" is not the same statement as "upgraded past the advisory's fixed version", and only the second one closes the finding.
Rebuild from a reviewed commit with a lockfile-enforced installation in a trusted, isolated environment; evaluate dependency installation scripts before executing them
npm ci installs exactly the lockfile and refuses to mutate it — that is the property you want, because it makes the build a function of reviewed inputs.
## pass 1: no lifecycle scripts, network restricted to the registry mirror
npm ci --ignore-scripts
## inspect what the tree would have run before you allow it
node -e '
const fs=require("fs"),path=require("path");
const roots=[process.cwd()];
const hits=[];
while(roots.length){
const d=roots.pop();
let e; try{e=fs.readdirSync(d,{withFileTypes:true})}catch{continue}
for(const x of e){
const p=path.join(d,x.name);
if(x.isDirectory()){ if(x.name==="node_modules"||x.name.startsWith("@")) roots.push(p); continue }
if(x.name!=="package.json") continue;
let j; try{j=JSON.parse(fs.readFileSync(p,"utf8"))}catch{continue}
for(const k of ["preinstall","install","postinstall"]) if(j.scripts&&j.scripts[k]) hits.push([path.relative(process.cwd(),p),k,j.scripts[k]]);
}
}
console.log(JSON.stringify(hits,null,2));'
## pass 2: scripts allowed only after the list above is reviewed
npm ci
Read that list. Anything that downloads binaries or shells out at install time is a supply-chain decision, and it should be reviewed rather than blindly executed on a host that might have credentials in its environment. For the rebuild itself, run in a clean container with no ambient cloud identity and no production secrets mounted.
Re-run the artifact inventory and compare before-and-after evidence, then perform normal application smoke tests without sending exploit payloads to production
Diff the two JSON reports by (name, version, manifest). Expected shape for the fixture rebuild:
"duplicates": [
- { "name": "react-dom", "copies": 3, "versions": ["1.0.0-fixture", "1.1.0-fixture"] }
+ { "name": "react-dom", "copies": 1, "versions": ["1.1.0-fixture"] }
]
If the duplicate count did not drop, the fix is not in the artifact — usually because a workspace still pins the old range, or a nested framework/node_modules copy was never hoisted out.
Then smoke test normally: render the SSR routes, hit the RSC endpoints your app actually uses, check response shapes. Do not send exploit payloads to production to "prove" the patch. A 200 from a normal request is sufficient evidence that the rebuild functions; exploit verification belongs in an isolated environment with an advisory-authored test case.
Define patch acceptance criteria: advisory-compliant dependencies, matching deployed digests, no affected instances serving traffic, and a safe rollback artifact
Accept the patch only when all four hold:
- Inventory of the built artifact shows only advisory-compliant versions, with zero stale duplicates.
- The digest in every deployment record matches the digest you built and tested.
- No artifact classified
affectedis serving traffic or reachable as a rollback target. - A rollback artifact exists that is also advisory-compliant — meaning you rebuild the previous release with the patched dependency, not roll back to the old image.
Point 4 is the one teams skip. Rolling back to a pre-patch image is not a rollback, it's a re-exposure.
Triage Which Secrets the Workload Could Have Exposed
Build a credential reachability matrix covering process environment, mounted files, secret-manager permissions, workload identity, CI credentials, and downstream integrations
Reachability is a property of the whole execution path, not just the container:
| Source | Where it lives | Who can read it | Pivot risk |
|---|---|---|---|
| Process environment | Container env, .env baked into image | Anyone who can read the process | High if the image is public or the artifact leaked |
| Mounted files | K8s Secret volumes, Docker secrets | Pod, plus node-level readers | High |
| Secret manager reads | IAM policy on the workload role | The workload identity, and anything that can assume it | Critical — new secrets obtainable on demand |
| Workload identity | Pod/instance role, OIDC subject | The workload, plus token-minting paths | Critical if the trust policy is broader than needed |
| CI credentials | Runner env, cached tokens | Build jobs, fork PRs on misconfigured pipelines | Critical — can rewrite artifacts |
| Downstream integrations | SaaS API keys, AI provider keys | App config, sometimes browser bundle | Depends on scope |
That severity column is why ordering matters: a secret-manager read permission outranks a static API key, because it converts a one-time theft into continuous access.
Separate possible access from confirmed theft: correlate application and cloud audit events while documenting logging gaps and uncertain exposure windows
Two states, and they never get merged into one sentence:
- Possible access — the credential was reachable from an affected artifact, so assume it may have been read.
- Confirmed use — an audit event shows the credential used by a principal, IP, or region you don't recognize.
Only the second justifies the emergency exception from earlier. The first justifies rotation on a schedule, after containment.
Write your gaps down as part of the record: which trail regions were covered, whether S3 data events were on, whether the container's stdout survived termination, whether the secret manager's read events are actually in the trail. An unexplained gap is not exculpatory.
Check browser bundles, source maps, and build logs for accidental secret publication as a separate exposure path, reporting locations and redacted fingerprints rather than values
This is a different path from the campaign and worth checking in the same pass: if a key ever got NEXT_PUBLIC_-prefixed or landed in a build log, it is public and contains no exploit prerequisite at all. Report locations and fingerprints, never values.
// Prints redacted fingerprints of secret-shaped strings. Never prints values.
const PATTERNS = [
/AKIA[0-9A-Z]{16}/g,
/sk-[A-Za-z0-9_-]{20,}/g,
/-----BEGIN [A-Z ]*PRIVATE KEY-----/g,
/(?:api[_-]?key|secret|token)s*[:=]s*["'][^"']{16,}["']/gi,
];
const hits = [];
async function walk(dir, depth = 0) {
if (depth > 8) return;
let entries;
try { entries = await readdir(dir, { withFileTypes: true }); } catch { return; }
for (const e of entries) {
const abs = path.join(dir, e.name);
if (e.isDirectory()) { await walk(abs, depth + 1); continue; }
if (!e.isFile()) continue;
let text;
try { text = await readFile(abs, "utf8"); } catch { continue; }
for (const re of PATTERNS) {
re.lastIndex = 0;
let m;
while ((m = re.exec(text)) !== null) {
hits.push({
file: path.relative(process.cwd(), abs),
line: text.slice(0, m.index).split("
").length,
length: m[0].length,
fingerprint: createHash("sha256").update(m[0]).digest("hex").slice(0, 12),
});
}
}
}
}
for (const root of process.argv.slice(2)) await walk(path.resolve(root));
console.log(JSON.stringify(hits, null, 2));Run it against your exported artifact and your public CDN contents. The fingerprint lets you answer "is this the same key that appears in three other places?" without ever copying the value into a chat window. Expect false positives from the last pattern — the output is a triage list, not a verdict.
Prioritize response by privilege, lifetime, cross-account reach, observed abuse, and access to additional secrets rather than rotating every credential indiscriminately
Rotation order, highest first:
- Credentials with observed abuse.
- Credentials that can read other secrets (secret-manager read, KMS decrypt on a shared key, CI tokens that can rewrite artifacts).
- Credentials with cross-account reach — confused-deputy risk is the expensive part of a breach.
- Long-lived static keys, regardless of privilege.
- Short-lived tokens that have already expired on their own.
Rotating everything at once has a real cost: you will break a consumer you forgot about, and during the ensuing outage nobody is investigating the exposure. Ordered rotation keeps the investigation running.
Rotate Cloud and AI Credentials Through a Trusted Control Plane
Map credential owners and consumers, then create least-privilege replacements only after affected execution paths and secret-delivery paths are controlled
Before creating anything, answer for each credential: who owns it, which workloads consume it, how it is delivered, and what it authorized. A replacement created before containment is a replacement delivered to the attacker. Create replacements from a clean control plane — not the suspect host, and not a CI runner whose tokens you have not yet ruled out. Least privilege is not a formality here: if the replacement is narrower than the original, the attacker's stolen copy (if any) retains the old, wider scope, which is an argument for revoking, not for keeping both alive.
Demonstrate a provider-neutral cutover state machine: create replacement, deliver to clean consumers, verify identity and service health, revoke the old credential, and confirm rejection
The provider API calls differ; the ordering does not. Encode the ordering so a rushed afternoon can't skip a step.
// Provider-neutral credential cutover. The ordering is the safety property.
const ALLOWED = new Map([
["contained", ["replacement_created"]],
["replacement_created", ["delivered_to_clean_consumer"]],
["delivered_to_clean_consumer", ["consumer_verified"]],
["consumer_verified", ["old_revoked"]],
["old_revoked", ["rejection_confirmed"]],
["rejection_confirmed", []],
]);
export function advance(state, nextState) {
const allowed = ALLOWED.get(state) ?? [];
if (!allowed.includes(nextState)) {
throw new Error(`illegal cutover transition: ${state} -> ${nextState}`);
}
return nextState;
}
// A revoked credential can never re-enter the delivery path.
export function assertNotReused(credential, revoked) {
if (revoked.has(credential.id)) {
throw new Error(`refusing to re-deliver revoked credential ${credential.id}`);
}
}
// Rollback produces a NEW replacement; it never restores the old one.
export function rollback(current) {
if (current === "rejection_confirmed") {
throw new Error("cutover already closed");
}
return "replacement_created";
}Each state means exactly one thing:
| State | Exit condition |
|---|---|
contained | Workload cannot reach secret store; out of rotation |
replacement_created | New credential exists with least-privilege policy, created from clean infra |
delivered_to_clean_consumer | New value written to the delivery path for a contained/clean consumer |
consumer_verified | Consumer authenticated with the new credential; health checks green |
old_revoked | Old credential deactivated/deleted at the provider |
rejection_confirmed | An explicit call using the old credential returns an auth error |
The last state is the one people skip. "I called the delete API" and "the old credential is rejected" are different facts; only the second is verification, and it is a five-second check.
Handle compromised sessions, temporary credentials, and workload identities through provider-specific revocation and trust-policy guidance rather than assuming static-key rotation invalidates them
This is where a correct-looking rotation leaves a live foothold:
- STS / temporary credentials. Deleting an access key does not invalidate session tokens already issued from a role. AWS documents the approach — attach a policy that denies actions when
aws:TokenIssueTimeis older than your cutoff — in Revoking IAM role temporary security credentials. - Static access keys. Deactivate first, verify nothing legitimate breaks, then delete. The access key management documentation covers the lifecycle; the practical point is that deactivation is reversible and deletion is not.
- Workload identity / OIDC federation. Rotating a key does nothing if the trust policy still accepts a subject claim an attacker can obtain. Tighten the trust policy: exact repository, exact branch, exact environment.
- Service account keys (GCP). Disable, then delete — disabling is reversible and immediately stops new token issuance.
- AI provider keys. Revoke and reissue, then check what the key did: uploaded files, fine-tuning jobs, batch jobs, and org-level member changes are all worth listing. A key that only ever made inference calls is a different incident from one that created resources.
Temporary credentials are the gap I see most often in incident write-ups: the static key gets rotated, the already-issued session keeps working for its remaining lifetime, and the timeline shows continued access for hours after "rotation complete".
Cover failure branches: unsupported overlapping keys, emergency revocation, consumer cutover failures, and rollback that must not restore compromised credentials
| Branch | Symptom | Action |
|---|---|---|
| No overlapping keys supported | Provider allows exactly one active key | Short maintenance window; provision replacement, cut over, revoke in one sequenced change. Do not leave the old key active "just in case" |
| Active abuse | Unknown-principal calls in audit logs | Emergency revocation now; accept outage; contain in parallel |
| Consumer cutover fails | New credential rejected by a downstream | Fix the consumer, not the credential. Never re-enable the old one to unblock |
| Rollback needed | New credential causes a functional regression | rollback() → create a newer credential with the correct scope; the revoked one stays revoked |
| Delivery path itself compromised | Secret written but read by an unknown principal | Treat as re-compromise: contain the delivery path first, then restart from replacement_created |
The invariant across every branch: the set of revoked credentials only grows.
Turn the Audit Into Deployment Gates and Closure Evidence
Fail CI on advisory-matched dependencies and missing artifact provenance while keeping unresolved applicability checks visible for human review
A gate that only fails on "vulnerable dependency present" is easy to satisfy and easy to bypass. Two extra checks carry most of the value:
## 1. fail the build if the built artifact does not match the reviewed lockfile
node audit-artifacts.mjs ./dist > /tmp/artifact-inventory.json
node scripts/check-advisories.mjs /tmp/artifact-inventory.json # exit 1 on advisory match
## 2. require provenance for anything that deploys
cosign verify-attestation --type slsaprovenance \
--certificate-identity-regexp '^https://github.com/org/repo/' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com \
registry.example.com/app@sha256:...
Rule 1 stops the "fixed in git, stale in the registry" failure. Rule 2 stops an image of unknown origin from deploying during the panic. Keep the unresolved applicability rows in a checked-in file a human reviews weekly — a gate that quietly passes on unresolved data teaches the team to ignore the gate.
Add regression fixtures for duplicate dependency copies, absent manifests, stale deployment digests, and secret-safe audit output
Turn each thing that went wrong into a fixture:
- A tree with two copies of the same package at different versions (must appear in
duplicates). - A package directory with no
package.json(must appear inmissing, not vanish). - A manifest with broken JSON (must appear in
errorsasEPARSE). - A deployment record pointing at a digest with no matching build (must fail the gate).
- A manifest containing a fake token (the inventory output must not contain it).
That last fixture is worth writing explicitly. Audit tooling that leaks secrets while investigating a secret leak is a genuinely common own-goal, and it is trivially testable.
Define incident closure evidence: fixed deployment coverage, investigated exposure scope, completed revocations, tested replacement consumers, and documented residual uncertainty
Close on artifacts, not on assertions:
| Evidence | Form |
|---|---|
| Fixed deployment coverage | Digest table: every environment/region/replica on an advisory-compliant artifact, rollback targets included |
| Exposure scope investigated | Credential reachability matrix with possible vs confirmed use marked per row |
| Revocations completed | Provider-side deactivation records plus a rejection test per credential |
| Replacement consumers tested | Smoke-test results per consumer with the new credential, in the cutover state machine |
| Residual uncertainty | Named gaps: unlogged regions, missing data events, unparseable manifests, unresolved advisories — each with an owner |
Conclusion: A Patched Repository Is Not a Patched Fleet
The React2Keys reporting gives you a reason to look. It does not give you a scope, and the supplied material — two secondary headlines, no advisory — cannot tell you whether a given application is exposed. What it can do is force a useful ordering discipline onto a bad week of supply-chain incident response.
Reinforce the decision sequence: contain first, establish applicability, verify running artifacts, investigate reachable secrets, and rotate from clean infrastructure
- Contain the workload: no traffic, no egress, no secret-store reads. Reversible, and it stops the bleeding.
- Establish applicability against a real advisory. If you can't find one, record
unresolvedwith an owner — neverclean. - Verify the running artifact, by digest, including rollback candidates and forgotten regions. The repo is not evidence.
- Investigate reachable secrets, keeping "could have read it" separate from "we have logs showing it was used".
- Rotate from clean infrastructure, in the enforced order, and confirm rejection rather than assuming it.
The headline number — 50,000 credentials — is a campaign statistic. Your number is the count of artifacts in your deployment records whose digests match a stale build. That one you can measure, and it is the only one you can act on.
Further Reading and Evidence Sources
Secondary campaign reporting (as supplied; not technical advisories):
- Hackread — "React2Keys Campaign Steals Over 50,000 Credentials Using React2Shell Flaw", published 2026-11-30 (per the supplied listing): Google News RSS item
- theoptimist.news — "React2Keys Hackers Steal 50,000 AI & Cloud Keys; India #2", published 2026-11-30 (per the supplied listing): Google News RSS item
Primary research status: no original research write-up, CVE record, or vendor advisory matching the name "React2Shell" was included in the supplied material. The applicability question therefore stays open until you match one; do not treat its absence as evidence that no issue exists.
Advisory and dependency sources:
- GitHub Advisory Database — search by the exact package names in your artifact inventory.
- Next.js security advisories — framework-level advisories, if you deploy Next.js.
- React Server Components reference — to establish which parts of your app execute server-side.
Package manager documentation:
npm ci— lockfile-enforced installs.npm lsandnpm explain— dependency tree tracing and exit-code behavior.npm audit— what the command does and does not cover.
Credential revocation and supply chain:
- AWS — Revoking IAM role temporary security credentials
- AWS — Managing access keys for IAM users
- Google Cloud — Disable and enable service account keys
- OWASP Secrets Management Cheat Sheet
- SLSA provenance specification and Sigstore Cosign documentation — artifact provenance verification for the deployment gate.
More posts

Stolen Source Code Is Not Build Tampering: Reading the 1Password GitHub Report Carefully
A careful technical reading of the reported 1Password GitHub account compromise that separates confirmed source-code theft from unverified build-tampering and vault-exposure risks while outlining containment priorities.

A Regression-Test Checklist for Custom Go Middleware Before Upgrading to Traefik 3.8
A pre-upgrade regression-test checklist for teams running custom Go middleware on Traefik, covering plugin-engine compatibility, request-handling behavior, and before/after performance comparison ahead of the 3.8 redesign.

Testing AMD GAIA 0.27’s C++ Overhead Claims with a Reproducible Agent Benchmark
A reproducible benchmark methodology for separating agent orchestration overhead from model inference in AMD GAIA 0.27, covering startup time, memory usage, tool-call latency, and end-to-end task completion.
Loading comments…