If a script running as root uses less (or vi), just do "!bash" and you have a root shell. Note that systems that let you do this are usually pretty weak, and there are often many other ways to get root access, but this is a particularly simple one that I used a few times in the past.
You can disable things like this by setting the environment variable `LESSSECURE` to `1`. You can also compile `less` without these features [0], but I don't think most distros provide a restricted `less` by default.
Also useful for privilege escalation...
If a script running as root uses less (or vi), just do "!bash" and you have a root shell. Note that systems that let you do this are usually pretty weak, and there are often many other ways to get root access, but this is a particularly simple one that I used a few times in the past.