5.8medium
Unwanted access to the entire file system vulnerability due to a missing check in `staticFiles` HTTP handler in graphql-mesh
- Severity
- 5.8medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.37% (higher than 32% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-j2wh-wrv3-4x4g
Description
GraphQL Mesh is a GraphQL Federation framework and gateway for both GraphQL Federation and non-GraphQL Federation subgraphs, non-GraphQL services, such as REST and gRPC, and also databases such as MongoDB, MySQL, and PostgreSQL. Missing check vulnerability in the static file handler allows any client to access the files in the server's file system. When `staticFiles` is set in the `serve` settings in the configuration file, the following handler doesn't check if `absolutePath` is still under the directory provided as `staticFiles`. Users have two options to fix vulnerability; 1. Update `@graphql-mesh/cli` to a version higher than `0.82.21`, and if you use `@graphql-mesh/http`, update it to a version higher than `0.3.18` 2. Remove `staticFiles` option from the configuration, and use other solutions to serve static files.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| ardatan graphql-mesh | @graphql-mesh/cli: >= 0.78.0, < 0.82.22, @graphql-mesh/http: < 0.3.19 | CVE List |
| @graphql-mesh/cli (npm) | from 0.78.0 before 0.82.22 | GitHub Advisory Database |
| @graphql-mesh/http (npm) | before 0.3.19 | GitHub Advisory Database |
| the-guild graphql_mesh_cli | from 0.78.0 before 0.82.22 | NVD |
| the-guild graphql_mesh_http | before 0.3.19 | NVD |
All scores
| GitHub_M | 5.8medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:L |
| GitHub | 5.8medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:L |
| NVD | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.
What each source says
CVE List
GraphQL Mesh is a GraphQL Federation framework and gateway for both GraphQL Federation and non-GraphQL Federation subgraphs, non-GraphQL services, such as REST and gRPC, and also databases such as MongoDB, MySQL, and PostgreSQL. Missing check vulnerability in the static file handler allows any client to access the files in the server's file system. When `staticFiles` is set in the `serve` settings in the configuration file, the following handler doesn't check if `absolutePath` is still under the directory provided as `staticFiles`. Users have two options to fix vulnerability; 1. Update `@graphql-mesh/cli` to a version higher than `0.82.21`, and if you use `@graphql-mesh/http`, update it to a version higher than `0.3.18` 2. Remove `staticFiles` option from the configuration, and use other solutions to serve static files.
GitHub Advisory Database
Summary
Missing check vulnerability in the static file handler allows any client to access the files in the server's file system
Details
When staticFiles is set in the serve settings in the configuration file, the following handler doesn't check if absolutePath is still under the directory provided as staticFiles;
if (staticFiles) {
router.get('/:relativePath+', async request => {
let { relativePath } = request.params;
if (!relativePath) {
relativePath = 'index.html';
}
const absolutePath = path.join(baseDir, staticFiles, relativePath);
if (absolutePath.includes(staticFiles) && (await pathExists(absolutePath))) {
const readStream = fs.createReadStream(absolutePath);
return new Response(readStream as any, {
status: 200,
});
}
return undefined;
});
Example scenario
To reproduce it, set staticFiles to the relative path of a directory in .meshrc.yml;
serve:
staticFiles: ./public
Then start the server with mesh dev, and browse to /..%2fpackage.json then you will see the content of package.json. You can even go deeper to see sensitive data; /..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2f..%2fetc/passwd
Impact and solution
If staticFiles is set under serve in the configuration file. you have two options to fix vulnerability;
- Update
@graphql-mesh/clito a version higher than0.82.21, and if you use@graphql-mesh/http, update it to a version higher than0.3.18 - Remove
staticFilesoption from the configuration, and use other solutions to serve static files.
Credits
Thanks alanwillms@gmail.com for reporting this vulnerability with details
NVD (es)
GraphQL Mesh es un framework de trabajo y puerta de enlace de GraphQL Federation tanto para GraphQL Federation como para subgrafos que no son de GraphQL Federation, servicios que no son de GraphQL, como REST y gRPC, y también bases de datos como MongoDB, MySQL y PostgreSQL. La vulnerabilidad de falta de verificación en el controlador de archivos estáticos permite que cualquier cliente acceda a los archivos en el sistema de archivos del servidor. Cuando se configura `staticFiles` en la configuración de `serve` en el archivo de configuración, el siguiente controlador no verifica si `absolutePath` todavía está bajo el directorio proporcionado como `staticFiles`. Los usuarios tienen dos opciones para corregir la vulnerabilidad; 1. Actualizar `@graphql-mesh/cli` a una versión superior a `0.82.21`, y si usa `@graphql-mesh/http`, actualizarlo a una versión superior a `0.3.18` 2. Eliminar la opción `staticFiles` de la configuración y usar otras soluciones para servir archivos estáticos.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-27098 changed 2025-02-20 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-j2wh-wrv3-4x4g changed 2025-02-20 | CC-BY-4.0 |
| NVD | CVE-2025-27098 changed 2026-06-17 | Public domain |