5.3medium
UAParser.js: Unbounded `Sec-CH-UA-Model` parsing can trigger ReDoS in `withClientHints()`
- Severity
- 5.3medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.45% (higher than 40% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-9h5v-pfqq-x599
Description
UAParser.js is a JavaScript library to detect browsers, operating systems, CPUs, and devices from user-agent data. From 2.0.1 until 2.0.10, a regular expression denial-of-service vulnerability exists when using the Client Hints API. By sending a crafted Sec-CH-UA-Model header to an application that calls UAParser(headers).withClientHints(), an attacker can cause excessive CPU time due to catastrophic backtracking in the device regex because Client Hints values are copied without the UA_MAX_LENGTH limit used for User-Agent values. This issue is fixed in version 2.0.10.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| faisalman ua-parser-js | >= 2.0.1, < 2.0.10 | CVE List |
| ua-parser-js (npm) | from 2.0.1 before 2.0.10 | GitHub Advisory Database |
| ua-parser-js_project ua-parser-js | from 2.0.1 before 2.0.10 | NVD |
All scores
| GitHub_M | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L |
| GitHub | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L |
Classification
What each source says
CVE List
UAParser.js is a JavaScript library to detect browsers, operating systems, CPUs, and devices from user-agent data. From 2.0.1 until 2.0.10, a regular expression denial-of-service vulnerability exists when using the Client Hints API. By sending a crafted Sec-CH-UA-Model header to an application that calls UAParser(headers).withClientHints(), an attacker can cause excessive CPU time due to catastrophic backtracking in the device regex because Client Hints values are copied without the UA_MAX_LENGTH limit used for User-Agent values. This issue is fixed in version 2.0.10.
GitHub Advisory Database
Summary
A regular expression denial-of-service (ReDoS) vulnerability has been discovered in ua-parser-js when using the Client Hints API. By sending a crafted Sec-CH-UA-Model header to an application that calls UAParser(headers).withClientHints(), an attacker can cause the parser to spend excessive CPU time due to catastrophic backtracking in the device regex:
/ ([\w ]+) miui\/v?\d/i
Unlike when using the User-Agent value, which has a hard limit of UA_MAX_LENGTH = 500, when using Client Hints, values are copied without a length limit before being passed into regex parsing.
PoC
const { UAParser } = require('ua-parser-js');
const headers = {
'sec-ch-ua-platform': '"Android"',
'sec-ch-ua-mobile': '?1',
'sec-ch-ua-model': '"' + 'A '.repeat(25000) + '"'
};
const t0 = process.hrtime.bigint();
UAParser(headers).withClientHints();
const ms = Number(process.hrtime.bigint() - t0) / 1e6;
if (ms > 100) {
console.log('Potential ReDoS');
}
Impact
This vulnerability allows an unauthenticated attacker to trigger a denial-of-service condition in any server-side application that uses UAParser(headers).withClientHints(). A single request with a ~32,000-character model value can consume over 400ms of CPU time, with parsing time growing polynomially with input length. The impact is availability only, there is no confidentiality or integrity impact.
Affected Versions
ua-parser-js versions >=2.0.1, <=2.0.9 are affected. The withClientHints() API is not present in version 0.7.x or 1.x.
Patches
A patch has been released to fix the vulnerable regular expression and limit the Client Hints input. Users should update to version 2.0.10 or later.
References
Credits
Thanks to @sondt99, who first reported the issue.
NVD (es)
UAParser.js es una biblioteca JavaScript para detectar navegadores, sistemas operativos, CPUs y dispositivos a partir de datos de user-agent. Desde la 2.0.1 hasta la 2.0.10, existe una vulnerabilidad de denegación de servicio por expresión regular al usar la API de Client Hints. Al enviar un encabezado Sec-CH-UA-Model manipulado a una aplicación que llama a UAParser(headers).withClientHints(), un atacante puede causar un tiempo de CPU excesivo debido a un retroceso catastrófico en la expresión regular del dispositivo porque los valores de Client Hints se copian sin el límite UA_MAX_LENGTH utilizado para los valores de User-Agent. Este problema está solucionado en la versión 2.0.10.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-48125 changed 2026-07-15 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-9h5v-pfqq-x599 changed 2026-06-15 | CC-BY-4.0 |
| NVD | CVE-2026-48125 changed 2026-10-24 | Public domain |