4 ms·
> The ! lets you invoke an external command. Also useful for privilege escalation... If a script running as root uses less (or vi), just do "!bash" and you ha
by GuB-42 10mo ago
> The ! lets you invoke an external command.
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.
- jmholla 10mo agoYou 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. [0]: https://github.com/gwsw/less/blob/master/README#L67-L70 https://github.com/gwsw/less/blob/master/README#L67-L70