{"vuln_id":"CVE-2026-132277","aliases":["GHSA-q87h-c5m7-659j"],"description":"Inscriptis: Quadratic memory growth from sibling <table> elements in get_text()","published_at":"2026-11-20T17:18:12.893000Z","modified_at":"2026-11-21T00:00:04.977540Z","first_seen_at":"2026-11-21T19:15:19.251064Z","severity":"medium","severity_source":"nvd","cvss_score":5.3,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L","cwe":["CWE-400","CWE-407"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":0.00913,"epss_percentile":0.60938,"nvd_status":"Received","enriched_at":null,"links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2026-132277"},"matched_alias":null,"items":[{"id":10647,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-q87h-c5m7-659j: Inscriptis: Quadratic memory growth from sibling <table> elements in get_text()","summary":"Inscriptis: Quadratic memory growth from sibling elements in get_text()\n\n# Summary\n\nEvery sibling `\n` 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('\n' + '\na\n' * 4 + '')\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 = \"\n\" + \"\n\" * n + \"\n\"\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\nself.canvas.write(self, text, whitespace=WhiteSpace.pre)\n\nif self.display == Display.block:\n+ self.canvas.current_block.prefix.remove_last_prefix()\nself.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.\n\nAffected: PyPI:inscriptis\n\nFixed in: 2.7.6\n\nReferences:\nhttps://github.com/weblyzard/inscriptis/security/advisories/GHSA-q87h-c5m7-659j\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-132277\nhttps://github.com/weblyzard/inscriptis/commit/dc122894cd671a0227f8fdad60464acddaf40fc8\nhttps://github.com/weblyzard/inscriptis\nhttps://github.com/weblyzard/inscriptis/releases/tag/2.7.6","url":"https://osv.dev/vulnerability/GHSA-q87h-c5m7-659j","published_at":"2026-11-20T23:48:51Z","updated_at":"2026-11-21T00:00:04.977540Z","fetched_at":"2026-11-21T19:15:55.946073Z","severity":"medium","cvss_score":5.3,"epss":0.00913,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"inscriptis","vuln_id":"CVE-2026-132277","vuln_ids":["CVE-2026-132277","GHSA-Q87H-C5M7-659J"],"tags":["osv","pypi","fix-available"],"cluster_id":1981,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10647","html":"https://vulnwatch.ve1ve2.com/item/10647"}},{"id":2282,"source":{"id":"ghsa","name":"GitHub Security Advisories"},"title":"GHSA-q87h-c5m7-659j / CVE-2026-132277: Inscriptis: Quadratic memory growth from sibling <table> elements in get_text()","summary":"Inscriptis: Quadratic memory growth from sibling elements in get_text()\n\n# Summary\n\nEvery sibling `\n` 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('\n' + '\na\n' * 4 + '')\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 = \"\n\" + \"\n\" * n + \"\n\"\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\nself.canvas.write(self, text, whitespace=WhiteSpace.pre)\n\nif self.display == Display.block:\n+ self.canvas.current_block.prefix.remove_last_prefix()\nself.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.\n\nAffected packages: pip:inscriptis\nPatched: inscriptis 2.7.6","url":"https://github.com/advisories/GHSA-q87h-c5m7-659j","published_at":"2026-11-20T23:48:51Z","updated_at":"2026-11-20T23:48:53Z","fetched_at":"2026-11-21T19:15:18.416719Z","severity":"medium","cvss_score":5.3,"epss":0.00913,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"inscriptis","vuln_id":"CVE-2026-132277","vuln_ids":["CVE-2026-132277","GHSA-Q87H-C5M7-659J"],"tags":["ghsa","pip","CWE-400","CWE-407"],"cluster_id":1981,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/2282","html":"https://vulnwatch.ve1ve2.com/item/2282"}},{"id":9920,"source":{"id":"nvd","name":"NVD CVE API 2.0"},"title":"CVE-2026-132277: Inscriptis is a Python library for converting HTML to text. From 2.0.0 until 2.7.6, when the parent is block-level, table_end_handler() in model/tag/table_tag.…","summary":"Inscriptis is a Python library for converting HTML to text. From 2.0.0 until 2.7.6, when the parent is block-level, table_end_handler() in model/tag/table_tag.py writes each sibling table through HtmlElement.write_verbatim_text() in model/html_element.py; Canvas.open_block() leaves the parent padding_inline prefix on the stack, Canvas.close_block() does not remove it, and only Canvas.close_tag() calls prefix.remove_last_prefix(). Each following sibling table therefore carries forward accumulated indentation, making get_text() 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.\n\nReferences:\nhttps://github.com/weblyzard/inscriptis/commit/dc122894cd671a0227f8fdad60464acddaf40fc8\nhttps://github.com/weblyzard/inscriptis/releases/tag/2.7.6\nhttps://github.com/weblyzard/inscriptis/security/advisories/GHSA-q87h-c5m7-659j","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-132277","published_at":"2026-11-20T17:18:12.893000Z","updated_at":"2026-11-20T17:18:12.893000Z","fetched_at":"2026-11-21T19:15:31.485419Z","severity":"medium","cvss_score":5.3,"epss":0.00913,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":null,"vuln_id":"CVE-2026-132277","vuln_ids":["CVE-2026-132277","GHSA-Q87H-C5M7-659J"],"tags":["CWE-400","CWE-407"],"cluster_id":1982,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/9920","html":"https://vulnwatch.ve1ve2.com/item/9920"}}]}