# CVE-2024-2756: __Host-/__Secure- cookie bypass due to partial CVE-2022-31629 fix

> Attackers can bypass __Host- and __Secure- cookie protections in PHP applications by setting standard insecure cookies, potentially leading to session hijacking or security control evasion.

- **Severity:** Medium 6.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 29 Apr 2024
- **Updated:** 4 Nov 2025
- **Also known as:** AZL-40070, BELL-CVE-2024-2756, BIT-libphp-2024-2756, BIT-php-2024-2756, BIT-php-min-2024-2756, CLEANSTART-2026-QQ38336, DEBIAN-CVE-2024-2756, ECHO-2a2f-0ff7-aca2, GHSA-wpj3-hf5j-x4v4, OESA-2024-2061, OESA-2024-2062, OESA-2024-2085, UBUNTU-CVE-2024-2756

## What is CVE-2024-2756?

CVE-2024-2756 is a medium-severity vulnerability in PHP, published on 29 Apr 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Due to an incomplete fix to  CVE-2022-31629 https://github.com/advisories/GHSA-c43m-486j-j32p , network and same-site attackers can set a standard insecure cookie in the victim's browser which is treated as a __Host- or __Secure- cookie by PHP applications.

Weakness: CWE-20 (Improper Input Validation)

## Which versions are affected by CVE-2024-2756?

3 open source packages ship an affected version, including libphp, php and php-min.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `libphp` | Bitnami | All versions | 8.1.28, 8.2.18, 8.3.5 |
| `php` | Bitnami | All versions | 8.1.28, 8.2.18, 8.3.5 |
| `php-min` | Bitnami | All versions | 8.1.28, 8.2.18, 8.3.5 |

## How do I fix CVE-2024-2756?

Upgrade libphp to a fixed version for your release line: 8.1.28, 8.2.18 or 8.3.5.

## Is CVE-2024-2756 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-2756 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-2756 and fix it if it is affected.

What it is: CVE-2024-2756 is a medium-severity vulnerability in PHP, published on 29 Apr 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-2756 exists.

Affected packages and fixed versions:
- libphp (Bitnami): affected all versions; fixed in 8.1.28, 8.2.18, 8.3.5
- php (Bitnami): affected all versions; fixed in 8.1.28, 8.2.18, 8.3.5
- php-min (Bitnami): affected all versions; fixed in 8.1.28, 8.2.18, 8.3.5

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-2756/ (Markdown: https://insights.sbomify.com/CVE-2024-2756/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-2756
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-2756
- OSV: https://osv.dev/vulnerability/CVE-2024-2756

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-2756/
Summaries are generated and may contain mistakes; the official description above is the record.
