# GHSA-h96f-fc7c-9r55: Regex denial of service vulnerability in codesample plugin

> A regex denial of service in the codesample plugin allows attackers to lock up browsers via malformed Ruby code samples, affecting TinyMCE users.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 6 Jan 2021

## What is GHSA-h96f-fc7c-9r55?

GHSA-h96f-fc7c-9r55 is a denial of service vulnerability in tinymce, published on 6 Jan 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

### Impact
A regex denial of service (ReDoS) vulnerability was discovered in a dependency of the `codesample` plugin. The vulnerability allowed poorly formed ruby code samples to lock up the browser while performing syntax highlighting. This impacts users of the `codesample` plugin using TinyMCE 5.5.1 or lower.

### Patches
This vulnerability has been patched in TinyMCE 5.6.0 by upgrading to a version of the dependency without the vulnerability.

### Workarounds
To work around this vulnerability, either:
- Upgrade to TinyMCE 5.6.0 or higher
- Disable the `codesample` plugin
- Disable ruby code samples using the [codesample_languages](https://www.tiny.cloud/docs/plugins/opensource/codesample/#exampleusingcodesample_languages) setting
- Override the PrismJS syntax highlighter to version 1.21.0 or higher using the [codesample_global_prismjs](https://www.tiny.cloud/docs/plugins/opensource/codesample/#codesample_global_prismjs) setting

### Acknowledgements
Tiny Technologies would like to thank Erik Krogh Kristensen at GitHub for discovering this vulnerability.

### References
https://www.tiny.cloud/docs/release-notes/release-notes56/#securityfixes

### For more information
If you have any questions or comments about this advisory:
* Open an issue in the [TinyMCE repo](http://github.com/tinymce/tinymce/issues)
* Email us at [infosec@tiny.cloud](mailto:infosec@tiny.cloud)

## Which versions are affected by GHSA-h96f-fc7c-9r55?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `tinymce` | npm | All versions | 5.6.0 |
| `tinymce` | npm | All versions | 5.6.0 |

## How do I fix GHSA-h96f-fc7c-9r55?

Upgrade tinymce to 5.6.0 or later.

## Is GHSA-h96f-fc7c-9r55 being exploited?

There is no known exploitation of GHSA-h96f-fc7c-9r55 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-h96f-fc7c-9r55 and fix it if it is affected.

What it is: GHSA-h96f-fc7c-9r55 is a denial of service vulnerability in tinymce, published on 6 Jan 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of GHSA-h96f-fc7c-9r55 in the wild and no public exploit code.

Affected packages and fixed versions:
- tinymce (npm): affected all versions; fixed in 5.6.0
- tinymce (npm): affected all versions; fixed in 5.6.0

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-h96f-fc7c-9r55/ (Markdown: https://insights.sbomify.com/GHSA-h96f-fc7c-9r55/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-h96f-fc7c-9r55

---
From sbomify Insights: https://insights.sbomify.com/GHSA-h96f-fc7c-9r55/
Summaries are generated and may contain mistakes; the official description above is the record.
