GHSA-5vm8-hhgr-jcjp Cross-site scripting vulnerability in TinyMCE

Not scored Published

An XSS vulnerability in TinyMCE allows arbitrary JavaScript execution via crafted form URLs when content is previewed or rendered outside the editor.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is GHSA-5vm8-hhgr-jcjp?

GHSA-5vm8-hhgr-jcjp is a cross-site scripting vulnerability in tinymce, published on 28 May 2021. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

Official description

Impact

A cross-site scripting (XSS) vulnerability was discovered in the URL sanitization logic of the core parser for form elements. The vulnerability allowed arbitrary JavaScript execution when inserting a specially crafted piece of content into the editor using the clipboard or APIs, and then submitting the form. However, as TinyMCE does not allow forms to be submitted while editing, the vulnerability could only be triggered when the content was previewed or rendered outside of the editor. This impacts all users who are using TinyMCE 5.7.0 or lower.

Patches

This vulnerability has been patched in TinyMCE 5.7.1 by improved URL sanitization logic.

Workarounds

To work around this vulnerability, either:

Example: Sanitizing using a node filter

editor.parser.addNodeFilter('form', function(nodes) {
  nodes.forEach(function(node) {
    if (node.attributes) {
      node.attributes.forEach(function(attr) {
        var name = attr.name;
        var value = attr.value;
        // Sanitize the attribute value here or remove it entirely
        var sanitizedValue = ...;
        node.attr(name, santizedValue);
      });
    }
  });
});

Example: Using invalid_elements

invalid_elements: 'form'

Acknowledgements

Tiny Technologies would like to thank Mikhail Khramenkov at Solar Security Research Team for discovering this vulnerability.

References

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

For more information

If you have any questions or comments about this advisory:

Which versions are affected by GHSA-5vm8-hhgr-jcjp?

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

PackageAffectedFixed in
tinymce npmAll versions5.7.1
tinymce npmAll versions5.7.1

How do I fix GHSA-5vm8-hhgr-jcjp?

Upgrade tinymce to 5.7.1 or later.

Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.

Is GHSA-5vm8-hhgr-jcjp being exploited?

There is no known exploitation of GHSA-5vm8-hhgr-jcjp in the wild and no public exploit code.

Sources

Is GHSA-5vm8-hhgr-jcjp in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free