diff --git a/advisories/github-reviewed/2024/07/GHSA-342q-2mc2-5gmp/GHSA-342q-2mc2-5gmp.json b/advisories/github-reviewed/2024/07/GHSA-342q-2mc2-5gmp/GHSA-342q-2mc2-5gmp.json new file mode 100644 index 00000000000..49ef83c23c5 --- /dev/null +++ b/advisories/github-reviewed/2024/07/GHSA-342q-2mc2-5gmp/GHSA-342q-2mc2-5gmp.json @@ -0,0 +1,65 @@ +{ + "schema_version": "1.4.0", + "id": "GHSA-342q-2mc2-5gmp", + "modified": "2024-07-15T17:47:00Z", + "published": "2024-07-15T17:47:00Z", + "aliases": [ + "CVE-2024-39919" + ], + "summary": "@jmondi/url-to-png enables capture screenshot of localhost web services (unauthenticated pages)", + "details": "### Summary\n\nThe maintainer been contemplating whether FTP or other protocols could serve as useful functionalities, but there may not be a practical reason for it since we are utilizing headless Chrome to capture screenshots. The argument is based on the assumption that this package can function as a service.\n\nThe package includes an `ALLOW_LIST` where the host can specify which services the user is permitted to capture screenshots of. By default, capturing screenshots of web services running on localhost, 127.0.0.1, or the [::] is allowed.\n\nThe maintainer is of the opinion that the package should also have a blacklist due to a potential vulnerability (or rather design oversight). If someone hosts this on a server, users could then capture screenshots of other web services running locally.\n\nUnless this is strictly for web pages. Something similar here: https://github.com/follow-redirects/follow-redirects/issues/235 (localhost is intended for end users or hosts to deny, and the package is for HTTP/HTTPS.)\n\nThis is marked as a `LOW` since the maintainer is not sure if this is a vulnerability, but it's still best to highlight it. :) \n\n### PoC\n\nHave a service like so running locally:\n\n```js\nconst http = require(\"http\")\n\nconst server = http.createServer((req, res) => {\n console.log(\"Received headers:\", req.headers)\n res.writeHead(200, { \"Content-Type\": \"text/plain\" })\n res.end(\"Something private! But Hello from Server 2 :)\")\n})\n\nserver.listen(3001, () => {\n console.log(\"Server two running on http://localhost:3001\")\n})\n```\n\nRun the package in dev mode, `pnpm dev`. Feed these URLs:\n\n```\nhttp://localhost:3089/?url=http://[::]:3001&width=4000\nhttp://localhost:3089/?url=http://localhost:3001&width=4000\nhttp://localhost:3089/?url=http://127.0.01:3001&width=4000\n```\n\n\"image\"\n\n\n\n### Impact\nDisclose internal web services?\n", + "severity": [ + { + "type": "CVSS_V3", + "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N" + }, + { + "type": "CVSS_V4", + "score": "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:N/SA:N" + } + ], + "affected": [ + { + "package": { + "ecosystem": "npm", + "name": "@jmondi/url-to-png" + }, + "ranges": [ + { + "type": "ECOSYSTEM", + "events": [ + { + "introduced": "0" + }, + { + "fixed": "2.1.2" + } + ] + } + ] + } + ], + "references": [ + { + "type": "WEB", + "url": "https://github.com/jasonraimondi/url-to-png/security/advisories/GHSA-342q-2mc2-5gmp" + }, + { + "type": "WEB", + "url": "https://github.com/jasonraimondi/url-to-png/commit/f62ff40403ffa1781459d6be8d97b8035888c00c" + }, + { + "type": "PACKAGE", + "url": "https://github.com/jasonraimondi/url-to-png" + } + ], + "database_specific": { + "cwe_ids": [ + "CWE-200" + ], + "severity": "LOW", + "github_reviewed": true, + "github_reviewed_at": "2024-07-15T17:47:00Z", + "nvd_published_at": null + } +} \ No newline at end of file diff --git a/advisories/github-reviewed/2024/07/GHSA-vvmv-wrvp-9gjr/GHSA-vvmv-wrvp-9gjr.json b/advisories/github-reviewed/2024/07/GHSA-vvmv-wrvp-9gjr/GHSA-vvmv-wrvp-9gjr.json new file mode 100644 index 00000000000..6eb2a876625 --- /dev/null +++ b/advisories/github-reviewed/2024/07/GHSA-vvmv-wrvp-9gjr/GHSA-vvmv-wrvp-9gjr.json @@ -0,0 +1,69 @@ +{ + "schema_version": "1.4.0", + "id": "GHSA-vvmv-wrvp-9gjr", + "modified": "2024-07-15T17:46:57Z", + "published": "2024-07-15T17:46:57Z", + "aliases": [ + "CVE-2024-39918" + ], + "summary": "@jmondi/url-to-png contains a Path Traversal vulnerability", + "details": "### Summary\nWhen 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. \n\n### Details\n\n@jmondi/url-to-png does not sanitizing the `ImageID` as in not removing special chars from the params [(extract_query_params.ts#l75)](https://github.com/jasonraimondi/url-to-png/blob/e43098e0af3a380ebc044e7f303a83933b94b434/src/middlewares/extract_query_params.ts#L75)\n\n```js\nconst imageId = dateString + \".\" + slugify(validData.url) +configToString(params);\n```\n\nThis when fed to other parts of the code such as ([filesystem.ts#L34](https://github.com/jasonraimondi/url-to-png/blob/8afc00247c1d7e6c7b37356a5f6282b486e596fa/src/lib/storage/filesystem.ts#L34))\n\n```js\nreturn path.join(this.storagePath, imageId) + \".png\";\n```\n\nWould result in path traversal issue. \n\n### PoC\n\n```\n# Configuration for filesystem storage provider (optional)\nSTORAGE_PROVIDER=filesystem\nIMAGE_STORAGE_PATH=poc\n```\n\nSet this in your `.env` file and use this as your payload. \n\n```\nhttp://localhost:3089/?url=http://example.com&width=400&isDarkMode=../../../../../../../../../../../../tmp/hack\n```\n\nThis will create a `.png` file in the `/tmp` section of the system.\n\nLoom POC: https://www.loom.com/share/bd7b306cdae7445c97e68f0626e743a6 \n\n\n\nThis is valid for pretty much all the arguments (except for numeric values)\n\nA simple fix would be to use the `slugify` for the params as well like so ([#L75](https://github.com/jasonraimondi/url-to-png/blob/e43098e0af3a380ebc044e7f303a83933b94b434/src/middlewares/extract_query_params.ts#L75))\n\n```diff\n- const imageId = dateString + \".\" + slugify(validData.url) + configToString(params);\n+ const imageId = dateString + \".\" + slugify(validData.url) + slugify(configToString(params));\n```\n\n\n### Impact\nThis would be path traversal vulnerability which allows arbitrary write as of now. \n", + "severity": [ + { + "type": "CVSS_V3", + "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N" + }, + { + "type": "CVSS_V4", + "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N" + } + ], + "affected": [ + { + "package": { + "ecosystem": "npm", + "name": "@jmondi/url-to-png" + }, + "ranges": [ + { + "type": "ECOSYSTEM", + "events": [ + { + "introduced": "0" + }, + { + "fixed": "2.1.2" + } + ] + } + ] + } + ], + "references": [ + { + "type": "WEB", + "url": "https://github.com/jasonraimondi/url-to-png/security/advisories/GHSA-vvmv-wrvp-9gjr" + }, + { + "type": "WEB", + "url": "https://github.com/jasonraimondi/url-to-png/commit/e4eaeca6493b21cd515b582fd6c0af09ede54507" + }, + { + "type": "PACKAGE", + "url": "https://github.com/jasonraimondi/url-to-png" + }, + { + "type": "WEB", + "url": "https://github.com/jasonraimondi/url-to-png/releases/tag/v2.1.2" + } + ], + "database_specific": { + "cwe_ids": [ + + ], + "severity": "MODERATE", + "github_reviewed": true, + "github_reviewed_at": "2024-07-15T17:46:57Z", + "nvd_published_at": null + } +} \ No newline at end of file