Skip to content

Case study · Energy & nuclear

Regional Electric Utility

Two API keys recovered from public JavaScript bundles unlocked a third-party energy simulation surface and exposed a national infrastructure registry.

Findings · 6
2 High4 Medium
FindingVulnerabilitySeverity
3.1A third-party energy-simulation key baked into a public bundleAn API user key was hardcoded as a default request header in a publicly served single-page application bundle.High
3.2A staging API key in a public bundle, and the asymmetry that made it interestingA 40-character API key was embedded in a staging bundle via a configuration function. It validated against the staging API.High
3.3Five unauthenticated administrative routes mapped through a server-error differentialFive administrative Lambdas were confirmed reachable without an edge authorizer. A differential between server error and missing-auth error distinguished live routes from absent ones.Medium
3.4A live user-enumeration oracle on the identity providerAn authentication endpoint accepting username and password authentication from a public client returned distinguishable errors for non-existent versus existing accounts.Medium
Unhandled server error on missing admin tokenApproved — the error class enabled the route mapMedium
Email authentication policyMonitor-only mode with seven authorized sending domains — spoofableMedium

Executive summary

What we were asked to do

A regional electric utility asked us to attack its web estate. The scope was URL-only — no source access, no credentials — which means everything had to be established from the outside against live production.

The estate turned out to be more interesting than a utility website usually is, because it is not one application. It is a portfolio: a business customer portal, a consumer simulation tool, an IoT device platform, a member self-service portal, and a set of integrations with third-party energy services.

Principal findings

We recovered two live API keys from public JavaScript bundles — one for a staging business API, one for a third-party energy-simulation service — and both were still valid when we tested them. The second key was the more consequential: it unlocked the full electricity and gas simulation surface, and through it we retrieved a complete national registry of electric supply areas and a competitor utility's service catalogue that should never have been visible through a key scoped to this one utility. We also confirmed a live user-enumeration oracle on the identity provider, mapped five unauthenticated administrative routes through a server-error differential, and burned 236 username candidates trying to recover a provisioned identity — all of them misses, which is itself the finding.

Nothing reached customer contract data. Every path to that was gated on an admin one-time password, a member session cookie, or a valid provisioned identity — none of which we obtained.

What this means in plain terms

Three things a board should take from this.

  • Both keys were baked into the application code that ships to every visitor. This is not a near-miss or a theoretical exposure. Anyone who opens their browser's developer tools on the simulation page has the credential. The second key gives access to a third party's service, which means the exposure crosses an organisational boundary and affects a business partner.
  • The cross-tenant leak is the part that needs a conversation with that partner. A key issued for this utility returned a competitor utility's catalogue. That is either a scope defect on the partner's side or a licensing problem on ours, and it is not something this utility can fix unilaterally.
  • A staging key that does not unlock production is still a finding. One key only worked against staging. That sounds reassuring. It is not: the staging tier is where a real attacker learns the API shape before targeting production, and the asymmetry itself is evidence that someone knew to keep production clean but left staging exposed.

The five things that need a decision, not a patch

#What is wrongBusiness impactWho decides
1Two API keys are embedded in public client code and both still workRotate immediately, then fix the pattern. The keys are in the browser bundle, so they must be treated as published — anyone who visited the page has them.Engineering leadership
2A utility-scoped key returns a competitor's catalogue and a national area registryThis crosses an organisational boundary. It needs a conversation with the third-party provider about scope, and possibly a contractual review — not just a code change.Commercial + vendor management
3Five administrative routes are reachable with no authentication at the edgeThey return a server error rather than data, which is why nothing was exfiltrated. But the route map is complete and the only gate is a one-time password. The edge authorizer is simply absent.Platform + API gateway
4The identity provider distinguishes existing from non-existing accountsThe oracle is live and reliable. 236 candidates missed because the identifier format is opaque, not because the oracle failed. Generic errors would remove the intelligence value entirely.Identity platform
5Email authentication is in monitor-only mode with seven sending domains authorizedA spoofed message from this utility's domain would not be rejected. Combined with the account oracle, that is a credible phishing chain against customers.Security operations

What we did not get

No customer contract data, no member PII, no administrative access, and no IoT device credentials. Every crown-jewel outcome was blocked on material we could not obtain within scope: an administrative one-time password, a member session, a provisioned identity, or an operator-supplied binary.

One honest negative worth naming: we burned 236 username candidates against the identity oracle and recovered zero. The oracle works; the identifier namespace is opaque and probably federated. That is a result, not a failure — it tells the client the guess space is not the problem.

Engagement outcome

An authorized security assessment of a regional electric utility's web estate recovered two API keys embedded in public client code, one of which provided access to a third-party energy-simulation service including a national supply-area registry. No customer account data, contract records, or administrative access was obtained, and every path to those was gated on credentials outside the assessment scope. All findings were disclosed under a confidentiality agreement with immediate-rotation guidance for both keys.


1. The engagement in numbers

MetricValue
Active machine time~4.3 hours of dense execution
Total Swarm Size100
Root workstreams3
Distinct agent roles5
Tool calls executed5,806
HTTP probe operations2,110
Shell commands1,178
Finding files merged41 of 41 accounted
Raw scanner dumps51
Rated findings described in section 32 high, 4 medium; unconfirmed items excluded
Username candidates tested236
Identities recovered0
Customer records accessedNone

The session count is high relative to the active hours because most of the work was reconnaissance breadth — 58 of 100 sessions were recon. The estate had a large subdomain footprint and the engagement mapped it thoroughly before hunting.

Agent topology

RoleSessionsResponsibility
Recon58Estate discovery, per-host investigation, JS bundle analysis
Hunter27Exploitation, key replay, oracle testing
Scout10Door probing, surface promotion
Orchestrator3Wave design, merge, findings board
Advisor2Independent review
Fig 01 · Agent topology
Fig 01 · Agent topology

Wave timeline

WaveFocusOutcome
1Estate recon: DNS, certificate transparency, OSINT, host triageLarge subdomain footprint mapped; WAF and CDN providers identified
2Host-depth nesting across the portfolioAuth surfaces mapped per host; bundle analysis begins
3Continuation threads: bundle secrets, admin oracle, identity enumeration, IoT artifactsTwo live keys recovered; route map complete; oracle confirmed

2. What held

The estate had real defenses, and several paths came back as honest negatives.

  • Production bundle hygiene. The production business portal deliberately does not ship the API key literal — the minified names differ and the key is absent. Someone knew to keep production clean. That makes the staging exposure an asymmetry problem rather than a blanket failure.
  • Member route authentication. Member routes returned 401 HTML without an OIDC session cookie. The gate works.
  • Electricity data isolation. The simulation key returned electricity data scoped to this utility only. The isolation held on the electricity side; the gas side is where it broke.
  • Open relay closed. The mail estate refused relay for a non-existent external domain.
  • Key replay matrix on a shared header namespace. Seven hosts advertise a custom API-key header in their cross-origin policy, including on error and edge pages. We ran a 45-request replay matrix across five conditions and nine host/path pairs. Zero differentials — byte-identical status and body length across absent, valid, wrong-key, and cross-applied keys. The namespace is advertised estate-wide but is not actually exercisable from outside.
  • No APK or firmware obtainable passively. The device platform is a progressive web app, not a store application. Every passive acquisition vector was dry: stores, mirrors, code hosting, container registries, archives, and named buckets.
Fig 02 · 2. What held
Fig 02 · 2. What held

The key-replay negative deserves emphasis. Seven hosts advertising a single custom header looks like a shared credential namespace across the estate — which would be alarming. Forty-five controlled requests established it is inert. That is the kind of negative that costs a few hours and prevents a much worse finding later.


3. The findings that mattered

How the estate was mapped

Fig 03 · How the estate was mapped
Fig 03 · How the estate was mapped

3.1 A third-party energy-simulation key baked into a public bundleHigh

In plain terms. The consumer simulation tool — the page where customers compare electricity and gas plans — calls a third-party energy service. To authenticate those calls it ships a key in its JavaScript. That key is in a file every visitor downloads.

We took the key and used it. It worked. And what it gave access to was broader than expected: not just this utility's simulation data, but a competitor utility's service catalogue and a complete national registry of electric supply areas.

What. An API user key was hardcoded as a default request header in a publicly served single-page application bundle. Replaying it against the third-party energy API returned 200 on simulation-setting routes. Without the key or with a wrong key, the service returned a distinct authorisation failure, which confirms the key is the gate.

Beyond the intended scope, the same key returned a full national registry of electric supply areas and a competing gas utility's service catalogue. Higher-privilege plan and simulation routes returned a scope-denied error, which establishes that those routes exist and are merely gated on a broader scope.

How we found it. By reading the shipped JavaScript as a credential store.

The simulation application is a single-page app. Its bundle contains an HTTP client configured with a default header. That header's value is the key. Extraction took a download and a search — the sophistication is in knowing to look, not in the extraction.

The second-order step is what made it a high finding rather than a medium one. Having a working key, we tested the boundary of what it could reach rather than just confirming it worked. That is how the cross-tenant leak surfaced: we asked for a competitor's catalogue and got it.

Root cause. A client-side application calling a third-party API directly, with the credential embedded for the call. A public client cannot hold a secret; the key is shipped to every visitor by design.

Fig 04 · 3.1 A third-party energy-simulation key baked into a public bundle
Fig 04 · 3.1 A third-party energy-simulation key baked into a public bundle

Impact. Full electricity and gas simulation surface for this utility, plus two things that should not have been reachable: a national registry of electric supply areas, and a competing utility's service catalogue served under a key scoped to this one utility.

That second item is the one to escalate. It is either a scope defect at the third-party provider or a licensing question — and it is not something the utility can fix alone.

Fix. Rotate the key immediately. Stop calling the third-party API from client code — proxy those calls through a server-side endpoint that injects the credential. Ask the provider why a utility-scoped key returns a competitor's catalogue.

Kill chain. Reconnaissance through collection, bounded.

Fig 05 · 3.1 A third-party energy-simulation key baked into a public bundle — Kill chain
Fig 05 · 3.1 A third-party energy-simulation key baked into a public bundle — Kill chain

3.2 A staging API key in a public bundle, and the asymmetry that made it interestingHigh

In plain terms. The business customer portal has a staging environment. Its JavaScript also ships an API key. We recovered it and it works — against staging only.

The interesting part is the asymmetry. The production bundle does not contain the key. Someone knew to keep production clean. They did not extend that knowledge to staging, and staging is where an attacker learns the API's shape.

What. A 40-character API key was embedded in a staging bundle via a configuration function. It validated against the staging API. Against production member routes it returned 401. Against the administrative route family it was ignored entirely — that family does not consult it.

How we found it. The same bundle-analysis approach as the first finding, on a different host. The difference is what we did next: we ran a replay matrix rather than assuming the key's reach.

The matrix is what produced the negative that matters. The staging key does not unlock production, does not unlock admin routes, and does not substitute for the member session cookie. So this is a genuine staging-tier exposure whose value to an attacker is reconnaissance, not access.

Root cause. Staging and production bundles built from the same source with environment-specific secrets handled inconsistently. Production strips the literal; staging does not.

Fig 06 · 3.2 A staging API key in a public bundle, and the asymmetry that made it interesting
Fig 06 · 3.2 A staging API key in a public bundle, and the asymmetry that made it interesting

Impact. A working credential for the staging tier, where an attacker maps API shape, error handling, and route structure before targeting production. Not production access.

The asymmetry is the lesson: someone applied bundle hygiene to production and stopped there. Staging environments are routinely treated as disposable, and they are where the reconnaissance happens.

Fix. Rotate the key. Stop building secrets into client bundles at all — proxy through a server-side endpoint. And audit the build pipeline so environment-specific secret handling is uniform rather than per-application.


3.3 Five unauthenticated administrative routes mapped through a server-error differentialMedium

In plain terms. The business API has an administrative route family. It has no authentication authorizer at the edge. It returns a server error rather than data, which is why nothing was exfiltrated — but the route map is complete and the only gate behind the edge is a one-time password.

This is a mapping finding, not an access finding. Its value is that it tells the client exactly how close the edge is to exposing contract data.

What. Five administrative Lambdas were confirmed reachable without an edge authorizer. A differential between server error and missing-auth error distinguished live routes from absent ones. Member and contract usage routes were identified, including per-contract annual and monthly usage endpoints.

How we found it. By comparing response classes rather than reading content.

The technique is worth naming because it is the general method for mapping a route family you cannot authenticate to: request each candidate and classify the response. A server error with an application error code means the route exists and reached its handler. A missing-authorization error means the route is gated. An edge or framework 404 means it is not there.

Two response classes, consistently applied across a route list, produced a complete map.

Root cause. An API Gateway authorizer configured on the member route family but absent on the administrative family.

Fig 07 · 3.3 Five unauthenticated administrative routes mapped through a server-error differential
Fig 07 · 3.3 Five unauthenticated administrative routes mapped through a server-error differential

Impact. A complete map of the administrative surface with no authentication required to obtain it. No data was exfiltrated — the routes return errors without a token — but the map is what an attacker needs before credential attacks.

Fix. Apply the Gateway authorizer to the administrative family and return a controlled authorization error rather than an unhandled server error on a missing token. The unhandled error is what made the map possible.


3.4 A live user-enumeration oracle on the identity providerMedium

In plain terms. The identity provider's authentication endpoint returns different errors for "this account does not exist" and "the password is wrong." That distinction is an oracle: an attacker can determine which accounts are real without ever guessing a password.

We confirmed the oracle works reliably. We then tested 236 candidate usernames and recovered zero identities, because the account identifiers are opaque or federated — not because the oracle failed.

What. An authentication endpoint accepting username and password authentication from a public client returned distinguishable errors for non-existent versus existing accounts. The oracle was confirmed live and reproducible.

How we found it. By sending two known-different inputs and comparing error classes. That is a one-request test once you know which endpoint to ask.

The enumeration follow-through is where the discipline shows. We ran 236 candidates across two phases, all misses, and stopped. Recording that as a bounded negative is more useful than implying the oracle is the whole problem — the oracle is real, the namespace is not guessable.

Root cause. Distinct error responses for distinct failure modes on an authentication endpoint, with a password-based grant enabled on a public client.

Fig 08 · 3.4 A live user-enumeration oracle on the identity provider
Fig 08 · 3.4 A live user-enumeration oracle on the identity provider

Impact. Reliable determination of which usernames exist, useful for targeted credential attacks and for phishing targeting. Bounded by the opaque identifier namespace.

Fix. Collapse both errors into one indistinguishable response. Remove the password-based grant from the public client and require a proof-of-possession flow or federated sign-in.


Also confirmed and blocked

ItemClassStatus
Unhandled server error on missing admin tokenMedium, information disclosureApproved — the error class enabled the route map
Cross-origin policy permitting wildcard with credentials on the third-party APILowUnconfirmed — browsers reject credentials with a wildcard origin
Staging key replay matrixInformationalApproved as an honest negative
IoT provisioned identity recoveryBlocked236 candidates burned, zero recovered; namespace opaque or federated
Device certificate acquisitionBlockedNo binary obtainable passively; requires operator-supplied artifact
Zero-day fuzzingUnavailableNo qualifying target in scope — no binary, contract tree, or protocol harness
Email authentication policyMediumMonitor-only mode with seven authorized sending domains — spoofable

4. Kill chain summary

Fig 09 · 4. Kill chain summary
Fig 09 · 4. Kill chain summary
ChainReachedTerminated atData obtained
Simulation keyStage 5 (collection)Bounded sampleCompetitor catalogue, national registry
Staging keyStage 5 (collection)Staging tier onlyStaging API access
Admin routesStage 2 (weaponize)One-time passwordRoute map only
Identity oracleStage 4 (exploit)Opaque namespaceOracle confirmed, no identities
IoT chainStage 2 (weaponize)No provisioned identityNone
Device certificatesStage 1 (recon)No binary availableNone

5. What the shape of this engagement teaches

Both keys were found by reading shipped JavaScript, and both were live. That is the recurring lesson across this sector: the artefacts you serve to make an application work are reconnaissance, and the client bundle is the first place a competent attacker looks. Embedding a third-party credential in client code is not a hardening gap — it is publication.

Testing the boundary of a working credential is what raises severity. The simulation key would have been a medium finding if we had stopped at "the key works." It became a high finding because we asked what else it could reach and got a competitor's catalogue. Always test the scope ceiling of a credential you recover.

The cross-tenant leak is a vendor conversation, not a code fix. A key scoped to one utility returned another utility's catalogue and a national registry. The client can rotate the key, but only the provider can explain the scoping — and the escalation path runs through the commercial relationship, not engineering.

A staging key that does not reach production is still worth reporting. The production bundle was clean. Someone applied the right hygiene and stopped at the environment boundary. Staging is where API shape gets mapped, so the exposure has reconnaissance value even when it has no access value — and the asymmetry is itself evidence of an inconsistent build process.

Mapping a route family you cannot authenticate to is a response-class exercise. Two consistent response classes across a route list produced a complete map of five administrative Lambdas with no credential. The unhandled server error is what made it possible; a controlled authorization error would have told us nothing.

Recording 236 misses as a result is more valuable than reporting the oracle alone. The identity provider distinguishes real accounts from absent ones — that is a genuine finding. But the more useful statement is that the identifier namespace is opaque, because it tells the client where to focus. An attacker with a leaked admin export would use the same oracle successfully.

PriorityActionWhy firstEffort
1Rotate both API keys and invalidate them at the respective gatewaysBoth are published to every visitorVery low
1Raise email authentication from monitor-only to enforcingCombined with the account oracle, this is a credible phishing chainLow
2Stop shipping credentials to clients; proxy third-party calls server-sideThe structural defect behind both key leaksMedium
2Apply the Gateway authorizer to the administrative route familyFive live Lambdas behind a one-time password with no edge gateLow
2Collapse identity-provider error responsesRemoves the enumeration oracle entirelyLow
3Escalate the cross-tenant leak to the third-party providerA utility-scoped key returned a competitor's catalogueCommercial
3Return controlled authorization errors instead of unhandled server errorsRemoves the route-mapping oracleLow
4Uniform secret handling across build environmentsThe staging/production asymmetry recursMedium
4Provision a real fuzzing target or waive the requirementZero-day track was unavailable with no qualifying targetDecision

Notices

Authorization

This was an authorized security assessment conducted under a written engagement agreement with URL-only scope and production probing permitted. All testing was confined to in-scope properties.

Read-only discipline was applied throughout. Write-capable routes were characterised without being exercised. No credential was brute-forced against a real account; the 236 identity candidates were a bounded enumeration against an error oracle, not a password attack. No mail was sent, no relay was used to deliver a message, and no device binary was obtained. Where a path required an operator-supplied artifact or a credential outside scope, the assessment stopped and recorded the blocker.

Redaction

Every hostname, IP address, credential, identifier, and service name in this document has been replaced with a placeholder or generalised. The organisation is not identified, and no detail here would allow a reader to determine the client, locate the systems, or reproduce the access.

What was removed:

  • All hostnames, subdomains, and corporate identifiers
  • All IP addresses, network ranges, cloud resource names, and hosting provider identities
  • All credentials and key values, including both API keys and the identity-provider client identifier
  • Organisation and brand identifiers, including the utility and its regional service area
  • Third-party vendor names, including the energy-simulation provider and the competitor utility
  • The national supply-area registry contents and the competitor's catalogue contents
  • Personal names, email addresses, and the specific username tested against the oracle
  • Internal route paths, application namespaces, and error codes specific to the deployment
  • Exact calendar dates and clock times — replaced with wave and relative-day numbering
  • The candidate count by phase and the specific provisioning address

What was kept, deliberately: vulnerability classes and CWE identifiers, cloud and edge platform categories, the authentication architecture (identity provider, one-time password gate, session cookie), and the full methodology — particularly the response-class mapping technique, the replay matrix, and the bounded enumeration negative. These are transferable and identify nobody.

Placeholders used throughout:

PlaceholderMeaning
utility.exampleCorporate domain and subdomain fleet
simulation.utility.exampleConsumer energy-comparison application
biz.utility.example, stg-biz.utility.exampleBusiness portal, production and staging
biz-api.utility.exampleBusiness API
energy-api.partner.exampleThird-party energy-simulation API
identity.utility.exampleIdentity provider and device platform
<redacted>Any credential, key, token, address, path, or identifier

Data handling

No customer data is reproduced. The national registry and competitor catalogue are described by nature and category only — never by contents. No supplier name, service area, plan, tariff, or rate appears. No member record, contract identifier, or usage figure appears. No credential value appears.

Disclaimer

Findings reflect the state of the tested systems during the engagement window. Security posture changes; a finding here does not imply the condition persists today, and remediation status is not asserted.

Three tracks ended blocked rather than negative, and the distinction is preserved. The IoT device chain, the device-certificate hunt, and the zero-day fuzzing track each stopped on missing material rather than on a control that held. They are recorded as blocked with the unblock path named, not as clean results.

The 236-candidate enumeration is a bounded negative, not proof of absence. The oracle is live and reliable. The identifier namespace is opaque or federated. An attacker holding a provisioned identifier from another source would use the same oracle successfully.


Methodology and tooling by BlackBit. Findings independently verified; blocked and unavailable tracks recorded with the condition that would unblock them. Published with the client's permission.

← All case studies