News for hackers. Stuff that matters.
Re:Is curl|bash insecure? by Mojah on Friday September 25, 2015 @07:27AM (#10277500)
One of the potential problems here is the fact that even just inspecting the "curl" result of the file can trick sysadmins into executing code they did not wanted executed.

Imagine the following scenario:

$ curl something.tld > installer.sh

$ cat installer.sh

"Hey, that looks safe, I'll go ahead and execute it".

$ bash installer.sh

If the install-file had terminal escape sequences, it could have been used to trick anyone into executing code they had no intention to execute.

More here, if you're interested: https://ma.ttias.be/terminal-escape-sequences-the-new-xss-fo...

Bottom line: assume everything you download from the internet is malicious in nature and inspect it with every possible tool you have available. And even then, run it in a sandboxed environment wherever possible.

Re:Is curl|bash insecure? by slasaus on Friday September 25, 2015 @07:38AM (#10277541)
use `cat -v installer.sh`

     -v      Displays non-printing characters so they are visible.  Control
             characters print as `^X' for control-X, with the exception of the
             tab and EOL characters, which are displayed normally.  The tab
             character, control-I, can be made visible via the -t option.  The
             DEL character (octal 0177) prints as `^?'.  Non-ASCII characters
             (with the high bit set) are printed as `M-' (for meta) followed
             by the character for the low 7 bits.
http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man1/...
Re:Is curl|bash insecure? by ketralnis on Friday September 25, 2015 @02:33PM (#10279843)
Use "install.sh --oh-and-don't-delete-all-of-my-files=true".

If it's not the default, it's not what's going to happen.

Re:Is curl|bash insecure? by skrebbel on Friday September 25, 2015 @08:38AM (#10277766)
> Bottom line: assume everything you download from the internet is malicious in nature and inspect it with every possible tool you have available. And even then, run it in a sandboxed environment wherever possible.

Ehhh. Ok that's not very actionable advice. I downloaded my entire OS from the internet.

Re:Is curl|bash insecure? by s1lver on Friday September 25, 2015 @02:52PM (#10279955)
There's a checksum for each package and for the CD. Back in the day, people cared about that.
Re:Is curl|bash insecure? by kentonv on Friday September 25, 2015 @05:06PM (#10280692)
How do you verify the checksum?
Re:Is curl|bash insecure? by mrbig4545 on Friday September 25, 2015 @07:35AM (#10277528)
Very interesting. I'm always (ab)using cat for this, and I keep meaning to stop, but I forget. After seeing this I'll definitely stop.

Thanks!

Re:Is curl|bash insecure? by xienze on Friday September 25, 2015 @07:29AM (#10277508)
So open it in an editor?
Re:Is curl|bash insecure? by Mojah on Friday September 25, 2015 @07:31AM (#10277512)
Yes, or view via `less` or a hexdumper.

But how many sysadmins do you know rely on `cat` for their day-to-day use? Too many, I reckon.

Re:Is curl|bash insecure? by slavik81 on Friday September 25, 2015 @08:18PM (#10281516)
You should be cautious about running less on untrusted input: http://seclists.org/fulldisclosure/2014/Nov/74
Re:Is curl|bash insecure? by andyzweb on Friday September 25, 2015 @10:56AM (#10278519)
`cat` abuse is rampant
Re:Is curl|bash insecure? by sn on Friday September 25, 2015 @02:32PM (#10279837)
Add "alias cat='cat -v'" to your login profile then.
Re:Is curl|bash insecure? by DonHopkins on Friday September 25, 2015 @08:08AM (#10277630)
Better python than bash or perl. At least the code shouldn't look like line noise. When's the last time you tried to read through a gnu ./configure file?