# GHSA-5HMW-VF9Q-XQHV: Micronaut static resources served from a class path directory follow symbolic links outside the configured base path

- Database: GitHub
- Severity: CVSS 3.7 (Low)
- Published: 2026-11-11
- Modified: 2026-11-11

## Affected versions

- io.micronaut:micronaut-core (Maven): fixed in 3.10.19
- io.micronaut:micronaut-core (Maven): from 4.0.0, fixed in 4.10.37
- io.micronaut:micronaut-core (Maven): from 5.0.0, fixed in 5.2.23

## Description

### Summary
Static resources mapped with a `classpath:` path (for example `micronaut.router.static-resources.default.paths=classpath:public`) are resolved by `DefaultClassPathResourceLoader`, which checks only the requested path and never the location of the file it opens. When the application runs from an exploded class path (a directory, as in development, `gradle run`, many container layouts and IDE launches), a symbolic link inside the static base directory is followed, and the server returns files outside of it.

`DefaultFileSystemResourceLoader`, used for `file:` static resource paths, compares the real path of the resolved file with the real path of the base directory and returns 404 in the same case; the class path loader does not.

### Details
Path to serving: `StaticResourceResolver.resolve` -> `ResourceLoader.getResource` on the loader created by `ClassPathResourceLoader.forBase("classpath:public")` -> `NettyRequestLifecycle.findFile` in `micronaut-http-server-netty`, which streams the `file:` URL.

### PoC
Class path directory layout:
```
classes/public/index.html
classes/public/export -> ../private
classes/private/key.txt
```
With `micronaut.router.static-resources.default.paths=classpath:public` and `mapping=/**`, `GET /export/key.txt` returns the contents of `classes/private/key.txt`.

### Impact
Disclosure of files reachable through a symbolic link that sits inside a static resource directory on an exploded class path. The attacker cannot create the link; it must already exist in the deployed directory (for example created by a build step, a mounted volume or a shared directory). Applications running from jars are not affected.

### Fix
`DefaultClassPathResourceLoader` with a base path rejects a `file:` resource whose real path is not under the real path of the base directory in the class path entry it came from. Loaders without a base path keep their behavior.

### Affected and patched versions

| Package | Affected versions | Patched version |
| --- | --- | --- |
| `io.micronaut:micronaut-core` | `< 3.10.19` | `3.10.19` |
| `io.micronaut:micronaut-core` | `>= 4.0.0, < 4.10.37` | `4.10.37` |
| `io.micronaut:micronaut-core` | `>= 5.0.0, < 5.2.23` | `5.2.23` |

The 3.x fix is in [commit 6708ff83bc](https://github.com/micronaut-projects/micronaut-core/commit/6708ff83bca36b18cd773cf7b0ec2314625a5fee), first included in stable release [3.10.19](https://github.com/micronaut-projects/micronaut-core/releases/tag/v3.10.19). The last affected stable 3.10.x release is 3.10.18.

## References

- https://github.com/micronaut-projects/micronaut-core/security/advisories/GHSA-5hmw-vf9q-xqhv

Page: https://cve.now/GHSA-5HMW-VF9Q-XQHV

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
