A shell weakness occurs when a program enables an attacker to execute unexpected commands on the operating system.
This causes a new program to execute and is difficult to use safely.
dyninst-9.3.1/testsuite-9.3.0/src/test_driver.C
The highlighted line of code below is the trigger point of this particular Centos 7 shell weakness.
bool collectInvocation(Dyninst::PID mpirun_pid, int session);
int setupLogs(ParameterDict ¶ms);
#if !defined(os_windows_test)
int runScript(const char *name, ...)
{
char test[1024];
int result;
va_list ap;
va_start(ap, name);
vsnprintf(test, 1024, name, ap);
va_end(ap);
char test2[1024];
if ((outlog != NULL) && (outlog != stdout)) {
snprintf(test2, 1024, "sh -c \"%s\" >>%s 2>&1", test, logfilename);
} else {
snprintf(test2, 1024, "%s", test);
}
// Flush before/after script run
flushOutputLog();
flushErrorLog();
result = system(test2);
flushOutputLog();
flushErrorLog();
return result;
}
#else
int runScript(const char *name, ...) {
getOutput()->log(STDERR, "runScript not implemented on Windows\n");
assert(0);
return -1;
}
#endif
void printLogMutateeHeader(const char *mutatee, test_linktype_t linktype)
{
flushOutputLog();
flushErrorLog();
// Mutatee Description
// Mutatee Info
if ( (mutatee != NULL) && (strcmp(mutatee, "") != 0) ) {
getOutput()->log(LOGINFO, "[Tests with %s]\n", mutatee);
#if !defined(os_windows_test)
runScript("ls -lLF %s", mutatee);
if( linktype == DynamicLink )