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 package | Versions | Reported by |
|---|---|---|
| simonsmith cypress-image-snapshot | <= 8.0.1 | CVE List |
| @simonsmith/cypress-image-snapshot (npm) | before 8.0.2 | GitHub Advisory Database |
| simonsmith cypress_image_snapshot | before 8.0.2 | NVD |
All scores
| GitHub_M | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N |
| GitHub | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N |
| NVD | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N |
Classification
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
| https://github.com/simonsmith/cypress-image-snapshot/security/advisories/GHSA-vxjg-hchx-cc4g | exploit, mitigation, vendor-advisory, web | |
| https://github.com/simonsmith/cypress-image-snapshot/issues/15 | exploit, issue-tracking, patch, third-party-advisory, web | |
| https://github.com/simonsmith/cypress-image-snapshot/commit/ef49519795daf5183f4fac6f3136e194f20f39f4 | patch, web | |
| https://github.com/simonsmith/cypress-image-snapshot/releases/tag/8.0.2 | release-notes, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2023-38695 | advisory | |
| https://github.com/simonsmith/cypress-image-snapshot | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2023-38695 changed 2024-10-04 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-vxjg-hchx-cc4g changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2023-38695 changed 2026-06-17 | Public domain |