
CVE-2026-4480 is a command injection vulnerability affecting certain Samba printing configurations that use external print commands.
The vulnerability exists because Samba inserts user-controlled print job metadata into a shell command without properly escaping shell metacharacters. Under specific configurations, an attacker can supply a malicious print job name that causes arbitrary commands to execute on the server.
The issue is particularly dangerous because some printer shares permit guest access, allowing exploitation without authentication.
Samba supports several printing backends. One legacy option, commonly referred to as sysv-style printing, executes an external command whenever a print job completes.
Administrators can configure commands using substitution macros such as:
print command = /usr/local/bin/print-helper %s %J
Where:
%s → Path to the spool file%J → Print job name supplied by the clientPrior to the fix, the %J value underwent minimal sanitization before being inserted into a command executed through the system shell.
Because shell metacharacters remained intact, specially crafted job names could alter the intended command flow and execute attacker-controlled instructions.
A typical attack consists of four stages:
If the print command references %J, the attacker's payload becomes part of the shell command and executes with the permissions of the Samba printing process.
Not every Samba installation is vulnerable.
The following conditions must generally be true:
%J.Modern deployments using CUPS-based printing do not expose this attack path because jobs are passed through the CUPS API instead of a shell command.
Successful exploitation may allow an attacker to:
The severity depends heavily on the permissions of the printing process and the surrounding system configuration.
Affected releases include versions prior to:
Systems using later releases are not affected by this issue.
Recommended mitigations include:
%J from print commands if it is not required.printing = cups where possible.Defenders should investigate:
smbd spawning shell interpreters unexpectedlysh
bash
python
perl
nc
curl
wget
Monitoring process creation from the Samba service can help identify exploitation attempts.
This repository is intended for educational and authorized security research only.
Do not use this code against systems, networks, or services without explicit permission from the owner. Unauthorized access to computer systems is illegal and unethical.
Always perform testing in isolated lab environments or platforms specifically designed for security training.