Exploiting Drupal8's REST RCE (SA-CORE-2019-003, CVE-2019-6340)
Drupal 8's REST module allowed unauthenticated GET requests to deserialise user-supplied data, enabling remote code execution via a crafted serialised payload. The advisory's advice to block POST/PATCH requests was insufficient because GET requests also triggered the flaw.
ambionics.io
Published on ambionics.io
Once again, an RCE vulnerability emerges on Drupal's core. This time it is targeting Drupal 8's REST module, which is present, although disabled, by default.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the REST module deserialised a field value from an unauthenticated GET request without restricting which classes could be created, allowing a gadget chain to execute code.
Impact
An unauthenticated attacker could execute arbitrary commands on the server, though Drupal's response caching may require clearing the cache or using a different node ID in testing.
What the attacker needed
REST module enabled; No authentication needed; Target runs vulnerable Drupal 8
How it was found
- Send an unauthenticated GET request to the node REST endpoint with a HAL JSON body containing an invalid type link.
- Observe that Drupal processes the body and returns an error, confirming the data is handled.
- Identify the LinkItem field's options property as the unserialise sink from the patch.
- Generate a serialised gadget chain payload for the Guzzle library.
- Send a GET request with the payload in the link options field and the type set to shortcut.
- Receive command output in the response.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Drupal is a content management system. Its REST module lets programs read and write content over HTTP. A flaw meant that even a simple read request could carry hidden data that Drupal turned back into objects, and one of those objects could run a command on the server. The attacker did not need to log in.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.