ATT&CK -

admin 2024年4月15日01:44:30评论7 views字数 2012阅读6分42秒阅读模式

PowerShell配置文件

在某些情况下,攻击者可以通过滥用PowerShell(T1086)配置文件来获得持久性和提升特权。PowerShell配置文件(profile.ps1)是一个在PowerShell启动时运行的脚本,可以用作登录脚本来自定义用户环境。PowerShell根据用户或主机程序支持多个配置文件。例如,PowerShell主机程序(例如PowerShell控制台,PowerShell ISE或Visual Studio Code)可以有不同的配置文件。管理员还可以配置一个配置文件,该配置文件适用于本地计算机上的所有用户和主机程序。

攻击者可能会修改这些配置文件,以包括任意命令,功能,模块和/或PowerShell驱动器来获得持久性。每次用户打开PowerShell会话时,除非启动该-NoProfile标志,否则将执行修改后的脚本。

如果PowerShell概要文件中的脚本由具有较高特权的帐户(例如域管理员)加载并执行,则对手也可能能够提升特权。

标签

ID编号: T1504

策略: 持久性,特权升级

平台: Windows

所需权限: user,administrator

数据源: 进程监视,文件监视,PowerShell日志

程序示例

名称 描述
Turla(G0010 Turla(G0010)使用PowerShell配置文件来维护受感染计算机的持久性。
Name Description
Turla(G0010 Turla(G0010) has used PowerShell profiles to maintain persistence on an infected machine.[2]

缓解措施

缓解 描述
代码签名(M1045) 强制执行仅签名的PowerShell脚本。对配置文件进行签名,以免对其进行修改。
限制文件和目录权限(M1022) 使PowerShell配置文件不可变且只能由某些管理员更改将限制对手轻松创建用户级持久性的能力。
软件配置(M1054) 如果不需要,请避免使用PowerShell配置文件。-No Profile远程执行PowerShell脚本时,请使用带有标志,以防止执行本地配置文件和脚本。
Mitigation Description
Code Signing (M1045) Enforce execution of only signed PowerShell scripts. Sign profiles to avoid them from being modified.
Restrict File and Directory Permissions (M1022) Making PowerShell profiles immutable and only changeable by certain administrators will limit the ability for adversaries to easily create user level persistence.
Software Configuration (M1054) Avoid PowerShell profiles if not needed. Use the -No Profile flag with when executing PowerShell scripts remotely to prevent local profiles and scripts from being executed.

检测

profile.ps1应该监视可以存储的位置是否有新的配置文件或修改。配置文件位置示例包括:

  • $PsHome\Profile.ps1
  • $PsHome\Microsoft._profile.ps1
  • $Home\My Documents\PowerShell\Profile.ps1
  • $Home\My Documents\PowerShell\Microsoft._profile.ps1

监视异常的PowerShell命令,异常的PowerShell驱动器或模块加载和/或未知程序的执行。

Locations where profile.ps1 can be stored should be monitored for new profiles or modifications. Example profile locations include:

  • $PsHome\Profile.ps1
  • $PsHome\Microsoft._profile.ps1
  • $Home\My Documents\PowerShell\Profile.ps1
  • $Home\My Documents\PowerShell\Microsoft._profile.ps1

Monitor abnormal PowerShell commands, unusual loading of PowerShell drives or modules, and/or execution of unknown programs.

- 译者: 林妙倩、戴亦仑 . source:cve.scap.org.cn

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年4月15日01:44:30
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   ATT&CK -https://cn-sec.com/archives/2657985.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息