# CVE-2019-6340: Drupal Core Remote Code Execution

> Remote attackers can execute arbitrary PHP code via unsanitized data in specific field types when web services modules are enabled.

- **Severity:** High 8.1 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Yes, since 25 Mar 2022 (CISA KEV)
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 21 Feb 2019
- **Updated:** 21 Oct 2025
- **Also known as:** DRUPAL-CORE-2019-003, GHSA-3gx6-h57h-rm27

## What is CVE-2019-6340?

CVE-2019-6340 is a high-severity unsafe deserialization vulnerability in Drupal Drupal, published on 21 Feb 2019. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Some field types do not properly sanitize data from non-form sources in Drupal 8.5.x before 8.5.11 and Drupal 8.6.x before 8.6.10. This can lead to arbitrary PHP code execution in some cases. A site is only affected by this if one of the following conditions is met: The site has the Drupal 8 core RESTful Web Services (rest) module enabled and allows PATCH or POST requests, or the site has another web services module enabled, like JSON:API in Drupal 8, or Services or RESTful Web Services in Drupal 7. (Note: The Drupal 7 Services module itself does not require an update at this time, but you should apply other contributed updates associated with this advisory if Services is in use.)

Weakness: CWE-502 (Deserialization of Untrusted Data)

## Which versions are affected by CVE-2019-6340?

13 open source packages ship an affected version, including drupal/core and drupal/drupal. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `drupal/core` | Packagist | From 7.0.0 | 7.62.0 |
| `drupal/core` | Packagist | From 7.0.0 | 7.62.0 |
| `drupal/core` | Packagist | From 8.0.0 | 8.5.11, 8.6.10 |
| `drupal/core` | Packagist | From 8.0.0 | 8.5.11 |
| `drupal/core` | Packagist | From 8.0.0 | 8.5.11 |
| `drupal/core` | Packagist | From 8.6.0 | 8.6.10 |
| `drupal/core` | Packagist | From 8.6.0 | 8.6.10 |
| `drupal/drupal` | Packagist | From 7.0.0 | 7.62.0 |
| `drupal/drupal` | Packagist | From 7.0.0 | 7.62.0 |
| `drupal/drupal` | Packagist | From 8.0.0 | 8.5.11 |
| `drupal/drupal` | Packagist | From 8.0.0 | 8.5.11 |
| `drupal/drupal` | Packagist | From 8.6.0 | 8.6.10 |
| `drupal/drupal` | Packagist | From 8.6.0 | 8.6.10 |

Products: Drupal Drupal.

## How do I fix CVE-2019-6340?

Upgrade drupal/core to a fixed version for your release line: 7.62.0, 8.5.11 or 8.6.10. US federal agencies must fix it by 15 Apr 2022.

## Is CVE-2019-6340 being exploited?

Yes. Attackers have exploited CVE-2019-6340 in the wild since at least 25 Mar 2022.

Public exploit code:

- Drupal8's REST RCE, SA-CORE-2019-003, CVE-2019-6340 (github_poc): https://github.com/jas502n/CVE-2019-6340
- Environment for CVE-2019-6340 (Drupal) (github_poc): https://github.com/knqyf263/CVE-2019-6340
- CVE-2019-6340-Drupal SA-CORE-2019-003 (github_poc): https://github.com/g0rx/Drupal-SA-CORE-2019-003
- CVE-2019-6340 POC Drupal rce (github_poc): https://github.com/oways/CVE-2019-6340
- (CVE-2019-6340, CVE-2018-7600) drupal8-REST-RCE  (github_poc): https://github.com/ludy-dev/drupal8-REST-RCE
- CVE-2019-6340 Drupal 8.6.9 REST Auth Bypass examples (github_poc): https://github.com/DevDungeon/CVE-2019-6340-Drupal-8.6.9-REST-Auth-Bypass

## Other vulnerabilities in Drupal Drupal

- [CVE-2026-9082](https://insights.sbomify.com/CVE-2026-9082/): Drupal Core SQL Injection (critical 9.8, exploited in the wild)
- [CVE-2020-13671](https://insights.sbomify.com/CVE-2020-13671/): Drupal core Un-restricted Upload of File (high 8.8, exploited in the wild)
- [CVE-2009-3352](https://insights.sbomify.com/CVE-2009-3352/): Other in n/a (critical 10.0)
- [CVE-2024-55636](https://insights.sbomify.com/CVE-2024-55636/): Drupal core - Less critical - Gadget chain - SA-CORE-2024-006 (critical 9.8)
- [CVE-2024-55637](https://insights.sbomify.com/CVE-2024-55637/): Drupal core - Moderately critical - Gadget chain - SA-CORE-2024-007 (critical 9.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2019-6340 and fix it if it is affected.

What it is: CVE-2019-6340 is a high-severity unsafe deserialization vulnerability in Drupal Drupal, published on 21 Feb 2019. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: Yes. Attackers have exploited CVE-2019-6340 in the wild since at least 25 Mar 2022.

Affected packages and fixed versions:
- drupal/core (Packagist): affected from 7.0.0; fixed in 7.62.0
- drupal/core (Packagist): affected from 7.0.0; fixed in 7.62.0
- drupal/core (Packagist): affected from 8.0.0; fixed in 8.5.11, 8.6.10
- drupal/core (Packagist): affected from 8.0.0; fixed in 8.5.11
- drupal/core (Packagist): affected from 8.0.0; fixed in 8.5.11
- drupal/core (Packagist): affected from 8.6.0; fixed in 8.6.10
- drupal/core (Packagist): affected from 8.6.0; fixed in 8.6.10
- drupal/drupal (Packagist): affected from 7.0.0; fixed in 7.62.0
- drupal/drupal (Packagist): affected from 7.0.0; fixed in 7.62.0
- drupal/drupal (Packagist): affected from 8.0.0; fixed in 8.5.11
- drupal/drupal (Packagist): affected from 8.0.0; fixed in 8.5.11
- drupal/drupal (Packagist): affected from 8.6.0; fixed in 8.6.10

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

## Sources

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

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