CVE-2026-132277: Inscriptis: Quadratic memory growth from sibling <table> elements in get_text()

Published Nov 20, 2026
·
Updated

Summary

Every sibling <table> adds another level of the parent's indentation, so the size of gettext() output grows quadratically with the number of tables. In the measurements below, a 240 KB HTML document produces about 1 billion characters and uses about 1 GB of memory.

Details

tableendhandler() (model/tag/tabletag.py) writes the rendered table into the parent element with HtmlElement.writeverbatimtext() (model/htmlelement.py). For a block-level parent, writeverbatimtext() calls canvas.openblock(), which pushes the parent's paddinginline onto the prefix stack. The following closeblock() never pops it; only Canvas.closetag() calls prefix.removelastprefix(). So each table leaves one extra padding entry on the stack.

This has been present since 2.0 (commit 84ec720).

python >> gettext('<ul>' + '<table><tr><td>a</td></tr></table>' 4 + '</ul>') ' a\n \n a\n \n a\n \n a\n '

PoC

python import sys, time, resource from inscriptis import gettext

n = int(sys.argv[1]) html = "<ul>" + "<table></table>" n + "</ul>" t = time.time(); out = gettext(html) print(len(html), f"{time.time()-t:.2f}s", len(out), resource.getrusage(resource.RUSAGESELF).rumaxrss // 220, "MiB")

inscriptis 2.7.5, Python 3.11, macOS (2.0.0 behaves the same):

| tables | HTML | time | output chars | peak RSS | |---|---|---|---|---| | 1,000 | 15 KB | 0.02 s | 4.0 M | 31 MiB | | 4,000 | 60 KB | 0.33 s | 64 M | 154 MiB | | 8,000 | 120 KB | 1.31 s | 256 M | 463 MiB | | 16,000 | 240 KB | 5.63 s | 1,024 M | 991 MiB |

When the input doubles, output size and memory grow about 4 times.

Impact

Any application that converts untrusted HTML with inscriptis can be made to exhaust memory with a small document. This includes crawlers, RAG and LLM ingestion pipelines, and inscriptis-api. No authentication and no user interaction are needed.

Fix

diff self.canvas.write(self, text, whitespace=WhiteSpace.pre)

if self.display == Display.block: + self.canvas.currentblock.prefix.removelastprefix() self.canvas.closeblock(self)

With this change the 240 KB input above produces 288 K characters in 0.14 s with 27 MiB peak RSS. A single table renders exactly as before, and the existing test suite passes.

Other sources

Inscriptis is a Python library for converting HTML to text. From 2.0.0 until 2.7.6, when the parent is block-level, tableendhandler() in model/tag/tabletag.py writes each sibling table through HtmlElement.writeverbatimtext() in model/htmlelement.py; Canvas.openblock() leaves the parent paddinginline prefix on the stack, Canvas.closeblock() does not remove it, and only Canvas.closetag() calls prefix.removelastprefix(). Each following sibling table therefore carries forward accumulated indentation, making gettext() output grow quadratically and allowing small attacker-controlled HTML to exhaust memory in applications converting it without authentication or user interaction. This issue is fixed in 2.7.6.

— MITRE

Affected Software

1 affected componentFixes available
pip/inscriptis>=2.0.0<=2.7.5
2.7.6

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/inscriptis to a version that resolves this vulnerability.

    Fixed in 2.7.6
  2. Upgrade

    Upgrade inscriptis to a version that resolves this vulnerability.

    Fixed in 2.7.6

Event History

Nov 20, 2026
CVE Published
via MITRE·05:08 PM
Data Sourced
via MITRE·05:08 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·05:18 PM
DescriptionSeverityWeakness
Advisory Published
via GitHub·11:48 PM
Data Sourced
via GitHub·11:48 PM
DescriptionSeverityWeaknessAffected Software

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