I Bypassed Authentication on a Government Database Using SoQL Injection
A government data portal running Socrata was vulnerable to SoQL injection in the $query parameter. By chaining UNION and @ cross-dataset references, an attacker could bypass authentication and read restricted datasets.
Published on clarkvoss.medium.com
Hacking
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.
Context
Socrata runs open data portals for a large number of government agencies and cities. Its SODA API exposes endpoints that accept SoQL queries. SoQL is Socrata's own query language, and on the backend it is compiled down to SQL and executed against PostgreSQL. When user input reaches the $query parameter without proper sanitisation, the result is SoQL injection.
The target in this engagement was a government data portal running Socrata. The injection point was a query parameter that accepted SoQL. The interesting part is that SoQL is not SQL: it has its own parser, its own function whitelist and its own restrictions, so the usual SQL injection tooling does not map cleanly onto it.
Setup
The researcher confirmed the injection with a simple arithmetic expression in the $query parameter:
$query=(select 198766*667891)
The response was 132754022506, the computed product. The server had done the multiplication, which confirmed injection.
Existing tools were not usable against this surface. sqlmap choked: every payload it sent was rejected by SoQL's parser before it ever touched the database. NoSQL techniques did not apply either. The injection was confirmed and, with existing tools, completely unexploitable.
To work the target, the researcher built a tool called soqli_hunter: Python, a single file, speaking SoQL natively. It takes raw request files from Burp with a * marker for the injection point, the same workflow as sqlmap's -r flag.
Finding it
The first step was mapping the attack surface. The researcher threw 138 payloads at the target across 7 technique categories to see what SoQL lets through and what it blocks.
What worked:
substring()length()upper()lower()chr()||concatenationCASE WHEN::textcast::booleancast
What did not work:
version()current_usercurrent_database()ascii()pg_sleep()- stacked queries
- basically everything else that would let you actually do something interesting
The function whitelist caught all of it. Every standard extraction path was dead, so the researcher went looking for a new one.

Exploitation
Step 1: the ::boolean error channel
While testing the :: type cast operator, the researcher found that casting to ::text worked fine and casting to ::integer was blocked by the SoQL typechecker, but ::boolean sailed right through to Postgres.
When Postgres tried to evaluate 'actual_data'::boolean it could not: non-boolean strings cannot cast to boolean. The error message, however, included the value it was trying to cast.
$query=(select substring(column_name::text, 1, 50)::boolean)
The response was:
{ "code": "soql.pg.query-error", "data": { "message": "ERROR: invalid input syntax for type boolean: \"actual_column_data\"" }}
The error code tells the story: soql.pg.query-error, not soql.analyzer.typechecker. The cast bypassed SoQL entirely and reached Postgres, and Socrata forwarded the raw Postgres error back to the client, extracted value and all.
This became the error_cast extraction method in soqli_hunter: 50 characters per request, with full values coming back in one or two calls.
The limitation at this point was that the data being extracted was the same public data the normal API returned. The researcher needed to reach something that was not supposed to be accessible.
Step 2: UNION, leaked by a parser error
This one came from a mistake. The researcher was testing Postgres dollar-quoting ($$soqli$$) to see whether it could bypass SoQL's string handling. The parser rejected it, but the error message was more interesting than the test:
Expected one of `)`, `|>`, `UNION`, `INTERSECT`, `MINUS`, `UNION ALL`,`INTERSECT ALL`, `MINUS ALL`, `LIMIT`, `OFFSET`, `ORDER BY`, ...
UNION was right there in the parser's expected token list. The researcher tested it:
(select 1) UNION (select 2)
The result was 200 OK, with two records returned. SoQL supports UNION, and the researcher had never seen it documented anywhere as an injection vector. This meant fabricated records could be injected into API responses alongside real government data. Response manipulation on a government dataset is interesting, but the real question was whether UNION could reach across dataset boundaries.
Step 3: cross-dataset access with @
The FROM clause rejected every dataset identifier the researcher tried: quoted names, backticks, underscores, and the internal identifiers that had leaked through earlier error messages. Nothing worked as a table reference.
Then the researcher tried Socrata's @ prefix:
(select 'x') UNION (select * from @target-dataset limit 1)
The result was a column count mismatch error, but it was not a rejection. The query coordinator had actually resolved the target dataset and compared its schema against the query. Cross-dataset UNION was live.
The column mismatch errors were valuable on their own. Every failed UNION attempt leaked the target dataset's full schema: column names, types and internal dataset identifiers. The researcher built an enumeration loop and mapped dozens of datasets through their error messages alone.
Step 4: the bypass through an unpublished dataset
The researcher scraped the platform's catalogue and found 50 unpublished datasets: draft copies and working versions. Each one was tested through the @ UNION path, and all 50 schemas leaked through error messages.
One of them stood out. When it was referenced in a UNION query, the error messages showed the query coordinator resolving it to a different internal dataset ID. The researcher checked that target dataset through the normal API:
GET /resource/[target-dataset].json?$limit=1
The response was:
{ "error": true, "message": "You must be logged in to access this resource"}
The dataset requires authentication. But the unpublished copy was publicly accessible, and its internal redirect to the restricted dataset happened inside the query coordinator, after the point where authentication should have been checked.
The exploit chain, as the researcher lays it out:
- Unauthenticated SoQL injection into a public dataset
- UNION references an unpublished dataset via
@(publicly accessible) - Query coordinator follows the internal redirect to the restricted dataset (403)
- No authentication check on the redirect path
- Restricted data comes back in the response
The researcher matched column types, built the UNION query and sent it:
$query=(select 'a','b','c','d','e','f','g','h','i','j')UNION (select col1,col2,col3,col4,col5,col6,col7,col8,col9,''from @unpublished-copy limit 1)
The response was HTTP 200, with data from the restricted dataset in the JSON response: titles, phone numbers, locations and descriptions, all from a dataset that tells you to log in when you try to access it normally.

Root cause
The vulnerability is not in any single layer. The SoQL typechecker is solid at blocking Postgres functions, but it lets UNION through, it lets @ cross-dataset references through, and the query coordinator follows redirects without rechecking authentication. The flaw sits in the gaps between those layers.
Error handling contributed directly. The parser grammar leak revealed UNION, the column mismatch errors leaked schemas, and the internal dataset identifiers exposed the redirect chain. The application told the researcher exactly what it expected, and the researcher read what it said.
Impact
An unauthenticated attacker with a SoQL injection into a public dataset could reach restricted datasets through the @ UNION path and read their contents. In this case the data returned included titles, phone numbers, locations and descriptions from a dataset that requires login when accessed normally. The researcher also showed that UNION allows fabricated records to be injected into API responses alongside real government data.
Reaching the restricted dataset depended on a specific condition: an unpublished copy of the dataset had to be publicly accessible and to redirect internally to the restricted dataset inside the query coordinator. The researcher lists among the dead ends that every restricted dataset found was on a different server cluster, that 200 random dataset IDs came back not found, that cross-instance federation was rejected, and that row counts between unpublished and published versions were identical.
Fix
What was changed is not stated in the report. The measures the findings point to are: enforce the authentication check on the internal redirect path inside the query coordinator, so that following a redirect to a restricted dataset is authorised at the point of access; stop forwarding raw Postgres error messages, including the values being cast, back to clients; and restrict UNION and @ cross-dataset references in the SoQL layer rather than relying on the typechecker alone.
Variants to test
- Type cast error channels. Send a cast of a column to a type the backend cannot convert, for example
::booleanon a text column, and look for a raw database error that echoes the value. A positive result is an error code from the database layer rather than the query analyser, with the extracted value in the message. - Parser grammar leaks. Send malformed syntax such as dollar-quoting and read the expected-token list in the error. A positive result is a list of keywords the query language accepts, such as
UNION, that are not documented as usable in queries. - UNION support. Send
(select 1) UNION (select 2)and check for a 200 with two records. A positive result is a normal response containing both fabricated rows. - Cross-dataset references. Reference another dataset through the platform's prefix syntax, for example
@target-dataset, inside a UNION. A positive result is a column count mismatch rather than a rejection, which shows the coordinator resolved the target schema. - Schema enumeration through errors. Iterate UNION attempts with varying column counts and read the mismatch errors. A positive result is column names, types and internal dataset identifiers leaking in the error text.
- Unpublished copies and redirects. Scrape the catalogue for unpublished datasets, reference each through the cross-dataset UNION path, and watch for the coordinator resolving it to a different internal dataset ID. A positive result is a restricted dataset whose data comes back in the response while the normal API endpoint returns a login requirement.
The tool
The researcher open sourced soqli_hunter since nothing else exists for this attack surface. It has 138 payloads, batch and interactive modes, raw Burp request file support, the ::boolean error extraction technique, UNION injection, @ cross-dataset federation, and a dataset scanner that automates the entire redirect bypass detection chain.
# Confirm, fingerprint, and scan for cross-dataset bypassespython soqli_hunter.py -r request.txt --batch --confirm --fingerprint --technique D
# Error-based extractionpython soqli_hunter.py -r request.txt --batch --extract "column_name" \ --extract-method error_cast --chunk-size 50
A set of Nuclei templates for detecting Socrata endpoints and confirming SoQL injection at scale was also published.
Takeaways
The injection itself was trivial: arithmetic in a query parameter. The hard part was turning it into impact when every standard technique was blocked by the SoQL layer. At multiple points the researcher had "injection confirmed, but no exploitable impact": every extraction technique returned public data, all the Postgres internal functions were blocked, error-based extraction worked but only on public columns, UNION injection seemed limited to response manipulation, cross-dataset FROM was rejected by the parser, every restricted dataset found was on a different server cluster, 200 random dataset IDs came back not found, cross-instance federation was rejected, and row counts between unpublished and published versions were identical. The finding came from not accepting any of those as the final answer.

What happened, in plain words
A security researcher was testing a government website that publishes open data: tables of information that anyone can browse and download. The site is built on a product called Socrata, which many government agencies and cities use to run these public data portals.
While testing, the researcher found that one of the site's search boxes (technically, a parameter in a web request) would happily do arithmetic for him. He typed a multiplication into it and the server sent back the answer. That is a classic sign of a vulnerability called injection: the website is taking text from the user and treating it as instructions for its database, instead of treating it as harmless data.
But this was not ordinary SQL injection. The site uses its own query language, SoQL, which is Socrata's own way of writing questions to the database. SoQL is later translated into SQL, the language most databases speak, and run against a PostgreSQL database. SoQL has its own rules and its own filter that blocks many dangerous commands. The usual tools for exploiting SQL injection, including the well-known sqlmap, simply did not work: every attack they sent was rejected before it reached the database. The researcher could prove the injection existed, but could not use it to read anything he was not already allowed to see.
So he built his own tool, called soqli_hunter, and the work of proving impact took weeks. The path ran through error messages: the site kept telling him what it expected and what went wrong, and those messages leaked information. Eventually he found a way to make the site return data from a dataset that normally requires you to log in, without logging in at all.
This article walks through that journey from the beginning, explaining each idea as it appears. You only need to know how to use a browser to follow it.
Some background first
What an API is
When you open a web page in a browser, the browser asks a server for the page and the server sends back HTML, the code that describes what the page looks like. An API (Application Programming Interface) is a similar conversation, but meant for programs rather than people. A program sends a request to a specific address, called an endpoint, and gets back structured data, usually in a format called JSON, which looks like a set of labelled values in curly brackets.
A simple comparison: a web page is a restaurant menu printed nicely for a customer, while an API is the waiter taking a precise order from another kitchen. Both reach the same kitchen, but the API speaks in exact terms.
What a query parameter is
When you search on a website, the words you type often end up in the address bar after a question mark, like ?search=cats. Everything after the ? is a parameter: a named value the server reads to decide what to send back. In this story the important parameter is called $query, and it carries a query written in SoQL.
What SoQL and SODA are
Socrata runs open data portals for a large number of government agencies and cities. Its SODA API exposes endpoints that accept SoQL queries. SoQL is Socrata's own query language, and on the backend it is compiled down to SQL and executed against PostgreSQL. When user input reaches the $query parameter without proper sanitisation, the result is SoQL injection.
Sanitisation means cleaning up what a user typed before using it, for example by escaping characters that have special meaning. Without it, the server cannot tell the difference between a legitimate query and one an attacker has tampered with.
What injection means
Injection is when a program mixes up data and instructions. Imagine a form at a bank where you write your name, and the clerk reads it out loud to a colleague. If you write "John, and also open the safe", a careless clerk might treat the second part as an instruction. Injection vulnerabilities work the same way: the attacker writes something that looks like data but is interpreted as a command.
SQL injection is the classic version, aimed at databases that speak SQL. SoQL injection is the same idea aimed at Socrata's query language. The target in this engagement was a government data portal running Socrata, and the injection point was a query parameter that accepted SoQL.
The interesting part is that SoQL is not SQL: it has its own parser, its own function whitelist and its own restrictions, so the usual SQL injection tooling does not map cleanly onto it. A parser is the part of the software that reads text and works out its structure, like a grammar checker. A function whitelist is a list of commands that are allowed; anything not on the list is refused.
Step 1: confirming the injection
The researcher confirmed the injection with a simple arithmetic expression in the $query parameter:
$query=(select 198766*667891)
Line by line:
$query=is the name of the parameter being set. Everything after the equals sign is the value the server will read.(select ...)is a query that asks the database to return something. The brackets group it together.198766*667891is a multiplication. If the server treats this as a query rather than as plain text, it will calculate the product.
The response was 132754022506, the computed product. The server had done the multiplication, which confirmed injection. If the site had been safe, it would have treated the whole string as a meaningless search term and returned nothing, or an error about invalid input. Instead it did maths on demand, which means the text reached the database as an instruction.
Existing tools were not usable against this surface. sqlmap choked: every payload it sent was rejected by SoQL's parser before it ever touched the database. A payload is the malicious input an attacker sends. NoSQL techniques did not apply either, because SoQL is neither SQL nor a NoSQL database language. The injection was confirmed and, with existing tools, completely unexploitable.
To work the target, the researcher built a tool called soqli_hunter: Python, a single file, speaking SoQL natively. Python is a popular programming language. It takes raw request files from Burp with a * marker for the injection point, the same workflow as sqlmap's -r flag. Burp is a tool that sits between your browser and a website and lets you capture and edit requests; saving a request to a file and marking the spot to attack is a common way to test a specific parameter.

Step 2: mapping what SoQL allows
The first step was mapping the attack surface: finding out which commands the site accepts and which it refuses. The researcher threw 138 payloads at the target across 7 technique categories to see what SoQL lets through and what it blocks.
What worked:
substring(): takes part of a piece of text, for example the first 50 characters.length(): tells you how many characters a piece of text has.upper()andlower(): change text to all capitals or all lowercase.chr(): turns a number into the character with that code.||concatenation: joins two pieces of text together.CASE WHEN: chooses between values depending on a condition, like an if-then statement.::textcast: converts a value to text.::booleancast: converts a value to true or false.
What did not work:
version(): would reveal the database software version.current_user: would reveal which database account the query runs as.current_database(): would reveal the database name.ascii(): would turn a character into its numeric code.pg_sleep(): would make the database pause, a common trick for timing attacks.- stacked queries: sending several queries one after another in a single request.
- basically everything else that would let you actually do something interesting.
The function whitelist caught all of it. Every standard extraction path was dead, so the researcher went looking for a new one. Extraction means pulling data out of the database through the injection. The usual routes were closed, so the only option was to find a route nobody had documented.

Step 3: the ::boolean error channel
While testing the :: type cast operator, the researcher found that casting to ::text worked fine and casting to ::integer was blocked by the SoQL typechecker, but ::boolean sailed right through to Postgres. A type cast is a request to convert a value from one kind to another, like converting the text "42" into the number 42. The typechecker is the part of SoQL that checks whether a conversion makes sense.
When Postgres tried to evaluate 'actual_data'::boolean it could not: non-boolean strings cannot cast to boolean. A boolean is a value that is either true or false. The text "actual_data" is neither, so the database raised an error. The error message, however, included the value it was trying to cast. That is the leak: the database complains about the value, and in complaining it repeats the value back.
$query=(select substring(column_name::text, 1, 50)::boolean)
Line by line:
$query=sets the parameter.selectasks the database to return a value.substring(column_name::text, 1, 50)takes the contents of a column calledcolumn_name, converts it to text, and keeps characters 1 to 50. A column is one field in a table, like the "Title" field in a spreadsheet.::booleanthen tries to convert that 50-character piece of text into true or false, which will fail for almost any real data.
The response was:
{ "code": "soql.pg.query-error", "data": { "message": "ERROR: invalid input syntax for type boolean: \"actual_column_data\"" }}
Line by line:
"code": "soql.pg.query-error"is the error label.pgstands for PostgreSQL, the database. The label says the error came from the database layer, not from SoQL's own analyser."data"wraps the details."message": "ERROR: invalid input syntax for type boolean: ..."is the database's own complaint, and the part in quotes after the colon is the value it was trying to convert. That is the extracted data, echoed back.
The error code tells the story: soql.pg.query-error, not soql.analyzer.typechecker. The cast bypassed SoQL entirely and reached Postgres, and Socrata forwarded the raw Postgres error back to the client, extracted value and all. In other words, the safety layer never saw the conversion, and the database's private complaint was passed straight to the visitor.
This became the error_cast extraction method in soqli_hunter: 50 characters per request, with full values coming back in one or two calls. Instead of asking the database a question and reading the answer, the researcher asks it to do something impossible and reads the value in the complaint.
The limitation at this point was that the data being extracted was the same public data the normal API returned. The researcher needed to reach something that was not supposed to be accessible. Reading public data through a clever trick proves the trick works, but it does not prove harm.
Step 4: UNION, leaked by a parser error
This one came from a mistake. The researcher was testing Postgres dollar-quoting ($$soqli$$) to see whether it could bypass SoQL's string handling. Dollar-quoting is a way of marking text in PostgreSQL so that special characters inside it are ignored. The parser rejected it, but the error message was more interesting than the test:
Expected one of `)`, `|>`, `UNION`, `INTERSECT`, `MINUS`, `UNION ALL`,`INTERSECT ALL`, `MINUS ALL`, `LIMIT`, `OFFSET`, `ORDER BY`, ...
Line by line:
Expected one ofmeans the parser reached a point where it needed a particular word and lists the words it would have accepted.- The backticked words are those acceptable words: punctuation and keywords such as
UNION,INTERSECT,MINUS,LIMIT,OFFSETandORDER BY. UNIONis the important one. It is a command that combines the results of two queries into one list.
UNION was right there in the parser's expected token list. A token is a single meaningful word or symbol in a query. The researcher tested it:
(select 1) UNION (select 2)
Line by line:
(select 1)asks for the number 1.UNIONcombines that result with what follows.(select 2)asks for the number 2.
If UNION is accepted, the response should contain both 1 and 2. The result was 200 OK, with two records returned. HTTP 200 is the standard status code for a successful request. SoQL supports UNION, and the researcher had never seen it documented anywhere as an injection vector. This meant fabricated records could be injected into API responses alongside real government data. Response manipulation on a government dataset is interesting, but the real question was whether UNION could reach across dataset boundaries. A dataset is one table or collection of data on the portal; reaching across boundaries would mean reading a different dataset from the one the query was meant for.
Step 5: cross-dataset access with @
The FROM clause rejected every dataset identifier the researcher tried: quoted names, backticks, underscores, and the internal identifiers that had leaked through earlier error messages. In a query, FROM names the table to read. An identifier is simply the name of something, here the name of a dataset. Nothing worked as a table reference.
Then the researcher tried Socrata's @ prefix:
(select 'x') UNION (select * from @target-dataset limit 1)
Line by line:
(select 'x')returns the single letter x.UNIONcombines it with the next query.(select * from @target-dataset limit 1)reads every column (*) from a dataset named with the@prefix, andlimit 1keeps only the first row.@target-datasetis a placeholder for the name of the dataset being tested.
The result was a column count mismatch error, but it was not a rejection. A column count mismatch means the two halves of the UNION returned different numbers of columns, which is not allowed. The key point is that the error was about the shape of the data, not about the dataset being forbidden. The query coordinator had actually resolved the target dataset and compared its schema against the query. The query coordinator is the part of the system that plans and runs queries. A schema is the list of columns and their types. Cross-dataset UNION was live.
The column mismatch errors were valuable on their own. Every failed UNION attempt leaked the target dataset's full schema: column names, types and internal dataset identifiers. The researcher built an enumeration loop and mapped dozens of datasets through their error messages alone. An enumeration loop is a program that tries one name after another automatically.
Step 6: the bypass through an unpublished dataset
The researcher scraped the platform's catalogue and found 50 unpublished datasets: draft copies and working versions. Scraping means automatically collecting information from pages. Each one was tested through the @ UNION path, and all 50 schemas leaked through error messages.
One of them stood out. When it was referenced in a UNION query, the error messages showed the query coordinator resolving it to a different internal dataset ID. In other words, the draft pointed at another dataset behind the scenes. The researcher checked that target dataset through the normal API:
GET /resource/[target-dataset].json?$limit=1
Line by line:
GETis the HTTP method for fetching something./resource/[target-dataset].jsonis the endpoint for a dataset, with the dataset's name in place of the placeholder.?$limit=1asks for just one row, to keep the response small.
The response was:
{ "error": true, "message": "You must be logged in to access this resource"}
Line by line:
"error": truesays the request failed."message": "You must be logged in to access this resource"explains why: the dataset is restricted to logged-in users.
The dataset requires authentication. Authentication means proving who you are, usually by logging in. But the unpublished copy was publicly accessible, and its internal redirect to the restricted dataset happened inside the query coordinator, after the point where authentication should have been checked. A redirect is when one address forwards to another. The check happened at the front door, but the coordinator used a side door that had no lock.
The exploit chain, as the researcher lays it out:
- Unauthenticated SoQL injection into a public dataset
- UNION references an unpublished dataset via
@(publicly accessible) - Query coordinator follows the internal redirect to the restricted dataset (403)
- No authentication check on the redirect path
- Restricted data comes back in the response
A 403 is the HTTP status code for forbidden. The researcher matched column types, built the UNION query and sent it:
$query=(select 'a','b','c','d','e','f','g','h','i','j')UNION (select col1,col2,col3,col4,col5,col6,col7,col8,col9,''from @unpublished-copy limit 1)
Line by line:
$query=sets the parameter.(select 'a','b','c','d','e','f','g','h','i','j')returns ten placeholder values, one per column, so the first half has the right shape.UNIONcombines it with the second half.(select col1,col2,col3,col4,col5,col6,col7,col8,col9,''from @unpublished-copy limit 1)reads nine named columns plus an empty string from the unpublished copy, keeping one row. The empty string fills the tenth column so the counts match.@unpublished-copyis the publicly accessible draft that redirects internally to the restricted dataset.
The response was HTTP 200, with data from the restricted dataset in the JSON response: titles, phone numbers, locations and descriptions, all from a dataset that tells you to log in when you try to access it normally.

Why it worked
The vulnerability is not in any single layer. The SoQL typechecker is solid at blocking Postgres functions, but it lets UNION through, it lets @ cross-dataset references through, and the query coordinator follows redirects without rechecking authentication. The flaw sits in the gaps between those layers. A useful comparison is a building where the front desk checks your badge, but the internal lift to the archive floor does not.
Error handling contributed directly. The parser grammar leak revealed UNION, the column mismatch errors leaked schemas, and the internal dataset identifiers exposed the redirect chain. The application told the researcher exactly what it expected, and the researcher read what it said.
What the impact was
An unauthenticated attacker with a SoQL injection into a public dataset could reach restricted datasets through the @ UNION path and read their contents. In this case the data returned included titles, phone numbers, locations and descriptions from a dataset that requires login when accessed normally. The researcher also showed that UNION allows fabricated records to be injected into API responses alongside real government data.
Reaching the restricted dataset depended on a specific condition: an unpublished copy of the dataset had to be publicly accessible and to redirect internally to the restricted dataset inside the query coordinator. The researcher lists among the dead ends that every restricted dataset found was on a different server cluster, that 200 random dataset IDs came back not found, that cross-instance federation was rejected, and that row counts between unpublished and published versions were identical. Federation here means one installation of the platform talking to another.
How to fix it
What was changed is not stated in the report. The measures the findings point to are: enforce the authentication check on the internal redirect path inside the query coordinator, so that following a redirect to a restricted dataset is authorised at the point of access; stop forwarding raw Postgres error messages, including the values being cast, back to clients; and restrict UNION and @ cross-dataset references in the SoQL layer rather than relying on the typechecker alone.
Things to try on your own targets
These are the checks the researcher describes, written so you can repeat them on a system you are allowed to test.
- Type cast error channels. Send a cast of a column to a type the backend cannot convert, for example
::booleanon a text column, and look for a raw database error that echoes the value. A positive result is an error code from the database layer rather than the query analyser, with the extracted value in the message. - Parser grammar leaks. Send malformed syntax such as dollar-quoting and read the expected-token list in the error. A positive result is a list of keywords the query language accepts, such as
UNION, that are not documented as usable in queries. - UNION support. Send
(select 1) UNION (select 2)and check for a 200 with two records. A positive result is a normal response containing both fabricated rows. - Cross-dataset references. Reference another dataset through the platform's prefix syntax, for example
@target-dataset, inside a UNION. A positive result is a column count mismatch rather than a rejection, which shows the coordinator resolved the target schema. - Schema enumeration through errors. Iterate UNION attempts with varying column counts and read the mismatch errors. A positive result is column names, types and internal dataset identifiers leaking in the error text.
- Unpublished copies and redirects. Scrape the catalogue for unpublished datasets, reference each through the cross-dataset UNION path, and watch for the coordinator resolving it to a different internal dataset ID. A positive result is a restricted dataset whose data comes back in the response while the normal API endpoint returns a login requirement.
The tool
The researcher open sourced soqli_hunter since nothing else exists for this attack surface. Open sourcing means publishing the code for anyone to use. It has 138 payloads, batch and interactive modes, raw Burp request file support, the ::boolean error extraction technique, UNION injection, @ cross-dataset federation, and a dataset scanner that automates the entire redirect bypass detection chain.
# Confirm, fingerprint, and scan for cross-dataset bypassespython soqli_hunter.py -r request.txt --batch --confirm --fingerprint --technique D
Line by line:
python soqli_hunter.pyruns the tool with Python.-r request.txtreads a saved request from a file, the same idea as sqlmap's-r.--batchruns without asking questions interactively.--confirmchecks whether the injection is real.--fingerprintworks out what the target is.--technique Dselects the technique category labelled D, which the comment describes as scanning for cross-dataset bypasses.
# Error-based extractionpython soqli_hunter.py -r request.txt --batch --extract "column_name" \ --extract-method error_cast --chunk-size 50
Line by line:
python soqli_hunter.py -r request.txt --batchruns the tool on the saved request without prompts.--extract "column_name"names the column whose contents should be pulled out.--extract-method error_castuses the::booleanerror trick to read the value.--chunk-size 50reads 50 characters at a time.
A set of Nuclei templates for detecting Socrata endpoints and confirming SoQL injection at scale was also published. Nuclei is a scanner that runs ready-made checks, called templates, against a target.
What to take away
The injection itself was trivial: arithmetic in a query parameter. The hard part was turning it into impact when every standard technique was blocked by the SoQL layer. At multiple points the researcher had "injection confirmed, but no exploitable impact": every extraction technique returned public data, all the Postgres internal functions were blocked, error-based extraction worked but only on public columns, UNION injection seemed limited to response manipulation, cross-dataset FROM was rejected by the parser, every restricted dataset found was on a different server cluster, 200 random dataset IDs came back not found, cross-instance federation was rejected, and row counts between unpublished and published versions were identical. The finding came from not accepting any of those as the final answer.

Glossary
- API: a way for one program to ask another for data, usually over the web, returning structured results such as JSON.
- Authentication: proving who you are, typically by logging in, so the server can decide what you may access.
- Authorised: officially allowed to do something.
- Boolean: a value that is either true or false.
- Burp: a tool that captures and lets you edit the requests your browser sends to a website.
- Cast: a request to convert a value from one type to another, such as text to a number.
- Column: one field in a table, like the Title field in a spreadsheet.
- Column count mismatch: an error saying two combined queries returned different numbers of columns.
- Concatenation: joining two pieces of text end to end.
- Cross-dataset: reaching from one dataset to another.
- Dataset: one table or collection of data on a data portal.
- Dollar-quoting: a PostgreSQL way of marking text so special characters inside it are ignored.
- Endpoint: a specific address on a server that accepts requests.
- Enumeration loop: a program that tries one name after another automatically.
- Error channel: using error messages as a way to carry data out of a system.
- Exploit: the action that turns a vulnerability into real impact.
- Extraction: pulling data out of a database through an injection.
- Federation: one installation of a platform talking to another.
- Fingerprint: working out what software and version a target runs.
- Function whitelist: a list of commands that are allowed, with everything else refused.
- HTTP 200: the status code for a successful request.
- HTTP 403: the status code for forbidden, meaning access was refused.
- Identifier: the name of something, such as a dataset.
- Injection: a vulnerability where user input is treated as instructions instead of data.
- JSON: a text format for structured data, made of labelled values in curly brackets.
- Nuclei: a scanner that runs ready-made checks, called templates, against a target.
- Open source: publishing code so anyone can read and use it.
- Parameter: a named value in a request, often after a
?in the address. - Parser: the part of software that reads text and works out its structure.
- Payload: the malicious input an attacker sends.
- PostgreSQL: a widely used open-source database.
- Query coordinator: the part of the system that plans and runs queries.
- Redirect: when one address forwards to another.
- Sanitisation: cleaning user input so it cannot be mistaken for instructions.
- Schema: the list of columns and their types in a dataset.
- Scraping: automatically collecting information from pages.
- Socrata: a product used by governments and cities to run open data portals.
- SODA API: Socrata's API for querying its datasets.
- SoQL: Socrata's own query language, translated to SQL on the backend.
- SQL: the standard language for querying relational databases.
- sqlmap: a well-known tool for automating SQL injection.
- Token: a single meaningful word or symbol in a query.
- Typechecker: the part of a query language that checks whether operations make sense for the types involved.
- UNION: a command that combines the results of two queries into one list.
- Vulnerability: a weakness in software that an attacker can use.
- Whitelist: a list of things that are allowed.