cybersecurity · beginner · ~15 min · safe pentest lab
Find the shell-invoking call.
Flag the shell-invoking system( call — a red flag for command injection whenever its argument is attacker-influenced.
Implement int uses_system(const char *code) that returns 1 if code contains the substring "system(", else 0.
code: a NUL-terminated string of C source text the grader passes.Returns int: 1 if "system(" appears anywhere in code, else 0.
uses_system("system(cmd);") -> 1
uses_system("execv(path, argv);") -> 0
A NUL-terminated string code of C source text.
An int: 1 if code contains "system(", else 0.
Match the system( substring.
#include <string.h>
int uses_system(const char *code) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.