Spip Preauth RCE 2024: Part 1, The Feather
An unauthenticated preview endpoint in the porte_plume plugin passed user-supplied text through a templating pipeline that could reach an eval statement, allowing PHP code embedded in a crafted link to be executed. An attacker could run arbitrary commands on the server without logging in.
Hi dear Sir, Madam. Please be informed that this is the third article dedicated to Spip 0-day research, if you haven’t read the first ones, I’d recommend reading them first!
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 preview formatting pipeline decoded and eval'd PHP that had been hidden inside a link's URL slug, because the URL filtering did not strip it before reaching the eval sink.
Impact
An unauthenticated attacker could execute arbitrary PHP code and system commands on the server, though the author notes the exploit did not work against Root-Me because that instance had not been updated.
What the attacker needed
Porte_plume plugin installed; no account needed; crafted POST request
The fix
It was fixed with two patches: the core gained a dedicated URL filtering function for templating, and the plugin added access control for model preview from an unauthenticated context.
How it was found
- Set up a local SPIP instance with the porte_plume plugin and an empty site.
- Send a POST request to the unauthenticated preview action with data containing a link whose slug holds PHP code.
- Observe the formatting pipeline pass the decoded PHP to the eval sink and run the command.
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.
SPIP is a content management system. Its preview feature takes text you type and formats it, and a formatting step could end up running PHP code (the language the site is built in) that came from the text. Because the preview worked without logging in, anyone could send a crafted request and get their own code run on the server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.