small-tech / should-i-pipe-it

Is this installation script safe to pipe into my shell?
GNU Affero General Public License v3.0
18 stars 1 forks source link

TOCTOU: always say no #14

Open leif opened 3 years ago

leif commented 3 years ago

It is never safe to pipe curl to bash. The practice of verifying a different fetch of a URL than the one which is actually executed, as this site is currently advocating that users do, is an easily-exploitable time-of-check to time-of-use vulnerability.

A malicious webserver can determine if the script download is actually being piped directly to bash, so, it can serve innocuous code when it isn't and malicious code when it is.

should-i-pipe.it should always say no. If you want to verify things somehow before running them, you should verify the copy you're going to run.