{
    "title": "CVE-2024-2961: the glibc iconv flaw that targets PHP",
    "seo_title": "CVE-2024-2961: glibc iconv and PHP explained",
    "h1": "CVE-2024-2961: the glibc iconv flaw that targets PHP",
    "description": "CVE-2024-2961: the glibc iconv flaw that turns a PHP file read into code execution. Who is affected, versions and fixes.",
    "lead": "A 24-year-old glibc flaw can turn a PHP file read into code execution. How it works, affected versions, how to check and how to fix it.",
    "language": "en",
    "locale": "en-US",
    "type": "article",
    "url": "https://www.wp-feint.com/glibc-iconv-cve-2024-2961-php-flaw/",
    "canonical": "https://www.wp-feint.com/glibc-iconv-cve-2024-2961-php-flaw/",
    "markdown": "https://www.wp-feint.com/glibc-iconv-cve-2024-2961-php-flaw/index.md",
    "json": "https://www.wp-feint.com/glibc-iconv-cve-2024-2961-php-flaw/index.json",
    "published": "2026-09-01T07:00:00+00:00",
    "modified": "2026-11-22T14:31:51+00:00",
    "site": {
        "name": "WP Feint",
        "url": "https://www.wp-feint.com/"
    },
    "translations": [
        {
            "language": "en",
            "hreflang": "en-US",
            "title": "CVE-2024-2961: the glibc iconv flaw that targets PHP",
            "url": "https://www.wp-feint.com/glibc-iconv-cve-2024-2961-php-flaw/",
            "markdown": "https://www.wp-feint.com/glibc-iconv-cve-2024-2961-php-flaw/index.md",
            "json": "https://www.wp-feint.com/glibc-iconv-cve-2024-2961-php-flaw/index.json"
        },
        {
            "language": "fr",
            "hreflang": "fr-FR",
            "title": "CVE-2024-2961 : la faille glibc iconv qui vise PHP",
            "url": "https://www.wp-feint.com/fr/glibc-iconv-cve-2024-2961-php/",
            "markdown": "https://www.wp-feint.com/fr/glibc-iconv-cve-2024-2961-php/index.md",
            "json": "https://www.wp-feint.com/fr/glibc-iconv-cve-2024-2961-php/index.json"
        },
        {
            "language": "es",
            "hreflang": "es-ES",
            "title": "CVE-2024-2961: la vulnerabilidad de glibc iconv que apunta a PHP",
            "url": "https://www.wp-feint.com/es/glibc-iconv-cve-2024-2961-php-vulnerabilidad/",
            "markdown": "https://www.wp-feint.com/es/glibc-iconv-cve-2024-2961-php-vulnerabilidad/index.md",
            "json": "https://www.wp-feint.com/es/glibc-iconv-cve-2024-2961-php-vulnerabilidad/index.json"
        },
        {
            "language": "de",
            "hreflang": "de-DE",
            "title": "CVE-2024-2961: die glibc-iconv-Lücke, die PHP ins Visier nimmt",
            "url": "https://www.wp-feint.com/de/glibc-iconv-cve-2024-2961-php-luecke/",
            "markdown": "https://www.wp-feint.com/de/glibc-iconv-cve-2024-2961-php-luecke/index.md",
            "json": "https://www.wp-feint.com/de/glibc-iconv-cve-2024-2961-php-luecke/index.json"
        },
        {
            "language": "it",
            "hreflang": "it-IT",
            "title": "CVE-2024-2961: la falla glibc iconv che prende di mira PHP",
            "url": "https://www.wp-feint.com/it/glibc-iconv-cve-2024-2961-php-falla/",
            "markdown": "https://www.wp-feint.com/it/glibc-iconv-cve-2024-2961-php-falla/index.md",
            "json": "https://www.wp-feint.com/it/glibc-iconv-cve-2024-2961-php-falla/index.json"
        },
        {
            "language": "pt",
            "hreflang": "pt-BR",
            "title": "CVE-2024-2961: a falha glibc iconv que mira o PHP",
            "url": "https://www.wp-feint.com/pt/glibc-iconv-cve-2024-2961-php-falha/",
            "markdown": "https://www.wp-feint.com/pt/glibc-iconv-cve-2024-2961-php-falha/index.md",
            "json": "https://www.wp-feint.com/pt/glibc-iconv-cve-2024-2961-php-falha/index.json"
        },
        {
            "language": "nl",
            "hreflang": "nl-NL",
            "title": "CVE-2024-2961: het glibc-iconv-lek dat PHP treft",
            "url": "https://www.wp-feint.com/nl/glibc-iconv-cve-2024-2961-php-lek/",
            "markdown": "https://www.wp-feint.com/nl/glibc-iconv-cve-2024-2961-php-lek/index.md",
            "json": "https://www.wp-feint.com/nl/glibc-iconv-cve-2024-2961-php-lek/index.json"
        }
    ],
    "headings": [
        {
            "level": 1,
            "text": "CVE-2024-2961: the glibc iconv flaw that targets PHP"
        },
        {
            "level": 2,
            "text": "What CVE-2024-2961 fixes"
        },
        {
            "level": 2,
            "text": "Why PHP is the most exposed target"
        },
        {
            "level": 2,
            "text": "A WordPress case and mass exploitation"
        },
        {
            "level": 2,
            "text": "Affected and fixed glibc versions"
        },
        {
            "level": 2,
            "text": "How to tell if you are affected"
        },
        {
            "level": 2,
            "text": "Fixing it and reducing the risk"
        },
        {
            "level": 3,
            "text": "Key takeaways"
        },
        {
            "level": 2,
            "text": "Where WP Feint fits"
        },
        {
            "level": 2,
            "text": "Videos to learn more"
        },
        {
            "level": 2,
            "text": "Sources"
        }
    ],
    "body": "In spring 2024, a twenty-four-year-old flaw in the Linux C library changed the risk level of many PHP applications. **CVE-2024-2961** does not affect WordPress directly, but it can turn a simple file read into [remote code execution](https://www.wp-feint.com/glossary/remote-code-execution/). This article explains the mechanism without an exploitation recipe, who is affected, and above all how to check and fix your hosting.\n\n## What CVE-2024-2961 fixes\n\nThe flaw lies in the `iconv()` function of the GNU C Library (glibc), which converts text from one character set to another. When converting to the `ISO-2022-CN-EXT` character set, the function can write **up to 4 bytes past** the output buffer it was given. This overflow can crash the application or overwrite a neighboring variable in memory. According to the official glibc advisory, the faulty code was introduced in 2000 and had never been spotted.\n\nThe National Vulnerability Database gives it a [CVSS 3.1](https://www.wp-feint.com/glossary/cvss/) score of 7.3. The flaw was found by Charles Fol (Ambionics / Lexfo), reported on March 26, 2024 and disclosed on April 17, 2024, together with the fix.\n\n![Four-step diagram: file read, PHP filter, glibc overflow, code execution](https://www.wp-feint.com/media/chaine-en.webp)\n\n## Why PHP is the most exposed target\n\nThe key is the `php://filter` wrapper. PHP lets you apply `convert.iconv` conversions to any stream it reads. An attacker who has a way to make the application read a file can ask it to convert that stream to `ISO-2022-CN-EXT`, and thereby trigger the glibc bug. According to the researcher's analysis, all of PHP's standard read functions are affected:\n\n- `file_get_contents()`, `file()`, `readfile()`, `fgets()`\n- `getimagesize()` and `SplFileObject`\n- write functions such as `file_put_contents()` are affected too\n- on the other hand, functions that only test a file (`file_exists()`, `is_file()`) do not trigger the conversion\n\nThe technique was demonstrated on PHP versions from 7.0 to 8.3. In other words, updating PHP is not enough: it is the server's glibc that needs fixing. The `phar://` wrapper is not involved here either, unlike in other deserialization attacks.\n\nThe filter is not the only way in. The researcher lists several ways to route a stream to iconv: an [SQL injection](https://www.wp-feint.com/glossary/sql-injection/) abusing `LOAD DATA LOCAL INFILE`, an XXE flaw, and some image processing or translation libraries. The common thread is always the same: the attacker needs a way to make the application handle content they control, with an unpatched glibc underneath. That is why the fix happens at the system level, not in a single plugin.\n\n## A WordPress case and mass exploitation\n\nThe first public demonstration targeted a WordPress site running the BuddyForms 2.7.7 plugin, vulnerable to `CVE-2023-26326` (unauthenticated deserialization). That plugin flaw provided the file read primitive needed to reach glibc. It is a useful reminder: a plugin flaw rated medium can become critical once chained with a system defect.\n\nThe danger did not stay theoretical. Starting in summer 2024, the campaign known as CosmicSting chained `CVE-2024-34102` (an XXE flaw in Adobe Commerce / Magento) with `CVE-2024-2961` to achieve code execution. According to Sansec, as reported by BleepingComputer in October 2024, more than 4,000 stores (about 5% of all Adobe Commerce and Magento stores) were compromised. The named victims included major brands.\n\n![Timeline of CVE-2024-2961, from 2000 to mass exploitation in late 2024](https://www.wp-feint.com/media/chrono-en.webp)\n\n## Affected and fixed glibc versions\n\nThe flaw affects glibc 2.39 and all earlier versions. It is fixed in version 2.40 and backported to the maintenance branches. On a server, what matters is almost always your distribution's package, not the upstream version.\n\n| Source | Status | Details |\n| --- | --- | --- |\n| Upstream glibc < 2.40 | Vulnerable | Faulty code present since the 2.1.93 branch |\n| glibc 2.40 | Fixed | Reference fix, April 2024 |\n| Branches 2.32 to 2.39 | Fixed by backport | Through distribution packages |\n| Debian 12 (bookworm) | Fixed | 2.36-9+deb12u6 and later |\n| Debian 13 (trixie) | Fixed | 2.37-18 and later |\n\n*Always check the glibc package version provided by your host.*\n\nThe package versions come from the Debian trackers and the glibc advisory; confirm the exact status with your own distribution's bulletins (Red Hat, Ubuntu, AlmaLinux, and so on).\n\n## How to tell if you are affected\n\nOn shared hosting, you do not always control glibc, but you can often check it and alert your support team. If you have SSH access:\n\n1. List the active character sets: `iconv -l | grep -E 'CN-?EXT'`. Output containing `ISO-2022-CN-EXT` means the vulnerable module is present.\n2. Compare the glibc package version (`ldd --version`) with the fix announced by your distribution.\n3. Ask your host when the glibc fix was applied to your servers.\n\nAccording to Zend, an application is not exposed through this path if any of these conditions holds: it does not use the iconv extension, glibc is up to date, the `ISO-2022-CN-EXT` character set has been removed from the configuration, or the application only passes explicitly allowed character sets to iconv.\n\n## Fixing it and reducing the risk\n\nThe only real fix is to update glibc. As Zend and Red Hat point out, no PHP patch will be released, since the defect is in the system library. Until the update is applied, Red Hat and Rocky Linux document a temporary mitigation: remove the `ISO-2022-CN-EXT` character set by commenting out the three matching lines in `gconv-modules-extra.conf`, then rebuild the cache with `iconvconfig`. This is a job for a system administrator, after testing, because it can break applications that actually use that character set.\n\nBeyond that, two habits limit the reach of such a chain. First, reduce the number of plugins that can read a file based on a parameter: they are what provides the initial primitive. Second, watch your logs for attempts to read sensitive files, often a sign of a reconnaissance phase before a chained attack. A system flaw patched quickly always beats detection after the fact.\n\n### Key takeaways\n\n- CVE-2024-2961 is an overflow in glibc (iconv, ISO-2022-CN-EXT character set), not in PHP: updating PHP alone does not protect you.\n- A file read through a plugin flaw, chained with this bug, can lead to code execution.\n- glibc 2.39 and earlier are affected; the fix is in 2.40 and in backported packages.\n- Check your host's glibc version and the date of the fix; keep PHP and your plugins up to date.\n\n## Where WP Feint fits\n\nTo be clear: WP Feint does not fix a flaw in glibc, PHP, a theme or a plugin. Its role is to reduce the attack surface and the noise, and to complement sound maintenance, never to replace it. Three contributions are relevant here. First, [hardening](https://www.wp-feint.com/features/hardening/) and hiding public signatures slow down the automated profiling that often precedes exploitation. Second, [bot traps](https://www.wp-feint.com/features/bot-traps/) count requests to sensitive paths (`/.env`, `.sql` backups, paths of other software), which gives an early signal of reconnaissance. Finally, [core integrity checking](https://www.wp-feint.com/features/wordpress-integrity-check/) (Pro) helps detect a modification after a compromise. The real protection remains updating glibc, PHP and plugins, backed by tested backups.\n\n## Videos to learn more\n\n*The reference talk by the researcher behind the discovery (GreHack 2024, in English).*\n\n*The same research presented at DEF CON 32 (in English).*\n\n## Sources\n\n- [NVD - CVE-2024-2961](https://nvd.nist.gov/vuln/detail/CVE-2024-2961)\n- [glibc advisory GLIBC-SA-2024-0004 (oss-security)](https://www.openwall.com/lists/oss-security/2024/04/17/9)\n- [Red Hat - CVE-2024-2961 and mitigation](https://access.redhat.com/security/cve/CVE-2024-2961)\n- [NVD - CVE-2023-26326 (BuddyForms)](https://nvd.nist.gov/vuln/detail/CVE-2023-26326)\n\nOther sources consulted: official documentation, official vendor pages, security research publications and trade press articles.",
    "categories": [
        "PHP vulnerabilities"
    ],
    "format": "application/json"
}