glibc/posix
Carlos O'Donell a39208bd7f CVE-2014-7817: wordexp fails to honour WRDE_NOCMD.
The function wordexp() fails to properly handle the WRDE_NOCMD
flag when processing arithmetic inputs in the form of "$((... ``))"
where "..." can be anything valid. The backticks in the arithmetic
epxression are evaluated by in a shell even if WRDE_NOCMD forbade
command substitution. This allows an attacker to attempt to pass
dangerous commands via constructs of the above form, and bypass
the WRDE_NOCMD flag. This patch fixes this by checking for WRDE_NOCMD
in exec_comm(), the only place that can execute a shell. All other
checks for WRDE_NOCMD are superfluous and removed.

We expand the testsuite and add 3 new regression tests of roughly
the same form but with a couple of nested levels.

On top of the 3 new tests we add fork validation to the WRDE_NOCMD
testing. If any forks are detected during the execution of a wordexp()
call with WRDE_NOCMD, the test is marked as failed. This is slightly
heuristic since vfork might be used in the future, but it provides a
higher level of assurance that no shells were executed as part of
command substitution with WRDE_NOCMD in effect. In addition it doesn't
require libpthread or libdl, instead we use the public implementation
namespace function __register_atfork (already part of the public ABI
for libpthread).

Tested on x86_64 with no regressions.
2014-11-19 14:35:03 -05:00
..
bits Complete _BSD_SOURCE / _SVID_source followup cleanup. 2014-02-21 21:45:26 +00:00
rxspencer
sys Complete _BSD_SOURCE / _SVID_source followup cleanup. 2014-02-21 21:45:26 +00:00
_exit.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
alarm.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
annexc.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
BOOST.tests
bsd-getpgrp.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-ga1.c
bug-ga2.c
bug-getopt1.c
bug-getopt2.c
bug-getopt3.c
bug-getopt4.c
bug-getopt5.c
bug-glob1.c
bug-glob2.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-glob3.c
bug-regex1.c
bug-regex2.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex3.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex4.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex5.c
bug-regex6.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex7.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex8.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex9.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex10.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex11.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex12.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex13.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex14.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex15.c
bug-regex16.c
bug-regex17.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex18.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex19.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex20.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex21.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex22.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex23.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex24.c
bug-regex25.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex26.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex27.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex28.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex29.c
bug-regex30.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex31.c
bug-regex31.input
bug-regex32.c
bug-regex33.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex34.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex35.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
bug-regex36.c Fix another memory leak in regexp compiler (BZ #17069) 2014-06-20 14:03:40 +02:00
confstr.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
cpio.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
Depend
environ.c
execl.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
execle.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
execlp.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
execv.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
execve.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
execvp.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
execvpe.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
fexecve.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
fnmatch_loop.c Move findidx nested functions to top-level. 2014-09-11 16:02:17 -07:00
fnmatch.c Move findidx nested functions to top-level. 2014-09-11 16:02:17 -07:00
fnmatch.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
fork.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
fpathconf.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
gai_strerror.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
gai.conf
get_child_max.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getaddrinfo.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getconf-speclist.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getconf.c Assume that all _[PS]C_* and _CS_* macros are always defined 2014-09-16 22:18:20 +05:30
getegid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
geteuid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getgid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getgroups.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getopt1.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getopt_init.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getopt_int.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getopt.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
getopt.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getpgid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getpgrp.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getpid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getppid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getresgid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getresuid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getsid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
getuid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
glob64.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
glob.c Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
glob.h Complete _BSD_SOURCE / _SVID_source followup cleanup. 2014-02-21 21:45:26 +00:00
globtest.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
globtest.sh Remove redundant C locale settings. 2014-06-07 19:58:36 +00:00
group_member.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
init-posix.c
Makefile Fix memory leak in regexp compiler (BZ #17069) 2014-06-19 19:00:03 +02:00
nanosleep.c Remove __libc_nanosleep function name. 2014-11-01 12:26:09 +00:00
pathconf.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
pause.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
PCRE.tests
posix_madvise.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
posix-envs.def Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
pread64.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
pread.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
ptestcases.h
PTESTS
PTESTS2C.sed
pwrite64.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
pwrite.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
re_comp.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
regcomp.c Move findidx nested functions to top-level. 2014-09-11 16:02:17 -07:00
regex_internal.c Check if DEBUG is defined in regex_internal.c 2014-08-01 14:24:41 +05:30
regex_internal.h Remove unused include 2014-11-04 15:32:07 +01:00
regex.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
regex.h Combine __USE_BSD and __USE_SVID into __USE_MISC. 2014-02-12 23:41:01 +00:00
regexbug1.c
regexec.c Move findidx nested functions to top-level. 2014-09-11 16:02:17 -07:00
runptests.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
runtests.c
sched_cpualloc.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sched_cpucount.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sched_cpufree.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sched_getaffinity.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sched_getp.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sched_gets.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sched_primax.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sched_primin.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sched_rr_gi.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sched_setaffinity.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sched_setp.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sched_sets.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sched_yield.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sched.h Include all of <time.h> from <sched.h> for older standards (bug 16670). 2014-03-07 20:54:03 +00:00
setgid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
setpgid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
setpgrp.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
setresgid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
setresuid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
setsid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
setuid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sleep.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawn_faction_addclose.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawn_faction_adddup2.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawn_faction_addopen.c Add missing #include in spawn_faction_addopen.c 2014-06-26 13:21:58 -07:00
spawn_faction_destroy.c posix_spawn_file_actions_addopen needs to copy the path argument (BZ 17048) 2014-06-11 23:13:42 +02:00
spawn_faction_init.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawn_int.h posix_spawn_file_actions_addopen needs to copy the path argument (BZ 17048) 2014-06-11 23:13:42 +02:00
spawn.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawn.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawnattr_destroy.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawnattr_getdefault.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawnattr_getflags.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawnattr_getpgroup.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawnattr_getschedparam.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawnattr_getschedpolicy.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawnattr_getsigmask.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawnattr_init.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawnattr_setdefault.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawnattr_setflags.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawnattr_setpgroup.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawnattr_setschedparam.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawnattr_setschedpolicy.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawnattr_setsigmask.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawni.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
spawnp.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
sysconf.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tar.h Define TSVTX in tar.h for older POSIX (bug 16978). 2014-05-23 20:37:40 +00:00
test-vfork.c
testcases.h
testfnm.c
TESTS
TESTS2C.sed
times.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
transbug.c
tst-boost.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-chmod.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-cpucount.c
tst-cpuset.c
tst-dir.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-exec-static.c
tst-exec.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-execl1.c
tst-execl2.c
tst-execle1.c
tst-execle2.c
tst-execlp1.c
tst-execlp2.c
tst-execv1.c
tst-execv2.c
tst-execve1.c
tst-execve2.c
tst-execvp1.c
tst-execvp2.c
tst-execvp3.c
tst-execvp4.c
tst-fnmatch2.c
tst-fnmatch3.c Don't read past end of pattern in fnmatch (BZ #17062) 2014-06-18 14:20:02 +02:00
tst-fnmatch.c Modify several tests to use test-skeleton.c 2014-11-05 15:24:08 +05:30
tst-fnmatch.input Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-fork.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-getaddrinfo2.c
tst-getaddrinfo3.c
tst-getaddrinfo4.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-getaddrinfo.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-getconf.sh Don't require test wrappers to preserve environment variables, use more consistent environment. 2014-06-06 22:19:27 +00:00
tst-getlogin.c Modify several tests to use test-skeleton.c 2014-11-05 15:24:08 +05:30
tst-getopt_long1.c
tst-gnuglob.c Modify several tests to use test-skeleton.c 2014-11-05 15:24:08 +05:30
tst-mmap.c Modify several tests to use test-skeleton.c 2014-11-05 15:24:08 +05:30
tst-nanosleep.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-nice.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-pathconf.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-pcre.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-preadwrite64.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-preadwrite.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-regex2.c
tst-regex.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-regexloc.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-rfc3484-2.c Fix qsort_r namespace (bug 17571). 2014-11-12 22:33:41 +00:00
tst-rfc3484-3.c Fix qsort_r namespace (bug 17571). 2014-11-12 22:33:41 +00:00
tst-rfc3484.c Fix qsort_r namespace (bug 17571). 2014-11-12 22:33:41 +00:00
tst-rxspencer-no-utf8.c Split up rules for tests using mtrace and something else. 2014-02-14 13:45:14 +00:00
tst-rxspencer.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-spawn-static.c
tst-spawn.c posix_spawn_file_actions_addopen needs to copy the path argument (BZ 17048) 2014-06-11 23:13:42 +02:00
tst-sysconf.c
tst-truncate64.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-truncate.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-vfork1.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-vfork2.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-vfork3.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tst-waitid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
tstgetopt.c
uname.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
unistd.h Complete _BSD_SOURCE / _SVID_source followup cleanup. 2014-02-21 21:45:26 +00:00
Versions
vfork.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
wait3.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
wait4.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
wait.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
wait.h
waitid.c Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
waitpid.c Remove __libc_waitpid function name. 2014-11-07 01:27:16 +00:00
wordexp-test.c CVE-2014-7817: wordexp fails to honour WRDE_NOCMD. 2014-11-19 14:35:03 -05:00
wordexp-tst.sh Don't require test wrappers to preserve environment variables, use more consistent environment. 2014-06-06 22:19:27 +00:00
wordexp.c CVE-2014-7817: wordexp fails to honour WRDE_NOCMD. 2014-11-19 14:35:03 -05:00
wordexp.h Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00