API Endpoint Accessible Without Authentication

API endpoints that return non-public data or perform actions respond to requests that carry no credentials, so anyone who can reach the API can use them.

SeverityHigh
CVSS 3.18.2 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N Open in the calculator
CVSS 4.08.8 CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N Open in the calculator
CWECWE-306: Missing Authentication for Critical Function
OWASP Top 10A07:2025 Authentication Failures
MITRE ATT&CKT1190 Exploit Public-Facing Application
CategoryBroken Access Control

Description

The API expects callers to authenticate, but one or more endpoints process requests that carry no session cookie, token or API key, and return data or perform actions as if the caller were authorised. This usually happens because authentication is applied route by route rather than by default, so a new, internal or rarely used endpoint is left out; because a gateway protects the documented routes while the service behind it can be reached another way; or because some methods or versions of an otherwise protected endpoint are not covered.

Anyone who can reach the API can therefore use the affected endpoints without an account, and because no credentials are needed, exploitation is easy to automate and cannot be traced to an account. Endpoints commonly affected include those built for a mobile application or a partner integration, internal and administrative operations, export and reporting functions, file and attachment downloads, health and diagnostic endpoints that reveal configuration, and GraphQL operations whose resolvers do not check the caller. Depending on what they do, this can expose personal or business data, often for all users at once, allow records to be created, changed or deleted, or reveal configuration and secrets that support further attacks; the impact is lower where the endpoint returns only information that is public elsewhere.

The weakness is identified by replaying each captured API request with the Authorization header, cookies and any API key removed, for every method, and comparing the responses with the authenticated ones. Endpoints found in client code, API documentation and older API versions should be tested in the same way, as should the service itself where it can be reached without passing through the gateway.

Remediation

Make authentication the default for the whole API:

  • Apply authentication globally, at the framework or gateway level, and mark only the endpoints that are intentionally public as anonymous. Examples are a fallback authorisation policy that requires an authenticated user in ASP.NET Core, anyRequest().authenticated() in Spring Security, and authentication middleware registered before all routes in Express.
  • Keep the list of anonymous endpoints short, documented and reviewed, and return no non-public data from them.
  • Make sure services behind a gateway cannot be reached directly, or authenticate requests in each service as well, for example by validating the token in every service.
  • Check authorisation as well as authentication on every endpoint, so that authenticated callers reach only what their role allows.
  • Add automated tests that call every route without credentials and fail if any non-public route succeeds.
// ASP.NET Core: require an authenticated user unless an endpoint allows anonymous access builder.Services.AddAuthorization(options => { options.FallbackPolicy = new AuthorizationPolicyBuilder() .RequireAuthenticatedUser() .Build(); });

Confirm the fix by repeating the unauthenticated requests against every affected endpoint and method and checking that each returns 401 Unauthorized.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More APIs Findings

Every APIs finding