Tag: security

Questions Related to security

  1. Program works when there is only 1 argument with program

  2. Program works when there are 3 arguments with program

  3. Program works when there are 4 arguments with program

  4. Program never executes successfully


Correct Option: D

With the size of unsigned integers being 4 bytes, What happens when a negative number is entered? unsigned int i; scanf("%u",&i);

  1. A run-time error is encountered and the program aborts

  2. unsigned int variables cannot store the sign (+ or -) of the number. The sign is discarded and only the number is stored in i

  3. A large positive number will be stored in i

  4. Unsigned int variables cannot store signed numbers. Hence in this program i will contain garbage values.


Correct Option: C
  1. 1289945278

  2. garbage. Integer j cannot hold such large values

  3. 9879879870

  4. Program is aborted


Correct Option: A
  1. Shell environment variables

  2. Data received via encrypted network channels

  3. argv[0] can only have either null or program name

  4. no external input must be trusted


Correct Option: D
  1. DNS Spoofing

  2. Command Injection

  3. Path Traversal

  4. Command Injection AND Path Traversal


Correct Option: D
  1. The program should be started with root privileges. Then it should use setuid(UID) to change privileges between root and another account.

  2. The program should be started with root privileges. Then it should use seteuid(UID) to change privileges between root and another account.

  3. Starting the program as root is a security risk. The program should run with least privileges and obtain root using seteuid(UID) whenever necessary.

  4. The program has to run with root privileges entirely. Once root privileges are dropped they cannot be regained.


Correct Option: B