Skip to content
SQL injection Disclosed report Advanced

Blind User-Agent SQL Injection to Blind Remote OS Command Execution at █████████

A login form on a Sony website was vulnerable to blind SQL injection. The researcher enabled xp_cmdshell and ran system commands, exfiltrating output via DNS.

echidonut Follow

Originally disclosed on HackerOne

Critical 9.1 View original
  • Triaged in 42 hours
  • Fixed in 13 days
  • Disclosed after 10 months

Summary by the program

The researcher reported that a login form of a Sony website was vulnerable to a blind SQL injection. The researcher was able to use the blind SQL injection to enable xp_cmdshell functionality on the database and then run system commands. The output from the system commands was then obtained via DNS-based exfiltration.

Summary by the researcher

https://infosecwriteups.com/how-i-escalated-a-time-based-sql-injection-to-rce-bbf0d68cb398

The original report as published on HackerOne, by echidonut. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 5 min read.

What the report shows

The target was a login form on a Sony website. The researcher found that it was vulnerable to a blind SQL injection, and then used that injection to escalate all the way to running operating system commands on the database server.

The chain, as the program's summary describes it, ran in three stages:

  1. A blind SQL injection was identified in the login form.
  2. The injection was used to enable xp_cmdshell on the database.
  3. System commands were executed through it, and their output was retrieved by DNS-based exfiltration.

The report itself is very short: the researcher's own summary is a single link to an external write-up, and the program's summary is a few sentences. No HTTP requests, payloads, parameter names, headers, versions or command lines appear in the disclosed text, so there is nothing to reproduce here verbatim. What the report does establish is the shape of the attack: a time-based blind injection (the linked write-up's title refers to a time-based SQL injection) against a login form, escalated through a database feature that shells out to the operating system, with a DNS channel used to get data back out.

The platform records the report as critical severity with a CVSS score of 9.1, classified as OS command injection, disclosed on 6 July 2022. The report does not state a bounty amount or describe the remediation that was applied.

Root cause

The report does not describe the root cause beyond a blind SQL injection in the login form. Because the injection was blind, the application did not return query results or errors that would reveal data directly; the researcher had to infer information from timing behaviour.

The escalation depended on the database allowing xp_cmdshell to be enabled and used. A least-privilege database account, or a server where that feature is disabled and cannot be re-enabled by the application's account, would have stopped the chain at the database layer.

Impact

According to the report, the attacker could run system commands on the database server. The DNS-based exfiltration shows that command output was retrieved over DNS.

How this kind of bug works

SQL injection happens when an application builds a query by joining strings, and part of those strings comes from the user. If the input is not separated from the query structure, the parser cannot tell data from syntax, and the attacker can change what the query does.

Blind variants occur when the application does not echo query results. Two common channels are used to extract information anyway:

  • Boolean-based: the attacker asks a true/false question in the query and watches for a difference in the response, such as content length or a different page.
  • Time-based: the attacker makes the database wait conditionally, for example with a sleep function, and measures response time. A slow response means the condition was true.

Escalation to the operating system depends on database features. In SQL Server, xp_cmdshell runs a command through the OS and returns its output as rows. It is disabled by default in modern versions and requires sysadmin-level permission to enable, so an injection alone is not enough.

DNS exfiltration is a way to get data out when the attacker cannot read responses directly. The database or host is made to resolve a hostname that encodes the data, and the attacker watches the DNS queries arriving at a domain they control. It works because DNS is often allowed outbound even when other traffic is filtered.

Defences are layered: parameterised queries or prepared statements remove the injection itself; least-privilege database accounts and disabled dangerous features such as xp_cmdshell limit what an injection can reach; and egress filtering, including DNS, limits exfiltration.

How to test for it

  1. Identify every input that reaches the database: login forms, search boxes, filters, sort parameters, and hidden fields. Login forms are interesting because they often run a query before any session exists.
  2. Send a single quote or a syntactically invalid value and look for errors, changed responses or delays. Do this on one parameter at a time.
  3. If the response does not change visibly, test blind. Send a condition that should be true and one that should be false, and compare response bodies, status codes, lengths and timing. For time-based testing, use a database-specific delay function and repeat the request several times to establish a baseline, because network jitter produces false positives.
  4. Confirm with a second, independent technique before reporting: a different delay value, a different boolean condition, or a comparison against a control request with the same length.
  5. Once confirmed, establish what the database account can do. Check the database version and current user, and whether dangerous features such as xp_cmdshell are available. Do not run destructive commands; a harmless command that proves execution is enough.

Common false positives include slow endpoints that are slow regardless of input, caching or rate limiting that changes response times, WAF pages that appear only for certain payloads, and differences caused by the payload length rather than its SQL meaning. Always compare against a control request.

How it is fixed

  • Use parameterised queries or prepared statements for every query, including login checks.
  • Apply least privilege to the database account used by the application: no sysadmin, no rights to enable xp_cmdshell or other dangerous features.
  • Disable xp_cmdshell and similar OS-interaction features at the server level, and restrict who can re-enable them.
  • Return generic error messages and avoid exposing database errors to users.
  • Filter and monitor outbound traffic, including DNS, from database and application servers.
  • Add input validation as defence in depth, not as the primary fix.

Hunting notes

Injection points cluster in older code paths: login and password-reset forms, search and reporting features, sort and filter parameters, and anything that builds dynamic SQL. Login forms are worth attention because they are reachable without authentication and often sit on legacy stacks.

Recon signals include database error pages, stack traces, response times that vary with input, and technology fingerprints pointing to SQL Server, where xp_cmdshell escalation is a known path. Parameters that accept structured input, such as sort direction or column names, are frequently concatenated rather than parameterised.

To get a report accepted, demonstrate the injection with a reproducible request and a control, then show the concrete consequence: data you should not see, or command execution proven with a harmless command. Keep evidence minimal and avoid touching real user data. If you reach command execution, stop at proof and report promptly, since the impact is high.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 5 min read.

What happened, in plain words

A Sony website had a login form: the page where you type a username and password to get into an account. A security researcher found that this form had a serious flaw. The form was vulnerable to a blind SQL injection, so specially crafted input could change what the database did.

A database is the program behind a website that stores and looks up information, a bit like a filing cabinet with a very fast librarian. Normally the website asks the librarian a fixed question, for example "is there a user with this name and this password?". Because the form did not separate the user's text from the question, the researcher could add extra instructions of their own to that question.

The flaw was a blind SQL injection. SQL is the language used to talk to the database, and injection means slipping your own SQL into someone else's query. "Blind" means the website does not show you the database's answer directly: no results, no error messages. The researcher had to work out what was happening indirectly, by observing how the site behaved. The linked write-up's title describes it as a time-based SQL injection, meaning the researcher made the database pause on purpose and measured how long the page took to respond.

From that starting point the researcher escalated the attack in three stages, as the program's summary describes:

  1. A blind SQL injection was identified in the login form.
  2. The injection was used to enable xp_cmdshell on the database.
  3. System commands were executed through it, and their output was retrieved by DNS-based exfiltration.

xp_cmdshell is a database feature that runs operating system commands. It lets the database run commands on the operating system underneath it, the same way you might type a command into a terminal. It is normally switched off, and turning it on requires high-level database permissions. The researcher managed to switch it on through the injection.

Once commands could run, the next problem was getting the results back. If the website does not show you anything, how do you read the output of a command? The answer was DNS-based exfiltration. DNS is the internet's address book: when a computer needs to reach a name like example.com, it asks a DNS server to translate that name into a numeric address. The researcher made the database server look up names that had the command output hidden inside them, and watched those lookups arrive at a domain they controlled. DNS traffic is often allowed out of a network even when other traffic is blocked, which is why it makes a useful secret channel.

The platform records the report as critical severity with a CVSS score of 9.1, classified as OS command injection, disclosed on 6 July 2022. CVSS is a standard scoring system for how bad a vulnerability is, from 0 to 10. The report does not state a bounty amount or describe how the issue was fixed.

The disclosed text is short: the researcher's own summary is a single link to an external write-up, and the program's summary is a few sentences. It contains no HTTP requests, payloads, parameter names, headers, versions or command lines, so there is nothing to reproduce here.

In general, how this kind of bug works

SQL injection happens when a website builds a database query by gluing text together, and part of that text comes from the user. Imagine a form letter where someone fills in a blank, but instead of a name they write a whole new paragraph that changes the letter's meaning. The database cannot tell the user's data from the query's instructions, so the user's input becomes instructions.

Blind variants occur when the site does not show query results. Two common ways to extract information anyway are:

  • Boolean-based: the attacker asks a true/false question inside the query and watches for any difference in the response, such as a different page or a different length.
  • Time-based: the attacker makes the database wait only if a condition is true, then measures the response time. A slow reply means the condition held. This is the technique the linked write-up's title refers to.

Escalation to the operating system depends on database features. xp_cmdshell runs a command through the operating system and returns its output. It is disabled by default in modern versions and needs sysadmin-level permission to enable, so an injection alone is not enough.

DNS exfiltration gets data out when responses cannot be read directly. The database or host is made to look up a hostname that encodes the data, and the attacker watches the DNS queries arriving at a domain they control.

Defences are layered. Parameterised queries, also called prepared statements, keep user input separate from the query structure and remove the injection itself. Least-privilege database accounts and disabled dangerous features such as xp_cmdshell limit what an injection can reach. Egress filtering, including DNS, limits exfiltration.

Glossary

  • SQL: the language used to ask questions of and give instructions to a database.
  • SQL injection: slipping extra SQL into a query because user input is mixed with the query's instructions.
  • Blind SQL injection: an injection where the site shows no query results or errors, so information must be inferred indirectly.
  • Time-based injection: a blind technique that makes the database pause conditionally and measures response time.
  • Boolean-based injection: a blind technique that asks true/false questions and watches for any difference in the response.
  • Database: the program behind a website that stores and looks up information.
  • Login form: the page where a user types credentials to access an account.
  • xp_cmdshell: a database feature that runs operating system commands.
  • xp_cmdshell: a SQL Server feature that runs operating system commands from the database.
  • Operating system command: an instruction given to the computer's underlying system, as typed in a terminal.
  • Escalation: turning a smaller flaw into a bigger one, here from injection to command execution.
  • DNS: the internet's address book, translating names into numeric addresses.
  • DNS-based exfiltration: hiding stolen data inside DNS lookups to a domain the attacker controls.
  • Egress filtering: controlling what traffic is allowed to leave a network.
  • Parameterised query / prepared statement: a way of building queries that keeps user input separate from the query structure.
  • Least privilege: giving an account only the permissions it actually needs.
  • Sysadmin: the highest level of database permission.
  • CVSS: a standard 0 to 10 score for the severity of a vulnerability.
  • Critical severity: the highest severity band in a vulnerability rating scheme.

More by echidonut

View all

1 more disclosed report, best first.

More from Sony

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.