NetBSD 1.6, NetBSD 2.0 through 2.1, and NetBSD-current before 20051031 allows local users to gain privileges by attaching a debugger to a setuid/setgid (P_SUGID) process that performs an exec without a reset of real credentials.
http://www.securityfocus.com/bid/15290
http://prdelka.blackart.org.uk/exploitz/prdelka-vs-BSD-ptrace.tar.gz
http://mail-index.netbsd.org/source-changes/2005/10/31/0001.html
http://archives.neohapsis.com/archives/fulldisclosure/2005-11/0157.html