GHSA-2qrf-pqgx-qh9v

Suggest an improvement
Source
https://github.com/advisories/GHSA-2qrf-pqgx-qh9v
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-2qrf-pqgx-qh9v/GHSA-2qrf-pqgx-qh9v.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-2qrf-pqgx-qh9v
Aliases
  • CVE-2026-115774
Published
2026-10-23T20:46:12Z
Modified
2026-10-23T21:00:04Z
Severity
  • 4.9 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:N/A:H CVSS Calculator
Summary
Twisted: Denial of Service in the Twisted IMAP4 Server via a Negative Literal Size in SEARCH
Details

Summary

An infinite-loop vulnerability (CWE-835) in the Twisted IMAP4 server lets an authenticated client freeze the whole process with one small command. twisted.mail.imap4.parseNestedParens reads an IMAP literal size with int() and never rejects a negative value. A negative size such as {-100} drives the parser cursor negative, and because a negative Python index wraps around the end of the string instead of raising, the scanning loop never terminates. It runs synchronously on the single-threaded reactor, so one SEARCH command holds the reactor at full CPU forever and every other connection stops being served.

Details

Meeting an inline literal, parseNestedParens reads the size between the braces and advances the cursor past the body:

# twisted/mail/imap4.py  parseNestedParens
literalSize = int(s[i + 1 : end])          # no sign check
contentStack[-1].append((s[end + 3 : end + 3 + literalSize],))
i = end + 3 + literalSize                    # negative size -> i goes negative

int(b"-100") is -100, so i goes negative; the loop condition i < len(s) stays true and s[i : i + 1] on a negative index never raises, so the cursor cycles forever. The _literalStringLimit guard only covers the synchronizing-literal continuation path, not this inline branch. The call is reached from select_SEARCH through arg_searchkeys, dispatched only in the selected state, so a valid login and a selected mailbox (any low-privilege account) suffice. It runs in the reactor thread, and the connection timeout cannot fire because the reactor itself is frozen.

Affected product: Twisted (twisted.mail), the IMAP4 server twisted.mail.imap4.IMAP4Server Affected versions: 26.4.0 and earlier

PoC

Log in, select a mailbox, and send a SEARCH whose literal size is negative:

C: t1 LOGIN testuser password-test
C: t2 SELECT INBOX
C: t3 SEARCH {-100}zzzzzzzzzz

The server never responds and one core stays at 100 percent. In a measured run a health service co-hosted on the same reactor stopped answering the instant the command arrived, showing the freeze hits the whole process and not just the attacking connection. A valid {5}zzzzz completes normally and a non-numeric {abc} is rejected with a parse error, which isolates the cause to the missing negative-size check.

Impact

A remote denial of service. One command of about ten bytes freezes the single-threaded reactor, so it stops serving not only every other IMAP connection but every other service co-hosted in the same process (for example SMTP and POP3 under twistd mail), and no timeout can recover it until the process is restarted. It requires an authenticated session, so any account holder can trigger it; there is no confidentiality or integrity impact and no code execution.

Database specific
{
    "cwe_ids":  [
        "CWE-400",
        "CWE-835"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2026-10-23T20:46:12Z",
    "nvd_published_at":  null,
    "severity":  "MODERATE"
}
References

Affected packages

PyPI / twisted

Package

Affected ranges

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

Affected versions

1.*
1.0.1
1.0.3
1.0.4
1.0.5
1.0.6
1.0.7
1.1.0
1.1.1
1.2.0
2.*
2.1.0
2.4.0
2.5.0
8.*
8.0.0
8.0.1
8.1.0
8.2.0
9.*
9.0.0
10.*
10.0.0
10.1.0
10.2.0
11.*
11.0.0
11.1.0
12.*
12.0.0
12.1.0
12.2.0
12.3.0
13.*
13.0.0
13.1.0
13.2.0
14.*
14.0.0
14.0.1
14.0.2
15.*
15.0.0
15.1.0
15.2.0
15.2.1
15.3.0
15.4.0
15.5.0
16.*
16.0.0
16.1.0
16.1.1
16.2.0
16.3.0
16.3.1
16.3.2
16.4.0
16.4.1
16.5.0rc1
16.5.0rc2
16.5.0
16.6.0rc1
16.6.0
16.7.0rc1
16.7.0rc2
17.*
17.1.0rc1
17.1.0
17.5.0
17.9.0rc1
17.9.0
18.*
18.4.0rc1
18.4.0
18.7.0rc1
18.7.0rc2
18.7.0
18.9.0rc1
18.9.0
19.*
19.2.0rc1
19.2.0rc2
19.2.0
19.2.1
19.7.0rc1
19.7.0
19.10.0rc1
19.10.0
20.*
20.3.0rc1
20.3.0
21.*
21.2.0rc1
21.2.0
21.7.0rc1
21.7.0rc2
21.7.0rc3
21.7.0
22.*
22.1.0rc1
22.1.0
22.2.0rc1
22.2.0
22.4.0rc1
22.4.0
22.8.0rc1
22.8.0
22.10.0rc1
22.10.0
23.*
23.8.0rc1
23.8.0
23.10.0rc1
23.10.0
24.*
24.2.0rc1
24.3.0
24.7.0rc1
24.7.0rc2
24.7.0
24.10.0rc1
24.10.0
24.11.0rc1
24.11.0rc2
24.11.0
25.*
25.5.0rc1
25.5.0
26.*
26.4.0rc2
26.4.0

Database specific

last_known_affected_version_range
"<= 26.4.0"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-2qrf-pqgx-qh9v/GHSA-2qrf-pqgx-qh9v.json"