CVE-2023-38695
JSON

6.5medium

cypress-image-snapshot vulnerable to insecure snapshot file names

Severity
6.5medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.99% (higher than 63% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-vxjg-hchx-cc4g

Description

cypress-image-snapshot shows visual regressions in Cypress with jest-image-snapshot. Prior to version 8.0.2, it's possible for a user to pass a relative file path for the snapshot name and reach outside of the project directory into the machine running the test. This issue has been patched in version 8.0.2.

Affected

Product or packageVersionsReported by
simonsmith cypress-image-snapshot<= 8.0.1CVE List
@simonsmith/cypress-image-snapshot (npm)before 8.0.2GitHub Advisory Database
simonsmith cypress_image_snapshotbefore 8.0.2NVD

All scores

GitHub_M6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
GitHub6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
NVD6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

Classification

CWE-22

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

cypress-image-snapshot shows visual regressions in Cypress with jest-image-snapshot. Prior to version 8.0.2, it's possible for a user to pass a relative file path for the snapshot name and reach outside of the project directory into the machine running the test. This issue has been patched in version 8.0.2.

GitHub Advisory Database
Impact

It's possible for a user to pass a relative file path for the snapshot name and reach outside of the project directory into the machine running the test. Example:

  cy.get('h1').matchImageSnapshot('../../../ignore-relative-dirs')

The above will create an ignore-relative-dirs.png three levels up

Patches

Fixed in 8.0.2

Workarounds

Validate all the existing uses of matchImageSnapshot to ensure correct use of the filename argument. Example:

    // snapshot name will be the test title
    cy.matchImageSnapshot();

    // snapshot name will be the name passed in
    cy.matchImageSnapshot('login');
References

https://github.com/simonsmith/cypress-image-snapshot/issues/15

NVD (es)

cypress-image-snapshot muestra regresiones visuales en Cypress con jest-image-snapshot. Antes de la versión 8.0.2, era posible que un usuario pasara una ruta de archivo relativa para el nombre de la instantánea y llegara fuera del directorio del proyecto a la máquina que ejecutaba la prueba. Este problema se ha corregido en la versión 8.0.2.

References

Sources

SourceRecordLicence
CVE ListCVE-2023-38695 changed 2024-10-04CVE Terms of Use
GitHub Advisory DatabaseGHSA-vxjg-hchx-cc4g changed 2026-09-10CC-BY-4.0
NVDCVE-2023-38695 changed 2026-06-17Public domain