libpag icon indicating copy to clipboard operation
libpag copied to clipboard

Update bundled Expat 2.6.3 in optional importers (CVE-2026-45186)

Open YMs0ra opened this issue 3 months ago • 2 comments

Which Version of libpag are you using?

Current main at 64f06dd0fd85240447d80e3900d06ca71b8482db. Its dependency manifest pins Expat commit 88b3ed553d8ad335559254863a33360d55b9f1d6, corresponding to Expat 2.6.3:

https://github.com/Tencent/libpag/blob/64f06dd0fd85240447d80e3900d06ca71b8482db/deps#L38-L41

What Platform are you on?

This is source-level and applies to builds which enable the optional PAGX/SVG/HTML importers. The base library options are disabled by default, while the repository CLI enables these importers.

Expected Behavior

Enabled XML importers should use an Expat revision containing the public CVE-2026-45186 fix and current hash-salt handling, so attacker-controlled attribute names cannot trigger the known superlinear CPU path.

Actual Behavior

The pinned Expat 2.6.3 predates the public CVE-2026-45186 fix and Expat's strengthened 16-byte hash-salt handling.

The optional PAGX/SVG/HTML importers expose path, data and string parsing APIs, for example:

https://github.com/Tencent/libpag/blob/64f06dd0fd85240447d80e3900d06ca71b8482db/include/pagx/SVGImporter.h#L68-L84

Their XML parser passes document input to XML_Parse. It also derives an address-based value, truncates it to 32 bits and calls the deprecated XML_SetHashSalt:

https://github.com/Tencent/libpag/blob/64f06dd0fd85240447d80e3900d06ca71b8482db/src/pagx/xml/XMLParser.cpp#L183-L212

The importer options are disabled in the base library by default, but the repository CLI enables PAGX/SVG/HTML. This report is limited to builds which enable these importers; it is not a claim about configurations which exclude them.

A bounded local differential check against the pinned source reproduced the upstream superlinear CPU behavior, while a fixed Expat build completed with near-linear growth. No production service or third-party system was tested.

Code Example

The commit-pinned links above identify the dependency pin, public importer API and the XML_Parse/hash-salt call site. The report intentionally does not attach a denial-of-service input.

PAG File

Not applicable: this is in the optional XML importer dependency, and no PAG file or resource-exhaustion payload is attached.

Suggested fix

Please update the bundled Expat revision to a current fixed release and replace the old salt call by either letting Expat initialize its own full-width salt or supplying high-quality entropy through the current API. A regression test for enabled PAGX/SVG/HTML importers would help prevent the vendored copy from drifting again.

Upstream release notes: https://github.com/libexpat/libexpat/blob/master/expat/Changes

Disclosure: automated tooling assisted with source review and draft preparation; the links above are commit-pinned and the report intentionally omits a denial-of-service payload.

YMs0ra avatar Aug 16 '26 11:08 YMs0ra

This fix has already been merged. Could we briefly acknowledge it in the upcoming release notes or changelog?

YMs0ra avatar Aug 24 '26 06:08 YMs0ra

Thanks for following up, and for the responsible disclosure!

We'd be happy to acknowledge this in the release notes / changelog. But to be transparent: the CVE is not yet fully remediated, so we'd prefer to acknowledge it once the fix is complete rather than now.

What's done so far: PR #3688 upgraded the Expat bundled for libpag's own pagx importer (and dropped the weak XML_SetHashSalt call).

What's still open: the same vulnerable Expat 2.6.3 (88b3ed5) is also pinned separately inside tgfx — our rendering dependency — where src/svg/xml/XMLParser.cpp uses it for SVG parsing. That path was not covered by #3688, so the CVE-2026-45186 exposure via tgfx's Expat 2.6.3 remains on main and release/4.5.

To fully close this out we still need to bump Expat in tgfx to ≥ 2.8.1 and update libpag's DEPS to the new tgfx commit. Once that lands, we'll cut a release and will acknowledge the fix (and your contribution) in the changelog.

We'll keep you posted — and thanks again for the detailed report and the differential test!

CodeJhF avatar Aug 24 '26 07:08 CodeJhF