Overview
Abducted is a medium-difficulty Linux machine built around the on-premise file and print server of a professional-services firm (Hartley Group). The only exposed services are SSH and Samba, and the entire chain hangs off Samba misconfiguration and group delegation rather than any web surface.
The foothold is an unauthenticated command injection in the Samba print subsystem (CVE-2026-4480). A guest-accessible printer share passes the client-supplied print job name into the configured print command without escaping, so a job submitted directly over the spooler RPC interface yields code execution as the print service account nobody. From there a world-readable rclone configuration leaks an obscured SFTP password that rclone itself can decode; the plaintext has been reused for the scott system account, giving SSH access and the user flag.
Privilege escalation runs in two hops. The transfer Samba share is configured with force user = marcus and wide links, letting scott plant a symbolic link out of the share and write an authorized_keys file owned by marcus. marcus belongs to the operators group, which has been delegated write access to a smbd.service.d systemd drop-in directory and a polkit grant to reload and restart that one service without a password. A drop-in that copies bash and sets it setuid root is loaded and triggered, landing a root shell.
| |
Reconnaissance
A full TCP port scan with service and script detection shows a small surface.
| |
| |
No web service is present. The host exposes SSH and a Samba server, and the NetBIOS name is ABDUCTED. The OpenSSH banner points to a recent Ubuntu release, which bounds the rough age of the host but not the exact Samba build.
Listing shares anonymously succeeds because the server allows null sessions.
| |
| |
projects and transfer reject anonymous tree connects with NT_STATUS_ACCESS_DENIED, but HP-Reception is a printer share that accepts guests. Connecting to it and trying to list files is instructive:
| |
A printer share has no browsable filesystem, so directory listing is meaningless here; the share type alone is the signal. This is a guest-accessible Samba print queue, which is precisely the precondition for the print-subsystem RCE discussed below.
Pinning the vulnerability
Fingerprinting the exact Samba package remotely is not reliable. The SMB2 negotiation carries no package version, and rpcclient srvinfo reports a hardcoded os version 6.1 rather than the real release. The most that can be inferred is that the host predates the May 2026 Samba security release, which fixed a batch of issues at once (reparse-point access checks, vfs_worm, GPO certificate handling, WINS, and the printing RCE), so the banner alone does not single out one CVE.
What singles it out is the exposed surface. Of that batch, the print-command injection (CVE-2026-4480) is the only issue reachable from an unauthenticated position on this host. The others require an Active Directory domain controller, a WINS server, the vfs_worm module, or authenticated file operations, none of which this server presents. A guest-accessible printer share is exactly what the printing RCE needs, and it is sitting in the share list. Since smb.conf cannot be read remotely to confirm the print command references %J, this remains a hypothesis to confirm by behaviour, with an out-of-band probe before committing to a payload.
Initial Access
CVE-2026-4480 is an OS command injection (CWE-78) in the Samba print subsystem. After a print job finishes spooling, Samba runs the configured print command through a system() call, substituting its macros into the string verbatim. %s becomes the spool file path and %J becomes the job name supplied by the client. Because %J is attacker-controlled and the result is handed straight to a shell, a print command that references %J unquoted is a shell-injection sink. The configured command on this host is:
| |
Before the fix, the only sanitization applied to the job name was turning the single-quote character into an underscore; |, ;, spaces, <, > and & all reach the shell intact. Only print backends that actually run a print command are affected (printing = cups and printing = iprint route through the CUPS API and are safe); this host uses the sysv backend. The flaw was fixed in Samba 4.22.10, 4.23.8 and 4.24.3 by masking shell-unsafe characters and single-quoting %J.
Reaching the sink
The obvious approach of setting a job name with a normal client is a dead end. When a job is queued through smbclient or smbspool, the name travels over the legacy RAP print interface, which sanitizes shell metacharacters to _ before they ever reach %J, and smbclient -c additionally splits its command list on ;. To deliver useful characters, the job has to be submitted over the spooler RPC interface (spoolss) directly, which the Samba Python bindings expose.
A print job over spoolss is a fixed call sequence. The job name that lands in %J is the document_name field passed to StartDocPrinter, and the spool body (%s) is whatever is handed to WritePrinter:
| |
With a document name of |sh, the command Samba executes becomes:
| |
So the spool body is piped into sh and run as a script, and the body itself has no character restrictions. The HP-Reception share allows guests, so anonymous credentials are sufficient and the whole exploit is unauthenticated.
Confirming blind execution
The injection is blind; the print command runs server-side and returns nothing. Before sending a real payload, execution is confirmed out-of-band by pointing the spool body at an ICMP callback and watching the wire:
| |
| |
Echo requests arriving from the target prove the body executed and validate the hypothesis from enumeration. Two details matter when swapping the body for a reverse shell. The spool file must be non-empty, because Samba skips the print command for a zero-byte job. The payload must also detach: the print command runs synchronously inside EndDocPrinter, so a foreground reverse shell would block smbd and time out the RPC. Wrapping the connect-back in setsid ... & lets the call return immediately while the shell keeps running.
| |
The PRINTER_ACCESS_USE mask (0x00000008) is all a normal client needs to submit a job. Note one binding quirk: the DocumentInfo union cannot be instantiated directly, so a DocumentInfo1 is populated and assigned to the container after setting level = 1.
Starting a listener and running the exploit catches a shell as the print service account:
| |
| |
The spool file that triggered the job is still visible on disk, confirming the injection path:
| |
Recovering a reused password
Enumerating the host turns up an offsite backup job under /opt/offsite-backup with a world-readable rclone configuration.
| |
rclone does not encrypt stored passwords; it only “obscures” them in a reversible encoding that rclone itself can decode. The tool hands back the plaintext directly:
| |
The recovered password does not work for svc-backup over SSH, but it has been reused for the scott account, which is a login user on the box (/etc/passwd lists scott and marcus with /bin/bash). SSH as scott succeeds and yields the user flag:
| |
Lateral Movement
scott -> marcus
Reading the Samba share definitions, the transfer share stands out:
| |
| |
Two settings combine into a write primitive. force user = marcus means every file operation through the share runs as marcus regardless of who authenticated, so files created through it are owned by marcus. wide links lets Samba follow symbolic links that point outside the shared directory tree. Samba normally disables wide links while Unix extensions are enabled, but the global unix extensions = no plus allow insecure wide links = yes re-enables exactly that unsafe behaviour.
scott owns /srv/transfer on disk, so a symlink can be planted there pointing at marcus’s home directory. Connecting to the share over SMB and writing through the link drops an authorized_keys file that ends up owned by marcus.
| |
The connection is made to 127.0.0.1 so that it hits smbd locally, and the symlink mh resolves to /home/marcus when followed. With the public key in ~marcus/.ssh/authorized_keys, the private key logs straight in:
| |
Privilege Escalation
marcus -> root
marcus belongs to the operators group. Searching for filesystem objects owned by that group reveals a single, high-value target:
| |
| |
| |
The permission bits are the whole finding. The directory is owned by group operators and is group-writable with the setgid bit set, so marcus can create files inside it. This is a systemd drop-in location: any *.conf placed in /etc/systemd/system/smbd.service.d/ is merged into smbd.service when the unit is reloaded, and ExecStartPre= directives run before the main process, as the service user. smbd runs as root, so a drop-in here is arbitrary command execution as root at service start.
Writing the drop-in is only half of it. The change does nothing until the unit is reloaded and the service restarted, and an unprivileged user cannot normally do either to a root-owned service. The question is what systemd operations polkit will let an operators member perform without authenticating. Each registered action is tested against the current process:
| |
| |
Most of these are noise handed to any active local session. The one that matters is org.freedesktop.systemd1.reload-daemon, so operators can reload the systemd manager without a password. Unit management (manage-units) does not appear in the allowed list, but that is expected rather than reassuring: the rule granting it is conditional on the target unit (action.lookup("unit") == "smbd.service"), and a blanket pkcheck sends no unit detail, so the condition never matches and the probe reads as denied. The grant only fires when the call carries unit=smbd.service, exactly as systemctl sends it, which is why systemctl restart smbd returns without a prompt while any other unit would ask for the root password.
Put together, the group-writable drop-in directory lets marcus make smbd.service run a command of his choosing as root at start-up, and the polkit delegation lets him reload and restart smbd to apply it, without authenticating. Neither is dangerous alone; combined they are a direct path to root.
A drop-in is written that copies bash and flags the copy setuid root, then the daemon is reloaded and the service restarted to trigger it:
| |
The [Service] section header is mandatory: ExecStartPre= is only valid there, and without it systemd would reject the directives. daemon-reload is needed so systemd re-reads the new drop-in from disk, and restart is needed because the ExecStartPre lines only run when the service actually starts. On restart, systemd (as root) executes both lines and leaves a setuid-root bash behind:
| |
The -p flag preserves the effective UID so the shell runs with root privileges rather than dropping them.
Detection and Mitigation
| Stage | Root cause | Mitigation |
|---|---|---|
| Print RCE (CVE-2026-4480) | print command references %J unquoted; job name passed to a shell unescaped | Patch to Samba 4.22.10 / 4.23.8 / 4.24.3; quote or remove %J; prefer printing = cups; disable guest printing |
| Guest printer exposure | HP-Reception allows anonymous job submission | Require authentication on printer shares; restrict spooler access to trusted hosts |
| Credential leak | rclone.conf world-readable with an obscured (not encrypted) password | Restrict config permissions to 0600; treat rclone obscure values as cleartext; use key-based SFTP auth |
| Password reuse | svc-backup backup password reused for scott | Unique credentials per account; vault-managed service passwords |
| scott -> marcus | force user + wide links + allow insecure wide links on a writable share | Remove allow insecure wide links; keep wide links = no; avoid force user on user-writable shares |
| marcus -> root | operators group writable smbd.service.d drop-in plus polkit reload/restart delegation | Remove group write on systemd unit directories; scope polkit grants narrowly and never alongside unit-config write access |
Detection signals:
- Samba spooler jobs submitted over
spoolsswith shell metacharacters in the document name;printauditor shell children spawned fromsmbd. - A reverse-shell process parented by
smbd.service(for examplebash -i >& /dev/tcp/...), visible in thesmbdcgroup. - Reads of
/opt/offsite-backup/rclone.confbynobody, andrclone revealexecutions. - SMB writes through the
transfershare that create or traverse symlinks pointing outside/srv/transfer. - New files in
/etc/systemd/system/smbd.service.d/, followed closely bydaemon-reloadandrestartofsmbdfrom a non-root session; auditd/laurel records ofExecStartPrerunningcp/chmodon/bin/bash. - Creation of setuid-root binaries in world-writable directories such as
/tmp.
Lessons Learned
- Service-version fingerprinting is not a prerequisite for exploitation. When a banner is unhelpful, the exposed attack surface (a guest printer share) can pin a vulnerability more reliably than a version string, and a blind out-of-band probe confirms it safely before any payload is sent.
- Client-side input sanitization is not a security control. The RAP interface scrubbed shell metacharacters, but the underlying
spoolssRPC path did not, so the fix had to live where the data is consumed, not where one client happens to send it. - “Obscured” is not “encrypted”. Reversible encodings such as
rclone obscureprotect against shoulder-surfing at best; a readable config file is a cleartext credential. - Credential reuse across a service account and an interactive user collapses trust boundaries. One leaked backup password became interactive SSH access.
- Samba
wide linkswithforce userturns write access to a share into write-as-another-user anywhere the service can reach;allow insecure wide linksdeliberately removes the guardrail that normally prevents this. - Delegation should be evaluated as a whole, not per-permission. Group-writable unit config and a password-less service reload are each defensible in isolation, but together they hand root to any group member.
Command Reference
| |
Based on public write-ups of the Hack The Box machine Abducted for the mechanism-level explanations of CVE-2026-4480.