Description
Cpanel::JSON::XS versions before 4.41 for Perl allow denial of service via UTF-8 BOM prefixed input when a decode filter callback throws. To skip a leading 3-byte UTF-8 BOM, decode_json() advances the input scalar’s string pointer past the mark with SvPV_set() and restores it only on the normal return path. When decoding aborts through a Perl exception, for example a filter_json_object callback that croaks, the restore is skipped and the scalar is left with its string pointer offset into its own buffer and a shortened length. When that scalar is later freed, the allocator receives an invalid pointer and the interpreter aborts. A single BOM prefixed document decoded with a throwing filter callback crashes any caller.
Problem types
CWE-763 Release of Invalid Pointer or Reference
CWE-755 Improper Handling of Exceptional Conditions
Product status
Any version before 4.41
Timeline
| 2026-05-18: | Issue reported. |
| 2026-05-27: | Version 4.41 released with fix. |
| 2026-05-28: | Fix verified. |
References
github.com/…dfe1b41a36caba51dc12a2917fe50285d1ffaa7b.patch
metacpan.org/release/RURBAN/Cpanel-JSON-XS-4.41/changes
