Live data from Hacker News

Pwning your web server the easy way or why exposing –/.ssh/ is a bad idea

0day.work

41–50 of 60 posts

Re: Pwning your web server the easy way or why exposing –/.ssh/ is a bad idea

#41
post #28
post #21

> For some of them, the www-data's home directory is the DocumentRoot “Well, there’s your problem.” Don't expose any ${HOME} to the world! SSH keys are not the only exploitable file in a typical homedir (or even auto-generated from /etc/skel/)! A few files that come to mind: # other keys ~/.gnupg/ # probably lots of app-specific risks # (e.g. saved login info) ~/.cache/ ~/.config/ ~/.local/share/ # if it's also a des…

why would www-data need a private key though?

[deleted]

Re: Pwning your web server the easy way or why exposing –/.ssh/ is a bad idea

#42
post #37

Earlier quoted context omitted.

> being comfortable using interfaces and abstractions they don't fully understand. I don't think it was an interface or abstraction that got the user in trouble here, they were using a pair of systems in ways that were fine on their own, but combined led to an emergent vulnerability that they didn't even know to consider. It may be sheer pedantry but I really do see this as a unique "systems" issue, and this type of…

I think it is an abstraction: the one underlying both of those components that combined to create the vulnerability. The abstractions provided by the OS compose in very surprising and hard to predict ways for humans. This is why newer systems don’t use the same abstractions (JavaScript and browser APIs), or else sandbox them much more thoroughly (iOS). Those newer tools have newer problems, of course, but I think a l…

> The abstractions ... [are] very surprising

From this[1] insightful video essay by Kyle Kallgren:

>> Metaphor Shear -- That feeling all users experience when you realize the metaphor you are working in is bogus. When the computer fails you and you remember that there are a hundred translations between input and output. Codes and translations we don't have the time or patience to do ourselves. Intellectual labor that we've surrendered to a device.

>> The joke at the center of Douglas Adams Hitchhiker's Guide To The Galaxy is about metaphor shear. The answer to an important question lost on its long journey from input to output. A computer glitch so huge, so strange and so embarrassing that its programmers have to make a computer the size of a planet to file a bug report.

[1] https://www.youtube.com/watch?v=hr9_DcO6G3A

Re: Pwning your web server the easy way or why exposing –/.ssh/ is a bad idea

#43
post #39
post #36

Earlier quoted context omitted.

Was there ever a time like that? I’m only in my 20s, but I can’t recall a time when most computer systems weren’t terrible. (I love computers, but honestly, they suck ass.)

Unverifiable working theory (I didn't live through the 80s myself): I think computer systems were always terrible (I think our brains were only ever able to properly/ completely grok the old 8- and 16-bit microcomputers and early game consoles), but because early networks and computer systems were built almost entirely on a combination of naivete and lack of awareness on the part of the large corporations, the sysadm…

I especially agree with your last note. Again, I’m young, but it seems to me that the shortcomings of humans have a largely homogenous distribution through time and space.

Re: Pwning your web server the easy way or why exposing –/.ssh/ is a bad idea

#44
post #38

Earlier quoted context omitted.

> Only time will tell if I am in fact right. I guess you prove a point here: you trust that the deployment of your GKE module allows you to be safe, so your investment vs risk trade seems to satisfy you. But you, yourself, cannot even predict how insecure you are at the moment due to the complexity of the software solutions you are using. > I suppose we'll see if companies with sysadmins have more breaches than the g…

No one can really predict their security accurately. Say you maintain a bare-metal server in a data center that your company controls. How much do you know about its physical security? The protocols for admitting new staff? Do you rely on your company’s physical security team and HR? Are any of those functions contracted externally, even partially? How much do you know about the network security? Do you rely on a net…

How well do you vet your IT staff? I was once the recipient of an inside job: http://boston.conman.org/2004/09/19.1

Re: Pwning your web server the easy way or why exposing –/.ssh/ is a bad idea

#45

This is what I have learned in many years of work: people who know systems should be let to handle those systems. This is what happens when a developer is left to do the work that a system administrator should be trained to do - not all are -. For a developer, in most cases, "just works" is the end goal, when referring to systems. Not "how it works", and what are the implications of making it work like this. This rea…

Isn't this exactly the reason people say PHP is awful, though? Hidden pitfalls if you just do what works and aren't security conscious, and too much flexibility instead of one clean standard. And at the end of the day, putting blame on rookie users who keep wandering onto the busy street and get run over by a bus.

At this point there is no reason sane network security shouldn't be baked into popular Linux OSes (except that the cloud is busy abstracting the problem away). Sure, real sysadmins can have the keys to the gun safe, but these are structural problems that could and should be mitigated through modernizing OS design.

Re: Pwning your web server the easy way or why exposing –/.ssh/ is a bad idea

#46
post #40
post #28

Earlier quoted context omitted.

why would www-data need a private key though?

It doesn't, but if someone is shelling around on the server, they might throw a key in there for convenience, maybe in order to scp something from another machine, and then forget to remove it when they're done. One can debate whether the root cause is forgetfulness, or rather that people shouldn't be sshing into prod servers to begin with.

[deleted]

Re: Pwning your web server the easy way or why exposing –/.ssh/ is a bad idea

#47
post #40
post #28

Earlier quoted context omitted.

why would www-data need a private key though?

It doesn't, but if someone is shelling around on the server, they might throw a key in there for convenience, maybe in order to scp something from another machine, and then forget to remove it when they're done. One can debate whether the root cause is forgetfulness, or rather that people shouldn't be sshing into prod servers to begin with.

Ever putting private data in a public place, is an unacceptable risk. Even if you remember to remove it there is a window of vulnerability. And there are people out there constantly probing for weaknesses.

Re: Pwning your web server the easy way or why exposing –/.ssh/ is a bad idea

#49

This is what I have learned in many years of work: people who know systems should be let to handle those systems. This is what happens when a developer is left to do the work that a system administrator should be trained to do - not all are -. For a developer, in most cases, "just works" is the end goal, when referring to systems. Not "how it works", and what are the implications of making it work like this. This rea…

Sys admins are dead. I have GKE now via a reliable Terraform module. None of my production instances can be logged onto.

I understand what you mean, but your GKE instances probably can be logged onto: `gcloud compute ssh --zone= `

Both COS and Ubuntu nodes are integrated with IAM, so this transparently provisions a user on the node, and copies a temporary SSH key. If your GCP user has the appropriate IAM permissions, they will also be able to use `sudo` to execute commands as root.

Re: Pwning your web server the easy way or why exposing –/.ssh/ is a bad idea

#50

This is what I have learned in many years of work: people who know systems should be let to handle those systems. This is what happens when a developer is left to do the work that a system administrator should be trained to do - not all are -. For a developer, in most cases, "just works" is the end goal, when referring to systems. Not "how it works", and what are the implications of making it work like this. This rea…

Isn't this exactly the reason people say PHP is awful, though? Hidden pitfalls if you just do what works and aren't security conscious, and too much flexibility instead of one clean standard. And at the end of the day, putting blame on rookie users who keep wandering onto the busy street and get run over by a bus. At this point there is no reason sane network security shouldn't be baked into popular Linux OSes (excep…

Literally nothing you said makes sense.
Post reply on HN