I'm considering a possible denial of service attack scenario, where a script cause a system resource outage by recursively invoking itself as interpreter.
The principle is as follow:
The script specifies at its first line, in the form of a #!
shabang, the absolute path of itself, as its own interpreter.
The system kernel will, depend on its support, automatically invoke the interpreter during the execve
system call, prepending the interpreter, to the vector of arguments.
Such invocation will exhaust the limit on the size of program arguments ({ARG_MAX}
) set in the system, thus causing a (possibly isolated) failure.
Experiment
I've created 2 different set of attack vectors,
The first one, invoking itself
#!/usr/local/bin/recurse
The second one, invoking each other.
#!/usr/local/bin/recurse-1
#!/usr/local/bin/recurse-2
I've tested these 2 attack vectors on macOS Big Sur 11.5.2. And when I check the exit status using echo $?
, it shows 0, which means the processes completed successfully.
Question.
Had modern operating systems been patched against such attack? Are there research papers on this?