WordPress DB Class, bad implementation of prepare method guides to sqli and information disclosure
The report claims that WordPress's database prepare method mishandles its arguments in two ways: it ignores later arguments when the first is an array, and it quotes %s placeholders in a way that can still allow injection when user input is already quoted. The author says this could leave plugins and themes open to SQL injection and information disclosure, and shows bbPress and a core function as examples.
b258ea62bf297b02afa9854 Follow
Originally disclosed on HackerOne
- Triaged in under an hour
- Fixed in 11 months
- Disclosed after 12 months
Issue 1: Method checks if first argument is an array and if it is, it avoids the rest of the arguments and uses the first argument array values as input.
Issue 2: When input query has %s in it, then it quote and this guides to sql injection in case query that need to be prepared have quoted user controlled input in it.
This leaves all wordpress plugins/ themes potentially vulnerable on this two types of attack. As PoC sqli in bbpress wp plugin and core wp function is shown.
PoC:
- There is SQLi in bbpress in case anonymous posting is allowed. ( check bbpress-sqli.png)
- Demo for the Issue 1 and Issue 2 for the prepare method
- Wordpress core function delete_metadata is vulnerable to sqli in case delete all e.g. last argument is true and meta value has value e.g. is user supplied / controlled.
Attachments

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the prepare helper's handling of array arguments and of already-quoted %s placeholders lets attacker-controlled values reach the SQL query unescaped.
Impact
Plugins and themes using these patterns could be open to SQL injection and information disclosure, though the text only asserts this and shows screenshots rather than a full walkthrough.
What the attacker needed
A plugin or theme using prepare unsafely; attacker-controlled input reaching the query
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 report has not been written yet. The Original tab links to the source.
WordPress code often builds database queries using a helper meant to make user input safe. This report argues that helper can be misused so that user-supplied text ends up being treated as part of the database command, letting an attacker read or change data. The write-up is very short and mostly asserts this rather than proving it step by step.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.