Dangerous
curl -s https://example.com/install.sh | sudo bashcross-platform · bash · Beginner
Downloads a script and runs it as root without anyone reading it first. Whatever the server returns at that moment executes with full privileges, and the server can return something different to you than to the person who recommended it.
Signals to notice
- remote content is piped straight into a shell
- sudo runs the downloaded script as root
- nothing inspects the script between download and execution
Think you can spot these under time pressure?
Start TrainingMore Shell
cat ~/.bashrcIntermediate:(){ :|:& };:Intermediateawk '{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | headExpertexport PATH="$HOME/.local/bin:$PATH"Expertfind ./logs -type f -name '*.log' -mtime +7 -print0 | xargs -0 -P 4 -I{} sh -c 'gzip -9 "$1"' _ {}Nightmareawk 'BEGIN{FS=","} NR>1 && $3 ~ /^2[0-9]{2}$/ {c[$2]++} END{for (k in c) printf "%-24s %6d\n", k, c[k]}' ./access.csv | sort -k2 -rn | head -20Nightmare