前瞻

关于net use和psexec无法使用本地管理员组用户建立连接的问题

测试环境:

win7系统,存在域环境
域名:de1ay
普通域用户: de1ay\de1ay
域管理员用户:de1ay\Administrator
本地管理员用户: de1ay

当我尝试使用域用户de1ay\de1ay和本地管理员组的用户de1ay使用psexec连接目标Windows服务器执行命令时返回了拒绝访问,并且在使用net use建立IPC连接的时候返回了Access Denied





唯一成功的是使用域管用户de1ay\Administrator成功获取到cmd

  1. net localgroup Administrators 查看本地管理员组,存在本地用户de1ay
  2. net user de1ay /domain 查看域用户de1ay
  3. net share 确定ADMIN$开启了共享

并且确定ADMIN$目录开启了共享



了解到Psexec是借助的IPC连接执行命令,那么尝试使用上面两组用户名进行IPC连接



只有域管用户成功建立了IPC连接,de1ay/de1ay全局组成员显示为Domain Users 普通的域成员,并非管理员,猜测是因为de1ay\de1ay是普通用户权限不足,所以无法建立连接。尝试将de1ay\de1ay加入到Domain Admins域管理员组。

  • net group "Domain Admins" de1ay /add /domain 在域控中执行,添加域管理员

再次尝试使用de1ay\de1ay用户连接,果然这次成功建立了对admin$目录的IPC连接



可成功使用Psexec弹回cmd



此时回到本地用户,在我修改了域控的密码复杂度等组策略并且在目标机器上启用了Administrator用户后发现使用目标机器本地的Administrator用户可以建立对admin$目录的IPC连接,而同为管理员组下的de1ay又是失败的。

既然域用户加入到管理员组后便可以成功建立IPC连接,为什么本地用户却又不行?

联想到微软 KB2871997 补丁使攻击者无法将哈希传递给非内置RID为500(Administrator)的管理用用户,猜测是否与补丁有关

但是通过查询补丁发现并没有安装KB2871997



而且网上也有一些即使未安装补丁也无法使用本地管理员组非RID500的用户进行哈希传递安装了补丁也可以使用RID非500的用户完成哈希传递的案例,那么除了补丁外,还有什么会对这些行为造成影响?

这些问题的罪魁祸首是远程访问上下文中的用户帐户控制(UAC)令牌过滤

本地用户和域用户的访问控制

微软的 WindowsVistaUACDevReqs 文档中有如下描述:

  • User Account Control and Remote Scenarios:

    When an administrator logs on to a Windows Vista computer remotely, through Remote Desktop for instance, the user is logged on to the computer as a standard user by default. Remote administration has been modified to be restrictive over a network. This restriction helps prevent malicious software from performing application “loopbacks” if a user is running with an administrator access token.

  • Local User Accounts:

    When a user with an administrator account in a Windows Vista computer’s local Security Accounts Manager (SAM) database remotely connects to a Windows Vista computer, the user has no elevation potential on the remote computer and cannot perform administrative tasks. If the user wants to administer the workstation with a SAM account, the user must interactively logon to the computer that he/she wishes to administer.

  • Domain User Accounts:

    When a user with a domain user account logs on to a Windows Vista computer remotely, and the user is a member of the Administrators group, the domain user will run with a full administrator access token on the remote computer and UAC is disabled for the user on the remote computer for that session.

还有另一份 Description of User Account Control and remote restrictions in Windows Vista 中的描述

  • Local user accounts (Security Account Manager user account):

    When a user who is a member of the local administrators group on the target remote computer establishes a remote administrative connection by using the net use * \remotecomputer\Share$ command, for example, they will not connect as a full administrator. The user has no elevation potential on the remote computer, and the user cannot perform administrative tasks. If the user wants to administer the workstation with a Security Account Manager (SAM) account, the user must interactively log on to the computer that is to be administered with Remote Assistance or Remote Desktop, if these services are available.

  • Domain user accounts (Active Directory user account):

    A user who has a domain user account logs on remotely to a Windows Vista computer. And, the domain user is a member of the Administrators group. In this case, the domain user will run with a full administrator access token on the remote computer, and UAC will not be in effect.

    Note This behavior is not different from the behavior in Windows XP.

对于本地用户:

  • 当使用远程计算机上本地管理员组成员的用户通过net use \\remotecomputer\ 命令建立IPC连接的时候不会以完全管理权限的管理员身份连接,用户无法在远程计算机上提升自己的权限,并且无法执行管理任务,如果用户希望使用安全账户管理器(SAM)中的用户管理服务器,则必须通过远程桌面连接来登录

即使已启用远程管理,内置管理员帐户之外的本地管理员帐户也可能不具有远程管理服务器的权限。 必须将远程用户帐户控制(UAC) LocalAccountTokenFilterPolicy注册表设置配置为允许除内置管理员帐户之外的管理员组的本地帐户远程管理服务器。

如果目标服务器未加入域,请启用以下注册表设置:

HKLM\SOFTWARE\Microsoft\Windows\Currentversion\system\LocalAccountTokenFilterPolicy\策略。

在不对系统设置进行更改的情况下,除默认的本地管理员账户(Administrators)外无法使用其他本地管理员账户完成远程管理。

对于域用户(ACTIVE DIRECTORY 账户):

  • 大致是说:如果你的计算机是域中的一部分,使用管理员组中的用户连接远程计算机,此时UAC 访问令牌过滤器不会生效,不要使用本地的、非域内用户的账户连接远程计算机,即使该用户属于管理员组
  • 当使用域用户(并且该域用户属于管理员组)远程登录到计算机时,该用户会拥有完整的管理员权限,并且UAC会在该会话期间被禁用

以上便解释了为什么本地管理账户在利用IPC远程访问时会失败,但是域管理员账户可以成功。

Windows已经普遍默认禁用了Administrator用户,并且在域环境下,由于域控端设置的密码安全策略,会因为默认的空密码不满足域内密码安全策略中的密码最小长度导致无法在域机器中启用该账户,除非在域控机器上主动修改域内的密码安全策略,在官方文档中已经有了解决方法,通过修改注册表来解除对非默认管理员账户的限制.

在注册表中新建如下项:

Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
Value: LocalAccountTokenFilterPolicy
Data: 1 (to disable, 0 enables filtering)
Type: REG_DWORD (32-bit)



建立完成后再次测试,本地管理员用户de1ay成功建立IPC连接,并且Psexec执行成功。



至此问题已经解决,总结如下:

  • 默认情况下,只有使用域管理员(归属于Domain Admins组)用户,可以直接进行连接,但本地管理员组中除Administrator用户外无法进行连接;
  • 添加HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\LocalAccountTokenFilterPolicy之后,rid非500的本地管理员账户可以进行连接(不影响本地和域的普通用户),并且可以进行哈希传递攻击,在此情况下KB2871997补丁将不会有实际作用
用户(组) 添加注册表前 添加注册表后
本地管理员(非Administrator) 无权限 有权限
Administrator 有权限 有权限
域管理员 有权限 有权限
普通域用户 无权限 无权限
普通用户 无权限 无权限

参考文章:https://ares-x.com/2020/03/10/关于IPC和PTH用户权限问题/

关于IPC和PTH用户权限问题,psexec拒绝访问(Access Denied)的原因的更多相关文章

  1. Mysql创建新用户后无法登录,提示 Access denied for user 'username'@'localhost' (using password: YES)

    MySQL创建新用户后无法登录,提示 Access denied for user 'username'@'localhost' (using password: YES) ,多半是因为存在匿名用户, ...

  2. IIS教程:因权限问题被拒绝访问的解决方案

    https://blog.csdn.net/a497785609/article/details/49952281 写了一个类IISAdmin,负责建立.设置.删除虚拟目录,发现在web中调用,遇到权 ...

  3. jenkins 设置权限后管理员登陆提示:Access Denied admin没有Overall/Read权限

    jenkins 设置权限后,管理员登陆提示:Access Denied  admin没有Overall/Read权限 处理办法: window下编辑 xml 配置文件: %userprofile%\. ...

  4. [mysql]root用户登录mysql,输入密码后报错:Access denied for user 'root'@'localhost'

    问题如下: wangju-G4:~$ mysql -u root -p Enter password: ERROR (): Access denied for user 'root'@'localho ...

  5. 开始VS 2012中LightSwitch系列的第5部分:我可以使用用户权限来控制访问权吗?

    [原文发表地址]  Beginning LightSwitch in VS 2012 Part 5: May I? Controlling Access with User Permissions [ ...

  6. sharepoint:拥有完全控制权限的用户依然“拒绝访问”

    //来源 http://www.cnblogs.com/jindahao/archive/2012/04/25/2468714.html 遇到问题: 拥有完全控制权限的用户依然拒绝访问. 可能的原因: ...

  7. 对于出现拒绝访问root用户的解决方案

    提示:ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'   由于使用mysql -u root ...

  8. Oracle 表空间和用户权限管理

    一. 表空间 Oracle数据库包含逻辑结构和物理结构. 数据库的物理结构指的是构成数据库的一组操作系统文件. 数据库的逻辑结构是指描述数据组织方式的一组逻辑概念以及它们之间的关系. 表空间是数据库逻 ...

  9. [Django]用户权限学习系列之权限管理界面实现

    本系列前三章: http://www.cnblogs.com/CQ-LQJ/p/5604331.htmlPermission权限基本操作指令 http://www.cnblogs.com/CQ-LQJ ...

随机推荐

  1. 什么时候使用session?什么时候使用application?

    application:程序全局变量对象,对每个用户每个页面都有效session:用户全局变量,对于该用户的所有操作过程都有效

  2. RENIX非对称时延测试——网络测试仪实操

    本文主要介绍RENIX软件如何进行非对称时延测试.文章分为四部分,第一部分为非对称时延概述,第二部分为测试说明,第三部分为测试配置,第四部分为测试报告. 第一部分:非对称时延概述 1.RFC2544测 ...

  3. MySQL索引如何优化?二十条铁则

    索引的相信大家都听说过,但是真正会用的又有几人?平时工作中写SQL真的会考虑到这条SQL如何能够用上索引,如何能够提升执行效率?  前言 索引的相信大家都听说过,但是真正会用的又有几人?平时工作中写S ...

  4. python中PIL库的使用

    API参考 打开dos窗口,安装库: pip install pillow 很明显,图片有点大,咱们缩略一下: from PIL import Image im = Image.open(" ...

  5. 你不需要基于 CSS Grid 的栅格布局系统

    在过去的几个星期里,我开始看到基于 CSS Grid 的布局框架和栅格系统的出现.我们惊讶它为什么出现的这么晚.但除了使用 CSS Grid 栅格化布局,我至今还没有看到任何框架能提供其他有价值的东西 ...

  6. 解决Mui中popover 顶部弹出菜单弹出位置不准确以及无法收回的问题

    前言 最近公司的项目转向使用Hbuilder开发移动端项目,其中想要通过在顶部标题栏加入弹出菜单的方式,来定位长列表的位置,如图所示. 问题 Mui的功能貌似还不是很完善,在使用这个弹出菜单的时候,发 ...

  7. 前端面试题整理——手写AJAX

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. pydev+eclipse写python代码

    首先,下载pydev:PyDev for Eclipse - Browse /pydev at SourceForge.net (建议下载到本地,之前看其他文章时,进行了如下安装: 启动 Eclips ...

  9. python中faker模块的使用

    Faker 安装 pip install Faker 基本使用 from faker import Faker #创建对象,默认生成的数据为为英文,使用zh_CN指定为中文 fake = Faker( ...

  10. 注册中心Eureka的简单使用

    不讲原理,只讲简单使用 微服务,一般是父子工程,可以直接在父工程下新建个模块来用来启动Eureka 1.创建Eureka模块 2.引入依赖 <dependency> <groupId ...