Tag: security

Questions Related to security

  1. Brute force Attack

  2. Variable Key Attack

  3. Round Key Analysis

  4. Plain Text Attack


Correct Option: D
  1. Replace cin call in line 3 with gets() function

  2. The length of input from cin cannot be limited. Use a larger array for fname

  3. Use cin.width[20] before line 3

  4. Use cin.size[19] before line 3


Correct Option: C
  1. No vulnerabilities are present

  2. Line 1 should only use malloc(inputsize)

  3. Line 2 should be for (i=0; i<=n, i++)

  4. Line 1 should use calloc() instead of malloc()


Correct Option: D
  1. Buffer overflow

  2. Off by one error

  3. Format string vulnerability

  4. No vulnerabilities are present in this code


Correct Option: C

What is the vulnerability in this code? int main(int argc, char * argv[]) { printf (argv[1]); }

  1. Buffer overflow

  2. Off by one error

  3. Format string vulnerability

  4. No vulnerabilities are present in this code


Correct Option: C

What is the possible vulnerability in this code? unsigned int total, userinput1, userinput2; userinput1 = receiveInput(); userinput2 = receiveInput(); total = userinput1 + userinput2;

  1. Integer overflow

  2. Buffer overflow

  3. Stack overflow

  4. Data type mismatch


Correct Option: A
  1. /GS on Visual C++ and -fmudflap -fmudflapth -fmudflapir on GCC

  2. /O in Vc++ and -O2 in GCC

  3. /S in Vc++ and -fcrossjumping in GCC

  4. /S in VC++ and -fno-function-cse in GCC


Correct Option: A

What can go wrong in following code? #include int main(int argc, char *argv[]) { if(argc != 3) { printf("usage: %s [source] [dest]\n", argv[0]); exit(1); } char x; FILE *file[2]; file[0] = fopen(argv[1],"r+"); file[1] = fopen(argv[2],"w+"); for(x = 0; x < 2; x++) { if(file[x] == NULL) { printf("error opening file.\n"); exit(1); } } do { x = fgetc(file[0]); fputc(x,file[1]); } while(x != EOF); for(x = 0; x < 2; x++) fclose(file[x]); return 0; }

  1. SQL Injection

  2. Arc Injection

  3. Buffer Overflow

  4. both 2 and 3


Correct Option: C
  1. fstack-protector

  2. fstack-protector-all

  3. fdelete-null-pointer-checks

  4. Both a and b


Correct Option: B