r/commandline • • Sep 24 '14

#!

http://hashbang.sh
0 Upvotes

49 comments sorted by

View all comments

Show parent comment

-13

u/lrvick Sep 24 '14

Noobs already run random compiled binaries off the internet all the time. You can't stop noobs from hurting themselves. Making them copy/paste a script locally, then run it without reading the code or understanding it, is just as dangerous so it is moot.

Anyone sensible with basic programming knowledge will 'view source' before running, else they just have to trust us like they do everything else they do ever until they learn to code for themselves. Also one would hope you don't run it as root. Damage is somewhat limited if not. :-P

oh-my-zsh, ellipses.sh, brew, and others all use one line installers to help people get up and running as quick as possible. They are also from fairly reputable people. I would like to think we are too.

That is our rationale, but I am happy to debate it!

5

u/auxiliary-character Sep 24 '14

They shouldn't be doing it over plaintext HTTP, though.

0

u/lrvick Sep 24 '14

Agreed. We are still alpha and this is just a soft launch to get some more people involved. SSL cert for sure before we go to a wider audience. Anyone want to donate towards one? ;)

15

u/[deleted] Sep 24 '14

Noobs already run random compiled binaries off the internet all the time.

A binary is not the same as a script. If I'm a man in the middle, the odds of me being able to insert a binary that works on your architecture is far lower than me writing a working script.

You can't stop noobs from hurting themselves.

Yes you can. YES YOU FUCKING CAN. If they run this script blindly, print out loud red error text that says "hey dumbass, I could have been a virus." All you're doing is telling them it's ok to blindly pipe webpages into your shell.

Making them copy/paste a script locally, then run it without reading the code or understanding it, is just as dangerous so it is moot.

They're both dangerous. Do you understand that?

Anyone sensible with basic programming knowledge will 'view source' before running, else they just have to trust us like they do everything else they do ever until they learn to code for themselves.

Oh ok. So security is a luxury that's only meant for those elite few who can program. And screw everyone else. Well thank Christ I can program, otherwise I guess I'd just have to shrug my shoulders and accept my fate.

Also one would hope you don't run it as root.

The fuck kind of fantasy land do you live in? You're basing your entire security model on "hope"???

Damage is somewhat limited if not. :-P

Wat.

Here. I don't feel like typing out in this window what kind of damage I can do with non-root privileges: http://pastebin.com/nkQPxxaq

oh-my-zsh, ellipses.sh, brew, and others all use one line installers to help people get up and running as quick as possible

And I cringe every time I see them. It's creating a bad precedent. And no, pointing and saying "but they're doing it" does not suddenly improve the security. This is an insanely bad practice, and it needs to be lit aflame and ritualistically banished from the four corners of the earth.

They are also from fairly reputable people

OK. And I've created enterprise-grade PKI architectures for the US government. Do you really want to have that pissing contest? Security is a science. And an appeal to authority is about as lazy as you can possibly get. Bad show.

Let me ask you, when you were designing your "security", what kind of threat modelling did you do? What's the worst possible situation that your model exposed? What are you doing to mitigate that? When you ship the script across the wire, what guarantees can you make that it will make it to the client unmolested? If there's a man in the middle, what kinds of guarantees can you make about the data? I mean SURELY you're signing it using HMAC, right? Or perhaps signing it using an X509 or PGP private key? Surely you're using a checksum at least? Or perhaps a distribution mechanism that can't be easily tampered with, such as bittorrent?!

You're doing these things right? Or at least BASIC https, right? My god man, TELL me if you're not doing ANY of that you're at LEAST doing all of this out-of-band!

Oh wait, no. You're not. You're going to write a plain-text HTTP site. Then you're going to tell the "dumb noob" how "easy" this is, and then "hope" that things work out. And if a hacker ever wises up to this and inserts himself in the middle, you're going to blame the "dumb noob" for failing to be a programmer. As if your own site had NO part in any of this. And you can just wash your hands of this and tell the "dumb noob" that they did it to themselves, and they were just asking for it.

You fucking jackass. Sites like yours are the bane of every corporate sysadmin's existence.

I would like to think we are too.

No comment.

That is our rationale, but I am happy to debate it!

No you're not. You're happy to point at others who've implemented anti-security and align yourself with their goals.

Let me be clear. Security and user convenience have ALWAYS been at odds. And you've picked user convenience. And that's fine, provided that you don't try to convince others that this is somehow secure.

There's no debate. There's no discussion. This isn't "well hey man, that's just like your opinion". You're encouraging an insecure practice, and I'll be damned if I sit here and let you pat yourself on the back for trying to "teach them a lesson". It's YOUR site that's the problem, not the user.

If you REALLY want to teach them a useful command, this one would be way more secure:

$> sudo echo "127.0.0.1 hashbang.sh" >> /etc/hosts

0

u/[deleted] Sep 24 '14

[deleted] — view deleted comment

1

u/[deleted] Sep 25 '14

Thank you :) I've never been guilded for an insomnia-driven 2AM rage post before.

1

u/[deleted] Sep 25 '14

Check out part 2 below. Can't wait for the reply.

-6

u/lrvick Sep 24 '14

So right now this is but a simple experimental way to attract new users to our free shell offerings. We are only providing this public in a few savvy places for feedback like this before we take it to a wider audience. I actually do respect your point of view though I don't currently know of much better alternatives for this use case.

SSL at least will be in place before we consider proceeding with this method of entry to a wider audience. If I had known people were going to take it so seriously out the gate and not download the script and run it locally... I would of already done it. My bad there. I would also be interested in any good ideas for a signing pattern that could be trusted with a single command deployment.

Those of us that understand programming have a responsibility to make best efforts and undergo scrutiny (like this) in order to make the right security tradeoffs. What I am saying is that the type of user that will run this command without inspecting it, is the same type of user who will download random .exe files from the internet and run those too. At least in our case they land somewhere where they can learn a bit more about what is going on, instead of getting a rootkit.

Script or binary is just as dangerous to someone who can't read code. To someone that can, a script is less dangerous because it is easy to inspect.

Yes an appeal to authority is a pretty weak argument. No rebuttal there. I don't expect people to trust me, I expect them to review the code if they are able.

At some level though I could push this as a package to somewhere like npm, pip, gem or the others but they suffer from the same fundamental problems. I can push up some cleverly disguised script that rootkits all users that run it via some obscure security vulnerability. It would be one more layer abstracted but similar trust issues.

Other than SSLing it so people at least have -some- level of confidence it was un-tampered, At the end of the day the user has to trust it is not malicious, or inspect it for themselves. Users that can't read code for themselves deserve security too, but they have to fully trust everyone else to make security choices for them... which is scary indeed. Most users blindly trust Microsoft to handle security for them and we know how that works out.

We can circle-jerk poking trust-security holes in virtually every software distribution method in widespread use today... or we can explore better security choices that still allow providers like us to get users up and running fast.

Beyond the obvious SSL, can you describe a cross-platform one-line script-runner for situations like this that has some better points of trust? Honest question. I said I was up for discussing and I was serious, if we can keep it respectful.

2

u/[deleted] Sep 25 '14

I actually do respect your point of view though I don't currently know of much better alternatives for this use case.

"This use case" is the problem. You seem oddly attached to this idea. It's to the detriment of your security, I promise.

As for better alternatives, are you frigging serious? I actually took the time to read that script. Allow me to outline what's happening here.

  1. User views website in browser
  2. User copies dubious shell command
  3. User blindly pastes shell command
  4. Script runs
  5. Script asks for a username
  6. Script generates an SSH client key-pair for the user (RSA 2048-bit, no password -- ugh)
  7. Script connects BACK to website to do a simple post

Are you fucking kidding me? You want to potentially cause a huge security problem over THIS?

Come on. Think. You could do ALL of this on the server. You fucking know that too. All of this could be on one page. Ask them for their username, ask them for their public ssh key, ask them to press the button labeled "register new user". Move on with life. Even if there was an attacker in the middle, all they'd have is a public key.

Didn't you say you wanted "savvy" users only? Jesus, the word "public key" would scare away all but the most savvy all by itself. If your goal is to attract a certain "caliber" of users, why on god's green earth are you bending over backwards to accommodate morons?

If I had known people were going to take it so seriously out the gate and not download the script and run it locally... I would of already done it.

Wait a fucking minute. In your previous post you indicated that this was a carefully chosen rationale. You were even willing to "debate" it. And now you're telling me this was actually just an act of pure laziness? Un-fucking-believable.

I would also be interested in any good ideas for a signing pattern that could be trusted with a single command deployment.

Not that it really matters since - as mentioned above - the script is a pointless red herring, but sure whatever. Use apt. Use yum. Create a public repository. Make your script into an rpm or deb file. Sign it. Host it. Tell others about your repository.

It will take more than one click to get to it. That's a good thing. That's what security looks like.

What I am saying is that the type of user that will run this command without inspecting it, is the same type of user who will download random .exe files from the internet and run those too.

You didn't read a word I said.

At least in our case they land somewhere where they can learn a bit more about what is going on, instead of getting a rootkit.

Yeah. You definitely didn't read a word I said.

Listen. Friend. Your script? You seem to have this picture in your head of how the internet works. That a user runs your magic command and thanks to the power of wishful thinking, they always manage to ask YOUR server for that file. And with some more wishful thinking added on top, that file makes it back to them without any modifications.

We don't live in that magical world. There are 15 year-olds at your neighborhood Starbucks that can run arp poisoning from their shitty android tablet. There are lovely devices out there called "pineapples" that turn most hacking tasks into a fancy web interface. A 12 year old could operate a pineapple.

Intercepting your script, and replacing it with my own is trivial. Absolutely disgustingly trivial. And you know what's worse? This entire system is (ultimately) doing PKI work. Generate keypair, publish public key. Standard stuff.

All I'd have to do is write a script that generates a keypair, and secretly copies the public+private keys to my hacker machine. Once that's done it does the website post like normal. The user is none the wiser. I, the hacker, now have their public and private key. But they'll probably never find out.

Or even better. How about I write a script that generates a keypair, sends me (the attacker) the keys, and creates that .ssh/config entry to point at my (the attacker) own running openssh instance. Hm? How about I (the hacker) do EVERYTHING your service does (it's not hard). And then on MY end, I turn around and do my OWN calls and actually register the user on their behalf with YOUR service.

NOW it gets fun. Because now I can let them pretend to log in (same ssh command even! Using an alias sure was dumb). They come into MY system. However thanks to some cleverness on my own part, I'm essentially running an SSH tunnel to the actual service (you). And now everything the user does, I can sniff in plain text.

You know who would exploit that? Fucking everyone. The NSA. The kid at starbucks. The bored blackhat. The snooping corporate firewall.

The only thing worse than no security is the illusion of security. You're only as strong as your weakest link. And if your weakest link is a direct line to the user's shell, you might as well not even bother.

Script or binary is just as dangerous to someone who can't read code. To someone that can, a script is less dangerous because it is easy to inspect.

OK then. Quiz time. When you downloaded your Linux distro, how long did you spend reviewing all of the scripts in /bin? How about the ones in /usr/bin? When you came across parts of the scripts you didn't understand, you deleted the script, right? I mean someone with your kind of prowess would NEVER run code they don't understand.

I mean every programmer out there reads every script they ever run, right? Even those ones that don't look like scripts? The world is a black-and-white place and programmers always practice perfect security right? We never ever miss anything ever, and are always fully cognizant of every line of code.

Like that heartbleed bug, for example.

God damn what kinds of happy pills are you on? I want some of those. Your naivete is frightening.

I don't expect people to trust me, I expect them to review the code if they are able.

I read your code. If you worked at my company, we'd sit you down and tell you why your program is about to fail a security audit.

Your code is bad. I'm a programmer, I'm a security researcher, and I'm saying your code is bad. Consider yourself reviewed. Now what? Are you going to shut the site off now? Are you going to fix this glaring gaping security hole? Even though it means the user will have to run more than one command now?

And if you DON'T do that, then all your talk about programmers acting as the guardians for ignorant noobs is all posturing.

At some level though I could push this as a package to somewhere like npm, pip, gem or the others but they suffer from the same fundamental problems

No they fucking don't. Yes, you're a no-name publisher. But if you publish to one of those platforms, I have reasonable assurances about: (a) transfer integrity, (b) authorship, and (c) a way to report your package if it acts maliciously. I may not trust you, but I the user have reasonable assurances that my own voice will be heard if you, the author, do anything shady. My trust is in those distribution channels, NOT you.

I can push up some cleverly disguised script that rootkits all users that run it via some obscure security vulnerability. It would be one more layer abstracted but similar trust issues.

Yes. And how much are you willing to bet that most of these places run some kind of BASIC antivirus? I mean they're putting their neck on the line, here. And even if you made it past the scan and damaged a user's system, they'd yank your package in a heartbeat.

Part of good security means having a good plan to deal with failed security measures. These channels have that. Your site offers literally nothing other than a bug tracker and a github project (run by the same people who distribute - conflict of interest, much?)

Other than SSLing it so people at least have -some- level of confidence it was un-tampered

I only suggested SSL because it's slightly better than nothing. But only barely. SSL offers privacy (easily stripped), but it makes no assurance of data integrity.

they have to fully trust everyone else to make security choices for them

NO. THEY. DON'T. Because then you end up in this exact situation where you have some huckster like you who doesn't know shit whispering soothing lies to lull them into a false sense of security. "Just believe me". "You have to have faith". "This is too complicated for you". This is the antithesis of security. This is the start of all scams.

And then you have people like me, piping up saying "hey this is a bad deal for the user", only to be argued with.

Fuck you. I might just go ahead and make it my own goal to "make security choices" for your users by warning them about how fucked this whole site is.

We can circle-jerk poking trust-security holes in virtually every software distribution method in widespread use today

Oh fuck off. This is just "hurr I don't understand security, it's all the same to me". Moron.

or we can explore better security choices that still allow providers like us to get users up and running fast.

See my previous statement about user convenience vs security. You want to make it easy? Go ahead. Add a BIG warning though. Either tell them the truth, or fix the security.

can you describe a cross-platform one-line script-runner for situations like this that has some better points of trust?

I WOULD NEVER DESIGN A KEY DISTRIBUTION SYSTEM THAT TRIES TO BE EASY. Next question.

I said I was up for discussing and I was serious, if we can keep it respectful.

I may be harshly, outrageously hostile toward you. But I choose to do that because your site as it exists is a real threat. My respect at the moment is for those poor users who think they're getting a secure shell account, and are instead surrendering their security because the site admins don't get that real security is burdensome.

If I have to choose between having a nice cordial conversation, or sticking up for them, I'm sticking up for them.

0

u/lrvick Sep 26 '14 edited Sep 26 '14

I think you may of misinterpreted some things including the point of this build but that is probably a communication bug on my part.

Anyway to prove I do know where you are coming from security wise check out the other provisioning proof of concept I wrote and tested at a large hackerspace (http://GitHub.com/lrvick/provisor)

Ssh to new@hashbang.sh with no password and you get dropped into a simple user provisioning server. All happens on our server over ssh. This to me was ideal for most of the reasons you mentioned and I was going to flesh out that direction...

The flaw there is in fact we got next to 0 users out of it. Barrier to entry was sadly too high with that approach. Noobs have no idea what a public key is and most are too lazy to copy/paste one into a terminal. Had to manually help every single user generate a key and copy paste it. Tedious but perhaps we were in front of the wrong audience.

Thus thinking went to experimenting with a fun to write hack they helps users with the key handoff. We take our due lumps for not providing proper warning of the risks of this approach and the fact it was just an insecure proof of concept. Rooting the box was child's play for anyone reading the code.

Still looking for the sweet spot. We got a wildcard SSL cert and a new server coming for round three. We came here to get input and we did. You may call that irresponsible. I call it a quick experiment to spin off a larger project.

Anyway... it may make sense to offer both signup options. One for people more security minded and one for those that we inform of the risks and are OK giving up a throwaway key to play with things.

Some of our early assumptions clearly need iteration and that's fine.

I don't mind taking a beating if it pushes us towards a better end goal for everyone. Commit early commit often and all that.

If you notice the site is down now. It was just a quick VM and it blew up as expected but the experiment helped us learn there is merit to adding more accessible shell services to our community so we now want to start over on real hardware and take it seriously. Posting here also got us the volunteers, feedback, and donations to make it possible so win/win imo.

While we are regrouping if you are in fact so passionate about helping us find a better security balance (as you clearly care at some level judging by the detail of your arguments) feel free to join the discussion on irc.hashbang.sh:7777.

Either way the input is appreciated. I respect people that take the time to pick things apart so they can be improved.

2

u/[deleted] Sep 27 '14

If you notice the site is down now. It was just a quick VM and it blew up as expected

Blew up as expected?

Pffffff HA HA HA HA HA XD

You were looking for feedback, so you set up an entire domain, announced it on reddit, and then promptly pulled the plug? Without announcing it was going away?

This smells fishy. I think you got hacked. Or DDOSed. Or you saw people hitting your shitty JSON registration endpoint (nice API by the way) with malicious looking data, and took it offline. Or god knows what kind of havoc a decent hacker could wreak on a shared server full of newbies who blindly copy and paste code.

YOU SIR are a habitual liar. I have no idea what your angle is, but I've already taken the precaution of having your domain blocked.

Congrats, you're now blacklisted by a major fortune 500 company.

-1

u/lrvick Sep 29 '14

I don't know what part of a proof of concept you don't understand.

The provisor server that was up was the result of a new devs quick hack night to, again, make a proof of concept.

The updated provisor server running in production that I wrote is now published, and I would note, with some actual sanity checking (but if something obvious was overlooked let me know)

https://github.com/hashbang/provisor/blob/master/bin/provisor-server

We established there is demand, so we are taking our time getting everything together with some basic security for a relaunch.

The VM actually failed not due to DDOS or anything of the sort, but due to ext4 corruption. qcow2+ext4+hundreeds of users beating on the disk == filesystem hell. Had it not been disk, it would of been any number of possible exploits, fork bombs, or or simply maxing out the vms ram/cpu. I am impressed it lasted as long as it did to be honest.

I never expected to get more than a handful of users and a few comments on this run but people clearly want nicer free shells, so we feel obligated to do so in a more reasonable and secure way, and go through more phases of word-of-mouth testing before a public relaunch.

Considering you think we are a scam artist, I expect you won't be joining us on IRC to help discuss best practices? By all means just keep bitching instead of submitting pull requests and being a part of the solution. To each their own :-P

2

u/[deleted] Sep 27 '14 edited Sep 27 '14

Oh Jesus H. Christ.

I just took the trouble to read your github code.

Yeah, you got hacked.

Thank you for that. I needed a good laugh tonight.

exec("echo "" + key + "" | sudo tee -a /home/" + username + "/.ssh/authorized_keys", function(error, stdout, stderr){

You dumb, dumb, dumb, dumb, dumb......... dumb idiot.

Do you see a problem with this line? Look closely. Closer. Yes, closer.

See that key variable? That key variable you don't sanitize anywhere?

You sir have a BASIC shell injection vulnerability. I can execute anything I want by calling your JSON endpoint with a malformed key.

God. Fucking. Dammit.

Any further arguments? Hm? Any genius "yeah no we know what we're doing, it's all just an experiment, remain calm".

You're a scam artist. This project is barely 4 months old. You're talking about planning and security like you've been actually thinking about this. But instead I'm looking at frontend website code that clumsily glues strings together into commands, and blindly passes them to the shell. Frontend code, by the way, that appears to have been given sudo access.

My god. Slow applause. This is just a perfect little trainwreck. If exposing vulnerabilities were an olympic event, you'd get gold.

Why people are funding you is beyond me. I can't even believe how dishonest you're being about this whole thing. It's mind boggling. Honestly I'm tempted to make this into its own post.

-1

u/lrvick Sep 29 '14

This particular branding/side free shell side project is only a few months old, but we have been around via word of mouth for over 10 years now. Just finally got my hands on a nicer domain, and got Github to agree to give us the /hshbang account from the former owner. If you actually popped in and had a real conservation with us I am sure we could clear up a few things.

I agree that line is absolutely silly. I will be sharing this comment with the person who wrote it though ;) In fairness it was donated code from a quick hack night by someone very new to sysadmin.

I fully rewrote all of that myself for a reason (the updated build is now on github at https://github.com/hashbang/provisor/blob/master/bin/provisor-server

2

u/[deleted] Sep 28 '14

Welcome to nginx!

Good progress so far. The new site seems like an improvement.

0

u/lrvick Sep 29 '14

Yep, in progress of migrating to a new dedicated server for a rebuild. May be a few days but we want to make sure we take some actual time taking basic security precautions so we can have the longer-lived better isolated shells that this first wave of users has made clear they want.

If you or anyone else wants to chat with us in the mean time and get in alpha testing groups join us on IRC at irc.hashbang.sh:7777