CVE-2022-0478 - WooCommerce Event-Manager Plugin SQL Injection
An authenticated SQL injection existed in the WooCommerce Event-Manager plugin because user input was inserted into an SQL query without quotes, making the sanitisation function ineffective. An attacker with an account could run arbitrary SQL and modify event data, such as changing the author ID of another event.
In this writeup, I will be going through how I found an Authenticated (sad) SQL Injection in the WooCommerce Event-Manager Wordpress Plugin. I will be going through the whole process, from the beginning of why I chose this plugin, to how a simple mistake could lead to a vulnerability.
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
The plugin concatenated user input directly into an SQL query without quoting it, so the sanitisation function that removed quotes was ineffective.
Impact
An authenticated attacker could execute arbitrary SQL commands, allowing them to modify data such as changing the author of an event.
What the attacker needed
A WordPress account with permission to create events
The fix
The vulnerability was fixed by the vendor after disclosure.
How it was found
- Create a new event in the plugin.
- Intercept the request that saves the event.
- Change the post_author_gutenberg parameter to include SQL syntax.
- Send the modified request and observe that another event's ID is changed.
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.
SQL injection is when a program puts user input directly into a database command without proper handling, so the input can change the command's meaning. Here, the plugin took a value from a form and placed it into an UPDATE statement without wrapping it in quotes, so the sanitisation that removed quotes did not help. An attacker with an account could therefore alter database records, for example changing who owns an event.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.