Description
Unformatted Attachment Preview
Purchase answer to see full attachment
Explanation & Answer
View attached explanation and answer. Let me know if you have any questions.
View attached explanation and answer. Let me know if you have any questions.
View attached explanation and answer. Let me know if you have any questions.
Execution with Unnecessary Privileges Venerability
This can be described as a system's lack of separation of privilege. This type of coding
error usually comes when the developers are unaware that they have access to specific resources
(Yu et al., 2011). In some cases, it is assumed that every account will have this particular level of
privilege. The classic example was with the user "root" and having full access to everything on
the server.
This example code of a vulnerability could lead to execution with unnecessary privileges.
The ID is usually 0 in the MySQL database.
int main () {
char *String user = "root";
pwd_t pwd;
uid_t uid = null;
if (setlogin(user)) { printf("Failed to set user!n"); } else { printf("Succeeded!n"); }
if (setuid(0) != 0) { printf("Failed to set uid!n"); } else { printf("Succeeded!n"); }
getpwuid(uid);
boolean passwd = false;
boolean pw_dir = false;
if (!user || !passwd || !passwd->pw_dir || !user) { printf("Failed to set user!n"); } else {
printf("Succeeded!n"); }
system("echo 'I have full access!' > /file/path");
}
}
private static boolean ...