The POSIX wordexp(3) API, commonly recommended for shell-style tilde expansion in C, has dangerous default behavior that enables command substitution unless WRDE_NOCMD is passed. However, even with WRDE_NOCMD, musl and macOS libc implementations delegate to system shells, leaving bypass vulnerabilities that can still execute arbitrary commands.
Background
wordexp(3) is a POSIX standard C library function designed to perform shell-style word expansion from C programs, often used as a safer alternative to system() for simple expansions like tilde resolution.
- Source
- Lobsters
- Published
- Oct 25, 2026 at 11:09 PM
- Score
- 6.0 / 10