Beginner Lab red team icon   aws

Abuse Unauthenticated API to Leak Data

Exploit a misconfigured private AWS API Gateway and pivot form recon to initial access, and see how far you can go!

Scenario

Huge Logistics recently launched a private bug bounty program, allowing trusted security professionals to assess the security of their internal web applications. If you manage to compromise an application, the terms of the program allow you to try and increase your access to other resources. Your scraping of the bug bounty page revealed that a new IP address has been added to the in-scope assets. You've already uncovered a Python script by curling the new IP, which exposes certain secrets. Now it’s time to probe the IP and try to claim a bounty!

Lab prerequisites
  • Basic understanding of AWS CLI Commands
  • Basic understanding of AWS services
  • Familiarity with web reconnaissance
  • Familiarity with Git commands
Learning outcomes
  • Identify sentitive information in client-side code
  • Pivot to internal network access.
  • Abuse API Gateway misconfiguration to leak data
  • Learn how the scenario could have been prevented

 

Real-world context

This lab mirrors a real-world attack scenario, demonstrating how adversaries may exploit API Gateway misconfigurations. Companies driven by pressures to quickly release new features may inadvertently overlook best security practices. For instance, T-Mobile disclosed in January 2023 that a bad actor had used a single API to obtain account information for a large number of customers. Similarly, Optus experienced a significant breach via an exposed, unauthenticated test API endpoint, enabling attackers to harvest sensitive data.

KEY TAKEAWAY

Anything shipped to a browser is public. Client-side code is downloaded, readable and permanently retrievable, so a key embedded in JavaScript is not a secret regardless of how it is obfuscated or which build step inserted it.

What this lab covers

You examine an application's client-side code for information it was not meant to disclose, use what you find to reach an internal endpoint, and exploit an API that does not authenticate requests the way its owners assumed.

The lab is framed as a bug bounty engagement, which is realistic, since this is precisely the shape of finding that programs receive constantly.

It is rated intermediate and suits application testers moving into cloud as well as engineers building APIs on managed gateways.

How unauthenticated API exposure happens

Client-side code is the first place to look because it is free to read. Applications embed endpoint addresses, identifiers and occasionally credentials in JavaScript, on the assumption that users only interact through the interface rather than reading what it is built from.

API Gateway then decides who may invoke each route. Authorisation is configured per method, so it is entirely possible for most routes to require a key or an authoriser while one route does not, usually because it was added later or was intended for internal use.

The internal-use assumption is the recurring error. An endpoint reachable only by the application is a network assumption rather than an authorisation control, and if the gateway is public, the endpoint is public. Attackers enumerate routes precisely because coverage tends to be inconsistent.

How to detect this in your own environment

Enable API Gateway access logging on stages, which is not on by default, so invocations are attributable. Without it you can see configuration changes and not who called what.

Watch for requests to routes that receive little legitimate traffic. Internal-only endpoints have a small, predictable caller population, so anything outside it is worth reviewing.

Look for enumeration patterns: many requests across many paths from one source, and a high rate of not-found responses. That is route discovery, and it precedes exploitation.

How to prevent it

Require authorisation on every route by default and treat exceptions as explicit decisions. Inconsistent coverage across methods is the actual failure, and a default-deny posture removes it.

Never place secrets in client-side code. Where the browser needs to call an API, the authorisation should be a short-lived token tied to the user, obtained after authentication, rather than an embedded key.

Use a private endpoint or a resource policy for genuinely internal APIs, so network reachability matches the intent rather than relying on nobody discovering the route.

Real-world context

API abuse has become one of the more significant causes of large-scale data exposure. T-Mobile disclosed on 19 January 2023 that a bad actor had used a single API to obtain limited types of information on customer accounts, and that the issue was shut down within 24 hours of being identified.

The pattern in that class of incident is consistent. The API worked as built, returned data as designed, and authorisation was either absent or scoped incorrectly, so the abuse was indistinguishable from use until the volume was noticed.

The pattern maps to MITRE ATT&CK T1190 Exploit Public-Facing Application and T1213 Data from Information Repositories.

Applying this at work

  • Audit every route on your public gateways and confirm each has an authoriser, treating any exception as a documented decision.
  • Search your client-side bundles for keys, internal hostnames and identifiers.
  • Enable access logging on production API stages so invocations are attributable.
  • Add rate limiting and anomaly alerting on endpoints that return records, since volume is often the only signal of abuse.
  • Move genuinely internal APIs to private endpoints rather than relying on route obscurity.

Frequently asked questions

Can a secret in JavaScript be protected by obfuscation?

No. Client-side code is downloaded and readable, and obfuscation only slows a reader down. Any value shipped to a browser should be treated as public regardless of how it is packaged.

Why do some API routes end up unauthenticated?

Because authorisation is configured per method rather than per API. Routes added later, or intended for internal use, are frequently deployed without an authoriser while the rest of the API has one.

Is an internal-only endpoint safe if nobody knows the path?

No. If the gateway is publicly reachable, the route is publicly reachable, and route enumeration is routine. Network reachability should be enforced with a private endpoint or resource policy rather than assumed.

Do I need my own AWS account to practice this?

No. The lab runs in a live AWS environment that Pwned Labs provisions for you, so there is nothing to set up and no risk to your own infrastructure.

Which certification covers this in depth?

The Amazon Cloud Red Team Professional (ACRTP) covers AWS attack and detection paths in full, including IAM abuse and privilege escalation, and is assessed hands-on in a live AWS account.

platform mock(1)

Cloud Security Training To Protect Your Business

Pwned Labs for Business gives your team access to dedicated business content, including labs and cyber ranges.

We also offer in-person or remote workshops, and our cloud penetration services are helping businesses become more secure!