linuxBratarina

Remote Code Execution via OpenSMTPD 2.0.0 Command Injection

Summary

  • Samba share backups exposed a file passwd.bak revealing a valid username: neil.

  • Web service running FlaskBB (turned out to be a rabbit hole). 😫

  • SMTP (OpenSMTPD 2.0.0) was exploitable via a known command injection vulnerability.

  • Exploited SMTP to write and execute a reverse shell ELF binary.

  • Gained a shell as neil via msfvenom payload.


🧡 Let's Unpack

πŸ”Ž Enumeration

nmap -p- -T4 192.168.167.71
sudo nmap -A -T4 -sC -sN -oN nmapFull -p 2,25,53,80,445 192.168.167.71
  • 80/tcp: Nginx hosting FlaskBB β†’ rabbit hole

  • 25/tcp: OpenSMTPD 2.0.0

  • 445/tcp: Samba 4.7.6 β†’ Exposed SMB share backups

πŸ“‚ SMB Enumeration

  • Found backups share with READ permission

  • Inside: passwd.bak with user: neil

⚑ Initial Foothold via SMTP RCE

Payload Preparation:

Exploit Chain:

  • Listener on attacker machine:

  • Got shell! Upgraded to full TTY:

Last updated