Enviar #1082211: kekingcn kkFileView v5.0.2 (official-baseline jar `server/target/kkFileView-5.0.2.jar` built from release commit `c4288f7e`, started unmodified); v5.0.3 was published on 2026-10-08 and was not part of this audit reflected cross-site scriptinginformación

Títulokekingcn kkFileView v5.0.2 (official-baseline jar `server/target/kkFileView-5.0.2.jar` built from release commit `c4288f7e`, started unmodified); v5.0.3 was published on 2026-10-08 and was not part of this audit reflected cross-site scripting
DescripciónReflected XSS in kkFileView via raw quotes in the `url` parameter query string of `/onlinePreview` (already-encoded filename bypass in `WebUtils.urlEncoderencode`) Vendor: kekingcn Affected versions: v5.0.2 (official-baseline jar `server/target/kkFileView-5.0.2.jar` built from release commit `c4288f7e`, started unmodified); v5.0.3 was published on 2026-10-08 and was not part of this audit Vulnerability class: reflected cross-site scripting (CWE-79) Preconditions: none for the request itself (anonymous). Deployment precondition: `trust.host` configured (the normal remote-preview configuration); with the shipped default the whole route returns 403 (verified negative control). The `url` host must be inside the trust list (the intended remote-preview use case); the referenced file does not need to exist (svg/dcm http branch performs no server-side download). Reflected XSS in kkFileView via raw quotes in the `url` parameter query string of `/onlinePreview` (already-encoded filename bypass in `WebUtils.urlEncoderencode`) Data flow: `GET /onlinePreview` request parameter `url` (base64-encoded URL) → `OnlinePreviewController.java:94` passes it through `WebUtils.urlEncoderencode` (`WebUtils.java:89-109`) → `:101-103`: the helper checks the filename segment with `UrlEncoderUtils.hasUrlEncoded`; a filename containing `%XX` (e.g. `x%20y.svg`) is judged already encoded, so the entire URL — including the attacker query string with a raw `'` — is returned verbatim → `CommonPreviewImpl.java:52` bare `model.addAttribute("currentUrl", url)` (no escaping) → `svg.ftl:99-100` `<#assign finalUrl="${currentUrl}">` → `svg.ftl:132` renders `var url = '${finalUrl}';` inside `<script>` → the raw quote closes the JavaScript string and the remainder executes on page load. The same finalUrl sink exists in `dcm.ftl:26-27,57`, `bpmn.ftl:44`, `eml.ftl:22`, `ofd.ftl:20`, `online3D.ftl:23`, `cadviewer.ftl:36` and further templates. ### Affected interfaces | Interface | |---| | `GET /onlinePreview?url=<base64 of "http://<trusted-host>/x%20y.svg?a=';alert(1)//">` (anonymous; svg and dcm routes among the shared-sink family) | Primary route detail: ``` GET /onlinePreview?url=aHR0cDovLzEyNy4wLjAuMS94JTIweS5zdmc/YT0nO2FsZXJ0KDEpLy8= -> HTTP 200, rendered page contains: var url = 'http://127.0.0.1/x%20y.svg?a=';alert(1)//'; ``` Why the actor reaches the sink: 1. The route requires no authentication; the only gate is the `trust.host` deployment configuration (the attacker's URL names a host inside the trust list, which is the intended remote-preview use). 2. The encoding helper's filename-based heuristic leaves the query string raw whenever the filename merely looks already encoded. ### Root cause The gap is heuristic encoding applied at the source instead of context-appropriate encoding at the sink: "the filename contains `%XX`" is treated as proof that the whole URL is safe to interpolate raw. 1. `WebUtils.java:101-103` — `hasUrlEncoded(filename)` true → the whole URL (query string included) is returned unencoded. 2. `CommonPreviewImpl.java:52` — bare `addAttribute("currentUrl", url)`, no `htmlEscape`/`js_string`. 3. `svg.ftl:132` (and the shared finalUrl family) — raw interpolation inside a `<script>` single-quoted JavaScript string. 4. Contrast: `PictureFilePreviewImpl.java:32` escapes the same URL with `KkFileUtils.htmlEscape` before use, neutralizing the identical payload (route-level negative control). Baseline: kkFileView v5.0.2 official-baseline jar (release commit `c4288f7e`), started unmodified on `127.0.0.1:18776`; the official external configuration mechanism supplied `trust.host=127.0.0.1`. **1. Positive - raw quote from the query string reaches the JavaScript string sink:** ```bash U=$(printf "http://127.0.0.1/x%%20y.svg?a=';alert(1)//" | base64 -w0) curl -s --noproxy '*' "http://127.0.0.1:18776/onlinePreview?url=$U" ``` Response `HTTP 200`; line 183 of the rendered page: ```js var url = 'http://127.0.0.1/x%20y.svg?a=';alert(1)//'; ``` The referenced file does not exist — the svg http branch performs no server-side download, and the page renders anyway. **2. Negative control A (unencoded filename branch re-encodes):** the same URL with a literal space in the filename renders `var url = 'http://127.0.0.1/x%20y.svg?a=%27%3Balert%281%29//';` — the whole URL re-encoded (`'` → `%27`), no injection. The escape route is the "filename judged already encoded" branch only. **3. Negative control B (picture route escapes the same input):** the same URL shape with a `.png` extension renders the quote neutralized as `&#39;` by `PictureFilePreviewImpl.java:32` (`htmlEscape`). **4. Gate control (default configuration):** restarted without `trust.host`, the identical request returns `HTTP 403` with zero occurrences of the payload. Note: the test host had no desktop browser, so no real browser execution was recorded; the injection point is a valid JavaScript statement context and the server-side reflection is byte-exact. - **Vendor contact**: GitHub Private Vulnerability Reporting - kekingcn/kkFileView - **Status**: vendor notification being sent through GitHub Private Vulnerability Reporting; private report https://github.com/kekingcn/kkFileView/security/advisories/GHSA-qhgg-r4gh-gw65; not publicly disclosed; no CVE assigned - **Duplicate check**: public advisories (NVD/OSV/GitHub) and the project issue tracker were searched before reporting; please tell us if this duplicates something already tracked internally.
Fuente⚠️ https://github.com/kekingcn/kkFileView
Usuario
 lucasg2g (UID 84737)
Sumisión2026-11-09 08:33 (hace 24 días)
Moderación2026-12-03 09:52 (24 days later)
EstadoAceptado
Entrada de VulDB448610 [kekingcn kkFileView hasta 5.0.2 Online Preview WebUtils.java urlEncoderencode url secuencias de comandos en sitios cruzados]
Puntos20

Interested in the pricing of exploits?

See the underground prices here!