Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1336 CNY

100%

CVE-2025-10230 PoC — Samba: command injection in wins server hook script

Source
Associated Vulnerability
Title: Samba: command injection in wins server hook script (CVE-2025-10230)
Description:A flaw was found in Samba, in the front-end WINS hook handling: NetBIOS names from registration packets are passed to a shell without proper validation or escaping. Unsanitized NetBIOS name data from WINS registration packets are inserted into a shell command and executed by the Samba Active Directory Domain Controller’s wins hook, allowing an unauthenticated network attacker to achieve remote command execution as the Samba process.
Description
CVE-2025-10230 PoC - Samba WINS Hook Command Injection 
Readme
# CVE-2025-10230 — Samba WINS Hook Command Injection

The author assumes no liability for misuse or damage caused by this tool.  
Research is provided strictly for educational and defensive purposes.

---

## Description

This repository contains a Proof-of-Concept (PoC) for **CVE-2025-10230**, a command-injection flaw in the **WINS hook** mechanism of Samba.

The flaw affects Samba installations where:

- `wins support = yes` is enabled
- A custom shell command is defined in `wins hook = ...`
- The server receives a **malformed NetBIOS registration** request
- The NetBIOS name is concatenated **directly into the shell invocation**, enabling code execution

This PoC demonstrates how specially crafted **NetBIOS Name Registration** packets can trigger arbitrary shell commands inside Samba.

---

### Technical Information
CVE-2025-10230 is a command injection vulnerability in Samba's WINS server implementation, specifically when acting as an Active Directory Domain Controller with both WINS support and a 'wins hook' parameter configured.

- Vulnerability Mechanism: When a WINS registration packet is received, the NetBIOS name from the packet is inserted directly into a shell command that is executed by the Samba process. No validation or escaping is performed on the NetBIOS name, which can be up to 15 characters and may include shell metacharacters.
- Attack Vector: An attacker sends a specially crafted WINS registration packet to UDP port 137 containing a NetBIOS name with shell metacharacters (such as ;, |, &, or backticks). The injected shell code is executed with the privileges of the Samba process, often root.
- Root Cause: Lack of input sanitization for the NetBIOS name field before passing it to a shell command (CWE-78: OS Command Injection).
- Affected Configuration: Only Samba servers acting as Active Directory Domain Controllers with 'wins support = yes' and a non-empty 'wins hook' parameter in smb.conf are vulnerable. The default configuration is not affected.

### CVSSv3 calculation
```CVSS:3.1: CRITICAL
CVSS:3.1: AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H  (10.0)
```

### Patch Availability

Patches addressing this issue have been posted to:

    https://www.samba.org/samba/security/

Additionally, Samba 4.23.2, 4.22.5, and 4.21.9 have been issued as
security releases to correct the defect. Samba administrators are
advised to upgrade to these releases or apply the patch as soon as
possible.

## Attack Vector (Technical Summary)

1. The attacker crafts a NetBIOS Name Service (NBNS) registration packet
2. The name contains payload characters within the allowed **≤15-character limit**
3. Samba receives the WINS request on **port 137/UDP**
4. The `wins hook` handler executes with **unsanitized input**
5. The payload runs with the privileges of the Samba daemon (often **root**)

### Constraints

- NetBIOS names **cannot contain `< > ;`**
- Payload size must be **≤ 15 chars**
- Injection happens through **positional arguments**

Example commands that execute successfully:

```bash
ls
pwd
uname
```

## dir: /etc/samba/smb.conf
```conf
[global]
    wins support = yes
    wins hook = /usr/bin/ls
```

## PoC Usage

```bash
python3 poc/cve-2025-10230.py \
    -t <TARGET_IP> \
    -n <PAYLOAD_NAME> \
    -i <SOURCE_IP>
```

## Example 192.168.0.10 (Samba Server) | bin (Show Directory) | 192.168.0.50 (whatever)
```bash
python3 poc/cve-2025-10230.py -t 192.168.0.10 -n bin -i 192.168.0.50
```

## Repository Structure

```
CVE-2025-10230/
│
├── poc/
│   └── cve-2025-10230.py
│
├── evidence/
│   └── logs.md
│
├── conf/
│   └── smb.conf
│
└── README.md
```


## Author & Contact
	- Researcher: krakhen.dev
	- GitHub: @nehkark
	- Email: krakhen@gmail.com
	- Website: https://vciso.cloud
	- Reference: https://github.com/dptsec/CVE-2025-10230/
File Snapshot

Log in to view the POC file snapshot cached by Shenlong Bot

Log in to view
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →