[EdgeSwitch] Web GUI command injection as root with Privilege-1 and Privilege-15 users
A CGI script in the EdgeSwitch web interface did not fully sanitise user input, allowing OS command injection. A logged-in operator with limited privileges could craft a specific HTTP request to escalate to root and become an administrator.
- Triaged in 5 days
- Fixed in 6 months
- Paid in 6 months
- Disclosed after 6 months
Summary by the program
The researcher found a privilege escalation in the EdgeSwitch prior to version 1.7.1, an CGI script don't fully sanitize the user input resulting in local commands execution, allowing an operator user (Privilege-1) to escalate privileges and became administrator (Privilege-15).
Summary by the researcher
OS command injection in the Web interface in Ubiquiti Networks EdgeSwitch prior to version 1.7.1 allows a limited privileges operator to escalate his privileges to root via crafting a specific HTTP request to a CGI script while logged in.
What the report shows
Ubiquiti's EdgeSwitch, a network switch product, exposes a web GUI. According to the program's summary, a CGI script behind that interface did not fully sanitise user input, which allowed local command execution. The researcher describes the issue as OS command injection in the web interface of EdgeSwitch prior to version 1.7.1, reachable by crafting a specific HTTP request to a CGI script while logged in.
The privilege angle is what makes the report interesting. EdgeSwitch distinguishes operator accounts (Privilege-1) from administrator accounts (Privilege-15). A user holding only the low-privilege operator role could send the crafted request and escalate to administrator, and the researcher's summary states the escalation reaches root. In other words, the web GUI gave a limited user a path to full control of the device.
The report is short and does not include the request itself, the name of the CGI script, the vulnerable parameter, or the exact payload. What it does give is the shape of the attack: an authenticated operator, one HTTP request to a CGI endpoint, and command execution that the researcher describes as reaching root.. The program's summary frames the same finding as a privilege escalation from Privilege-1 to Privilege-15, and the researcher frames it as escalation to root; both descriptions point at the same underlying flaw.
On outcome, the platform records the report as medium severity with a CVSS score of 6.8, weakness class command injection, disclosed on 21 July 2017. The affected range is EdgeSwitch prior to version 1.7.1. No bounty figure is given.
Root cause
The likely root cause is that a CGI script invoked by the web GUI passes user-controlled input into a shell without adequate sanitisation. The program's summary says the script "don't fully sanitise the user input", which implies some filtering exists but is incomplete, rather than none at all. Because the injected command reaches root, any command that slips through executes with the highest privileges available, and the web application's own role checks become irrelevant: the operator is authorised to reach the script, but the script then does more than the operator's role should allow.
Impact
An authenticated operator with the lowest privilege level could turn a legitimate web session into root-level command execution on the switch. On a network device that means control over configuration, and potentially over traffic and the management plane. The report does not enumerate specific post-exploitation steps, so the practical ceiling beyond "root on the device" is not documented here. The program rated it medium (6.8), which reflects that authentication as an operator is required before the injection can be reached.
How this kind of bug works
Command injection happens when an application builds a shell command from untrusted input and the input is not confined to data. Typical patterns are string concatenation into a command line, system()-style calls in CGI scripts, and shell wrappers around utilities such as ping, traceroute, backup or diagnostic tools. The shell treats metacharacters in the input as syntax: command separators, subshell markers, redirection, and so on. If the input reaches the shell unquoted or only partially filtered, the attacker appends their own command.
Filtering that blocks a few characters is a common but weak defence, because shells offer many ways to express the same operation, and because the input may pass through several layers (URL decoding, form parsing, the application's own validation) before it reaches the shell. The robust defences are to avoid the shell entirely (call the underlying API or library, or use argument-vector execution with no shell), to validate input against a strict allowlist of expected values, and to run the web component with the least privilege it needs so that a successful injection is contained.
How to test for it
- Map every feature in the GUI that causes the device to run a system operation: diagnostics, connectivity tests, configuration import and export, firmware handling, logging, user management.
- For each, capture the request and identify parameters that plausibly end up on a command line: hostnames, addresses, filenames, interface names, free-text fields.
- Send a benign value first and observe the response, so you know what normal output looks like.
- Then send values containing shell metacharacters, one class at a time, and compare responses, timing and status codes. A positive result is output from a command you did not ask the application to run, a delay that matches a sleep-style payload, or an out-of-band interaction (DNS or HTTP callback) triggered by the injected value.
- Repeat with encoding variants, since a filter may decode after checking.
- Test at the lowest privilege level available, because that is where the escalation argument is strongest.
Common false positives: reflected input that merely appears in the response without execution, error pages that echo the payload, timing noise mistaken for a delay, and callbacks caused by the application fetching a URL you supplied (SSRF) rather than by a shell. Confirm execution with a second, independent signal before reporting.
How it is fixed
Vendors fix this class by removing the shell from the path: replacing shell invocations with direct library calls or argument-vector execution, and validating input against a strict allowlist. Where a shell must remain, quoting and escaping are applied at the point of use, not earlier. Defence in depth includes running the web service as an unprivileged user, so that injection does not immediately yield root, and separating privileged operations behind a narrow, audited interface.
Hunting notes
This bug class hides in appliance and embedded-device web interfaces, where CGI scripts and shell wrappers are common, and in any feature that shells out to a system tool. Recon signals include CGI paths in URLs, parameters named after command-line flags, diagnostic pages, and firmware or backup features that handle filenames. Test with the lowest-privilege account you can obtain, and show impact by demonstrating that the injected command runs with more privilege than your account should have, ideally as root or as an administrator-equivalent context. A clear before-and-after of privilege level, plus the exact request, is what makes such a report convincing.
What happened, in plain words
Ubiquiti makes EdgeSwitch, a piece of networking equipment (a switch) that businesses use to connect computers and devices together. Like many such devices, it has a web interface: you open a browser, log in, and manage the device through pages. Behind those pages, small programs called CGI scripts do the actual work on the device.
According to the program's summary, one of those CGI scripts did not fully clean up ("sanitise") what the user typed in. The researcher describes the result as OS command injection in the web interface of EdgeSwitch before version 1.7.1, reachable by crafting a specific HTTP request to a CGI script while logged in.
To understand why that matters, you need two ideas. First, an HTTP request is simply the message your browser sends to a website when you click a link or submit a form: it asks the server to do something and carries your input along. Second, command injection is when an application takes your input and passes it to the operating system as if it were an instruction, so carefully chosen input makes the device run commands the application never intended.
The privilege angle is the heart of the report. EdgeSwitch separates accounts into roles: an operator (Privilege-1) has limited rights, while an administrator (Privilege-15) has full rights. A user holding only the low-privilege operator role could send the crafted request and escalate to administrator, and the researcher's summary states the escalation reaches root. Root is the all-powerful account on a Linux-style system; whoever has it controls everything on the machine. In other words, the web interface gave a limited user a path to full control of the device.
The report is short and does not include the request itself, the name of the CGI script, the vulnerable parameter, or the exact payload. What it does give is the shape of the attack: an authenticated operator, one HTTP request to a CGI endpoint, and command execution that the researcher describes as reaching root.. The program's summary frames the same finding as a privilege escalation from Privilege-1 to Privilege-15, and the researcher frames it as escalation to root; both descriptions point at the same underlying flaw.
On outcome, the platform records the report as medium severity with a CVSS score of 6.8, weakness class command injection, disclosed on 21 July 2017. CVSS is a standard scoring system for how serious a vulnerability is; 6.8 sits in the medium band. The affected range is EdgeSwitch prior to version 1.7.1. No bounty figure is given.
Root cause
The likely root cause is that a CGI script invoked by the web interface passes user-controlled input into a shell without adequate sanitisation. A shell is the program on a device that reads text commands and runs them. The program's summary says the script "don't fully sanitise the user input", which implies some filtering exists but is incomplete, rather than none at all. Because the injected command reaches root, any command that slips through executes with the highest privileges available, and the web application's own role checks become irrelevant: the operator is authorised to reach the script, but the script then does more than the operator's role should allow.
Impact
An authenticated operator with the lowest privilege level could turn a legitimate web session into root-level command execution on the switch. On a network device that means control over configuration, and potentially over traffic and the management plane. The report does not enumerate specific post-exploitation steps, so the practical ceiling beyond "root on the device" is not documented here. The program rated it medium (6.8), which reflects that authentication as an operator is required before the injection can be reached.
In general, how this kind of bug works
Command injection happens when an application builds a shell command from untrusted input and the input is not confined to data. A useful comparison: imagine a form that asks for a name and then tells a colleague "please file this under X". If you write "X, and also unlock the safe" as your name, a careless colleague might do both. The shell is that careless colleague.
Typical patterns are string concatenation into a command line, system()-style calls in CGI scripts, and shell wrappers around utilities such as ping, traceroute, backup or diagnostic tools. The shell treats metacharacters in the input as syntax: command separators, subshell markers, redirection, and so on. If the input reaches the shell unquoted or only partially filtered, the attacker appends their own command.
Filtering that blocks a few characters is a common but weak defence, because shells offer many ways to express the same operation, and because the input may pass through several layers (URL decoding, form parsing, the application's own validation) before it reaches the shell. The robust defences are to avoid the shell entirely (call the underlying API or library, or use argument-vector execution with no shell), to validate input against a strict allowlist of expected values, and to run the web component with the least privilege it needs so that a successful injection is contained.
In general, how to test for it
- Map every feature in the interface that causes the device to run a system operation: diagnostics, connectivity tests, configuration import and export, firmware handling, logging, user management.
- For each, capture the request and identify parameters that plausibly end up on a command line: hostnames, addresses, filenames, interface names, free-text fields.
- Send a benign value first and observe the response, so you know what normal output looks like.
- Then send values containing shell metacharacters, one class at a time, and compare responses, timing and status codes. A positive result is output from a command you did not ask the application to run, a delay that matches a sleep-style payload, or an out-of-band interaction (DNS or HTTP callback) triggered by the injected value.
- Repeat with encoding variants, since a filter may decode after checking.
- Test at the lowest privilege level available, because that is where the escalation argument is strongest.
Common false positives: reflected input that merely appears in the response without execution, error pages that echo the payload, timing noise mistaken for a delay, and callbacks caused by the application fetching a URL you supplied (SSRF) rather than by a shell. Confirm execution with a second, independent signal before reporting.
In general, how it is fixed
Vendors fix this class by removing the shell from the path: replacing shell invocations with direct library calls or argument-vector execution, and validating input against a strict allowlist. Where a shell must remain, quoting and escaping are applied at the point of use, not earlier. Defence in depth includes running the web service as an unprivileged user, so that injection does not immediately yield root, and separating privileged operations behind a narrow, audited interface.
In general, where to look
This bug class hides in appliance and embedded-device web interfaces, where CGI scripts and shell wrappers are common, and in any feature that shells out to a system tool. Recon signals include CGI paths in URLs, parameters named after command-line flags, diagnostic pages, and firmware or backup features that handle filenames. Test with the lowest-privilege account you can obtain, and show impact by demonstrating that the injected command runs with more privilege than your account should have, ideally as root or as an administrator-equivalent context. A clear before-and-after of privilege level, plus the exact request, is what makes such a report convincing.
Glossary
- EdgeSwitch: a network switch product made by Ubiquiti, managed through a web interface.
- Web GUI: a graphical user interface you use through a browser rather than a command line.
- CGI script: a small program on a web server that runs when a particular page or form is used, and produces the response.
- HTTP request: the message a browser sends to a server asking it to do something, carrying any input you supplied.
- Sanitise: clean up user input so it cannot be interpreted as anything other than plain data.
- Command injection: a flaw where user input is passed to the operating system as a command, letting an attacker run their own commands.
- OS command: an instruction given to the device's operating system, such as running a program.
- Privilege: the level of access an account has; higher privilege means more allowed actions.
- Privilege-1 / Privilege-15: EdgeSwitch's labels for its operator (limited) and administrator (full) roles.
- Privilege escalation: gaining a higher level of access than your account was granted.
- Root: the most powerful account on a Linux-style system, able to do anything on the device.
- Shell: the program that reads text commands and executes them.
- Metacharacter: a character with special meaning to the shell, such as a separator or redirection symbol.
- Allowlist: a list of values that are explicitly permitted, with everything else rejected.
- Least privilege: running a component with only the access it actually needs, so a compromise is contained.
- CVSS: a standard scoring system for the severity of a vulnerability.
- SSRF: server-side request forgery, where the server is tricked into making a request to a location you choose.
- False positive: a test result that looks like a vulnerability but is not one.