Media

@jmondi/url-to-png contains a Path Traversal vulnerability

  • Publicada: 15.07.2024
  • Actualizado: 11.10.2026 10:22

Summary

When trying to add a BLOCK_LIST feature when the maintainer noticed they didn't sanitize the ImageId in the code, which leads to path traversal vulnerability. Now, this is different from a traditional path traversal issue, because as of NOW you can store the image in any place arbitrarily, and given enough time they might be able to come up with a working exploit BUT for the time being they am reporting this.

Details

@jmondi/url-to-png does not sanitizing the ImageID as in not removing special chars from the params (extract_query_params.ts#l75)

js
const imageId = dateString + "." + slugify(validData.url) +configToString(params);

This when fed to other parts of the code such as (filesystem.ts#L34)

js
return path.join(this.storagePath, imageId) + ".png";

Would result in path traversal issue.

PoC

# Configuration for filesystem storage provider (optional)
STORAGE_PROVIDER=filesystem
IMAGE_STORAGE_PATH=poc

Set this in your .env file and use this as your payload.

http://localhost:3089/?url=http://example.com&width=400&isDarkMode=../../../../../../../../../../../../tmp/hack

This will create a .png file in the /tmp section of the system.

Loom POC: https://www.loom.com/share/bd7b306cdae7445c97e68f0626e743a6

This is valid for pretty much all the arguments (except for numeric values)

A simple fix would be to use the slugify for the params as well like so (#L75)

diff
- const imageId = dateString + "." + slugify(validData.url) + configToString(params);
+ const imageId = dateString + "." + slugify(validData.url) + slugify(configToString(params));

Impact

This would be path traversal vulnerability which allows arbitrary write as of now.

Software afectado

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

PlataformaPaqueteVersiones vulnerablesCorregida en
Paquete de npm @jmondi/url-to-png < 2.1.2 2.1.2

Referencias

Puntuación CVSS 5.3/10
Vector CVSS
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N
Debilidad (CWE)
CWE-22
Plataforma
npm
Paquete
@jmondi/url-to-png
Publicada
15.07.2024
Actualizado
11.10.2026 10:22

Fuentes y licencias

OSV / GitHub Advisory Database - GHSA-vvmv-wrvp-9gjr - CC BY 4.0

Historial de vulnerabilidades: @jmondi/url-to-png

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
06.2024 07.2024
Sin corrección
0
Explotada en ataques
0

Distribución por gravedad

  • Media 3

Divulgaciones por año

  1. 2024: 3
  2. 2025: 0
  3. 2026: 0
  1. @jmondi/url-to-png contains a Path Traversal vulnerability esta entrada
    Media · 5.3 CVE-2024-39918 < 2.1.2 2.1.2

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.