Summary
Prefect 3.6.19 contains an authentication bypass where middleware skips auth checks for any URL path ending in health or ready, originally intended only for liveness/readiness probes.
An attacker who can create Prefect resources with names ending in health or ready can then access those resources without authentication, potentially exposing sensitive configuration data such as API keys and database credentials stored in Prefect Variables.
Affected context
This vulnerability occurs in Prefect 3.6.19 deployments where:
- HTTP authentication middleware uses simple suffix matching to exempt health and readiness endpoints from authentication.
- User-controlled resource identifiers (names or paths) are incorporated into URL routes.
- Variables, flows, work pools, work queues, and deployments are reachable via HTTP APIs that share the same middleware.
Under these conditions, any resource whose name causes its URL to end with health or ready may unintentionally fall under the health-check exemption logic and be served without authentication.
Exploit preconditions
- Attack surface: Prefect API/Orion HTTP endpoints exposed to a network (intranet or internet).
- Required access: Ability to reach the Prefect API and create or influence the naming of resources (e.g., flows, variables, work pools, work queues, deployments).
- Trigger point: Issuing HTTP requests to URLs whose paths end with
healthorready, constructed via attacker-controlled resource names. - Why exploitation is possible: The authentication middleware applies a coarse-grained rule that treats any path ending with
healthorreadyas a probe endpoint, skipping normal authentication checks. Because resource names are embedded in these paths, an attacker can craft names that cause sensitive endpoints to be misclassified as health/readiness endpoints.
Why this happens
The underlying issue is improper authorization logic (CWE-863) caused by conflating endpoint semantics with URL suffix patterns.
Instead of explicitly whitelisting dedicated health and readiness routes, the middleware uses a generic rule: if the URL path ends with health or ready, skip authentication.
Since resource names are user-controlled and incorporated into the path, this pattern allows untrusted input to influence access control decisions.
Conceptually, the bug is an insecure authorization check that bases trust on path string matching rather than on the actual handler, route metadata, or explicit policy, allowing sensitive endpoints to be treated as public health probes.
Potential impact
- Unauthorized reading of Prefect Variables that may contain API keys, database credentials, and other secrets.
- Unauthorized access to details of flows, deployments, work pools, and work queues, revealing internal architecture and operational metadata.
- Potential modification or misuse of orchestration resources (depending on which operations are exposed on the affected endpoints).
- Facilitation of broader compromise of connected systems via stolen credentials and tokens.
- Increased ability for attackers to perform reconnaissance on job scheduling and deployment configurations.
General mitigation guidance
Effective mitigation focuses on tightening authorization logic and reducing reliance on fragile URL patterns:
- Replace suffix-based exemptions with explicit whitelists for well-defined health and readiness routes that are not influenced by user-controlled path segments.
- Separate health/readiness probes onto distinct routes or even a dedicated service or port with clearly scoped access control.
- Ensure that all resource-specific endpoints (variables, flows, work pools, work queues, deployments) always enforce authentication and authorization, regardless of naming.
- Treat resource names as untrusted input and avoid using them directly in authorization decisions; instead, use stable route identifiers and explicit permission checks.
- Apply the principle of least privilege to Prefect service accounts and associated secrets so that exposed information is minimized if an endpoint is accidentally left unauthenticated.
How teams detect issues like this
Detection can be approached through both code-centric and operational techniques:
- Static analysis and code review:
- Search middleware and routing logic for broad pattern-based exemptions (e.g.,
endswith("health"),endswith("ready"), or similar string checks) that bypass authentication. - Flag any authorization decisions that depend solely on URL string patterns rather than explicit route configuration or permission rules.
- Review API route definitions to ensure health/readiness handlers are clearly separated from resource-management endpoints.
- Automated security testing:
- Use API fuzzing or integration tests that create resources with specially crafted names and then probe for unauthenticated access to their endpoints.
- Add regression tests that verify all variable and control-plane endpoints enforce authentication regardless of resource naming.
- Runtime monitoring:
- Analyze access logs for unauthenticated requests to non-standard paths ending with
healthorready. - Configure WAF or API gateways to alert on suspicious path patterns that resemble internal resource URLs but appear as health endpoints.

