“asInvoker”和“asInvoker”有什么区别?和“最高可用”执行水平?

发布于 2024-12-23 12:16:31 字数 247 浏览 3 评论 0原文

的区别是什么。

<requestedExecutionLevel  level="asInvoker" uiAccess="false" />

我一直想知道嵌入和

<requestedExecutionLevel  level="highestAvailable" uiAccess="false" />

应用程序清单中

I've been wondering what the difference between embedding

<requestedExecutionLevel  level="asInvoker" uiAccess="false" />

and

<requestedExecutionLevel  level="highestAvailable" uiAccess="false" />

in your application's manifest is.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

明明#如月 2024-12-30 12:16:31

这是 MSDN 上的描述

基本上,“asInvoker”将使用用户的默认安全设置。它被描述为“应用程序使用与父进程相同的访问令牌运行。”,这意味着相同的安全令牌用作调用进程,通常是桌面 shell(或启动它的进程,如果您启动来自另一个程序的应用程序)。

使用“highestAvailable”将导致应用程序使用用户可以获得的最高权限运行。例如,如果他们是管理员,他们将收到 UAC 提示,并且应用程序将以管理员权限运行。但是,如果他们是普通用户,他们将获得正常的安全设置等。

一般来说,除非您有特定原因请求更多权限,否则您将需要使用“asInvoker”。

This is described on MSDN:

Basically, "asInvoker" will use the user's default security settings. It's described as "The application runs with the same access token as the parent process.", which means the same security token is used as the calling process, which is typically the desktop shell (or the process that launches this, if you launch your app from another program).

Using "highestAvailable" will cause the application to run using the highest priveledges the user can obtain. If they're an administrator, for example, they'll get a UAC prompt and the app will run with admin rights. However, if they're a normal user, they'll get normal security settings, etc.

In general, you'll want to use "asInvoker" unless you have a specific reason to request more rights.

与酒说心事 2024-12-30 12:16:31

“最高可用”的一个很好的例子是备份操作员组的成员。

从 Windows Vista 开始,不仅仅是“管理员”被剥夺了权限并被授予分割令牌。系统会查看您是否:

  • 某些组的成员
  • 具有某些权限

因此,如果您是备份操作员组的成员,您的安全令牌将被过滤,就像过滤备份操作员组的成员一样。 strong>管理员组。

来自 MSDN 杂志文章

最低权限
教您的应用程序如何与 Windows Vista 用户帐户控制完美配合
作者:克里斯·科里奥

当用户登录到计算机时,UAC 开始工作。在交互式登录期间,本地安全机构 (LSA) 获取用户的凭据并执行初始登录,评估用户的令牌以查看其是否具有定义为提升的权限。如果LSA确定用户具有提升的权限,它将过滤该令牌,然后使用过滤后的令牌执行第二次登录。

 

用户帐户控制将以下组定义为具有提升的权限:

  • 内置管理员 (S-1-5-32-544)
  • 高级用户 (S-1-5-32-547)
  • 帐户操作员 (S-1-5-32-548)
  • 服务器操作员 (S-1-5-32-549)
  • 打印机操作员 (S-1-5-32-550)
  • 备份操作员 (S-1-5-32-551)
  • RAS 服务器组
  • 内置\Windows 2000 之前版本的兼容访问 (S-1-5-32-554)
  • 内置\网络配置运算符 (S-1-5-32-556)
  • 域管理员 (S-1-5-21-domain-512)
  • 域控制器 (S-1-5-21-domain-516)
  • 证书发布者 (S-1-5-21-domain-517)
  • 架构管理员 (S-1-5-21-root domain-518)
  • 企业管理员 (S-1-5-21-root domain-519)
  • 组策略管理员 (S-1-5-21-domain-520)

因此,如果 LSA 注意到用户的初始令牌中列出了任何这些组成员身份或权限,则将在交互式登录期间使用 CreateRestrictedToken API,完全特权令牌由LSA保存。这两个令牌是链接的,并且可以使用 GetTokenInformation API 与新的 TokenLinkedToken信息类型。但请注意,UAC 不会影响服务、网络或批量登录。

 

如果用户不属于上面列出的任何组,但具有某些权限,则将创建一个过滤令牌,并删除这些权限。有问题的权限是:

  • SeCreateTokenPrivilege - 用户权限:创建令牌对象。
  • SeTcbPrivilege - 用户权限:充当操作系统的一部分。
  • SeTakeOwnershipPrivilege - 用户权限:取得文件或其他对象的所有权。
  • SeBackupPrivilege - 用户权限:备份文件和目录。
  • SeRestorePrivilege - 用户权限:恢复文件和目录。
  • SeDebugPrivilege - 用户权限:调试程序。
  • SeImpersonatePrivilege - 用户权限:身份验证后模拟客户端。
  • SeRelabelPrivilege - 用户权限:修改对象标签。

如果我创建一个备份用户,我需要使用返回给我的备份相关权限来运行:

  • SeBackupPrivilege SeRestorePrivilege

这意味着我不需要(或希望)以成熟的管理员身份运行。我想以我的最高可用权限集运行。

这是 requestedExecutionLevel 的三个选项开始出现的地方:

  • asInvoker:应用程序将以与启动它的进程相同的权限运行。通过选择以管理员身份运行,可以将应用程序提升到更高的权限级别。

  • highestAvailable:应用程序将以它可以的最高权限级别运行。如果启动应用程序的用户是管理员组的成员,则此选项与 requireAdministrator 相同。如果最高可用权限级别高于打开进程的级别,系统将提示输入凭据。

  • requireAdministrator:应用程序将以管理员权限运行。启动应用程序的用户必须是管理员组的成员。如果打开进程未以管理权限运行,系统将提示输入凭据。

额外阅读

A good example of "highest available" is someone who is a member of the Backup Operators group.

Starting with Windows Vista, it is not just "Administrators" who are stripped of their privileges and given a split-token. The system looks to see if you are:

  • a member of certain groups
  • have certain privileges

So if you are a member of the Backup Operators groups, your security token is filtered exactly like it is for members of the Administrators group.

From MSDN Magazine article:

Least Privilege
Teach Your Apps To Play Nicely With Windows Vista User Account Control
by Chris Corio

UAC starts working when a user logs onto a machine. During an interactive logon, the Local Security Authority (LSA) takes the user's credentials and performs the initial logon, evaluating the user's token to see if it has what are defined as elevated privileges. If the LSA determines that the user has elevated privileges, it will filter this token and then perform a second logon with the filtered token.

User Account Control defines the following groups as having elevated privileges:

  • Built-In Administrators (S-1-5-32-544)
  • Power Users (S-1-5-32-547)
  • Account Operators (S-1-5-32-548)
  • Server Operators (S-1-5-32-549)
  • Printer Operators (S-1-5-32-550)
  • Backup Operators (S-1-5-32-551)
  • RAS Servers Group
  • BUILTIN\Pre-Windows 2000 Compatible Access (S-1-5-32-554)
  • BUILTIN\Network Configuration Operators (S-1-5-32-556)
  • Domain Admins (S-1-5-21-domain-512)
  • Domain Controllers (S-1-5-21-domain-516)
  • Cert Publishers (S-1-5-21-domain-517)
  • Schema Admins (S-1-5-21-root domain-518)
  • Enterprise Admins (S-1-5-21-root domain-519)
  • Group Policy Administrators (S-1-5-21-domain-520)

Therefore, if the LSA notices that any of those group memberships or privileges are listed in the user's initial token, a filtered token will be created during an interactive logon, using a version of the CreateRestrictedToken API, and the fully privileged token is saved by LSA. These two tokens are linked and the fully privileged token can be obtained from the filtered token using the Get­Token­Infor­mation API with the new TokenLinkedToken information type. Note, however, that UAC does not affect service, network, or batch logons.

If the user does not belong to any of the groups listed above but has certain privileges, a filtered token will be created with these privileges removed. The privileges in question are:

  • SeCreateTokenPriv­i­lege - User Right: Create a token object.
  • SeTcbPrivilege - User Right: Act as part of the operating system.
  • Se­Take­Owner­ship­Priv­ilege - User Right: Take ownership of files or other objects.
  • Se­Back­up­Priv­i­lege - User Right: Back up files and directories.
  • Se­Re­store­Privilege - User Right: Restore files and directories.
  • Se­De­bug­Priv­ilege - User Right: Debug programs.
  • Se­Im­personatePrivilege - User Right: Impersonate a client after authentication.
  • Se­Re­labelPrivilege - User Right: Modify an object label.

If i create a backup user, i need to run with my backup related privileges returned to me:

  • Se­Back­up­Priv­i­lege
  • SeRestorePrivilege

That means that i don't need (or want) to run as a full fledged Administrator. I want to run with my highest available set of permissions back.

This is where your three options for requestedExecutionLevel start to come out:

  • asInvoker: The application will run with the same permissions as the process that started it. The application can be elevated to a higher permission level by selecting Run as Administrator.

  • highestAvailable: The application will run with the highest permission level that it can. If the user who starts the application is a member of the Administrators group, this option is the same as requireAdministrator. If the highest available permission level is higher than the level of the opening process, the system will prompt for credentials.

  • requireAdministrator: The application will run with administrator permissions. The user who starts the application must be a member of the Administrators group. If the opening process is not running with administrative permissions, the system will prompt for credentials.

Bonus Reading

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文