Re: When a service really starts

From: Sean Hederman (usemy_at_blogentry.com)
Date: 03/06/05


Date: Sun, 6 Mar 2005 10:09:51 +0200


"Bruce Parker" <bparkerhsd@nospam.nospam> wrote in message
news:A2E2B5D1-684D-4655-B586-F41587FB34E7@microsoft.com...
> Does this mean if I put the code in the constructor to change the logon
> credentials it is too late?

Yes, the process has already been started with the credentials entered in
the Service Management Tool. You could stop your service starting if the
credentials do not match. Another possible solution would be to impersonate
the required user.

Finally, you could change the service credentials, and then kick off a
process that will restart the service. Needless to say this process would
require pretty high privileges.

> In addition, this is not a security hole. A network administrator
> provides
> this information via another secured application which is required by our
> software. The service obtains this information from the secured
> application.
> Without going into details, it becomes a security risk if the logon
> credentials does not match the one the network administrator provides in
> the
> other application.

Any time you're passing logon information around it presents another attack
surface for your app. Obviously if your solution requires this there's not a
helluva lot you can do about it though. If it was acceptable to have your
service fail to start up if it didn't have the required credentials, then
you could connect to the secured admin app, and check what credentials you
required, compare them with the credentials you have, and exit if you don't
have enough. The security hole comes in when the secured admin app stores
and transmits the logon details (namely the password) to your application.

> I need a definitive answer on this question.
>
> "Sean Hederman" wrote:
>
>> "Bruce Parker" <bparkerhsd@nospam.nospam> wrote in message
>> news:F531A640-B232-45C7-95F3-E7876A1DD714@microsoft.com...
>> >I have written a .NET Service. In the OnStart method, I am setting the
>> > Services user name and password. Has the service already obtained this
>> > information at this point and is using the existing information? Is
>> > this
>> > the
>> > right place to do this in the service's code?
>>
>> Yes, the Service Controller starts your process up with the credentials
>> indicated. You don't have to change anything as far as that is concerned.
>> In
>> fact I would consider it a pretty serious security hole to have a service
>> change it's own logon credentials.
>>
>>
>>



Relevant Pages

  • Re: Remote User Needs to Change PWD without connecting to domain
    ... credentials to log on and eventually the password expired. ... > I think you are misinterpreting the "10 logon" settings. ... > Settings, Security Settings, Local Policy, Security Options). ... >> account (note: this should only be temporary as this presents a security ...
    (microsoft.public.win2000.security)
  • Re: Cant use WM6 to access network shares
    ... unfortunately nothing in any of the event logs. ... the logon prompt. ... So for whatever reason it's just not passing my credentials ... Can get to about any other share on the network. ...
    (microsoft.public.pocketpc.wireless)
  • Re: Change local password for domain account while disconnected
    ... control -alt -delete and then try to unlock it with new credentials. ... The Microsoft VPN client ... also has an option to logon to the domain in it's properties which may be ... > She then VPN's into the corporate network but the corporate VPN ...
    (microsoft.public.security)
  • Re: Does the ability to use cached logon expire?
    ... >> credentials, they need to log on to the Domain to reset it. ... > Microsoft Windows 2000 Security Hardening Guide ... > Disable Caching of Logon Information ... > how many user account entries Windows 2000 saves in the logon cache ...
    (microsoft.public.windowsxp.security_admin)
  • Re: LogOnUser with Smart Card Credentials
    ... from the Windows logon dialog and serves our application only). ... call LogonUser with the credentials provided in the dialog. ... The card needs to be present to verify the PIN and also to obtain a token. ...
    (microsoft.public.platformsdk.security)

Loading