> For the complete documentation index, see [llms.txt](https://windows.dfirhandbook.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://windows.dfirhandbook.com/windows-artifacts/account-usage/rouge-local-accounts.md).

# Rouge Local Accounts

1. **Manual Creation:**
   * **Control Panel:** Using 'User Accounts' in the Control Panel.
   * **Computer Management:** Under 'Local Users and Groups', new users can be added, groups can be managed, and user properties can be edited.
2. **Command Line:**
   * **`net user` Command:** For creating users and setting properties.
     * Example: `net user [username] [password] /add` to create a new user.
3. **PowerShell:**
   * **`New-LocalUser` Cmdlet:** Creates a new local user account.
     * Example: `New-LocalUser -Name "username" -Password (ConvertTo-SecureString "password" -AsPlainText -Force) -FullName "User Name" -Description "Description"`
4. **Group Policy:**
   * For domain environments, group policies can be used to manage user accounts across multiple systems.

**Querying User Accounts on a Host**

1. **Command Line Tools:**
   * **`net user`**&#x20;
     * Lists all user accounts on a local machine or domain controller.
   * **`wmic useraccount`**&#x20;
     * Provides detailed information about user accounts.
2. **PowerShell:**
   * **`Get-LocalUser`**&#x20;
     * Retrieves local user accounts.
   * **Custom Scripts:** Can be written to query specific account properties or filter results.
3. **Windows Management Instrumentation (WMI):**
   * Allows querying of user accounts and their properties through WMI queries.

**Expanded Technical Explanations**

1. **System Logs Analysis:**
   * **Event IDs:** Look for Event IDs 4720 (account creation), 4722 (account enabled), and 4732 (added to group).
   * **Log Source:** Primarily found in Security logs of Windows Event Viewer.
2. **Identifying Unauthorized Accounts:**
   * **Account Properties:** Analyze properties like creation date, last login date, group memberships, and whether the account is active or disabled.
   * **Baseline Comparison:** Compare current user accounts against a known good baseline of authorized accounts.

**Advanced Considerations**

* **Least Privilege Principle:** Regularly review and enforce least privilege access policies to minimize the impact of rogue accounts.
* **Anomalous Behavior Detection:** Implement systems to detect anomalous behaviors such as unusual login times or excessive privilege escalations.
* **Incident Response Drills:** Regularly conduct drills to ensure readiness for incidents involving rogue accounts.

**PowerShell Query**

```powershell
#PowerShell command to list all local users with their last login time
Get-LocalUser | Select-Object Name,Enabled,LastLogon | Format-Table -AutoSize
```


---

# 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://windows.dfirhandbook.com/windows-artifacts/account-usage/rouge-local-accounts.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.
