{"vuln_id":"CVE-2019-20446","aliases":[],"description":"In xml.rs in GNOME librsvg before 2.46.2, a crafted SVG file with nested patterns can cause denial of service when passed to the library for processing. The attacker constructs pattern elements so that the number of final rendered objects grows exponentially.","published_at":"2020-02-02T14:15:10.523000Z","modified_at":"2026-06-17T02:30:28.273000Z","first_seen_at":"2026-11-21T19:15:19.253071Z","severity":"medium","severity_source":"nvd","cvss_score":6.5,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H","cwe":["CWE-400"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":0.02125,"epss_percentile":0.82362,"nvd_status":"Modified","enriched_at":"2026-11-22T18:21:10.376237Z","links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2019-20446"},"matched_alias":null,"items":[{"id":10649,"source":{"id":"osv","name":"OSV.dev"},"title":"GHSA-555j-qj3j-c8jv: svglib: Exponential resource consumption via nested <use> references in svg2rlg","summary":"svglib: Exponential resource consumption via nested\nreferences in svg2rlg\n\n# Summary\n\n`svg2rlg()` expands `\n` references without any limit on the total number of expansions. Only direct cycles are rejected (`CircularRefError`). A group containing N `\n` elements that point to another such group multiplies the work by N per nesting level, so an SVG of about 1.4 KB makes svglib clone and render over 100,000 nodes, taking tens of seconds of CPU time and hundreds of MiB of memory. Each additional level adds about 245 bytes to the document and multiplies time by ~10.\n\nThis is the SVG `\n` variant of the XML \"billion laughs\" attack (the same class as librsvg CVE-2019-20446).\n\n# Details\n\n`SvgRenderer.renderUse()` in `src/svglib/svglib.py`:\n\n```python\ntry:\nitem = self.xlink_href_target(node, group=group)\nexcept CircularRefError:\nnode.parent.etree_element.remove(node.etree_element)\nreturn group\n...\nif len(node.getchildren()) == 0:\n# Append a copy of the referenced node as the\nchild (if not\n# already done)\nnode.append(copy.deepcopy(item))\nself.renderNode(list(node.iter_children())[-1], parent=group)\n```\n\nThe referenced node is deep-copied under the `\n` element and rendered. Any `\n` elements inside the copied subtree go through `renderUse()` again. `xlink_href_target()` raises `CircularRefError` only for a direct cycle, so a reference DAG with fan-out is expanded fully: `fan ** levels` renders.\n\nPayload shape (fan = 10, levels = 5):\n\n```xml\n\n... 10 times ...\n\n... 10 times ...\n\n...\n\n... 10 times ...\n\n```\n\n# Impact\n\nDenial of service (CPU and memory exhaustion) for any application that renders SVG from an untrusted source with svglib: thumbnail/preview generation, SVG-to-PDF conversion, report generation. Only the SVG document needs to be attacker-controlled; no non-default option is required.\n\nThe same happens through `xhtml2pdf`, which depends on svglib to render SVG images. An HTML document containing `\n` passed to `pisa.CreatePDF()` triggers the expansion. HTML-to-PDF conversion of user-supplied content is a common use of xhtml2pdf in web applications.\n\n# Reproduction\n\nMinimal local PoC, non-destructive:\n\n```python\nimport io, time\nfrom svglib.svglib import svg2rlg\n\ndef make(levels, fan=10):\nparts = ['\n',\n'\n']\nfor i in range(1, levels + 1):\nparts.append(f'\n' + f'\n' * fan + '\n')\nparts.append(f'\n')\nreturn \"\".join(parts).encode()\n\nfor levels in (3, 4, 5):\nd\n\nAffected: PyPI:svglib\n\nFixed in: 2.3.1\n\nReferences:\nhttps://github.com/deeplook/svglib/security/advisories/GHSA-555j-qj3j-c8jv\nhttps://nvd.nist.gov/vuln/detail/CVE-2026-132275\nhttps://github.com/deeplook/svglib/commit/7380d3c3836940fd75f8e203fff80077b7d5a425\nhttps://github.com/deeplook/svglib\nhttps://github.com/deeplook/svglib/releases/tag/v2.3.1","url":"https://osv.dev/vulnerability/GHSA-555j-qj3j-c8jv","published_at":"2026-11-20T23:47:58Z","updated_at":"2026-11-21T00:00:04.016340Z","fetched_at":"2026-11-21T19:15:55.946075Z","severity":"high","cvss_score":7.5,"epss":0.02125,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"svglib","vuln_id":"CVE-2026-132275","vuln_ids":["CVE-2019-20446","CVE-2026-132275","GHSA-555J-QJ3J-C8JV"],"tags":["osv","pypi","fix-available"],"cluster_id":1983,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/10649","html":"https://vulnwatch.ve1ve2.com/item/10649"}},{"id":2283,"source":{"id":"ghsa","name":"GitHub Security Advisories"},"title":"GHSA-555j-qj3j-c8jv / CVE-2026-132275: svglib: Exponential resource consumption via nested <use> references in svg2rlg","summary":"svglib: Exponential resource consumption via nested\nreferences in svg2rlg\n\n# Summary\n\n`svg2rlg()` expands `\n` references without any limit on the total number of expansions. Only direct cycles are rejected (`CircularRefError`). A group containing N `\n` elements that point to another such group multiplies the work by N per nesting level, so an SVG of about 1.4 KB makes svglib clone and render over 100,000 nodes, taking tens of seconds of CPU time and hundreds of MiB of memory. Each additional level adds about 245 bytes to the document and multiplies time by ~10.\n\nThis is the SVG `\n` variant of the XML \"billion laughs\" attack (the same class as librsvg CVE-2019-20446).\n\n# Details\n\n`SvgRenderer.renderUse()` in `src/svglib/svglib.py`:\n\n```python\ntry:\nitem = self.xlink_href_target(node, group=group)\nexcept CircularRefError:\nnode.parent.etree_element.remove(node.etree_element)\nreturn group\n...\nif len(node.getchildren()) == 0:\n# Append a copy of the referenced node as the\nchild (if not\n# already done)\nnode.append(copy.deepcopy(item))\nself.renderNode(list(node.iter_children())[-1], parent=group)\n```\n\nThe referenced node is deep-copied under the `\n` element and rendered. Any `\n` elements inside the copied subtree go through `renderUse()` again. `xlink_href_target()` raises `CircularRefError` only for a direct cycle, so a reference DAG with fan-out is expanded fully: `fan ** levels` renders.\n\nPayload shape (fan = 10, levels = 5):\n\n```xml\n\n... 10 times ...\n\n... 10 times ...\n\n...\n\n... 10 times ...\n\n```\n\n# Impact\n\nDenial of service (CPU and memory exhaustion) for any application that renders SVG from an untrusted source with svglib: thumbnail/preview generation, SVG-to-PDF conversion, report generation. Only the SVG document needs to be attacker-controlled; no non-default option is required.\n\nThe same happens through `xhtml2pdf`, which depends on svglib to render SVG images. An HTML document containing `\n` passed to `pisa.CreatePDF()` triggers the expansion. HTML-to-PDF conversion of user-supplied content is a common use of xhtml2pdf in web applications.\n\n# Reproduction\n\nMinimal local PoC, non-destructive:\n\n```python\nimport io, time\nfrom svglib.svglib import svg2rlg\n\ndef make(levels, fan=10):\nparts = ['\n',\n'\n']\nfor i in range(1, levels + 1):\nparts.append(f'\n' + f'\n' * fan + '\n')\nparts.append(f'\n')\nreturn \"\".join(parts).encode()\n\nfor levels in (3, 4, 5):\nd\n\nAffected packages: pip:svglib\nPatched: svglib 2.3.1","url":"https://github.com/advisories/GHSA-555j-qj3j-c8jv","published_at":"2026-11-20T23:47:58Z","updated_at":"2026-11-20T23:47:59Z","fetched_at":"2026-11-21T19:15:18.416719Z","severity":"high","cvss_score":7.5,"epss":0.02125,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":null,"product":"svglib","vuln_id":"CVE-2026-132275","vuln_ids":["CVE-2019-20446","CVE-2026-132275","GHSA-555J-QJ3J-C8JV"],"tags":["ghsa","pip","CWE-400","CWE-776"],"cluster_id":1983,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/2283","html":"https://vulnwatch.ve1ve2.com/item/2283"}}]}