{"id":"GHSA-wm7q-rxch-43mx","aliases":[],"status":"published","title":"Byass due to validation before canonicalization in serve","description":"Versions of `serve` before 6.5.2 are vulnerable to the bypass of the ignore functionality. The bypass is possible because validation happens before canonicalization of paths and filenames.\n\n\n\nExample:\nHere we have a server that ignores the file test.txt.\n```\nconst serve = require('serve')\nconst server = serve(__dirname, {\n      port: 1337,\n      ignore: ['test.txt']\n})\n```\n\nUsing the URL encoded form of a letter (%65 instead of e) attacker can bypass the ignore control accessing the file. \n\n`curl http://localhost:1337/t%65st.txt`\n\nAdditionally this technique can be used to get directory listings of ignored directories.\n\n\n## Recommendation\n\nUpdate to version 6.5.2 or later.","facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"published":"2020-09-01T19:38:33Z","modified":"2023-01-09T05:03:53Z","fixes":[{"ecosystem":"npm","package":"serve","fixed_in":["6.5.2"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"serve","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"6.5.2"}]}]},{"source":"osv","ecosystem":"npm","package":"serve","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"6.5.2"}]}]}],"references":[{"url":"https://hackerone.com/reports/308721","tags":["web"]},{"url":"https://www.npmjs.com/advisories/594","tags":["web"]},{"url":"https://github.com/advisories/GHSA-wm7q-rxch-43mx"}],"sources":{"ghsa":[{"id":"GHSA-wm7q-rxch-43mx","title":"Byass due to validation before canonicalization in serve","description":"Versions of `serve` before 6.5.2 are vulnerable to the bypass of the ignore functionality. The bypass is possible because validation happens before canonicalization of paths and filenames.\n\n\n\nExample:\nHere we have a server that ignores the file test.txt.\n```\nconst serve = require('serve')\nconst server = serve(__dirname, {\n      port: 1337,\n      ignore: ['test.txt']\n})\n```\n\nUsing the URL encoded form of a letter (%65 instead of e) attacker can bypass the ignore control accessing the file. \n\n`curl http://localhost:1337/t%65st.txt`\n\nAdditionally this technique can be used to get directory listings of ignored directories.\n\n\n## Recommendation\n\nUpdate to version 6.5.2 or later.","status":"published","published":"2020-09-01T19:38:33Z","modified":"2023-01-09T05:03:53Z","updated_at":"2026-11-02T14:36:06.884904Z"}],"osv":[{"id":"GHSA-wm7q-rxch-43mx","title":"Byass due to validation before canonicalization in serve","description":"Versions of `serve` before 6.5.2 are vulnerable to the bypass of the ignore functionality. The bypass is possible because validation happens before canonicalization of paths and filenames.\n\n\n\nExample:\nHere we have a server that ignores the file test.txt.\n```\nconst serve = require('serve')\nconst server = serve(__dirname, {\n      port: 1337,\n      ignore: ['test.txt']\n})\n```\n\nUsing the URL encoded form of a letter (%65 instead of e) attacker can bypass the ignore control accessing the file. \n\n`curl http://localhost:1337/t%65st.txt`\n\nAdditionally this technique can be used to get directory listings of ignored directories.\n\n\n## Recommendation\n\nUpdate to version 6.5.2 or later.","status":"published","published":"2020-09-01T19:38:33Z","modified":"2020-08-31T18:29:10Z","updated_at":"2026-11-02T15:46:58.767335Z"}]}}
