WordPress Core Race Condition Leading to Privilege Escalation
A race condition in WordPress core allowed a low-privileged Subscriber to bypass capability checks and edit posts, potentially leading to privilege escalation. An attacker could exploit this to gain partial editor privileges and then access further vulnerabilities like SQL injection and XSS.
blog.checkpoint.com
Published on blog.checkpoint.com
A number of critical vulnerabilities exist in default WordPress installations, allowing potential compromise of millions of live web sites.
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 capability check function map_meta_cap() returns an empty array when the post ID does not exist, causing current_user_can() to incorrectly return true, and a race condition allows the post ID to become valid later.
Impact
A Subscriber could gain partial editor privileges, potentially leading to SQL injection and persistent XSS attacks, but the exploit requires specific timing and conditions.
What the attacker needed
A Subscriber account; ability to send multiple HTTP requests; timing the race condition
The fix
The vulnerability was fixed in WordPress 4.2.3.
How it was found
- As a Subscriber, obtain a valid CSRF token for the 'add-post' action by triggering the wp_dashboard_quick_press() function.
- Send a request to edit_post() with a non-existent post ID (the next auto-increment ID) in the POST parameter and a valid post ID in the GET parameter to pass the token check.
- While edit_post() is processing, send a second request to create a new quick draft, which will create the post with the guessed ID.
- Use a large number of taxonomy terms to delay the edit_post() execution, allowing the second request to complete before wp_update_post() is called.
- After the race condition succeeds, change the post status to 'trash' to bypass further capability checks.
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.
WordPress lets users have different roles, like Subscriber or Administrator. A Subscriber is only supposed to read posts, but a flaw in how WordPress checks permissions meant a Subscriber could trick the system into letting them edit posts. This is called a race condition because it relies on timing two requests just right.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.