Bug #63527 [PATCH]: DCOM does not work with Username, Password parameter

From: Date: Fri, 10 Jul 2020 13:49:55 +0000
Subject: Bug #63527 [PATCH]: DCOM does not work with Username, Password parameter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227937@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63527&edit=1 ID: 63527 Patch added by: cmb@php.net Reported by: friedrich dot grosse at gmail dot com Summary: DCOM does not work with Username, Password parameter Status: Open Type: Bug Package: COM related Operating System: Windows Server 2008 R2 PHP Version: 5.4.8 Block user comment: N Private report: N New Comment: The following pull request has been associated: Patch Name: Fix #63527: DCOM does not work with Username, Password parameter On GitHub: https://github.com/php/php-src/pull/5835 Patch: https://github.com/php/php-src/pull/5835.patch Previous Comments: ------------------------------------------------------------------------ [2020-06-25 19:52:07] cmb@php.net FTR: <http://svn.php.net/viewvc?view=revision&revision=350083>. ------------------------------------------------------------------------ [2015-06-05 18:52:49] bradley at scrapcode dot com I can verify Friedrich's suggested fix is correct. (Changing -1 to user_name_len on line 131) ------------------------------------------------------------------------ [2012-11-15 13:17:03] friedrich dot grosse at gmail dot com Here are some information copied from the security event log of the target machine. Note that the username is just 'A' and not the wanted 'Admin': Subject: Security ID: NULL SID Account Name: - Account Domain: - Logon ID: 0x0 Logon Type: 3 Account For Which Logon Failed: Security ID: NULL SID Account Name: A Account Domain: Testdomain.com ------------------------------------------------------------------------ [2012-11-15 13:06:53] friedrich dot grosse at gmail dot com Description: ------------ I try to instantiate a DCOM object on a remote machine (Windows Server 2008 R2) in another domain using the Username and Password parameters of the COM class constructor [1] I did also figure out that there is a Domain parameter which is not mentioned in the manual at [1]. However I can not authenticate at the remote machine. The event log there indicates that only the first character of the Logon Accounts Username has been transmitted to the DCOM Server. The Domain parameter has been received completely. I am not familiar with PHP internals but I did a quick look in the source code and would guess that the issue can be traced back to [2]. The user_name and user_name_len are already parsed some lines above. Why is php_com_string_to_olestring called with a -1 as second parameter which leads to determining the length of the username again? Maybe giving user_name_len instead of -1 could fix this issue? [1] http://de1.php.net/manual/de/class.com.php [2] https://github.com/php/php-src/blob/master/ext/com_dotnet/com_com.c#L131 Test script: --------------- try { $DCOMserverInfo = array( 'Server' => "Server.com", 'Username' => "Admin", 'Domain' => "Testdomain.com", 'Password' => "password" ); /** You may change the COM module name to word.application or whatever COM enabled app is installed on the target machine. **/ $comObj = new COM("word.application", $DCOMserverInfo); echo "Everything works fine"; } catch (Exception $exception) { echo exception->getMessage(); } Expected result: ---------------- Everything works fine Actual result: -------------- Failed to create COM object `word.application': Access is denied. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63527&edit=1

« previous php.bugs (#227937) next »