// For flags

CVE-2021-29475

PDF export allows arbitrary file reads

Severity Score

10.0
*CVSS v3.1

Exploit Likelihood

*EPSS

Affected Versions

*CPE

Public Exploits

0
*Multiple Sources

Exploited in Wild

-
*KEV

Decision

-
*SSVC
Descriptions

HedgeDoc (formerly known as CodiMD) is an open-source collaborative markdown editor. An attacker is able to receive arbitrary files from the file system when exporting a note to PDF. Since the code injection has to take place as note content, there fore this exploit requires the attackers ability to modify a note. This will affect all instances, which have pdf export enabled. This issue has been fixed by https://github.com/hedgedoc/hedgedoc/commit/c1789474020a6d668d616464cb2da5e90e123f65 and is available in version 1.5.0. Starting the CodiMD/HedgeDoc instance with `CMD_ALLOW_PDF_EXPORT=false` or set `"allowPDFExport": false` in config.json can mitigate this issue for those who cannot upgrade. This exploit works because while PhantomJS doesn't actually render the `file:///` references to the PDF file itself, it still uses them internally, and exfiltration is possible, and easy through JavaScript rendering. The impact is pretty bad, as the attacker is able to read the CodiMD/HedgeDoc `config.json` file as well any other files on the filesystem. Even though the suggested Docker deploy option doesn't have many interesting files itself, the `config.json` still often contains sensitive information, database credentials, and maybe OAuth secrets among other things.

"HedgeDoc (antes se conoce como CodiMD) es un editor colaborativo de código abierto. Un atacante es capaz de recibir archivos arbitrarios del sistema de archivos al exportar una nota a PDF. Dado que la inyección de código presente que toma lugar como contenido de la nota, esta explotación requiere la habilidad de los atacantes para modificar una nota. Esto afectará a todas las instancias que tengan habilitada la exportación a PDF. Este problema ha sido corregido por https://github.com/hedgedoc/hedgedoc/commit/c1789474020a6d668d616464cb2da5e90e123f65 y está disponible en versión 1.5.0. Iniciar la instancia de CodiMD/HedgeDoc con ""CMD_ALLOW_PDF_EXPORT=false"" o ajustar ""allowPDFExport"": false"" en config.json puede mitigar este problema para aquellos que no puedan actualizar. Esta explotación funciona porque aunque PhantomJS no renderiza realmente las referencias ""file:///"" al archivo PDF en sí, sigue usándolas internamente, y la exfiltración es posible, y fácil por medio del renderizado de JavaScript. El impacto es bastante malo, ya que el atacante es capaz de leer el archivo CodiMD/HedgeDoc ""config.json"" así como cualquier otro archivo en el sistema de archivos. Aunque la opción de despliegue de Docker sugerida no presenta muchos archivos interesantes en sí misma, el archivo ""config.json"" suele contener información confidencial, credenciales de bases de datos, y quizás secretos de OAuth entre otras cosas

*Credits: N/A
CVSS Scores
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
None
Attack Vector
Network
Attack Complexity
Medium
Authentication
None
Confidentiality
Partial
Integrity
Partial
Availability
None
* Common Vulnerability Scoring System
SSVC
  • Decision:-
Exploitation
-
Automatable
-
Tech. Impact
-
* Organization's Worst-case Scenario
Timeline
  • 2021-03-30 CVE Reserved
  • 2021-04-26 CVE Published
  • 2024-01-10 EPSS Updated
  • 2024-08-03 CVE Updated
  • ---------- Exploited in Wild
  • ---------- KEV Due Date
  • ---------- First Exploit
CWE
  • CWE-94: Improper Control of Generation of Code ('Code Injection')
  • CWE-918: Server-Side Request Forgery (SSRF)
CAPEC
Affected Vendors, Products, and Versions
Vendor Product Version Other Status
Vendor Product Version Other Status <-- --> Vendor Product Version Other Status
Hedgedoc
Search vendor "Hedgedoc"
Hedgedoc
Search vendor "Hedgedoc" for product "Hedgedoc"
< 1.5.0
Search vendor "Hedgedoc" for product "Hedgedoc" and version " < 1.5.0"
-
Affected