Skip to content
RCE Write-up Advanced

Unauthenticated PHP Object Injection to Remote Code Execution on GiveWP

GiveWP's 'safe' unserialize helper did not strip attacker-supplied objects, so a serialized gadget chain stored in a donor's name field was written into the session table and later unserialized without a guard. Combined with a gadget chain in shipped TCPDF and TestData classes, an attacker could run arbitrary OS commands on the server.

Patchstack Follow

Published on patchstack.com

This blog post is about an unauthenticated remote code execution vulnerability in the GiveWP plugin. An attacker with no account can run arbitrary commands on t

Patchstack, on patchstack.com

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 'safe' unserialize helper relied on allowed_classes => false, which only produces a placeholder that re-serialises to the original bytes, so the payload survived storage and was unserialized later without restriction.

Impact

An attacker with no account could run arbitrary OS commands as the web server user; on 4.16.6 to [redacted] a default install was no longer reachable through the legacy processor, but a single form lacking form builder settings re-armed the chain.

What the attacker needed

One published donation form; active payment gateway; no account needed

The fix

It was fixed in [redacted] by returning false for incomplete-class payloads, rejecting serialized data on the write path, restricting the read sinks, validating the provider before calling it, sanitising meta writes, and migrating existing stored payloads.

How it was found

  1. Register an account through the unauthenticated registration action, which returns an authentication cookie.
  2. Read the profile nonce and store the serialized gadget chain in the account's last_name meta field.
  3. Fetch a donation nonce and submit a donation without the last name field, so the gadget is written into the sessions table.
  4. Request any front-end page with the same cookie to trigger unserialization and command execution.

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.

PHP can turn a piece of text into a live object, and if that text comes from an attacker it can carry hidden instructions. GiveWP tried to make this safe but only hid the object for one read, then saved it back to the database unchanged. Later code read it again without protection, and a chain of existing library methods ended up running a system command.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by Patchstack

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.