Vulnerabilities in pkg:npm/@simonsmith/cypress-image-snapshot
PACKAGECVE-2023-38695 is a MODERATE (CVSS 6.5) @simonsmith/cypress-image-snapshothas fix for insecure snapshot vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting @simonsmith/cypress image snapshot libraries in the npm ecosystem. The issue involves @simonsmith/cypress-image-snapshothas fix for insecure snapshot file names. Remediation is available by upgrading affected packages to version 8.0.2.
pkg:npm/@simonsmith/cypress-image-snapshot
Vulnerability advisories affecting package pkg:npm/@simonsmith/cypress-image-snapshot. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-vxjg-hchx-cc4g | CVE-2023-38695 | MODERATE | @simonsmith/cypress-image-snapshothas fix for insecure snapshot file names |
CVE-2023-38695 at a Glance
Security Impact
CVSS: 6.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N).
How to Fix CVE-2023-38695
To remediate this vulnerability, upgrade all affected @simonsmith/cypress image snapshot dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install @simonsmith/cypress-image-snapshot@8.0.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @simonsmith/cypress-image-snapshot
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2023-38695, inspect your project dependencies using npm:
npm ls @simonsmith/cypress-image-snapshot
Analyze the terminal output to locate any version of @simonsmith/cypress image snapshot in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 8.0.2), your application is affected.
Note: The npm ls @simonsmith/cypress-image-snapshot command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In @simonsmith/cypress image snapshot, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2023-38695 Affected @simonsmith/cypress image snapshot Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@simonsmith/cypress-image-snapshot
|
npm |
< 8.0.2
|
8.0.2
|
References
Frequently Asked Questions
What is CVE-2023-38695?
Which @simonsmith/cypress image snapshot versions are affected?
What version fixes CVE-2023-38695?
Is @simonsmith/cypress-image-snapshot affected?
What is the CVSS score of CVE-2023-38695?
What CWE is associated with CVE-2023-38695?
How can I check npm dependencies for CVE-2023-38695?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-vxjg-hchx-cc4g",
"modified" : "2023-08-04T18:41:47Z",
"published" : "2023-08-01T16:59:40Z",
"aliases" : [ "CVE-2023-38695" ],
"summary" : "@simonsmith/cypress-image-snapshothas fix for insecure snapshot file names",
"details" : "### Impact\nIt'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:\n\n```js\n cy.get('h1').matchImageSnapshot('../../../ignore-relative-dirs')\n```\nThe above will create an `ignore-relative-dirs.png` three levels up\n\n### Patches\nFixed in `8.0.2`\n\n### Workarounds\nValidate all the existing uses of `matchImageSnapshot` to ensure correct use of the filename argument. Example:\n\n```js\n // snapshot name will be the test title\n cy.matchImageSnapshot();\n\n // snapshot name will be the name passed in\n cy.matchImageSnapshot('login');\n```\n\n### References\nhttps://github.com/simonsmith/cypress-image-snapshot/issues/15\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@simonsmith/cypress-image-snapshot"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "8.0.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 8.0.1"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/simonsmith/cypress-image-snapshot/security/advisories/GHSA-vxjg-hchx-cc4g"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-38695"
}, {
"type" : "WEB",
"url" : "https://github.com/simonsmith/cypress-image-snapshot/issues/15"
}, {
"type" : "WEB",
"url" : "https://github.com/simonsmith/cypress-image-snapshot/commit/ef49519795daf5183f4fac6f3136e194f20f39f4"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/simonsmith/cypress-image-snapshot"
}, {
"type" : "WEB",
"url" : "https://github.com/simonsmith/cypress-image-snapshot/releases/tag/8.0.2"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-08-01T16:59:40Z",
"nvd_published_at" : "2023-08-04T18:15:14Z"
}
}