cybersecurity · intermediate · ~15 min · safe pentest lab
Flag world-writable permissions in an audit.
Flag a world-writable file — a top finding in a permission audit, since any local user can tamper with it.
Implement int audit_world_writable(int mode) that returns 1 if the other-write bit (octal 0002) is set, else 0.
mode: a Unix permission mode (octal). The grader passes fixed values.Returns int: 1 if the other-write bit is set, else 0.
audit_world_writable(0777) -> 1
audit_world_writable(0755) -> 0
0002.A Unix permission mode (octal int).
An int: 1 if the other-write bit (0002) is set, else 0.
Test mode & 0002.
int audit_world_writable(int mode) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.