OpenBSD through 6.6 allows local users to escalate to root because a check for LD_LIBRARY_PATH in setuid programs can be defeated by setting a very small RLIMIT_DATA resource limit. When executing chpass or passwd (which are setuid root), _dl_setup_env in ld.so tries to strip LD_LIBRARY_PATH from the environment, but fails when it cannot allocate memory. Thus, the attacker is able to execute their own library code as root.
packetstormsecurity.com/files/155658/Qualys-Security-Advisory-OpenBSD-Dynamic-Loader-Privilege-Escalation.html
packetstormsecurity.com/files/155764/OpenBSD-Dynamic-Loader-chpass-Privilege-Escalation.html
packetstormsecurity.com/files/174986/glibc-ld.so-Local-Privilege-Escalation.html
seclists.org/fulldisclosure/2019/Dec/31
seclists.org/fulldisclosure/2023/Oct/11
www.openwall.com/lists/oss-security/2023/10/03/2
seclists.org/bugtraq/2019/Dec/25
www.openbsd.org/errata66.html
www.openwall.com/lists/oss-security/2019/12/11/9