SSHD Poison : A Tool To Get Creds Of Pam Based SSHD Authentication

SSHD Poison is a tool to get creds of pam based sshd authentication, this is not the easiest way to do that (you can create a pam module, or just add auth optional pam_exec.so quiet expose_authtok /bin/bash -c {read,-r,x};{echo,-e,"`env`\n$x"}>>somefile in a service configuration), not even the stealthiest (the tool don’t have any mechanism to try hide yourself, and needs control the main sshd pid all the time), but code this gave me a lot of fun.

How it works

The tool starts attaching the main sshd pid and wait for some events, when a new process is created, it means that a new connection was started, after that the tool will wait for an execve event, then checks if the program executed is the same as the main pid, to ensure a re-exec (this is why we need take control of the main pid, every re-exec will erase any memory modification), then a breakpoint are set in the entry point of the new process, for wait the program load the shared librarys.

When it’s done and the breakpoint has hit, it are unset, the program will write the shellcode to a code cave, and the GOT entry for pam_set_item, used by libpam, will be changed, to hook internal libpam call to pam_set_item function.

The log format are password\0rhost\0user\0.

This will only works with x86_64 PIE binaries, and kernel 3.4 or early (PTRACE_SEIZE), I tested this with OpenSSH_8.0p1, OpenSSL 1.1.1b 26 Feb 2019 with kernel 5.0.13-arch1-1-ARCH and OpenSSH_7.9p1 Debian-10, OpenSSL 1.1.1b 26 Feb 2019with kernel 4.19.0-kali3-amd64

Also Read – CrossLinked : LinkedIn Enumeration Tool To Extract Valid Employee Names From An Organisation

Compiling

git clone –recurse-submodules https://github.com/hc0d3r/sshd-poison
– cd sshd-poison
– make

Demo

R K

Recent Posts

Install PHP on Ubuntu 26.04: Apache, Nginx, and Multiple Versions

PHP 8.5 is included in Ubuntu 26.04's default repositories and is the recommended version for…

15 hours ago

Upgrade to Ubuntu 26.04 from 25.10 and 24.04 LTS: Complete Guide

Ubuntu 26.04 LTS "Resolute Raccoon" arrived on April 23, 2026 with Linux kernel 7.0, GNOME 50,…

15 hours ago

Install Kubernetes on Ubuntu 26.04 with kubeadm and containerd

Kubernetes is the standard platform for running containerized workloads across multiple servers with self-healing, rolling…

15 hours ago

Install Ubuntu 26.04: Bootable USB, Partitioning, and First Steps

Ubuntu 26.04 LTS "Resolute Raccoon" was released on April 23, 2026 with Linux kernel 7.0, GNOME desktop, and standard security support until April 2031. A clean install gives you a known-good starting point on new hardware, when replacing another operating system, or when an upgrade path is not practical. This guide walks through how to install Ubuntu 26.04: downloading and verifying the ISO, writing a bootable USB drive, completing the installer, and doing the initial setup after the first boot. Before you start: You need a USB drive with at least 12 GB of free space. Back up any existing data on the target machine — the installer can erase the entire disk. Install Ubuntu 26.04: Download the ISO…

15 hours ago

Change Timezone on Ubuntu: timedatectl and Desktop GUI Guide

The correct timezone affects more than the clock on your screen. It drives cron job scheduling, systemd timer execution, log file timestamps, database record timing, and SSL certificate validity checks. A mismatched timezone can cause scheduled jobs to fire at the wrong hour and make log timestamps impossible to match with real-world events. This guide shows how to change timezone on Ubuntu using the timedatectl command (the recommended approach for servers and remote machines) and through the graphical Date & Time settings on desktop systems. The steps apply to all current Ubuntu releases including 24.04 and 26.04. <strong>Prerequisite:</strong>&nbsp;Only&nbsp;the&nbsp;root&nbsp;user&nbsp;or&nbsp;a&nbsp;user&nbsp;with&nbsp;sudo&nbsp;access&nbsp;can&nbsp;change&nbsp;the&nbsp;system&nbsp;timezone. Check the Current Timezone Before You Change It Run timedatectl with no arguments to see the active timezone and clock status: bashtimedatectl Sample output: Local…

15 hours ago

Install Atom on Ubuntu 18.04: GitHub’s Code Editor APT Setup

Atom is a free, open-source, cross-platform code editor developed by GitHub. Built on Electron, it uses…

1 day ago