160 likes | 291 Vues
This presentation by Rodney Thayer explores the technique of shared library shimming through a tool called Slimjim. Slimjim targets Pluggable Authentication Modules (PAM) to intercept data, specifically passwords, during authentication processes in systems like OpenSSH. The talk covers the implementation of Slimjim, a demonstration of its capabilities, and discusses the vulnerabilities present in PAM's use of shared libraries. Aimed at academic research, the presentation highlights the importance of security measures in library loading practices to mitigate such risks.
E N D
Shared Library Shimming for Password Harvesting Rodney Thayer rodney@shmoo.com
Introduction • ‘Slimjim’ – a shared library shim • PAM – Pluggable Authentication Modules • Shared Library shimming • The vulnerability • The Slimjim code • Demonstration • Conclusions www.shmoo.com/rodney/slimjim.ppt
Disclaimer • We’re not suggesting you do anything bad with this. • This is for academic research purposes only. www.shmoo.com/rodney/slimjim.ppt
‘Slimjim’ – a shared library shim • Takes advantage of shared library technology • Used to intercept data flowing to PAM • Can be applied to OpenSSH + PAM • Extracts passwords www.shmoo.com/rodney/slimjim.ppt
Shared Library Plumbing Conventional SSH+PAM configuration OpenSSH PAM www.shmoo.com/rodney/slimjim.ppt
Shared Library Plumbing Exploited SSH+PAM configuration OpenSSH Slimjim PAM Slimjim captures function calls across Shared Library interface www.shmoo.com/rodney/slimjim.ppt
PAM • Pluggable Authentication Modules • Uses shared libraries to implement access control • Supports password access and other mechanisms • Used by many components, including OpenSSH, ‘su’, ‘telnet’, login, … www.shmoo.com/rodney/slimjim.ppt
Shared Library Shimming Shared Library Public function Well known public functions published by shared library, so interfaces are known Public function Public function www.shmoo.com/rodney/slimjim.ppt
Shimming a shared library • Write a new shared library • Publish the same interfaces by name • At initialization, call the old library • ‘sift’ the data as it passes through • Since the interfaces are the same, theusing program won’t know www.shmoo.com/rodney/slimjim.ppt
The Vulnerability • PAM provides password authentication • PAM uses shared libraries • OpenSSH on Linux uses PAM • OpenSSH doesn’t know which ‘PAM’ it’s using • No security on library loading. www.shmoo.com/rodney/slimjim.ppt
Slimjim Implementation • Source code at http://www.shmoo.com/rodney/slimjim.tgz • Tested with Red Hat 9,OpenSSH 3.6p1,PAM www.shmoo.com/rodney/slimjim.ppt
The Slimjim code • One file, slimjim.c • Publishes standard PAM entry points: pam_authenticate, pam_start, pam_get_user, ... • Note it implements the ‘conversation’ function www.shmoo.com/rodney/slimjim.ppt
PAM Password Exploit • PAM uses a ‘conversation’ function to pass the username and password from the user to PAM • The data passes across the public shared library interface • Therefore, slimjim sees the password, in the clear www.shmoo.com/rodney/slimjim.ppt
Demonstration • OpenSSH on Port 8022 • Shimmed PAM • Red Hat 9 www.shmoo.com/rodney/slimjim.ppt
Conclusions • Is this a realistic problem? Yes. Attackers can drop files on a system, as ‘root’ • How do you prevent this? Usestaticlibraries • Are shared libraries a good idea? Maybenot. • Implement digitally signed shared library loading? www.shmoo.com/rodney/slimjim.ppt
Thank You! Rodney Thayer rodney@shmoo.com http://www.shmoo.com/rodney/slimjim.html www.shmoo.com/rodney/slimjim.ppt