*BSD setusercontext vulnerabilites
BSD derived operating systems have a special function to set a 'user context'. The function setusercontext() is available on for example FreeBSD 5.0 and 7.0. An example from ftpd.c : setusercontext(lc, pw, (uid_t)0, LOGIN_SETLOGIN|LOGIN_SETGROUP|LOGIN_SETPRIORITY| LOGIN_SETRESOURCES|LOGIN_SETUMASK). An interesing setting here is LOGIN_SETRESOURCES with which a USER is allowed to set resources actually. From the manpage: LOGIN_SETRESOURCES Set resource limits for the current process based on values specified in the system login class database. Class capability tags used, with and without -cur (soft limit) or -max (hard limit) suffixes and the corresponding resource setting: cputime RLIMIT_CPU, filesize RLIMIT_FSIZE, datasize RLIMIT_DATA, stacksize RLIMIT_STACK, coredumpsize RLIMIT_CORE, memoryuse RLIMIT_RSS, memorylocked RLIMIT_MEMLOCK, maxproc RLIMIT_NPROC, openfiles RLIMIT_NOFILE, sbsize RLIMIT_SBSIZE, vmemoryuse RLIMIT_VMEM. Now one can set (means: upload) their own ~/.login_conf and play around a bit. For example the chroot() call in ftpd.c can be bypassed by setting 'openfiles' to a value of 5.