# GHSA-mq6v-w35g-3c97: Local File Inclusion vulnerability in zmarkdown

> An attacker can include arbitrary local files in generated LaTeX documents by specifying known paths, potentially exposing sensitive host data.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 3 Feb 2024

## What is GHSA-mq6v-w35g-3c97?

GHSA-mq6v-w35g-3c97 is a path traversal vulnerability in zmarkdown, published on 3 Feb 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

### Impact

A minor Local File Inclusion vulnerability has been found in
`zmarkdown`, which allowed for images with a known path on
the host machine to be included inside a LaTeX document.

To prevent it, a new option has been created that allow to replace
invalid paths with a default image instead of linking the image on the
host directly. `zmarkdown` has been updated to make this setting the
default.

Every user of `zmarkdown` is likely impacted, except if
disabling LaTeX generation or images download. Here
is an example of including an image from an invalid path:

```markdown
![](/tmp/img.png)
```

Will effectively redownload and include the image
found at `/tmp/img.png`.

### Patches

The vulnerability has been patched in version 10.1.3.
If impacted, you should update to this version as soon as possible.

### Workarounds

Disable images downloading, or sanitize paths.

### For more information

If you have any questions or comments about this advisory, open an issue in [ZMarkdown](https://github.com/zestedesavoir/zmarkdown/issues).

## Which versions are affected by GHSA-mq6v-w35g-3c97?

2 open source packages ship an affected version, including zmarkdown.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `zmarkdown` | npm | All versions | 10.1.3 |
| `zmarkdown` | npm | All versions | 10.1.3 |

## How do I fix GHSA-mq6v-w35g-3c97?

Upgrade zmarkdown to 10.1.3 or later.

## Is GHSA-mq6v-w35g-3c97 being exploited?

There is no known exploitation of GHSA-mq6v-w35g-3c97 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-mq6v-w35g-3c97 and fix it if it is affected.

What it is: GHSA-mq6v-w35g-3c97 is a path traversal vulnerability in zmarkdown, published on 3 Feb 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of GHSA-mq6v-w35g-3c97 in the wild and no public exploit code.

Affected packages and fixed versions:
- zmarkdown (npm): affected all versions; fixed in 10.1.3
- zmarkdown (npm): affected all versions; fixed in 10.1.3

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/GHSA-mq6v-w35g-3c97/ (Markdown: https://insights.sbomify.com/GHSA-mq6v-w35g-3c97/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-mq6v-w35g-3c97

---
From sbomify Insights: https://insights.sbomify.com/GHSA-mq6v-w35g-3c97/
Summaries are generated and may contain mistakes; the official description above is the record.
