CVE-2026-59220: Open WebUI: ReDoS in skill-mention regexes causes whole-instance DoS on default config

Published Jul 9, 2026
·
Updated

Summary Two regexes in backend/openwebui/utils/middleware.py that parse <$skillId|label> skill-mention tags backtrack in O(n²) on input that contains <$ followed by a long run with no closing >. Both run synchronously, on the asyncio event loop, on every chat completion with no feature gate. Because the default deployment is a single uvicorn worker, one such input pins a CPU core inside re and freezes the entire instance for all users until the worker is killed. Any authenticated user can trigger it with one chat message; it also fires accidentally on benign retrieved content (a RAG chunk or tool output) containing the pattern.

Affected versions >= 0.9.2, < 0.10.0. Fixed in v0.10.0 (there is no 0.9.7 release). - SKILLMENTIONRE (the extract pattern) has been O(n²) since v0.9.2; exploitable on 0.9.2–0.9.5 with a large input (hundreds of KB). - v0.9.6 added a second, far more aggressive O(n²) in the strip pattern (introduced by the "keep label as readable text" change), so on 0.9.6 a small input is enough to hang the instance.

Both are fixed by the same patch.

Affected component backend/openwebui/utils/middleware.py (line numbers as of v0.9.6):

python line 2223 — used by extractskillidsfrommessages(), called unconditionally (~line 2625) SKILLMENTIONRE = re.compile(r'<\$([^|>]+)\|?[^>]>')

line 2247 — used by stripskillmentions(), called unconditionally (line 2662) stripre = re.compile(r'<\$[^|>]+\|?([^>])>')

extractskillidsfrommessages() runs before the if allskillids: block (that guard gates only skill injection, not the regex), and stripskillmentions() runs with no guard at all. Neither requires a skill to exist or any setting to be enabled. Both functions are plain synchronous calls inside the async processchatpayload coroutine, so they block the event loop; with the default UVICORNWORKERS=1 (backend/start.sh) the whole instance stalls.

Root cause [^|>] is a subset of [^>], so the quantifier pair [^|>]+ \|? [^>] is ambiguous: on input that never closes with >, [^|>]+ greedily consumes the tail, > fails, and the engine backtracks through every split point between [^|>]+ and [^>] — O(n) positions each doing O(n) work. Polynomial, not exponential, but more than enough to hang a single worker on a ~100 KB input.

Proof of concept Standalone (no Open WebUI required):

python import re, time EXTRACT = re.compile(r'<\$([^|>]+)\|?[^>]>') STRIP = re.compile(r'<\$[^|>]+\|?([^>])>') for n in (8000, 16000, 32000, 64000): s = '<$' + ('a' n) for name, rx in (('extract', EXTRACT), ('strip', STRIP)): t = time.perfcounter(); rx.search(s) print(f'n={n:>6} {name:>7} = {(time.perfcounter()-t)1000:8.1f} ms')

Time quadruples per doubling of n (textbook O(n²)); the strip pattern runs for ~6 seconds on a 64k blob and for minutes on a ~96 KB one.

End-to-end against a live instance (default config): 1. docker run ghcr.io/open-webui/open-webui:v0.9.6 on defaults. 2. Log in as any user (no admin or skill setup). 3. Send a chat message containing <$ followed by 50k+ characters with no >. 4. One CPU core pegs in re; UI and API stop responding for every user until the worker is killed.

Patch Rewrite the optional |label as a non-capturing optional group so the two quantifiers no longer overlap. Both patterns become linear; captures and substituted output are unchanged on well-formed <$id|label>, <$id|>, and bare <$id> mentions.

python SKILLMENTIONRE = re.compile(r'<\$([^|>]+)(?:\|[^>])?>') stripre = re.compile(r'<\$[^|>]+(?:\|([^>]))?>')

After the patch the same hostile input returns in under 1 ms. Shipped in v0.10.0.

Credit Reported by @Vlad-WKG, including a correct root-cause analysis and patch.

Other sources

Open WebUI is an extensible, feature-rich, and user-friendly self-hosted AI platform. From 0.9.2 before 0.10.0, the SKILLMENTIONRE and stripre regular expressions in backend/openwebui/utils/middleware.py parsed <$skillId|label> skill mentions with overlapping quantifiers, allowing an authenticated chat message containing <$ without a closing > to trigger quadratic backtracking and block the asyncio event loop. This issue is fixed in version 0.10.0.

MITRE

Affected Software

3 affected componentsFixes available
Open WebUI Open WebUI>undefined
openwebui Open WebUI>=0.9.2<0.10.0
pip/open-webui>=0.9.2<0.10.0
0.10.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/open-webui to a version that resolves this vulnerability.

    Fixed in 0.10.0
  2. Upgrade

    Upgrade Open WebUI to a version that resolves this vulnerability.

    Fixed in v0.10.0
  3. Configuration

    Rewrite the optional `|label` part of `SKILL_MENTION_RE` to a non-capturing optional group to prevent overlapping quantifiers (ReDoS). Apply: `SKILL_MENTION_RE = re.compile(r'<\$([^|>]+)(?:\|[^>]*)?>')` (introduced to be fixed in v0.10.0).

    backend/open_webui/utils/middleware.py SKILL_MENTION_RE = re.compile(r'<\$([^|>]+)(?:\|[^>]*)?>')
  4. Configuration

    Ensure the `SKILL_MENTION_RE` pattern used in the vulnerable code path matches the patched version that makes the regex linear (as shipped in v0.10.0). Apply: `SKILL_MENTION_RE = re.compile(r'<\$([^|>]+)\|?[^>]*>')`.

    backend/open_webui/utils/middleware.py SKILL_MENTION_RE (final form) = re.compile(r'<\$([^|>]+)\|?[^>]*>')
  5. Compensating control

    Mitigate instance-wide impact until upgraded by reducing CPU pinning during ReDoS: run Open WebUI with more than the default `UVICORN_WORKERS=1` (e.g., increase `UVICORN_WORKERS`) so a single pinned worker doesn’t freeze the entire instance.

Event History

Jul 9, 2026
CVE Published
via MITRE·04:09 PM
Data Sourced
via MITRE·04:09 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·05:17 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jul 24, 2026
Advisory Published
via GitHub·04:55 PM
Data Sourced
via GitHub·04:55 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-59220?

The severity of CVE-2026-59220 is medium with a CVSS score of 6.5.

2

How do I fix CVE-2026-59220?

To fix CVE-2026-59220, upgrade Open WebUI to version 0.10.0 or later.

3

What does CVE-2026-59220 affect?

CVE-2026-59220 affects the skill-mention regexes in Open WebUI versions before 0.10.0.

4

What kind of attack is associated with CVE-2026-59220?

CVE-2026-59220 involves a Regular Expression Denial of Service (ReDoS) that can lead to a whole-instance Denial of Service.

5

Who is at risk due to CVE-2026-59220?

Users of Open WebUI versions from 0.9.2 to before 0.10.0 are at risk due to CVE-2026-59220.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203