GHSA-CRQ7-3XG2-HJCH
Stored XSS via Unescaped Namespace File Name [Latest Release <= 1.3.31]
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-CRQ7-3XG2-HJCH divulgada | |
| Remediación | Parche 1.3.36 | io.kestra:kestra · 4 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
A namespace file name is stored and returned by the API byte for byte, with no character validation. The delete-confirmation dialog interpolates that name into a translation string containing HTML and renders it with `v-html`. vue-i18n's `escapeParameterHtml` is not enabled and defaults to `false`, so the name is concatenated raw.
Anyone who can create a namespace file can persist JavaScript that runs in the browser of any user who clicks Delete file.
## Vulnerable code
Sink, `ui/src/components/inputs/FileExplorer.vue:315`:
315 <span class="py-3" v-html="confirmationLabels.message" />Message built by raw interpolation, `ui/src/components/inputs/FileExplorer.vue:509-510`:
509 if (foldersCount === 1) labels.message = t("namespace files.dialog.deletion.folder_single", {name: folders?.[0].fileName})
510 else if (filesCount === 1) labels.message = t("namespace files.dialog.deletion.file_single", {name: files?.[0].fileName})
// ^^ unescaped file nameTranslation contains HTML, `ui/src/translations/en.json:992`:
992 "file_single": "Are you sure you want to delete the file <code>{name}</code>?",Missing guard, `ui/src/utils/init.ts:116-122`:
116 const i18n = setupI18n({
117 locale: "en",
118 messages: translations,
119 allowComposition: true,
120 legacy: false,
121 warnHtmlMessage: false,
122 } as any) // escapeParameterHtml NOT set, defaults to falseSource is unvalidated, `webserver/.../NamespaceFileController.java:200,254-257`. Only a
length check is applied, no character allowlist:
200 @Parameter(description = "The internal storage uri") @QueryValue String path,
...
254 for (Path component : Path.of(filePath)) {
255 if (component.toString().length() > MAX_FILE_NAME_LENGTH) { // length onlyFor contrast, flow ids and namespaces are pattern validated and cannot contain `<`
(`core/.../AbstractFlow.java:31`, `@Pattern(regexp = "^[a-zA-Z0-9][a-zA-Z0-9._-]*")`).
Every sibling dialog escapes; this one does not. `ChangeStatus.vue:67` imports `escape from "lodash/escape"` and wraps its values; the same applies in `ForceRun.vue`, `Pause.vue`, `Restart.vue`, `Resume.vue`, `ResumeFromBreakpoint.vue`, `Unqueue.vue`, `SetLabels.vue`. Of all 59 `v-html`/`innerHTML` sites in the UI, `FileExplorer.vue:315` is the only unescaped one taking user-controlled input.
Reproduction
docker run -d --name kestra -p 8080:8080 --user root kestra/kestra:develop server localOpen `http://localhost:8080/ui/` and complete the first-run setup.
- Go to `http://localhost:8080/ui/main/namespaces/edit/tutorial/files`
- In the toolbar right of the Filter box, click the first icon (page with +, tooltip *Create file*)
<img width="1576" height="945" alt="image" src="https://github.com/user-attachments/assets/9479d286-40d2-4a9c-81cb-30d08719569c" />
4. In Name, paste this as the file name:
```
<img src=x onerror=alert(document.domain)>.txt
```
<img width="1263" height="685" alt="image" src="https://github.com/user-attachments/assets/8da12118-c61d-40df-86bc-b6709fd9a6f9" />
5. Click Create. The file appears in the tree and nothing fires; the tree uses
`{{ data.fileName }}` and is correctly escaped.
6. Right-click the file, choose Delete file.
7. The confirmation dialog renders the name via `v-html` and the payload executes.
<img width="1277" height="832" alt="image" src="https://github.com/user-attachments/assets/b95db2ce-f90b-40b8-80b8-0c026b418a65" />
No need to click Confirm; the script runs when the dialog renders.
The Rename file dialog is a second injection point with the same effect.
Proof
Server returns the name byte for byte:
[{"type":"File","size":7,
"fileName":"<img src=x onerror=alert(document.domain)>.txt", ...}]<img width="1918" height="712" alt="image" src="https://github.com/user-attachments/assets/db770af1-1af2-4515-a351-ad423db70b66" />
Rendered DOM of the dialog, captured from a real browser:
Are you sure you want to delete the file
<code><img src="x" onerror="alert(document.domain)"></code>?Who can inject
Any user who can create a namespace file. File-API access is not required: `io.kestra.plugin.core.namespace.UploadFiles` writes namespace files from inside a running flow and its `filesMap` keys become the path verbatim (`core/src/main/java/io/kestra/plugin/core/namespace/UploadFiles.java:213`, `Path.of(destination + targetFilePath)`). Verified: a flow planted `/<img src=x onerror=window.__planted='VIA-FLOW'>.txt` into another namespace.
The payload then executes with the privileges of whoever opens the dialog, which is what `S:C` reflects.
Fix
- Escape at the sink, `FileExplorer.vue`:
import escape from "lodash/escape"
...
labels.message = t("namespace files.dialog.deletion.file_single", {name: escape(files?.[0].fileName)})- Close the class, `ui/src/utils/init.ts`, add `escapeParameterHtml: true` to `setupI18n`.
- Ship a Content-Security-Policy; the example at `cli/src/main/resources/application.yml:152` is commented out. This is what turns the bug from Medium into Critical.
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
mavenio.kestra:kestra |
Corregida | 1.3.36 | 4 d | 2.0.10 no afectada |
1.3.36Arsenal 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-crq7-3xg2-hjchLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
