Re: HOWTO Validate security privileges



ATS wrote:

We are writing an installer that installs a service, where the security of
the person running the installer and the security that the service will run
both must have the following privileges:


- Act as part of the operating system
- Create a token object
- Create global objects
- Create permanent shared objects
- Impersonate a client after authentication
- Log on as a batch job
- Log on as a service
- Log on locally
- Take ownership of files or other objects

- Possibly more over time.

What we want to do, is examine the user's account that is running the
installer and determine if they have these privileges themselves. Then, we
want to do the same thing to determine if the account to be used for the
service has those privileges as well.

Any ideas on how this can be done?

To find out the privileges of a user:
1) open LSA policy with LsaOpenPolicy;
2) translate the user name to the corresponding SID, if you don't know the SID already. You do it with LookupAccountName;
3) use LsaEnumerateAccountRights.


Note, however, that not all of the privileges listed may be available to a process running in the security context of this user. The process might have been stated using a so-called restricted token with certain privileges filtered out.

To find out which exactly privileges are associated with the currently running process, you need to open the user token with OpenProcessToken and query the list of privileges using GetTokenInformation with the TokenPrivileges flag. If you do this, keep in mind that some privileges (or, rather, "account rights" as they are called in the MSDN) translate to group SIDs rather than to privileges in the token. For example, "Log on locally" right, SE_INTERACTIVE_LOGON_NAME, controls whether the user can log on interactively. When the user does log on interactively, the well-known INTERACTIVE SID (S-1-5-4) is added to the group list in the token.

I suggest you take some time to read through access control documentation on MSDN, it has improved greatly over past few years and should answer most of your questions:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secauthz/security/access_control.asp


-- Alex Fedotov

.



Relevant Pages

  • Re: APACHE$PRIVILEDGED
    ... The primary security on OpenVMS and on most other multi-processing operating systems is implemented via the memory management system and via what VAX calls the change-mode routines, via the Alpha SRM PALcode change-mode equivalent, or via what the IA-32 and IA-32e architectures refer to as the call gate. ... With OpenVMS constructs including device drivers )and user-written system services (UWSS; also known as privileged shareable images), these constructs operate in inner processor modes. ... One of the more hazardous situations for system security is a mixed environment; where there are resources shared between trusted and untrusted environments. ... Not only will the operation that requires privileges now be permitted, but other and potentially unintended operations can also be permitted. ...
    (comp.os.vms)
  • [UNIX] Bugzilla Multiple Vulnerabilities (SQL Injections, Privileges Escalation, Information Leak)
    ... Get your security news from a reliable source. ... user may retain privileges that should have been removed, ... Reference: ... secure bug, you can access the summary of that bug even if you do not have ...
    (Securiteam)
  • Re: Happy 10 years of continuous virus free computing on OpenVMS alpha 7.1
    ... OpenVMS provides an inherent security advantage over all the other ... advantage of OpenVMS brings it much closer to such a goal than any OS ... attaining higher mode privileges or services for which a process was ... currently used University-level texts on OS Design. ...
    (comp.os.vms)
  • Re: Microsoft finally acknowledges the security drumbeats
    ... not part of the operating system. ... If the security problems go ... > IIS full administrator privileges. ... If processes like IIS running with admin priveleges is the ...
    (comp.security.unix)
  • Re: Microsoft finally acknowledges the security drumbeats
    ... not part of the operating system. ... If the security problems go ... > IIS full administrator privileges. ... If processes like IIS running with admin priveleges is the ...
    (comp.security.misc)