windows - 从临时文件夹运行签名和 RequireAdministrator 可执行文件?

标签 windows uac elevation windows-appcompat-platform

我将我的可执行文件显示为需要管理员:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> 

    <!-- Disable Windows Vista UAC compatability heuristics -->
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
            </requestedPrivileges>
        </security>
    </trustInfo> 
</assembly>

然后我对其进行了数字签名。

但是当我运行可执行文件时,我注意到一些奇怪的事情:Consent 对话框中可执行文件的名称从 PingWarning.exe 更改为 pinxxxx.tmp ;就好像制作了一个临时副本,并且正在运行:

alt text

我挖出 Process Montior,看看是否有人在我启动我的可执行文件时创建了一个 *.tmp 文件,并且有:

alt text

此特定 svchost 容器内的Application Information 服务有意将我的可执行文件复制到 Windows 临时文件夹,并征求用户“同意” “从那里;提供无效的文件名。

一旦获得同意,可执行文件将从其原始位置运行: link text

如果我不对文件进行数字签名,则该文件不会复制到临时文件夹:

alt text


所以我的问题是当我对显示为的可执行文件进行数字签名时,无效文件名出现在同意对话框中需要管理员

做什么?


更新:

我能找到的最接近解释的是Uninformed.org 🕗 :

Breaking the Broker

In the case of a launch request for a program requesting uiaccess, appinfo!RAiLaunchAdminProcess is called to service the request. The process is then verified to be within the (hardcoded) set of allowed directories by appinfo!AiCheckSecureApplicationDirectory. After validating that the program is being launched from within an allowed directory, control is eventually passed to appinfo!AiLaunchProcess which performs the remaining work necessary to service the launch request. At this point, due to the "secure" application directory requirement, it is not possible for a limited user (or a user running with low integrity, for that matter) to place a custom executable in any of the "secure" application directories.

提示是一些(未记录、未指定的)应用程序“允许”位于的硬编码路径。

另一个是用于请求 uiaccess 的程序。就我而言,我的原始 list 中没有 uiAccess="false"。但是更改 list 以包含无用户界面访问权限:

但这并没有解决原来的问题。


更新二:

来自 MSDN :

SendSAS function

Important Applications with the uiAccess flag set to true must be Authenticode signed to start properly. In addition, the application must reside in a protected location in the file system. Currently, there are the two allowable protected locations:

  • **\Program Files**
  • **\windows\system32**

这似乎支持了请求 uiAccess 的可执行文件必须位于允许位置的概念;除了我不要求 uiAccess。

最佳答案

我在未签名的应用程序中看到了同样的问题,特别是 NSIS 和 InnoSetup 安装程序(当 1gb+ 安装程序被复制到 %windir%\temp 然后由 consent.exe 扫描时有点问题)

NSIS 错误跟踪器有一个 entry关于它。当我调查此事时,我正在与某人@MS 联系,他们应该联系在 UAC 上工作的人,但没有任何结果。我从那次谈话中得到的唯一适用信息是这句话:

One friend in Windows had a vague recollection that this may have been a mitigation for a concern about file tampering while the trust dialog was being displayed

关于windows - 从临时文件夹运行签名和 RequireAdministrator 可执行文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2827266/

相关文章:

64 位 UAC 提升的 Delphi list

python - 光栅 : How to get elevation at lat/long using python?

Windows 10 信息亭模式,没有可用的应用程序

c++ - 在 Vista 上调用 CoCreateInstance 时是否可以降低权限级别?

delphi - 使用更新资源将 UAC list 文件附加到任何 PE

css - React Native 中的提升

c - “gnuplot”在 Visual Studio 中不起作用

linux - Endianness 是一种属性、硬件还是软件?

c# - 从 Windows 服务关闭显示

git status 仅在 "Run As Administrator"时正确,这是由于 Windows VirtualStore 导致的问题