【权限与会话】由appinfo谈谈UAC级别

概述:学习 appinfo 的时候看到了相关的设定,由此记录以及说明一下 ConsentPromptBehaviorAdminConsentPromptBehaviorUser 两个字段。

相关阅读:

0x01 前言

学习 UAC 避免不了 appinfo、consent、RPC 这三个关键点。当然,整个 UAC 的流程也不能只有这三点,还涉及到用户会话、安全策略、ACL、DACL、SACL等等概念。都是需要去了解和深入的。而安全策略我们都知道,有比较多的字段策略都是保存在注册表中的。这里就包括 用户账户控制:管理员批准模式中管理员的提升权限提示的行为

用户账户控制:管理员批准模式中管理员的提升权限提示的行为

0x02 UAC 提权中的处理

从何说起?就是UAC的提权过程中创建 consent 进程的时候。如下图所示,在 AiLaunchConstnUI 函数中,首先根据传入的 CreateFlags 来确定要检查的用户,这里分两种情况,一个管理员用户,一个普通用户。两个字段在注册表中的值所对应的策略和处理是一致的。如下所示,查询的注册表目录为 计算机\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

AiLaunchConesentUI

可以看到 ConsentPromptBehavior 策略值也是 UAC 提权中的一个判断点。接下来就 ConsentPromptBehavior 值描述一下。

0x03 ConsentPromptBehavior

ConsentPromptBehavior 值对应了五个级别,分别如下表所示:

Data: This MUST be a value in the following table.

Value Meaning
0x00000000 无提示提升: 允许有权限的帐户执行需要提升权限的操作,而无需同意或凭据。注意: 仅在大多数受限制的环境中使用该选项 This option allows the Consent Admin to perform an operation that requires elevation without consent or credentials.
0x00000001 当操作需要提升权限时,此选项会提示同意管理员输入其用户名和密码(或其他有效的管理员)。此操作在安全桌面上进行。 This option prompts the Consent Admin to enter his or her user name and password (or another valid admin) when an operation requires elevation of privilege. This operation occurs on the secure desktop.
0x00000002 此选项提示管理员在 "管理员审批模式 "下选择 "允许 "或 "拒绝 "需要提升权限的操作。如果同意管理员选择 “允许”,操作将以可用的最高权限继续进行。"提示同意 "消除了要求用户输入姓名和密码才能执行权限任务的不便。此操作在安全桌面上进行。 This option prompts the administrator in Admin Approval Mode to select either “Permit” or “Deny” an operation that requires elevation of privilege. If the Consent Admin selects Permit, the operation will continue with the highest available privilege. “Prompt for consent” removes the inconvenience of requiring that users enter their name and password to perform a privileged task. This operation occurs on the secure desktop.
0x00000003 当操作需要提升权限时,该选项会提示同意管理员输入其用户名和密码(或其他有效管理员的用户名和密码)。 This option prompts the Consent Admin to enter his or her user name and password (or that of another valid admin) when an operation requires elevation of privilege.
0x00000004 此选项提示管理员在 "管理员审批模式 "下选择 "允许 "或 "拒绝 "需要提升权限的操作。如果同意管理员选择 “允许”,操作将以可用的最高权限继续进行。"提示同意 "消除了要求用户输入姓名和密码才能执行权限任务的不便。 This prompts the administrator in Admin Approval Mode to select either “Permit” or “Deny” an operation that requires elevation of privilege. If the Consent Admin selects Permit, the operation will continue with the highest available privilege. “Prompt for consent” removes the inconvenience of requiring that users enter their name and password to perform a privileged task.
0x00000005 该选项为默认值。它用于在管理员审批模式下提示管理员选择 "允许 "或 "拒绝 "对任何非 Windows 二进制文件进行需要提升权限的操作。如果同意管理员选择 “允许”,操作将以最高可用权限继续进行。此操作将在安全桌面上进行。 This option is the default. It is used to prompt the administrator in Admin Approval Mode to select either “Permit” or “Deny” for an operation that requires elevation of privilege for any non-Windows binaries. If the Consent Admin selects Permit, the operation will continue with the highest available privilege. This operation will happen on the secure desktop.<8>

其中,0x0 所代表的限制最小,0x5 是默认级别。


【权限与会话】由appinfo谈谈UAC级别
https://hodlyounger.github.io/A_OS/Windows/权限与会话/【权限与会话】由appinfo谈谈UAC级别/
作者
mingming
发布于
2023年12月1日
许可协议