# CVE-2024-50340: Ability to change environment from query in symfony/runtime

> Attackers can alter application environment or debug mode via crafted query strings when specific PHP directives are enabled, potentially exposing sensitive configurations.

- **Severity:** High 7.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 6 Nov 2024
- **Updated:** 7 Nov 2024
- **Also known as:** DEBIAN-CVE-2024-50340, GHSA-x8vp-gf4q-mw5j, UBUNTU-CVE-2024-50340

## What is CVE-2024-50340?

CVE-2024-50340 is a high-severity vulnerability in symfony, published on 6 Nov 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

symfony/runtime is a module for the Symphony PHP framework which enables decoupling PHP applications from global state. When the `register_argv_argc` php directive is set to `on` , and users call any URL with a special crafted query string, they are able to change the environment or debug mode used by the kernel when handling the request. As of versions 5.4.46, 6.4.14, and 7.1.7 the `SymfonyRuntime` now ignores the `argv` values for non-SAPI PHP runtimes. All users are advised to upgrade. There are no known workarounds for this vulnerability.

Weakness: CWE-74 (Improper Neutralization of Special Elements in Output Used by a Downstream Component)

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

12 open source packages ship an affected version, including symfony/runtime and symfony/symfony.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `symfony/runtime` | Packagist | From 5.3.0 | 5.4.46 |
| `symfony/runtime` | Packagist | From 5.3.0 | 5.4.46 |
| `symfony/runtime` | Packagist | From 6.0.0 | 6.4.14 |
| `symfony/runtime` | Packagist | From 6.0.0 | 6.4.14 |
| `symfony/runtime` | Packagist | From 7.0.0 | 7.1.7 |
| `symfony/runtime` | Packagist | From 7.0.0 | 7.1.7 |
| `symfony/symfony` | Packagist | From 5.3.0 | 5.4.46 |
| `symfony/symfony` | Packagist | From 5.3.0 | 5.4.46 |
| `symfony/symfony` | Packagist | From 6.0.0 | 6.4.14 |
| `symfony/symfony` | Packagist | From 6.0.0 | 6.4.14 |
| `symfony/symfony` | Packagist | From 7.0.0 | 7.1.7 |
| `symfony/symfony` | Packagist | From 7.0.0 | 7.1.7 |

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

Upgrade symfony/runtime to a fixed version for your release line: 5.4.46, 6.4.14 or 7.1.7.

## Is CVE-2024-50340 being exploited?

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

Public exploit code:

- https://github.com/Nyamort/CVE-2024-50340 (github_poc): https://github.com/Nyamort/CVE-2024-50340
- Symfony Profiler - Remote Access via Injected Arguments (nuclei): http/cves/2024/CVE-2024-50340.yaml

## Fix prompt for AI coding agents

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

What it is: CVE-2024-50340 is a high-severity vulnerability in symfony, published on 6 Nov 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-50340 exists.

Affected packages and fixed versions:
- symfony/runtime (Packagist): affected from 5.3.0; fixed in 5.4.46
- symfony/runtime (Packagist): affected from 5.3.0; fixed in 5.4.46
- symfony/runtime (Packagist): affected from 6.0.0; fixed in 6.4.14
- symfony/runtime (Packagist): affected from 6.0.0; fixed in 6.4.14
- symfony/runtime (Packagist): affected from 7.0.0; fixed in 7.1.7
- symfony/runtime (Packagist): affected from 7.0.0; fixed in 7.1.7
- symfony/symfony (Packagist): affected from 5.3.0; fixed in 5.4.46
- symfony/symfony (Packagist): affected from 5.3.0; fixed in 5.4.46
- symfony/symfony (Packagist): affected from 6.0.0; fixed in 6.4.14
- symfony/symfony (Packagist): affected from 6.0.0; fixed in 6.4.14
- symfony/symfony (Packagist): affected from 7.0.0; fixed in 7.1.7
- symfony/symfony (Packagist): affected from 7.0.0; fixed in 7.1.7

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-50340/ (Markdown: https://insights.sbomify.com/CVE-2024-50340/index.md)
```

## Sources

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

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