> For the complete documentation index, see [llms.txt](https://dmcxblue.gitbook.io/red-team-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dmcxblue.gitbook.io/red-team-notes/persistence/new-service.md).

# New Service

When operating systems boot up, they can start programs or applications called services that perform background systems funcionts. A service's configuration information, including the file path to the service's executable, is stored in the Windows Registry.

Adversaries may install a new service that can be configured to execute at startup by using utilities to interact with services or by directly modifying the Registry. The service name may be disguised by using a name form a related operating system or benign software with Masquerading. Services may be created with administrator privileges but are executed under SYSTEM privileges, so an adversary may also use service to escalate privileges from administrator to SYSTEM. Adversaries may also directly start services through Service Execution.

Services in Windows environment can lead to privilege escalation if these are not configured properly or can be used as a persistence method. Creating a new service requires Administrator level privileges and it is not considered the stealthier of persistence techniques. However in red team operations against companies that are less mature towards threat detection can be used to create further noise and build SOC capability to identify threats that are using basic techniques in their malware.

In the following example I will use CMD to create a new service with Administrator privileges and connect back to my attacking machine using the nc.exe binary

```
sc create redteam binpath= "PATH TO BINARY" start="auto" obj="LocalSystem"
```

**Make sure there is a empty space between (= ")**

![](/files/-LyRMI5_mI9kycA7XCVo)

For this technique is reliable and simple to understand and create as a one-line command will create you a reverse shell by manually inserting the commands this can also be done with other incredible tools such as Powershell, PowerSploit, Empire, Metasploit and many other's.

References:

{% embed url="<https://pentestlab.blog/2019/10/07/persistence-new-service/>" %}


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://dmcxblue.gitbook.io/red-team-notes/persistence/new-service.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
