Consider following C code snippet:
void barfoo (int authstatus) {
char packet[1024];
fgets (packet, 1023, stdin);
if (authstatus != 0)
system (packet);
else
syslog ("Not authorised to process packet");
return;
}
Attacker can only call this function with auth_status
set to 0
. Goal of the attacker is to execute code of his choice like spawn a shell. So, can attacker do this in any way if he has to exploit only this function or any function directly related to this function like fgets
or system
or syslog
?
I am unable to find any vulnerability in this. For instance fgets
checks for bounds so buffer overflow is not possible.
authstatus
is 1 which is not mentioned anywhere. Now, I'm feeling sorry for posting this question here.