Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 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.





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.

[0]: https://github.com/gwsw/less/blob/master/README#L67-L70




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: