Blind SQL injection at tsftp.informatica.com
The refresh_token parameter of a token endpoint was vulnerable to blind SQL injection, shown by a database delay command changing the response time. An attacker could use this to extract data, bypass authentication or possibly run code on the server.
- Triaged in 3 hours
- Fixed in 19 hours
- Disclosed after 41 hours
Summary by the program
Researcher identified a time based/blind SQL injection in an Informatica TSFTP website and responsibly disclosed via this report.
Informatica's incident response team engaged within minutes of the report being received, bringing the site offline for maintenance as the issue was resolved. Following resolution of the issue and confirmation from our security team the site was brought back online. Additionally web server access logs and database logs from before the issue existed were reviewed, showing the issue had not been exploited by any malicious attackers.
The report
The parameter refresh_token sent to the REST path /api/v1/token is vulnerable to blind SQL injection.
Compare the response time of these 2 requests:
$ time curl -X POST "https://tsftp.informatica.com/api/v1/token" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=refresh_token&refresh_token='; WAITFOR DELAY '0:0:1'--"
{"error":"invalid_grant"}curl -X POST "https://tsftp.informatica.com/api/v1/token" -H -H -d 0.02s user 0.01s system 1% cpu 2.048 total
vs
$ time curl -X POST "https://tsftp.informatica.com/api/v1/token" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=refresh_token&refresh_token='; WAITFOR DELAY '0:0:13'--"
{"error":"invalid_grant"}curl -X POST "https://tsftp.informatica.com/api/v1/token" -H -H -d 0.02s user 0.01s system 0% cpu 14.045 total
and notice that the WAITFOR DELAY command is executed.
Impact
Blind SQL injection can be exploited to exfiltrate data from the FTP server, bypass authentication or for remote code execution.
I stopped my testing at the time-based PoC because I didn't want to risk accessing sensitive data. If you would like to though, I can continue exploiting this vulnerability to present the above impact in practice, eg by getting the database version string.
Context
Informatica runs a site at tsftp.informatica.com, described in the report as an Informatica TSFTP website. The vulnerable feature is the token endpoint at the REST path /api/v1/token. That endpoint accepts form-encoded POST requests and, among other grant types, supports grant_type=refresh_token, where the client supplies a refresh_token value and receives a JSON response. On a failed refresh the endpoint returns {"error":"invalid_grant"}.
The report is a blind, time-based SQL injection in the refresh_token parameter of that endpoint. The program's summary states that the researcher identified the issue and disclosed it responsibly through the report, and that Informatica's incident response team engaged within minutes, took the site offline for maintenance while the issue was resolved, and brought it back online after the security team confirmed the fix. The program also reviewed web server access logs and database logs from before the issue existed and found that the issue had not been exploited by any malicious attackers.
Setup
The report does not describe any account, role, credential or registration step. The requests shown are POSTs to the token endpoint carrying only the standard form headers and a grant_type/refresh_token body. The only tooling visible is curl, invoked through the shell's time builtin so that the total request duration can be compared between payloads. No product version, database version or server software is given.
The test works because the endpoint processes the supplied refresh_token value in a way that lets the injected delay run, and the backend database supports a delay primitive. The payload used, WAITFOR DELAY, is a Microsoft SQL Server construct, which suggests the backend behaved like SQL Server, though the report does not state the database product.
Finding it
The researcher's observation is that the refresh_token parameter sent to /api/v1/token is vulnerable to blind SQL injection. The reasoning is the standard time-based one: if the value is concatenated into a query, a payload that asks the database to pause will make the HTTP response arrive later by roughly the requested amount, even though the application's own response body is unchanged. Because the endpoint returns the same {"error":"invalid_grant"} either way, the timing of the response is the only channel that carries the result.
Exploitation
Step 1: baseline with a one-second delay
The first request injects a one-second delay into refresh_token and measures the total time with time:
$ time curl -X POST "https://tsftp.informatica.com/api/v1/token" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=refresh_token&refresh_token='; WAITFOR DELAY '0:0:1'--"
{"error":"invalid_grant"}curl -X POST "https://tsftp.informatica.com/api/v1/token" -H -H -d 0.02s user 0.01s system 1% cpu 2.048 total
The payload is '; WAITFOR DELAY '0:0:1'--. The response body is the ordinary {"error":"invalid_grant"}, but the measured total is 2.048 seconds, which is consistent with the injected one-second wait on top of normal request handling.
Step 2: confirm with a longer delay
The second request repeats the test with a thirteen-second delay:
$ time curl -X POST "https://tsftp.informatica.com/api/v1/token" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=refresh_token&refresh_token='; WAITFOR DELAY '0:0:13'--"
{"error":"invalid_grant"}curl -X POST "https://tsftp.informatica.com/api/v1/token" -H -H -d 0.02s user 0.01s system 0% cpu 14.045 total
Here the payload is '; WAITFOR DELAY '0:0:13'--, identical apart from the delay value. The body is again {"error":"invalid_grant"}, and the total is 14.045 seconds. The total rose from 2.048 to 14.045 seconds when the delay value changed, and the researcher concluded that the WAITFOR DELAY command is executed. The researcher's conclusion is that the WAITFOR DELAY command is executed.
Step 3: stopping point
The researcher stopped at the time-based proof of concept, stating that continuing would risk accessing sensitive data. The report offers to go further, for example by retrieving the database version string, if the program wanted the impact demonstrated in practice, but no further requests are shown.
Root cause
The report does not include the application code or explain the mechanism; it only shows that the injected delay ran. The endpoint returned the same invalid_grant JSON in both requests, leaving response timing as the observable difference.
Impact
In the researcher's words, blind SQL injection can be exploited to exfiltrate data from the FTP server, bypass authentication, or for remote code execution. Those are the stated possibilities; the report does not demonstrate any of them, and the researcher deliberately stopped at the timing proof of concept to avoid touching sensitive data. The channel is blind and time-based, and the program's log review found no evidence that anyone had exploited the issue before it was fixed.
Fix
What is documented is the response: the site was taken offline for maintenance while the issue was resolved, and brought back online after the security team confirmed the fix.
Variants to test
Hunting notes
The researcher showed two requests with different delay values and an unchanged error body, and stopped at the time-based proof of concept. The program's log review showed no prior exploitation.
What happened, in plain words
Informatica runs a website at tsftp.informatica.com. The report calls it an Informatica TSFTP website. One part of that site is a web address, /api/v1/token, that programs send token requests to. A token is a short piece of text that proves who you are, a bit like the wristband you get at a festival: you show it at the gate and you get in without showing your ID again.
A security researcher found that this token address could be tricked into running database commands. The trick is called blind SQL injection. SQL is the language used to talk to databases, the big organised stores of information behind most websites. Injection means that something a visitor types is treated as part of that language instead of as plain text. Blind means the attacker never sees the database's answer directly; they have to work it out indirectly, here by watching how long the server takes to reply.
The researcher proved the problem with two carefully timed requests and then stopped, because going further would have meant touching real data. Informatica's incident response team reacted within minutes, took the site offline for maintenance, fixed the issue, and brought it back once their security team confirmed the fix. They also checked web server access logs and database logs from before the issue existed and found no sign that any malicious attacker had exploited it.
Context
The site and the feature
tsftp.informatica.com is the site named in the report. The report describes it as an Informatica TSFTP website. The part that matters here is the token endpoint, the web address /api/v1/token.
An endpoint is a specific address on a server that accepts a particular kind of request, like a service counter in a large building: the building is the website, the counter is the endpoint, and each counter deals with one kind of paperwork. An API, short for application programming interface, is the set of these counters that programs use to talk to each other, as opposed to the pages a person clicks through in a browser.
The endpoint accepts a grant_type value of refresh_token. The endpoint accepts POST requests, which are requests that carry data in their body, the way a form submission does. The data is form-encoded, meaning it is laid out as name=value pairs joined by &, exactly like the text a browser sends when you submit a web form.
The request uses grant_type=refresh_token. A grant type is simply a label saying which kind of permission slip you are presenting. With this one, the client sends a refresh_token value and gets back a JSON response. JSON is a plain text format for structured data, made of names and values in curly braces. When the refresh fails, the endpoint answers with:
{"error":"invalid_grant"}
That is a generic error message meaning the grant was not valid. It says nothing about why.
The vulnerability class
The report describes a blind, time-based SQL injection in the refresh_token parameter of that endpoint. A parameter is one of the named values in a request, here the refresh_token field in the form body.
To understand the class, picture a librarian who takes your written request slip and reads it out loud to a colleague in the back room. If you write a normal book title, all is well. If you write something that looks like an instruction to the colleague, such as "and also unlock the archive", the colleague may follow it, because nothing marks your words as just a title. SQL injection is that: user input placed into a database instruction without being clearly separated from it.
Time-based means the attacker does not read any data back. Instead they ask the database to pause for a chosen number of seconds and then measure how long the web response took. If the response arrives late by roughly the requested amount, the instruction ran. Blind means the attacker cannot see the result directly and must infer it from such side effects.
The program's response
The program's summary states that the researcher identified the issue and disclosed it responsibly through the report. Responsible disclosure means telling the owner privately and giving them time to fix it before saying anything publicly. Informatica's incident response team engaged within minutes of receiving the report and took the site offline for maintenance while the issue was resolved. After the security team confirmed the fix, the site was brought back online. The program also reviewed web server access logs and database logs from before the issue existed and found that the issue had not been exploited by any malicious attackers.
Setup
What you need
The report does not describe any account, role, credential or registration step. The requests shown are POSTs to the token endpoint; the report does not describe any account, credential or registration step. A session cookie is a small piece of data a browser stores after you log in so the site recognises you on the next page; none is used here.
The requests carry only the standard form headers and a body with grant_type and refresh_token. A header is an extra line of information attached to a request, such as what format the sender expects back. The only tooling visible is curl, a command-line program for sending web requests, invoked through the shell's time builtin. time is a small shell feature that reports how long the following command took. It is used here so the total duration of each request can be compared between payloads. A payload, in security testing, is the deliberately crafted input sent to probe for a weakness.
No product version, database version or server software is given in the report.
The precondition
For the test to work, two things must be true. First, the endpoint must process the supplied refresh_token value in a SQL query before rejecting it. Second, the backend database must support a delay primitive, that is, a command that makes it wait.
Finding it
The researcher's observation is that the refresh_token parameter sent to /api/v1/token is vulnerable to blind SQL injection.
The reasoning is the standard time-based one. If the value is concatenated into a query, meaning glued into the query text as-is, a payload that asks the database to pause will make the HTTP response arrive later by roughly the requested amount. The application's own response body stays the same. Because the endpoint returns the same {"error":"invalid_grant"} either way, the timing of the response is the only channel that carries the result. A channel here means the observable difference an attacker can measure.
Exploitation
Step 1: baseline with a one-second delay
The first request injects a one-second delay into refresh_token and measures the total time with time:
$ time curl -X POST "https://tsftp.informatica.com/api/v1/token" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=refresh_token&refresh_token='; WAITFOR DELAY '0:0:1'--"
{"error":"invalid_grant"}curl -X POST "https://tsftp.informatica.com/api/v1/token" -H -H -d 0.02s user 0.01s system 1% cpu 2.048 total
Line by line:
$ time curlruns thecurlprogram under the shell'stimebuiltin, so the shell prints a timing summary after the command finishes.-X POSTtellscurlto use the POST method, the method used to send data to a server."https://tsftp.informatica.com/api/v1/token"is the address being called, the token endpoint.-H "accept: application/json"adds a header saying the sender would like a JSON answer.-H "Content-Type: application/x-www-form-urlencoded"adds a header saying the body is form-encoded, thename=value&name=valuelayout.-d "grant_type=refresh_token&refresh_token='; WAITFOR DELAY '0:0:1'--"is the body. It setsgrant_typetorefresh_tokenand setsrefresh_tokento the payload.{"error":"invalid_grant"}is the response body, the ordinary error.0.02s user 0.01s system 1% cpu 2.048 totalis the timing summary. Thetotalfigure is the wall-clock duration, and it is 2.048 seconds, consistent with the injected one-second wait on top of normal request handling.
A string literal is text enclosed in quotes inside a SQL statement. Closing it early is what lets the rest of the input be read as SQL rather than as data.
Step 2: confirm with a longer delay
The second request repeats the test with a thirteen-second delay:
$ time curl -X POST "https://tsftp.informatica.com/api/v1/token" -H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=refresh_token&refresh_token='; WAITFOR DELAY '0:0:13'--"
{"error":"invalid_grant"}curl -X POST "https://tsftp.informatica.com/api/v1/token" -H -H -d 0.02s user 0.01s system 0% cpu 14.045 total
Line by line:
- The command is identical to the first one, so the method, address and headers are the same.
- The body differs only in the payload:
'; WAITFOR DELAY '0:0:13'--, with the delay value changed from one second to thirteen. - The response body is again
{"error":"invalid_grant"}. - The timing summary shows
14.045 total, so the total is 14.045 seconds.
The total rose from 2.048 to 14.045 seconds when the delay value changed, and the researcher concluded that the WAITFOR DELAY command is executed. Latency is the normal delay of a request travelling over the internet and being processed; it does not grow just because you changed a number in the input. The researcher's conclusion is that the WAITFOR DELAY command is executed.
Step 3: stopping point
The researcher stopped at the time-based proof of concept. A proof of concept is a minimal demonstration that a weakness is real, without going on to abuse it. The researcher stated that continuing would risk accessing sensitive data. The report offers to go further, for example by retrieving the database version string, if the program wanted the impact demonstrated in practice, but no further requests are shown.
Root cause
The report does not include the application code, so the mechanism is inferred from behaviour. The report does not include the application code or explain the mechanism; it only shows that the injected delay ran. Binding a parameter means handing the value to the database separately from the query text, so the database treats it purely as data and never as an instruction. Without that separation, the quote in the payload terminates the literal and the rest of the payload is parsed as SQL.
The endpoint returned the same invalid_grant JSON in both requests, leaving response timing as the observable difference. That leaves response timing as the only observable difference.
Impact
In the researcher's words, blind SQL injection can be exploited to exfiltrate data from the FTP server, bypass authentication, or for remote code execution. To exfiltrate data means to pull it out of the system. To bypass authentication means to get past the login check without valid credentials. Remote code execution means making the server run commands of the attacker's choosing.
Those are the stated possibilities. The report does not demonstrate any of them, and the researcher deliberately stopped at the timing proof of concept to avoid touching sensitive data. The channel is blind and time-based, so results are inferred from response timing. The program's log review found no evidence that anyone had exploited the issue before it was fixed.
Fix
What is documented is the response: the site was taken offline for maintenance while the issue was resolved, and brought back online after the security team confirmed the fix.
Variants to test
Hunting notes
The researcher showed two requests with different delay values and an unchanged error body, and stopped at the time-based proof of concept. The program's log review showed no prior exploitation.
Glossary
- API: the set of addresses and rules that programs use to talk to a service, as opposed to the pages a person clicks in a browser.
- Authentication: the process of proving who you are, usually with a password or token.
- Blind SQL injection: SQL injection where the attacker cannot see the database's answer and must infer it from side effects such as response timing.
- Boolean: a value that is either true or false.
- Bound parameter: a value handed to the database separately from the query text, so it is always treated as data and never as an instruction.
- Concatenation: gluing pieces of text together into one string, here building a query by joining user input to query text.
- Conditional sleep: a pause that only happens when a condition is true.
- Cookie: a small piece of data a browser stores for a site, often used to remember that you are logged in.
- curl: a command-line program for sending web requests.
- Endpoint: a specific address on a server that accepts a particular kind of request.
- Exfiltrate: to pull data out of a system without permission.
- Form-encoded: a body layout of
name=valuepairs joined by&, as sent by a web form. - Grant type: a label in an OAuth request saying which kind of permission slip is being presented.
- Header: an extra line of information attached to a web request or response.
- HTTP: the protocol browsers and servers use to exchange web requests and responses.
- Incident response team: the group in an organisation that handles security incidents.
- Injection: a weakness where user input is treated as part of a command or query instead of as plain data.
- Introspection: an OAuth endpoint that reports whether a token is valid and what it allows.
- JSON: a plain text format for structured data, made of names and values in curly braces.
- Latency: the normal delay of a request travelling over the internet and being processed.
- OAuth: a standard way for one program to get permission to act on your behalf without seeing your password.
- Opaque string: a value the server treats as a meaningless blob to look up rather than parsing into parts.
- Parameter: a named value in a request, such as a field in a form body.
- Payload: the deliberately crafted input sent to probe for a weakness.
- POST: the HTTP method used to send data to a server, as a form submission does.
- Proof of concept: a minimal demonstration that a weakness is real, without going on to abuse it.
- Recon: the early information-gathering stage of a security test.
- Refresh token: a longer-lived token used to obtain a new access token when the old one expires.
- Remote code execution: making a server run commands of the attacker's choosing.
- Responsible disclosure: telling the owner of a system privately about a weakness and giving them time to fix it before saying anything publicly.
- Revocation: an OAuth endpoint that cancels a token.
- Session: a period during which a site remembers who you are, usually via a cookie.
- SQL: the language used to talk to databases.
- SQL Server: Microsoft's database product, which supports the
WAITFOR DELAYcommand. - Stacked query: several SQL statements sent and run in one go, separated by semicolons.
- String literal: text enclosed in quotes inside a SQL statement.
- Time-based SQL injection: SQL injection detected by measuring how long the server takes to respond.
- Token: a short piece of text that proves who you are or what you are allowed to do.
- Unauthenticated: sent without any login, session or credential.
WAITFOR DELAY: a Microsoft SQL Server command that makes the database pause for a given time.