|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-02-27 03:51 UTC] louis at steelbytes dot com
Description: ------------ php-cgi.exe (and I guess other php .exe's) should have a UAC manifest stating "asInvoker" Reproduce code: --------------- n/a Expected result: ---------------- n/a Actual result: -------------- n/a PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 12:00:01 2025 UTC |
Hi, php.exe, php-cgi.exe etc. of PHP 7.0.6 currently have the following manifest: <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> <application> <!-- Windows Vista --> <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS> <!-- Windows 7 --> <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS> <!-- Windows 8 --> <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS> <!-- Windows 8.1 --> <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS> <!-- Windows 10 --> <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS> </application> </compatibility> </assembly> As the OP noted, this manifest misses a <requestedExecutionLevel level="asInvoker" uiAccess="false" /> element that a application normally should have. Without this element, Windows (since Vista) enables file/registry virtualization because it thinks this is an old application that is not aware of the limited permissions that a non-admin user has. Note however that this only applies to 32-bit executables, not to 64-bit ones. For example, if you rename "php.exe" to "phpsetup.exe", you will get an UAC icon and if you try to run it, the UAC dialog appears to elevate the process. This is because without the entry, Windows has to guess e.g. by the filename if the EXE is a Setup program that needs administrative rights. Also, if you write a file to "C:\Program Files\myfile.txt" when running php.exe non-elevated, it will succeed, but the file is actually written to "C:\Users\<Username>\AppData\Local\VirtualStore\Program Files\myfile.txt". When adding the <requestedExecutionLevel>, trying to write a file in that location would correctly fail instead of being redirected (and renaming php.exe to phpsetup.exe would not display an UAC icon). Ideally, php.exe and php-cgi.exe's manifest should look like this (the <compatibility> is needed for correctly detecting the Windows version with APIs like GetVersionEx() since Windows 8.1): <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> <security> <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> <requestedExecutionLevel level="asInvoker" uiAccess="false" /> </requestedPrivileges> </security> </trustInfo> <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> <application> <!-- Windows Vista --> <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS> <!-- Windows 7 --> <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"></supportedOS> <!-- Windows 8 --> <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS> <!-- Windows 8.1 --> <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"></supportedOS> <!-- Windows 10 --> <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"></supportedOS> </application> </compatibility> </assembly> "asInvoker" means that the application doesn't need to be elevated. Thanks!