Vulnerabilities > CVE-2017-2916 - Link Following vulnerability in Meetcircle Circle With Disney Firmware 2.0.1
Attack vector
NETWORK Attack complexity
LOW Privileges required
LOW Confidentiality impact
HIGH Integrity impact
HIGH Availability impact
HIGH Summary
An exploitable vulnerability exists in the /api/CONFIG/restore functionality of Circle with Disney running firmware 2.0.1. Specially crafted network packets can cause an arbitrary file to be overwritten. An attacker can send an HTTP request to trigger this vulnerability.
Vulnerable Configurations
Part | Description | Count |
---|---|---|
OS | 1 | |
Hardware | 1 |
Common Weakness Enumeration (CWE)
Common Attack Pattern Enumeration and Classification (CAPEC)
- Symlink Attack An attacker positions a symbolic link in such a manner that the targeted user or application accesses the link's endpoint, assuming that it is accessing a file with the link's name. The endpoint file may be either output or input. If the file is output, the result is that the endpoint is modified, instead of a file at the intended location. Modifications to the endpoint file may include appending, overwriting, corrupting, changing permissions, or other modifications. In some variants of this attack the attacker may be able to control the change to a file while in other cases they cannot. The former is especially damaging since the attacker may be able to grant themselves increased privileges or insert false information, but the latter can also be damaging as it can expose sensitive information or corrupt or destroy vital system or application files. Alternatively, the endpoint file may serve as input to the targeted application. This can be used to feed malformed input into the target or to cause the target to process different information, possibly allowing the attacker to control the actions of the target or to cause the target to expose information to the attacker. Moreover, the actions taken on the endpoint file are undertaken with the permissions of the targeted user or application, which may exceed the permissions that the attacker would normally have.
- Accessing, Modifying or Executing Executable Files An attack of this type exploits a system's configuration that allows an attacker to either directly access an executable file, for example through shell access; or in a possible worst case allows an attacker to upload a file and then execute it. Web servers, ftp servers, and message oriented middleware systems which have many integration points are particularly vulnerable, because both the programmers and the administrators must be in synch regarding the interfaces and the correct privileges for each interface.
- Leverage Executable Code in Non-Executable Files An attack of this type exploits a system's trust in configuration and resource files, when the executable loads the resource (such as an image file or configuration file) the attacker has modified the file to either execute malicious code directly or manipulate the target process (e.g. application server) to execute based on the malicious configuration parameters. Since systems are increasingly interrelated mashing up resources from local and remote sources the possibility of this attack occurring is high. The attack can be directed at a client system, such as causing buffer overrun through loading seemingly benign image files, as in Microsoft Security Bulletin MS04-028 where specially crafted JPEG files could cause a buffer overrun once loaded into the browser. Another example targets clients reading pdf files. In this case the attacker simply appends javascript to the end of a legitimate url for a pdf (http://www.gnucitizen.org/blog/danger-danger-danger/) http://path/to/pdf/file.pdf#whatever_name_you_want=javascript:your_code_here The client assumes that they are reading a pdf, but the attacker has modified the resource and loaded executable javascript into the client's browser process. The attack can also target server processes. The attacker edits the resource or configuration file, for example a web.xml file used to configure security permissions for a J2EE app server, adding role name "public" grants all users with the public role the ability to use the administration functionality. The server trusts its configuration file to be correct, but when they are manipulated, the attacker gains full control.
- Manipulating Input to File System Calls An attacker manipulates inputs to the target software which the target software passes to file system calls in the OS. The goal is to gain access to, and perhaps modify, areas of the file system that the target software did not intend to be accessible.
Seebug
bulletinFamily | exploit |
description | ### Summary An exploitable vulnerability exists in the /api/CONFIG/restore functionality of Circle with Disney running firmware 2.0.1. Specially crafted network packets can cause an arbitrary file to be overwritten. 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-59: Improper Link Resolution Before File Access ('Link Following') ### 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 can be performed using the command "/api/CONFIG/backup", which will return an encrypted archive. Encryption is performed using the `aescrypt` binary and the password used is the one extracted from the `appid` parameter of the API command. Before encryption, the backup binary is a gzipped tar archive with the following contents: ``` configure.xml backup.version photos/ photos/user.0.photo photos/user.1.photo ... ``` The archive contains a copy of "configure.xml", the "backup.version" file to ensure compatibility, and a "photos" directory containing profile's photos. Vulnerable code exists in the "/api/CONFIG/restore" command, which executes the script "/mnt/shares/usr/bin/scripts/restorebackup.sh". This command must be invoked using a POST request and needs 3 parameters: a valid token, an appid (decryption key) and the encrypted configuration binary. The handler in the apid binary will receive the restore request and call "restorebackup.sh": ``` /mnt/shares/usr/bin/scripts/restore_backup.sh /tmp/postfile.bin appid 66 ``` where "postfile.bin" is the encrypted binary and "appid" is taken from the request. Contents of "restore_backup.sh" are shown below: ``` #!/bin/sh if [ $# != 3 ] ; then echo "restore_backup.sh <filename> <password> <max profiles>" exit 1 fi CIRCLE_ROOT=`cat /tmp/CIRCLE_ROOT` CIRCLE_BASE=`cat /tmp/CIRCLE_BASE` #clear out any existing old backup files rm -rf $CIRCLE_ROOT/backup.tgz $CIRCLE_ROOT/backup/ /tmp/aescrypt -d -p $2 -o $CIRCLE_ROOT/backup.tgz $1 # [1] if [ ! -s $CIRCLE_ROOT/backup.tgz ] ; then echo "failed to decrypt backup" exit 1 fi mkdir -p $CIRCLE_ROOT/backup tar -C $CIRCLE_ROOT/backup/ -xzf $CIRCLE_ROOT/backup.tgz # [2] if [ ! -s $CIRCLE_ROOT/backup/configure.xml -o ! -d $CIRCLE_ROOT/backup/photos ] ; then echo "missing files in backup" rm -rf $CIRCLE_ROOT/backup.tgz $CIRCLE_ROOT/backup/ exit 1 fi check_failed=0 #check to make sure current version >= backup version if [ -s $CIRCLE_ROOT/backup/backup.version ] ; then v_current=`cat $CIRCLE_BASE/VERSION | cut -f 1 -d -` v_backup=`cat $CIRCLE_ROOT/backup/backup.version | cut -f 1 -d -` if [ "$v_current" \< "$v_backup" ] ; then echo "restore failed: current version less than backup version" check_failed=2 fi fi #check to make sure number of profiles <= max number of profiles num_profiles=`grep -o "<user pid=" $CIRCLE_ROOT/backup/configure.xml | wc -l` if [ $num_profiles -gt $3 ] ; then echo "restore failed: too many profiles in backup" check_failed=3 fi #simple checks on configure.xml grep -q "<config>" $CIRCLE_ROOT/backup/configure.xml || check_failed=1 grep -q "<wifi>" $CIRCLE_ROOT/backup/configure.xml || check_failed=1 grep -q "<overall>" $CIRCLE_ROOT/backup/configure.xml || check_failed=1 grep -q "<users>" $CIRCLE_ROOT/backup/configure.xml || check_failed=1 grep -q "<devices>" $CIRCLE_ROOT/backup/configure.xml || check_failed=1 grep -q "<contact>" $CIRCLE_ROOT/backup/configure.xml || check_failed=1 if [ $check_failed -gt 0 ] ; then echo "bad configuration file" rm -rf $CIRCLE_ROOT/backup.tgz $CIRCLE_ROOT/backup/ exit $check_failed fi #replace configure.xml and photos/ with backups cp -f $CIRCLE_ROOT/backup/configure.xml $CIRCLE_ROOT/configure.xml rm -rf $CIRCLE_ROOT/photos/ cp -rf $CIRCLE_ROOT/backup/photos/ $CIRCLE_ROOT/photos/ # [3] rm -rf $CIRCLE_ROOT/backup.tgz $CIRCLE_ROOT/backup/ #clear out old tracking files rm -rf $CIRCLE_ROOT/tracking/* echo "configuration restored from backup" exit 0 ``` Note that the value of "CIRCLE_ROOT" is "/mnt/shares/usr/bin/". At [1] the binary is decrypted and at [2] it's extracted in "/mnt/shares/usr/bin/backup". After a few checks files are copied from the temporary backup directory to their real destinations. In particular at [3] all the files contained in the "photos" directory will be copied to "/mnt/shares/usr/bin/photos". No restrictions are in place on the contents of the "photos" directory: an attacker may include a symbolic link to any file in the system which might cause future operations to have an unexpected behavior. Indeed, this would allow an attacker to overwrite any file in the system. Consider the following symbolic link is copied to "photos/": ``` user.123.photo -> /mnt/shares/usr/bin/scripts/check_system_time.sh ``` An attacker, using the API command "/api/UPDATE/users/user/photo" can overwrite the photo for user with pid 123, which will in turn overwrite the file "checksystemtime.sh" with arbitrary data. ### Timeline * 2017-08-29 - Vendor Disclosure * 2017-10-31 - Public Release |
id | SSV:96814 |
last seen | 2017-11-19 |
modified | 2017-11-08 |
published | 2017-11-08 |
reporter | Root |
source | https://www.seebug.org/vuldb/ssvid-96814 |
title | Circle with Disney Configuration Restore Photos File Overwrite Vulnerability(CVE-2017-2916) |
Talos
id | TALOS-2017-0423 |
last seen | 2019-05-29 |
published | 2017-10-31 |
reporter | Talos Intelligence |
source | http://www.talosintelligence.com/vulnerability_reports/TALOS-2017-0423 |
title | Circle with Disney Configuration Restore Photos File Overwrite Vulnerability |