URL is also a shell script that executes some malicious(?) code
31–40 of 74 posts
Re: URL is also a shell script that executes some malicious(?) code
#32Re: URL is also a shell script that executes some malicious(?) code
#33Earlier quoted context omitted.
Because zsh has usually the url-quote-magic feature enabled which automatically escapes all special characters typed or pasted if the current argument is identified as URL.
Most likely it escapes enough to prevent code execution, but last time I tried it didn't escape all special characters out of the box: https://news.ycombinator.com/item?id=29071196
Re: URL is also a shell script that executes some malicious(?) code
#34Re: URL is also a shell script that executes some malicious(?) code
#35Re: URL is also a shell script that executes some malicious(?) code
#36Am I missing something, or is this basically "copy this into your terminal" followed by "oh look, it did something"?
Re: URL is also a shell script that executes some malicious(?) code
#37Yes, $() inside of double quotes is expanded. This is a documented and standardized feature of all shells derived from the bourne shell.
Anyway, shells are dumb and dangerous. A real interactive language should simply have a text box for text. I guess I could write a usual 10 paragraph rant on this but it really is that simple.
1. Day of the seal soon.
Re: URL is also a shell script that executes some malicious(?) code
#38Earlier quoted context omitted.
I mean, it like dodgy to any user familiar with URLs surely? Wouldn't wget -qO - www.example.com/script | sh catch far more of the uninitiated?
People go nuts about curl | bash but then grab random packages off pip/gem/npm/brew/VimPlug/packages.el/VS Code without so much as a second look and they can all run arbitrary code too.
Re: URL is also a shell script that executes some malicious(?) code
#39Clever, but I really hope nobody is going to blindly copy-paste-go! a URL like that. Especially if you're technical enough to use a terminal, you should know better.
1. Your epistemic reasoning capabilities are broken (as in, why do you think people should know better?)
2. You are just adopting an ad-hoc philosophy based on how shells work. If interactive languages had separate text inputs instead of just parsing a stream of text from stdin, pasting would always be safe. One may be tempted to call this "UN*X braindamage".
3. You appear to possibly believe in checking a URL before opening it type voodoo as well, regardless of shell issues
Re: URL is also a shell script that executes some malicious(?) code
#40Am I missing something, or is this basically "copy this into your terminal" followed by "oh look, it did something"?
Ah yes, the legendary UN*X hacker who never pastes into his terminal.
There is literally no way to secure against people being hacked if the scenario is a user blindly following instructions without looking at / thinking about them.