GHSA-785h-76cm-cpmf

Suggest an improvement
Source
https://github.com/advisories/GHSA-785h-76cm-cpmf
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2025/03/GHSA-785h-76cm-cpmf/GHSA-785h-76cm-cpmf.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-785h-76cm-cpmf
Published
2025-03-26T20:34:02Z
Modified
2025-03-26T21:21:09.890357Z
Severity
  • 1.7 (Low) CVSS_V4 - CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:N/SI:L/SA:N/E:U CVSS Calculator
Summary
Django TomSelect incomplete escaping of dangerous characters in widget attributes
Details

Summary

User supplied values passed through to certain attributes in form widgets are not fully escaped for potentially dangerous tokens, and in some cases are rendered in browser as valid html tags.

Details

Attributes passed to the widget (such as label_field) containing <, >, and similar tokens are not fully escaped. This results in some raw values reaching the widget, and rendering in part or fully.

For example, a label of: "Test User <script>I can pass this to the label_field and it gets rendered</script>" is rendered in the choices's label visually as "Test User " with the trailing space, and what appears as an un-executed script tag following it (which is visible when viewing source).

The actual output rendered in the browser for this example is: <div role="option" data-value="63f205b6" class="item" data-ts-item="">Test User <script>I can pass this to the label_field and it gets rendered</script></div>

The script tags appears to be valid in Chrome dev tools, but doesn't appear execute code.

Impact

Although the risk may be mediated since the content within the rendered <script></script> tags does not seem to actually/immediately run, potential may exist for other ways of increasing the risk (e.g.: code injection). In addition, the widget does not display correctly for valid strings containing < or >. Valid use-cases for printing these characters include widget label fields displaying email addresses (e.g.: "User Jane <user.jane@example.com>"

Because of the relatively small number of users at this moment, our plan to yank affected releases on PyPI and GitHub, and because raw text is rendered but does not seem to be executable, I am marking the Severity Low.

Update to version 5.3.3. The only difference from 5.3.2 is the code and documentation changes to resolve this vulnerability, so the update process should not be problematic.

Database specific
{
    "nvd_published_at": null,
    "cwe_ids": [
        "CWE-79",
        "CWE-116"
    ],
    "severity": "LOW",
    "github_reviewed": true,
    "github_reviewed_at": "2025-03-26T20:34:02Z"
}
References

Affected packages

PyPI / django-tomselect

Package

Name
django-tomselect
View open source insights on deps.dev
Purl
pkg:pypi/django-tomselect

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
2025.3.3

Affected versions

0.*

0.4.0
0.4.1
0.4.2
0.4.3
0.4.4
0.5.1b0
0.5.1b1
0.5.1b2
0.5.1b3
0.5.1b4
0.5.1b5
0.5.1b6
0.5.1b7
0.5.1b8
0.5.1b9
0.5.1b10
0.5.1b11

2024.*

2024.12.1
2024.12.2
2024.12.3
2024.12.4
2024.12.5
2024.12.6
2024.12.7

2025.*

2025.1.1
2025.1.2
2025.2.1
2025.2.2
2025.2.3
2025.3.1
2025.3.2