Samba spoolss Print Job Command Injection RCE (CVE-2026-4480)
by Vusal777 · 2026-07-05
- Severity
- Critical
- CVE
- CVE-2026-4480
- Category
- network
- Affected product
- Samba (spoolss / print spooler RPC service)
- Affected versions
- Per source repository (Samba builds exposing vulnerable spoolss print-job handling over \pipe\spoolss)
- Disclosed
- 2026-07-05
- Patch status
- unpatched
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-07 |
| Author / Researcher | Vusal777 |
| CVE / Advisory | CVE-2026-4480 |
| Category | network |
| Severity | Critical |
| CVSS Score | Not specified in source |
| Status | PoC |
| Tags | samba, spoolss, smb, printer, rpc, command-injection, reverse-shell |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Samba (spoolss / print spooler RPC service) |
| Versions Affected | Per source repository (Samba builds exposing vulnerable spoolss print-job handling over \pipe\spoolss) |
| Language / Platform | Python 3 (uses Samba’s samba.dcerpc.spoolss Python bindings) |
| Authentication Required | No (supports anonymous/guest login) or Yes (username/password) |
| Network Access Required | Yes (SMB/TCP 445) |
Summary
This PoC targets a flaw in Samba’s spoolss print spooler RPC interface where a submitted print job’s document name/content is not safely handled, allowing an attacker who can open a writable printer/share to inject a shell command that gets executed on the server (document_name = "|sh"). The script authenticates (anonymously or with credentials) to the target’s SMB service, opens the named printer/share via the spoolss RPC interface, and writes a malicious “print job” whose body is executed as a shell command or reverse shell payload.
Vulnerability Details
Root Cause
The Samba print spooler processes submitted print jobs and, under vulnerable configurations, treats a document name prefixed with a pipe (|sh) combined with attacker-controlled job body data as something to be piped into a shell rather than strictly treating it as inert print data. This lets an authenticated (or anonymous, if permitted) SMB client submit a “print job” whose payload is actually shell command text, which the backend executes with the privileges of the Samba/print-handling process.
Attack Vector
- Attacker verifies target SMB service is reachable on TCP/445.
- Attacker authenticates to the target Samba server — anonymously (
-N) or with valid/guessed credentials (-u/-p) — against a writable SMB share/printer. - Attacker opens the printer object via the
spoolssRPCOpenPrintercall withPRINTER_ACCESS_USE. - Attacker starts a document with
document_name = "|sh"and datatypeRAW, then writes the payload body (a shell command or a bash reverse-shell one-liner) viaWritePrinter. - The print job is closed (
EndPagePrinter/EndDocPrinter/ClosePrinter), triggering server-side processing of the job body as a shell command. - If a reverse shell payload was used, the attacker catches the callback on their listener.
Impact
Full remote command execution on the Samba host with the privileges of the process handling the print job (potentially root or a privileged service account), enabling complete compromise of the target server.
Environment / Lab Setup
Target: Samba server with spoolss print service exposed on TCP/445,
with a writable share/printer object accessible anonymously
or via valid credentials.
Attacker tooling: Kali/Linux box with python3-samba installed
(sudo apt install python3-samba), attacker listener
(e.g. netcat) for reverse shells.
Proof of Concept
PoC Script
See
exploit.pyin this folder.
| |
Running the script checks that TCP/445 is reachable, authenticates to the target, opens the specified printer/share, and submits a print job whose body is executed as a shell command — demonstrating unauthenticated or authenticated RCE via the spoolss print interface.
Detection & Indicators of Compromise
- Samba/print spooler logs showing print jobs with a document name
beginning with "|" (pipe) submitted via spoolss RPC (StartDocPrinter).
- Unexpected child processes spawned by the Samba/print spooler service
(smbd, spoolssd) shortly after an SMB session/print job.
- Outbound TCP connections from the Samba host to unfamiliar external
IPs/ports immediately following a print job submission (reverse shell).
Signs of compromise:
- Print spooler logs containing document names starting with
|or shell metacharacters. - New unexpected outbound connections from the Samba server host.
- Unauthorized processes or shells running under the Samba service account.
Remediation
| Action | Detail |
|---|---|
| Primary fix | Apply the official Samba security patch/update that sanitizes/rejects shell-metacharacter document names and print job data in the spoolss RPC handler. |
| Interim mitigation | Disable or restrict access to writable print shares; restrict SMB/spoolss access to trusted hosts only via firewall; disable anonymous/guest SMB access. |
References
Notes
Mirrored from https://github.com/Vusal777/CVE-2026-4480-exploit-poc on 2026-07-05.
| |