# CVE-2023-38487: HedgeDoc API allows to hide existing notes

> Attackers can hide existing notes by creating aliases with matching IDs, causing denial of service or presenting manipulated content to users.

- **Severity:** Medium 6.5 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** No
- **Published:** 4 Aug 2023
- **Updated:** 3 Oct 2024
- **Also known as:** GHSA-7494-7hcf-vxpg

## What is CVE-2023-38487?

CVE-2023-38487 is a medium-severity vulnerability in hedgedoc, published on 4 Aug 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

HedgeDoc is software for creating real-time collaborative markdown notes. Prior to version 1.9.9, the API of HedgeDoc 1 can be used to create notes with an alias matching the ID of existing notes. The affected existing note can then not be accessed anymore and is effectively hidden by the new one.

When the freeURL feature is enabled (by setting the `allowFreeURL` config option or the `CMD_ALLOW_FREEURL` environment variable to `true`), any user with the appropriate permissions can create a note by making a POST request to the `/new/<ALIAS>` API endpoint. The `<ALIAS>` parameter can be set to the ID of an existing note. HedgeDoc did not verify whether the provided `<ALIAS>` value corresponds to a valid ID of an existing note and always allowed creation of the new note. When a visitor tried to access the existing note, HedgeDoc will first search for a note with a matching alias before it searches using the ID, therefore only the new note can be accessed.

Depending on the permission settings of the HedgeDoc instance, the issue can be exploited only by logged-in users or by all (including non-logged-in) users. The exploit requires knowledge of the ID of the target note. Attackers could use this issue to present a manipulated copy of the original note to the user, e.g. by replacing the links with malicious ones. Attackers can also use this issue to prevent access to the original note, causing a denial of service. No data is lost, as the original content of the affected notes is still present in the database.

This issue was fixed in version 1.9.9. As a workaround, disabling freeURL mode prevents the exploitation of this issue. The impact can be limited by restricting freeURL note creation to trusted, logged-in users by enabling `requireFreeURLAuthentication`/`CMD_REQUIRE_FREEURL_AUTHENTICATION`.

Weakness: CWE-289 (Authentication Bypass by Alternate Name)

## Which versions are affected by CVE-2023-38487?

It affects 1 product.


Products: Hedgedoc Hedgedoc.

## How do I fix CVE-2023-38487?

No fix has been published for CVE-2023-38487 yet. Limit exposure of the affected software until one is available.

## Is CVE-2023-38487 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-38487 exists.

## Other vulnerabilities in hedgedoc

- [CVE-2021-29475](https://insights.sbomify.com/CVE-2021-29475/): PDF export allows arbitrary file reads (critical 10.0)
- [CVE-2020-26287](https://insights.sbomify.com/CVE-2020-26287/): Stored XSS in mermaid diagrams (high 8.7)
- [CVE-2021-39175](https://insights.sbomify.com/CVE-2021-39175/): XSS vector in slide mode speaker-view (high 8.1)
- [CVE-2021-29503](https://insights.sbomify.com/CVE-2021-29503/): Improper Neutralization of Script-Related HTML Tags in Notes (high 8.1)
- [CVE-2020-26286](https://insights.sbomify.com/CVE-2020-26286/): Arbitary file upload (high 7.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-38487 and fix it if it is affected.

What it is: CVE-2023-38487 is a medium-severity vulnerability in hedgedoc, published on 4 Aug 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-38487 exists.

Affected product: hedgedoc. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-38487/ (Markdown: https://insights.sbomify.com/CVE-2023-38487/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-38487
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-38487
- OSV: https://osv.dev/vulnerability/CVE-2023-38487

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-38487/
Summaries are generated and may contain mistakes; the official description above is the record.
