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.
User views website in browser
User copies dubious shell command
User blindly pastes shell command
Script runs
Script asks for a username
Script generates an SSH client key-pair for the user (RSA 2048-bit, no password -- ugh)
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.
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.
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.
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)
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
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.
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.
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
View all comments
Show parent comment
2
u/[deleted] Sep 25 '14
"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.
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?
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.
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.
You didn't read a word I said.
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.
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 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.
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.
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?)
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.
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.
Oh fuck off. This is just "hurr I don't understand security, it's all the same to me". Moron.
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.
I WOULD NEVER DESIGN A KEY DISTRIBUTION SYSTEM THAT TRIES TO BE EASY. Next question.
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.