Question: What is the vulnerability with the following code and what can be done to have a secure equivalent CWE78_OS_Command_Injection_wchar_t_listen_socket_system_72b.cpp io.c std_testcase.h std_testcase_io.h CWE78_OS_C File Contains:

What is the vulnerability with the following code and what can be done to have a secure equivalent

What is the vulnerability with the following code and what can be

CWE78_OS_Command_Injection_wchar_t_listen_socket_system_72b.cpp io.c std_testcase.h std_testcase_io.h CWE78_OS_C File Contains: CWE-078: Improper Neutralization of Special Elements used in an Os Command (Os Command Injection') on line(s): 47 #UCTITE STOTLIWystem 31 #else /* NOT _WIN32 */ 32 #define SYSTEM system 33 #endif 34 35 using namespace std; 36 37 namespace CWE78_05_Command_Injection_wchar_t_listen_socket_system_72 38 { 39 40 #ifndef OMITBAD 41 42 void badSink(vector dataVector) 43 { 44 /* copy data out of dataVector */ 45 wchar_t * data = dataVector[2]; 46 /* POTENTIAL FLAW: Execute command in data possibly leading to command injection */ 47 if (SYSTEM(data) != 0) 48 { 49 printLine("command execution failed!"); 50 exit(1); 51 } 52 } 53

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!