{"id":"CVE-2018-3771","aliases":[],"url":"https://o3.security/vulnerability/CVE-2018-3771","summary":"statics-server Cross-site Scripting vulnerability","details":"An XSS in statics-server <= 0.0.9 can be used via injected iframe in the filename when statics-server displays directory index in the browser. Statics-server does not implement any HTML escaping when displays directory index in the browser. Variable `v` is used in `<a href>` element without escaping, which allows to embed HTML `<iframe>` tag with `src` attribute points to another HTML file in the directory. This file can contain malicious JavaScript code, which will be executed:\n\n```js\n// ./node_modules/statics-server/index.js, line 18:\n\n    if(fs.lstatSync(staticPath).isDirectory()){\n        var files=fs.readdirSync(staticPath);\n        var lis='';\n        files.forEach((v,i)=>{\n            if(fs.lstatSync(path.resolve(staticPath,v)).isDirectory()){\n                lis+=`<li><a href=\"${req.url}${v}/\">${v}/</a></li>`;\n            }else {\n                lis+=`<li><a href=\"${req.url}${v}\">${v}</a></li>`\n            }\n        });\n\n        (...)\n```","published":"2022-05-13T01:32:20Z","modified":"2024-04-22T23:26:36.518156Z","cvss":{"score":6.1,"severity":"MEDIUM","vector":"CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"},"epss":null,"cisaKev":null,"exploitsKnown":1,"affectedPackages":[{"ecosystem":"npm","name":"statics-server","fixedVersion":null}],"fix":null,"references":[{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2018-3771"},{"type":"WEB","url":"https://hackerone.com/reports/355458"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2024-04-22T23:26:36.518156Z"}}