Earlier quoted context omitted.
I understand your point, but there is a big difference between running a 20 year old program written in C and running a shell script that someone with one or two years of experience hacked out in ten minutes. To answer your question, I do fuzz many of the GNU utilities that I use regularly, and I have discovered vulnerabilities that way. Of course it is unreasonable to read all of the code that runs in our operating…
Plus the risk associated with running Linux or any of the executables is orders of magnitude lower than copy/pasting and running a bash script one found on the internet.
Show HN: Run unknown shell script with a line-by-line confirmation prompt
51–60 of 86 posts
Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt
#52What would be amazing is a tool that analyses the script first, figures out folders and files (and networking) it influences and allows to sandbox it accordingly. This script wants to modify: - /usr/local/program/* - /etc/program/* - $HOME/.program Do you want to execute this? [Yes/No] ..because you know, what happens when you execute a script that does rm -rf /usr in the 100th step?
Very difficult to do in any kind of robust way. A script can run all kinds of things and use myriad forms of obfuscation, causing all kinds of obscure side effects.
This would still allow the script to steal data though, as installer script generally require internet access.
Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt
#53Earlier quoted context omitted.
Excuse my ignorance but when are you copying commands from a site you don't trust? If I don't trust a site I don't run anything it suggests to me, copy hijacking or no.
Realistically, I copy all sorts of commands from all sorts of sites. Some fool has a blog saying "Run `kubectl blahblah -o yaml`" and I copy `kubectl blahblah -o yaml` but he can then inject nonsense in it so when I paste it something else runs. Fortunately, my terminal emulator doesn't run on paste.
Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt
#54Earlier quoted context omitted.
Realistically, I copy all sorts of commands from all sorts of sites. Some fool has a blog saying "Run `kubectl blahblah -o yaml`" and I copy `kubectl blahblah -o yaml` but he can then inject nonsense in it so when I paste it something else runs. Fortunately, my terminal emulator doesn't run on paste.
Which terminal emulator do you use, and what happens if you paste something including newline characters?
The entire newline-inclusive text is pasted into the terminal and nothing is run until I hit Return.
Input: https://pastebin.com/LpDW2r0d
Result: https://streamable.com/94z5oq
Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt
#55> Useful for running unknown scripts Or just, you know, read them before you run them.
"Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something."
Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt
#56What would be amazing is a tool that analyses the script first, figures out folders and files (and networking) it influences and allows to sandbox it accordingly. This script wants to modify: - /usr/local/program/* - /etc/program/* - $HOME/.program Do you want to execute this? [Yes/No] ..because you know, what happens when you execute a script that does rm -rf /usr in the 100th step?
That doesn't mean what you want is completely unattainable, you just need to figure out whether you're okay with false positives, false negatives, or your tool just giving up on certain scripts (or some combination thereof).
Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt
#57Earlier quoted context omitted.
I distrust every site. What sites do you trust, and why do you assume they haven't been hacked or xss'd?
Because that's an unrealistic threat model for most users.
Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt
#58Earlier quoted context omitted.
Very difficult to do in any kind of robust way. A script can run all kinds of things and use myriad forms of obfuscation, causing all kinds of obscure side effects.
I imagine this could be done by actually running the script in some sort of sandbox, having file changes written to overlayfs at first. This would still allow the script to steal data though, as installer script generally require internet access.
Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt
#59Earlier quoted context omitted.
I imagine this could be done by actually running the script in some sort of sandbox, having file changes written to overlayfs at first. This would still allow the script to steal data though, as installer script generally require internet access.
This would still be defeated by any script that is nondeterministic which is a real possibility if you're trying to defend against malicious scripts or against very poorly written scripts.
Re: Show HN: Run unknown shell script with a line-by-line confirmation prompt
#60What would be amazing is a tool that analyses the script first, figures out folders and files (and networking) it influences and allows to sandbox it accordingly. This script wants to modify: - /usr/local/program/* - /etc/program/* - $HOME/.program Do you want to execute this? [Yes/No] ..because you know, what happens when you execute a script that does rm -rf /usr in the 100th step?