> For the complete documentation index, see [llms.txt](https://www.udayxd.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.udayxd.tech/notes/windows/service-permissions.md).

# Service Permissions

* Service permissions are critical part of Windows operating systems, and weak permissions may serve as potential threat vectors leading to execution of malicious executable or DLLs, privilege escalation etc.
* Most Services in Windows run with the LocalSystem privileges which is the highest level of access on an individual Windows OS.

### **Examining Services using sc**

The `sc qc` The command is used to query the service. If we wanted to query a service on a device over the network, we could specify the hostname or IP address immediately after `sc`.

```powershell
sc qc <service name> #queries service on the local machine

sc //hostname or ip of box query <ServiceName> # queries  service on a remote machine
```

We can also use sc to start and stop services.

```powershell
sc stop <service name>
```

### **Examining S**ervice permissions using `sc`

```powershell
sc sdshow wuauserv
```

At an initial glance, the output looks crazy. will look like a random string; the output is displayed in **Security Descriptor Definition Language (SDDL)**.

* Every named object in Windows is securable object
* Securable objects are those that have a security descriptor associated with them
* Security Descriptors identify the owner's primary group containing Discretionary Access Control List (DACL) and System Access Control List (SACL)
* DACL is used for controlling access to an object, and a SACL is used to account for and log access attempts.

`D: (A;;CCLCSWRPLORC;;;AU)`

1. D: - the proceeding characters are DACL permissions
2. AU: - defines the security principal Authenticated Users
3. A;; - access is allowed
4. CC - SERVICE\_QUERY\_CONFIG is the full name, and it is a query to the service control manager (SCM) for the service configuration
5. LC - SERVICE\_QUERY\_STATUS is the full name, and it is a query to the service control manager (SCM) for the current status of the service
6. SW - SERVICE\_ENUMERATE\_DEPENDENTS is the full name, and it will enumerate a list of dependent services
7. RP - SERVICE\_START is the full name, and it will start the service
8. LO - SERVICE\_INTERROGATE is the full name, and it will query the service for its current status
9. RC - READ\_CONTROL is the full name, and it will query the security descriptor of the service

As we read the security descriptor, it can be easy to get lost in the seemingly random order of characters, but recall that we are essentially viewing access control entries in an access control list.

### **Examine service permissions using PowerShell**

Using the `Get-Acl` PowerShell cmdlet, we can examine service permissions by targeting the path of a specific service in the registry.

```powershell
Get-ACL <path to the service in the registry> | Format-List
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://www.udayxd.tech/notes/windows/service-permissions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
