Tutorial 2
Tutorial 2
A. Attacker can abuse the format string “%d” to cause confidentiality violation.
B. Attacker can abuse the format string “%i” to cause integrity violation.
C. Attacker can abuse the format string “%s” to cause availability violation.
D. Attacker can abuse the format string “%x” to cause confidentiality violation.
3) In a C program, let an unsigned int variable x = UINT_MAX. What will be the result when
we calculate x ++?
A. 0
B. UINT_MAX
C. INT_MAX
D. INT_MIN
3. Consider the following fragment of a C program. The program has a vulnerability that would allow
an attacker to cause the program to disclose the content of the variable “secret” at runtime. We
assume that the attacker has no access to the exact implementation of the ‘get_secret()’
function so the attack has to work regardless of how the function ‘get_secret()’ is implemented.
1) Explain how the attack mentioned above works. You do not need to produce the exact
input to the program that would trigger the attack. It is sufficient to explain the strategy
of the attack. Explain why the attack works.
2) The vulnerability above can be fixed by modifying just one statement in the program
without changing its functionality. Show which statement you should modify and how you
would modify it to fix the vulnerability. Show the C code of the proposed solution
return 0;
}
4. You are developing a web service, which accepts the email title ‘title’ and body ‘body’ from
users, and forwards them to [email protected]. This is achieved by the following program.
Identify the security problems in this piece of program