SSD Advisory – Synology Photo Station Unauthenticated Remote Code Execution

Credit to Author: SSD / Maor Schwartz| Date: Mon, 07 Aug 2017 05:23:22 +0000

Want to get paid for a vulnerability similar to this one?
Contact us at: sxsxdx@xbxexyxoxnxdxsxexcxuxrxixtxy.xcom

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:

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:

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:

6.7.1-3419 is version of Photo Station installed.

Proof of Concept

Print Friendly, PDF & Email

https://blogs.securiteam.com/index.php/feed