News for hackers. Stuff that matters.
Re:Don't Copy-Paste from Website to Terminal by ams6110 on Sunday April 07, 2013 @03:36PM (#5508362)
And another good reason to not work in root shells routinely. As damaging as something like this might still be, it will be confined to just one account if you are not running as root.
Re:Don't Copy-Paste from Website to Terminal by h2s on Sunday April 07, 2013 @03:59PM (#5508488)
Sadly this is not complete protection. Many Linux distributions configure sudo to prompt for the password only once every 15 minutes or so. If you have successfully executed sudo in your terminal within the last 15 minutes, any malicious code that you run can silently escalate its privileges to root just by starting with "sudo -i;".

You need to have the following in /etc/sudoers in order to be truly protected by not being logged-in as root:

    Defaults timestamp_timeout=0
Re:Don't Copy-Paste from Website to Terminal by micampe on Sunday April 07, 2013 @03:54PM (#5508464)
I always thought this concept to be silly unless you are a sysadmin.

For most people who are not sysadmins losing ~ is much worse than losing /. Go ahead and wipe my OS, I just care for my photos to be safe.

Re:Don't Copy-Paste from Website to Terminal by gislifb on Sunday April 07, 2013 @04:27PM (#5508601)
Could you please tell me in which directory your ~ directory is and in which directory that directory is?
Re:Don't Copy-Paste from Website to Terminal by micampe on Sunday April 07, 2013 @07:44PM (#5509242)
You either enjoy pointless nitpicking or have entirely missed my point.
Re:Don't Copy-Paste from Website to Terminal by hollerith on Sunday April 07, 2013 @10:02PM (#5509622)
No, he did not: typing rm -rf / into a root shell will delete the OS and your home directory.

It is a little more complicated than that, but the complications do not really affect very much. Last time I installed Debian around 2005 the documentation encouraged me to give /home its own partition, in which case rm -rf / will not get it. But on OS X the default is to put everything in one big partition and I kind get the feeling that Linux has moved that way, too. And even if /home is on its own partition, there are many ways for the malefactor to get /home, e.g., rm -rf /home.

Re:Don't Copy-Paste from Website to Terminal by micampe on Monday April 08, 2013 @12:02AM (#5509922)
Yes, you both did. To a user losing / is just as bad as losing ~, because ~ is all she cares about, not her OS settings, hence why I think the idea that running as root is worse than running as an unprivileged user is silly in this context.

They are effectively the same: an unknown script executing "rm -rf ~" with an unprivileged user is going to cause as much grief as root running "rm -rf /".

I couldn't care less that the system is still up if all my data is gone.

Also, I believe “rm -r” traverses mount points.

Re:Don't Copy-Paste from Website to Terminal by acomjean on Monday April 08, 2013 @04:35PM (#5514383)
at a place I used to worked they aliased rm to rm -i by default. It was kind of annoying but we all knew why they did it.
Re:Don't Copy-Paste from Website to Terminal by vacri on Sunday April 07, 2013 @07:19PM (#5509163)
Not to mention that it's sysadminny-types that you turn to when your OS is hosed and you want to recover data from your drive - having little or no sysadmin skills means recovery and reinstall is very much not trivial.
Re:Don't Copy-Paste from Website to Terminal by jstanley on Sunday April 07, 2013 @03:45PM (#5508416)
Even if you're not root, if you're having trouble setting something up (which is why you're copying things off the web in the first place), you likely have a fresh sudo timestamp, so the attacker could become root anyway.
Re:Don't Copy-Paste from Website to Terminal by eli on Sunday April 07, 2013 @03:45PM (#5508413)
True, though not very comforting since it's presumably running in a shell that has access to all your files and is where you do all your work.
Re:Don't Copy-Paste from Website to Terminal by nodata on Sunday April 07, 2013 @03:44PM (#5508411)
I think that's bad advice: you would likely be running as your user account, the one owning all your important data.
Re:Don't Copy-Paste from Website to Terminal by TheJH_ on Sunday April 07, 2013 @04:50PM (#5508694)
Well, if I had really wanted to build a serious attack instead of a harmless PoC, I'd have downloaded a second stage via `curl <url> | sh`, and that script would, for example, set aliases in your shell for `su` and `sudo` that call the real commands but log your password in the background. Unless you're using requiretty, of course, but I don't assume that you're using a real tty.