CVE-2026-132277: Inscriptis Quadratic Memory Growth From Sibling Vulnerability

MODERATE
Advisory Identifier: GHSA-q87h-c5m7-659j
CVSS 5.3
CWE-400 CWE-407
Published
Advisory Summary

CVE-2026-132277 is a MODERATE (CVSS 5.3) quadratic memory growth from sibling vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Inscriptis libraries in the PyPI ecosystem. The issue involves quadratic memory growth from sibling <table> elements in get_text(). Remediation is available by upgrading affected packages to version 2.7.6.

CVE-2026-132277 at a Glance

CVE Identifier CVE-2026-132277
GHSA Identifier GHSA-q87h-c5m7-659j
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Inscriptis
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability Low (A:L)

How to Fix CVE-2026-132277

To remediate this vulnerability, upgrade all affected Inscriptis dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

inscriptis fixed: 2.7.6
pip install inscriptis>=2.7.6
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show inscriptis

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-132277, inspect your installed packages using pip:

pip show inscriptis

Analyze the terminal output to locate any version of Inscriptis in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.7.6), your application is affected.

Note: The pip show inscriptis command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Inscriptis, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

# Summary Every sibling `<table>` adds another level of the parent's indentation, so the size of `get_text()` 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 `table_end_handler()` (`model/tag/table_tag.py`) writes the rendered table into the parent element with `HtmlElement.write_verbatim_text()` (`model/html_element.py`). For a block-level parent, `write_verbatim_text()` calls `canvas.open_block()`, which pushes the parent's `padding_inline` onto the prefix stack. The following `close_block()` never pops it; only `Canvas.close_tag()` calls `prefix.remove_last_prefix()`. So each table leaves one extra padding entry on the stack. This has been present since 2.0 (commit 84ec720). ```python >>> get_text('<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 get_text n = int(sys.argv[1]) html = "<ul>" + "<table></table>" * n + "</ul>" t = time.time(); out = get_text(html) print(len(html), f"{time.time()-t:.2f}s", len(out), resource.getrusage(resource.RUSAGE_SELF).ru_maxrss // 2**20, "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.current_block.prefix.remove_last_prefix() self.canvas.close_block(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.

CVE-2026-132277 Affected Inscriptis Versions

1 component(s)
Fixed Versions:
2.7.6
Product / Package Ecosystem Affected Versions Fixed Version
inscriptis
PyPI
≥ 2.0.0
< 2.7.6
2.7.6

References

Frequently Asked Questions

What is CVE-2026-132277?
CVE-2026-132277 is a security vulnerability in Inscriptis involving Quadratic memory growth from sibling <table> elements in get_text() under CWE-400: Uncontrolled Resource Consumption.
Which Inscriptis versions are affected?
Affected versions include releases prior to 2.7.6 across affected packages: inscriptis.
What version fixes CVE-2026-132277?
Upgrading to 2.7.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is inscriptis affected?
Yes, inscriptis is affected in releases prior to 2.7.6. Upgrade your dependency to 2.7.6 or later.
What is the CVSS score of CVE-2026-132277?
CVE-2026-132277 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2026-132277?
CVE-2026-132277 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check PyPI dependencies for CVE-2026-132277?
Run the dependency tree command: 'pip show inscriptis'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-q87h-c5m7-659j",
  "modified" : "2026-11-20T23:48:51Z",
  "published" : "2026-11-20T23:48:51Z",
  "aliases" : [ "CVE-2026-132277" ],
  "summary" : "Inscriptis: Quadratic memory growth from sibling <table> elements in get_text()",
  "details" : "# Summary\n\nEvery sibling `<table>` adds another level of the parent's indentation, so the size of `get_text()` 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.\n\n# Details\n\n`table_end_handler()` (`model/tag/table_tag.py`) writes the rendered table into the parent element with `HtmlElement.write_verbatim_text()` (`model/html_element.py`). For a block-level parent, `write_verbatim_text()` calls `canvas.open_block()`, which pushes the parent's `padding_inline` onto the prefix stack. The following `close_block()` never pops it; only `Canvas.close_tag()` calls `prefix.remove_last_prefix()`. So each table leaves one extra padding entry on the stack.\n\nThis has been present since 2.0 (commit 84ec720).\n\n```python\n>>> get_text('<ul>' + '<table><tr><td>a</td></tr></table>' * 4 + '</ul>')\n'        a\\n        \\n            a\\n            \\n                a\\n                \\n                    a\\n                    '\n```\n\n# PoC\n\n```python\nimport sys, time, resource\nfrom inscriptis import get_text\n\nn = int(sys.argv[1])\nhtml = \"<ul>\" + \"<table></table>\" * n + \"</ul>\"\nt = time.time(); out = get_text(html)\nprint(len(html), f\"{time.time()-t:.2f}s\", len(out), resource.getrusage(resource.RUSAGE_SELF).ru_maxrss // 2**20, \"MiB\")\n```\n\ninscriptis 2.7.5, Python 3.11, macOS (2.0.0 behaves the same):\n\n| tables | HTML | time | output chars | peak RSS |\n|---|---|---|---|---|\n| 1,000 | 15 KB | 0.02 s | 4.0 M | 31 MiB |\n| 4,000 | 60 KB | 0.33 s | 64 M | 154 MiB |\n| 8,000 | 120 KB | 1.31 s | 256 M | 463 MiB |\n| 16,000 | 240 KB | 5.63 s | 1,024 M | 991 MiB |\n\nWhen the input doubles, output size and memory grow about 4 times.\n\n# Impact\n\nAny 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.\n\n# Fix\n\n```diff\n         self.canvas.write(self, text, whitespace=WhiteSpace.pre)\n\n         if self.display == Display.block:\n+            self.canvas.current_block.prefix.remove_last_prefix()\n             self.canvas.close_block(self)\n```\n\nWith 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "inscriptis"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.7.6"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.7.5"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/weblyzard/inscriptis/security/advisories/GHSA-q87h-c5m7-659j"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-132277"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/weblyzard/inscriptis/commit/dc122894cd671a0227f8fdad60464acddaf40fc8"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/weblyzard/inscriptis"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/weblyzard/inscriptis/releases/tag/2.7.6"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-407" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-11-20T23:48:51Z",
    "nvd_published_at" : "2026-11-20T17:18:12Z"
  }
}