> For the complete documentation index, see [llms.txt](https://fvb.vchan.in/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fvb.vchan.in/api-vulnerabilities/authenticated-route-bypass.md). Agents can also search and read this documentation through its [MCP server](https://fvb.vchan.in/~gitbook/mcp).

# Authenticated Route Bypass

A vulnerable authentication bypass  might occur when an endpoint that should be protected isn't properly enforced by authentication middleware or decorators.

An authentication bypass occurs when secure endpoints aren't protected by authentication measures, allowing unauthorized access to sensitive areas like admin panels or user accounts. This can lead to data breaches and exposure. Proper authentication checks are crucial to prevent this risk. Developers should review code, ensure all sensitive endpoints are protected, and conduct regular security audits

## Vulnerable Code <a href="#score-1" id="score-1"></a>

In the below code snippet, the `get_all_users` endpoint lacks authentication or authorization, which means anyone can access the list of users without restriction. This creates a vulnerability in scenarios where sensitive user information should be restricted to authenticated or authorized users only.

```python
@router.get("/users")
async def get_all_users(db: Session = Depends(get_db)):
    users = await get_all_users_handler(db)
    return JSONResponse(status_code=200, content={"status": "success", "message": "Users retrieved successfully", "data": jsonable_encoder(users)})
```

## Vulnerable APIs

**(Admin) Get All Users**

<https://apidoc.fvb.vchan.in/#ff62ee09-4e94-4a0f-9621-ddff39925fd8>

## Compliance[​](https://docs.escape.tech/testing/vulnerabilities/access_control/auth_bypass#compliance) <a href="#compliance" id="compliance"></a>

* OWASP: **API2:2023**
* PCI: **6.5.10**
* GDPR: **Article-32**
* SOC2: **CC1**
* ISO27001: **A.14.2**
* NIST: **SP800-53**

## CWE & CVSS[​](https://docs.escape.tech/testing/vulnerabilities/access_control/auth_bypass#score-1) <a href="#score-1" id="score-1"></a>

* CWE: **285**
* CVSS VECTOR: **AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N**
* CVSS  SCORE: **6.5**
