Chaining CSRF and XSS to Remote Code Execution in a WordPress Plu
A WordPress plugin (Quiz and Survey Master) stored user input in the 'Answer' field without sanitisation, leading to stored XSS. Combined with a CSRF weakness (SameSite=None cookies), an attacker could trick a logged-in admin into visiting a malicious page that injects a script, which then installs and activates a malicious plugin, achieving remote code execution.
Published on medium.com
Recently, during Voorivex’s OWASP Top 10 class we were tasked to find and exploit CSRF and XSS vulnerabilities in a vulnerable WordPress plugin: Quiz and Survey Master (v4.7.7). As a bonus objective, we were challenged to chain the vulnerabilities together and demonstrate how a seemingly limited bug could lead to a…
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 plugin failed to sanitise or escape user-supplied input in the 'Answer' field before rendering it, and session cookies lacked the SameSite protection that would have blocked cross-site requests.
Impact
An attacker could execute arbitrary code on the server by tricking a logged-in administrator into visiting a malicious page, leading to full compromise.
What the attacker needed
A public quiz exists; Victim is a logged-in admin; Victim visits attacker page
How it was found
- Create a quiz and add a question with a script payload in the Answer field.
- Preview the quiz to confirm the script executes (stored XSS).
- Inspect cookies and note SameSite=None, enabling cross-site requests with credentials.
- Host a malicious page that sends a POST request to create a question with an external script URL.
- Lure a logged-in admin to the malicious page; the script is injected into the quiz.
- The injected script fetches nonces, uploads a malicious plugin, and activates it, leading to remote code 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.
The quiz plugin let people type text into an answer box, and that text was later shown to anyone viewing the quiz without being cleaned. Because the site's cookies were sent even on requests from other websites, an attacker could make a logged-in administrator's browser silently add a malicious script to a quiz. That script then used the admin's own permissions to upload and activate a harmful plugin, giving the attacker control of the server.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.