VYPR
Moderate severityNVD Advisory· Published Feb 20, 2025· Updated Feb 20, 2025

Unwanted access to the entire file system vulnerability due to a missing check in `staticFiles` HTTP handler in graphql-mesh

CVE-2025-27098

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 packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
@graphql-mesh/clinpm
>= 0.78.0, < 0.82.220.82.22
@graphql-mesh/httpnpm
< 0.3.190.3.19

Affected products

1

Patches

1
95d93e7c140c

Merge pull request from GHSA-j2wh-wrv3-4x4g

https://github.com/Urigo/graphql-meshArda TANRIKULUFeb 16, 2023via ghsa
6 files changed · +55 2
  • .changeset/dry-countries-travel.md+5 0 added
    @@ -0,0 +1,5 @@
    +---
    +'@graphql-mesh/http': patch
    +---
    +
    +When `staticFiles` is set, do not allow to access upper directories
    
  • packages/http/src/index.ts+3 2 modified
    @@ -86,8 +86,9 @@ export function createMeshHTTPHandler<TServerContext>({
           if (!relativePath) {
             relativePath = 'index.html';
           }
    -      const absolutePath = path.join(baseDir, staticFiles, relativePath);
    -      if (await pathExists(absolutePath)) {
    +      const absoluteStaticFilesPath = path.join(baseDir, staticFiles);
    +      const absolutePath = path.join(absoluteStaticFilesPath, relativePath);
    +      if (absolutePath.startsWith(absoluteStaticFilesPath) && (await pathExists(absolutePath))) {
             const readStream = fs.createReadStream(absolutePath);
             return new Response(readStream as any, {
               status: 200,
    
  • packages/http/test/fixtures/static-files/index.html+12 0 added
    @@ -0,0 +1,12 @@
    +<html>
    +  <head>
    +    <title>Static Files</title>
    +    <link rel="stylesheet" href="style.css" />
    +    <script src="script.js"></script>
    +  </head>
    +  <body>
    +    <h1>Static Files</h1>
    +    <p>Some static files.</p>
    +    <p id="test"></p>
    +  </body>
    +</html>
    
  • packages/http/test/fixtures/static-files/script.js+1 0 added
    @@ -0,0 +1 @@
    +document.getElementById('test').innerHTML = 'Hello World!';
    
  • packages/http/test/fixtures/static-files/style.css+8 0 added
    @@ -0,0 +1,8 @@
    +body {
    +  background: #fff;
    +  color: #000;
    +  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    +  font-size: 14px;
    +  line-height: 1.42857143;
    +  margin: 0;
    +}
    
  • packages/http/test/http.spec.ts+26 0 added
    @@ -0,0 +1,26 @@
    +import { createMeshHTTPHandler } from '@graphql-mesh/http';
    +import { MeshInstance } from '@graphql-mesh/runtime';
    +import { getTestMesh } from '../../testing/getTestMesh';
    +
    +describe('http', () => {
    +  let mesh: MeshInstance;
    +  beforeEach(async () => {
    +    mesh = await getTestMesh();
    +  });
    +  it('should not allow upper directory access when `staticFiles` is set', async () => {
    +    const httpHandler = createMeshHTTPHandler({
    +      baseDir: __dirname,
    +      getBuiltMesh: async () => mesh,
    +      rawServeConfig: {
    +        staticFiles: './fixtures/static-files',
    +      },
    +    });
    +    const response = await httpHandler.fetch(
    +      'http://localhost:4000/..%2f/..%2f/..%2f/package.json',
    +    );
    +    expect(response.status).toBe(404);
    +  });
    +  afterEach(() => {
    +    mesh.destroy();
    +  });
    +});
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

5

News mentions

0

No linked articles in our index yet.