cybersecurity · beginner · ~15 min · safe pentest lab
Encode the default-deny policy.
Encode a seccomp filter's default-deny policy: allow what is explicitly permitted, kill everything else — the safe sandbox posture.
Implement int seccomp_action(int allowed) that returns 0 (ALLOW) when allowed is true, and -1 (KILL) otherwise.
allowed: 1 if the syscall is on the allowlist, 0 otherwise.Returns 0 (ALLOW) when allowed is true, -1 (KILL) when it is false.
seccomp_action(1) -> 0 (ALLOW)
seccomp_action(0) -> -1 (KILL)
A flag allowed (1 if the syscall is permitted, 0 otherwise).
0 (ALLOW) if allowed is true; -1 (KILL) otherwise.
Default-deny: allow only when allowed is true.
int seccomp_action(int allowed) {
/* TODO */
return -1;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.