Skip to content
RCE Disclosed report Beginner

Remote Code Execution at http://tw.corp.ubnt.com

A directory listing exposed sensitive files on an internal-looking host, and one exposed endpoint that converted plaintext passwords into NT and LM hashes was vulnerable to command injection. An attacker could run commands on the server through that endpoint.

hassham Follow

Originally disclosed on HackerOne

Critical View original
  • Triaged in 21 hours
  • Fixed in 50 days
  • Paid in 3 days
  • Disclosed after 2 months

Summary by the program

The researcher found a Command Injection in tw.corp.ubnt.com.

Summary by the researcher

While hunting i came across a host of Ubiquiti Networks tw.corp.ubnt.com , when i browsed to http://tw.corp.ubnt.com there was Dir listing enabled which contained various sensitive information. This was reported to Ubiquiti Team.

However I decided to look further in the Directories and files which were being leaked, and came across an endpoint /tools/ntpasswd.php . This endpoint had functionality of allowing users for converting clear text passwords into NT and LM hashes.

After simple fuzzing it was discovered that the end point is vulnerable to Command Injection bug and was reported to Ubiquiti team.

PS: One of the simplest bug found.

The original report as published on HackerOne, by hassham. 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 is a Ubiquiti Networks host, [redacted].ubnt.com. The researcher reached it over plain HTTP at http://[redacted].ubnt.com and found directory listing enabled, exposing directories and files that should not have been browsable. That exposure was reported to the Ubiquiti team on its own.

Rather than stopping there, the researcher went through the leaked directories and files and found an endpoint at /tools/ntpasswd.php. According to the report, its purpose was to let users convert clear text passwords into NT and LM hashes.

Simple fuzzing of that endpoint showed it was vulnerable to command injection. The researcher reported this second issue to Ubiquiti as well, and the report closes with the remark that it was "One of the simplest bug found."

The report does not include the fuzzing payload, the request that triggered the injection, the server response, or any version or configuration detail. It also gives no bounty amount and no description of the fix. The platform records the weakness as command injection and the severity as critical, disclosed on 29 November 2017.

Root cause

The report does not describe the code behind /tools/ntpasswd.php, so the exact mistake is not stated. What it implies is the usual pattern for this bug class: a password-conversion tool that takes user input and passes it to a shell or to an external program, without separating the data from the command. Because the endpoint's job is to transform a supplied string into NT and LM hashes, the input plausibly reaches a command line or a helper binary. That is a likely explanation, not something the report confirms.

Impact

The report's own claim is limited to command injection on the endpoint. In general, command injection on a web server means commands run with the privileges of the web server process. The report does not demonstrate any of this. The report does not demonstrate any of this, and it does not say what the injected command did or what output came back. The platform records the severity as critical; the report itself documents no exploitation chain.

The directory listing is a separate exposure: it let the researcher enumerate files and directories, which is how the endpoint was found in the first place. The report does not list which files were leaked.

How this kind of bug works

Command injection happens when an application builds a command string from untrusted input and hands it to a shell. The shell does not know which part of the string was meant as data; it parses the whole thing, so characters that have meaning to the shell (command separators, subshell syntax, redirection, variable expansion, backticks) end the intended command and start a new one. The same applies when input is passed to interpreters such as eval-style constructs or to programs that themselves invoke a shell.

The bug is common wherever a feature wraps a command line tool: file conversion, image processing, archive handling, DNS lookups, ping and traceroute utilities, password and hash tools, PDF and document generation. It also appears when arguments are concatenated rather than passed as an argument vector, because even without shell metacharacters an argument beginning with a dash can be reinterpreted as an option.

Defences work at three levels. First, avoid the shell entirely: use APIs or libraries that do the job in-process, or pass arguments as a list to an exec-style call that does not invoke a shell. Second, validate input strictly against an allowlist of the characters and format the feature actually needs. Third, run the component with the least privilege and in a sandbox so that a successful injection has limited reach. Output encoding is not a defence here; the problem is on the command side, not the HTML side.

How to test for it

  1. Map features that plausibly shell out. Look for parameters whose names suggest a host, a filename, a format, a template, a hash type or a conversion, and for endpoints under paths such as /tools/, /cgi-bin/, /admin/ or anything with a .php, .cgi or .pl extension.
  2. Establish a baseline. Send a normal value and record the response body, status code, headers and timing.
  3. Probe with harmless metacharacters. Send values containing shell separators, subshell syntax, backticks and redirection, and compare against the baseline. A positive result is a change in output, an error message from the shell or the wrapped program, a delay that matches a sleep-style payload, or an out-of-band interaction on a collaborator host you control.
  4. Confirm with a benign command whose output you can recognise, such as an identity or directory listing command, and check that the output appears in the response or in your out-of-band channel.
  5. Test blind paths too: time-based payloads and DNS or HTTP callbacks catch cases where output is never returned.

Common false positives: the application reflecting your input back in an error page without executing anything; a generic 500 caused by input validation rather than by a shell; timing noise that happens to resemble a delay; and WAF blocks that look like a change in behaviour. Repeat each probe several times and compare against a control request before concluding anything.

How it is fixed

The standard fix is to stop building command strings. Call the underlying functionality through a library or API, or pass arguments as a list to a non-shell exec call so that no parsing of metacharacters occurs. Where a shell is unavoidable, quote and escape arguments with a well-tested library for the target platform, and validate input against a strict allowlist of the expected format. Add least privilege for the service account and sandboxing for the component, remove the directory listing that exposed the endpoint, and add regression tests that send metacharacter payloads and assert they are treated as data.

Hunting notes

This bug class tends to hide in older internal or corporate-facing hosts, in tool pages that wrap system utilities, and in features added quickly for convenience. Directory listing, verbose errors, exposed backups and default pages are useful recon signals: they reveal endpoints that were never meant to be public. Once you have a candidate, fuzz the parameters methodically and keep a control request for comparison. A clear reproduction with a harmless proof beats a claim of full compromise.

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. 7 min read.

What happened, in plain words

This report is about a website run by Ubiquiti Networks at [redacted].ubnt.com. A security researcher was hunting and came across this host. When they opened http://[redacted].ubnt.com in a browser, the server showed a list of its folders and files instead of a normal web page. This is called directory listing: the server behaves like a filing cabinet with the doors open, letting anyone read the labels on every drawer. The researcher reported that exposure to Ubiquiti on its own.

Instead of stopping there, the researcher clicked through the leaked folders and files. That is how they found a page at /tools/ntpasswd.php. According to the report, this page let users convert a clear text password (a password as a person types it, like hunter2) into NT and LM hashes. A hash is a scrambled fingerprint of a password: the same password always produces the same fingerprint, but you cannot easily turn the fingerprint back into the password. Windows systems used these hashes to check logins without storing the real password. A tool that converts passwords to hashes is handy for administrators, but it also means the page takes text from whoever visits it and does something with it.

The researcher then did some fuzzing on that page. Fuzzing means sending lots of slightly odd inputs on purpose, the way you might jiggle a door handle and push a few wrong keys to see whether a lock is really locked. The result: the page was vulnerable to command injection. In plain terms, the page was vulnerable to command injection: text supplied to it could end up being run as an operating system command. If the visitor's text contains special characters that the command line treats as instructions, the page may end up running those instructions too, not just converting a password.

The researcher reported this second problem to Ubiquiti as well. The report ends with the remark that it was "One of the simplest bug found."

The report does not include the fuzzing payload, the request that triggered the injection, the server's response, or any version or configuration detail. It also gives no bounty amount and no description of the fix. The platform records the weakness as command injection and the severity as critical, disclosed on 29 November 2017.

In general, how this kind of bug works

Command injection happens when a program builds a command out of text supplied by a user and hands the whole string to a shell. The shell is the part of the operating system that reads typed commands and runs them. It does not know which words were meant as data and which as instructions; it reads the entire line the same way. So characters that have a special meaning to the shell, such as separators between commands, brackets for running a command inside a command, redirection signs, or backticks, can end the intended command and start a new one. It is like a form that asks for your name and then reads your answer out loud to a clerk: if you write "John, and also open the safe", the clerk may do both.

The bug is common wherever a feature wraps a command line tool: file conversion, image processing, archive handling, DNS lookups, ping and traceroute utilities, password and hash tools, PDF and document generation. It also appears when arguments are joined together as one string rather than passed as a list, because even without shell special characters an argument beginning with a dash can be read as an option.

Defences work at three levels. First, avoid the shell entirely: use a library or API that does the job inside the program, or pass arguments as a list to a call that does not invoke a shell. Second, check input strictly against an allowlist of the characters and format the feature actually needs. Third, run the component with the least privilege and in a sandbox, so that a successful injection has limited reach. Output encoding is not a defence here; the problem is on the command side, not the web page side.

How to test for it

  1. Map features that plausibly shell out. Look for parameters whose names suggest a host, a filename, a format, a template, a hash type or a conversion, and for pages under paths such as /tools/, /cgi-bin/, /admin/ or anything with a .php, .cgi or .pl extension.
  2. Establish a baseline. Send a normal value and record the response body, status code, headers and timing. This is your control, the "before" picture.
  3. Probe with harmless special characters. Send values containing shell separators, brackets, backticks and redirection, and compare against the baseline. A positive result is a change in output, an error message from the shell or the wrapped program, a delay that matches a sleep-style payload, or an out-of-band interaction on a server you control.
  4. Confirm with a benign command whose output you can recognise, such as an identity or directory listing command, and check that the output appears in the response or in your out-of-band channel.
  5. Test blind paths too: time-based payloads and DNS or HTTP callbacks catch cases where output is never returned.

Common false positives: the application reflecting your input back in an error page without executing anything; a generic 500 error caused by input validation rather than by a shell; timing noise that happens to resemble a delay; and firewall blocks that look like a change in behaviour. Repeat each probe several times and compare against a control request before concluding anything.

How it is fixed

The standard fix is to stop building command strings. Call the underlying functionality through a library or API, or pass arguments as a list to a non-shell call so that no special characters are parsed. Where a shell is unavoidable, quote and escape arguments with a well-tested library for the target platform, and check input against a strict allowlist of the expected format. Add least privilege for the service account and sandboxing for the component, remove the directory listing that exposed the page, and add regression tests that send special-character payloads and assert they are treated as data.

Hunting notes

This bug class tends to hide in older internal or corporate-facing hosts, in tool pages that wrap system utilities, and in features added quickly for convenience. Directory listing, verbose errors, exposed backups and default pages are useful recon signals: they reveal pages that were never meant to be public. Once you have a candidate, fuzz the parameters methodically and keep a control request for comparison. A clear reproduction with a harmless proof beats a claim of full compromise.

Glossary

  • Directory listing: a web server setting that shows the contents of a folder as a list of links instead of a normal page.
  • Endpoint: a specific address on a website that does something, such as a page or a script.
  • Clear text password: a password in its ordinary readable form, not scrambled.
  • Hash: a fixed-length scrambled fingerprint of some input; the same input always gives the same hash, but the hash cannot easily be reversed.
  • NT and LM hashes: password hash formats used by older Windows systems to check logins.
  • Fuzzing: sending many unusual or malformed inputs to a feature to see how it reacts and whether it breaks.
  • Shell: the part of an operating system that reads commands and runs them.
  • Payload: the specific input an attacker sends to trigger a vulnerability.
  • Baseline: a normal request and its response, kept for comparison against test requests.
  • Control request: a request with ordinary input, used to tell a real change from normal variation.
  • Out-of-band interaction: a signal, such as a DNS or HTTP request, that reaches a server you control, proving code ran even when the response shows nothing.
  • False positive: a result that looks like a vulnerability but is not one.
  • WAF: web application firewall, a filter that blocks suspicious requests.
  • Least privilege: running a program with only the permissions it needs, so damage from a bug is limited.
  • Sandbox: an isolated environment that limits what a program can reach.
  • Allowlist: a list of inputs that are explicitly permitted, with everything else rejected.
  • Output encoding: converting characters so a browser displays them as text rather than treating them as code; it does not stop command injection.
  • Recon: short for reconnaissance, the information-gathering phase of a security test.
  • Regression test: an automated test that checks a fixed bug stays fixed.

More by hassham

View all

3 more disclosed reports, best first.

More from Ubiquiti Inc.

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.