Live data from Hacker News

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

0day.work

21–30 of 60 posts

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

#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 desktop system running X
    ~/.Xauthority
    ~/.mozilla/
Yes, protecting ~/.id* with a passphrase is important and leaking ~/.ssh/known_hosts can have consequences, but this type of exploit shouldn't even be possible. Don't share your homedir - which contains most user-level config files on UNIX systems - with the world. DocumentRoot needs to be contained in a subdir. (edit: or even better, contained somewhere outside of /home where it won't overlap with common file paths)

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

#22
Off topic but I personally find the use of the female pronouns in technical articles distracting. Referring to a hypothetical "Attacker" as "he" or "they" is what my brain expects which means I can parse the text faster and get to the point quicker. When the "attacker" is a "she" I'm surprised and the flow is interrupted. I'm forced to think about the fact that the author is signaling to me that they believe that women can be anything they want and shouldn't be boxed in into predetermined gender special professions etc.

Perhaps one might argue that this interruption is precisely the goal, and therein lies my point: I see this choice of words as a form of guerrilla advertisement by the author to showcase their agenda about a subject which has no relevance to the topic of the essay. Basically every "she" is a little ad for "Women's Rights" (for lack of a better term), and ads are annoying. Note that this has nothing to do with my personal opinion on the subject. It's just like mangling in an opinion about climate change, veganism etc. While legitimate and worthwhile, it shouldn't be purported as part of a technical article.

I'm obviously "zooming-in" a little on a minute matter, but nevertheless it's a minor pet peeve of mine. I wonder how others see this.

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

#23

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…

I've encountered a system administrator who left the admin LDAP password (for the entire organization) in plaintext in a world accessible script. I'd tell you the name but I don't want to drag the institution through the mud unnecessarily.

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

#24
post #20

Earlier quoted context omitted.

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

Are you sure about that?

Only time will tell if I am in fact right. I'm counting on being more right than the guys who have dedicated staff who routinely shell into their servers.

I suppose we'll see if companies with sysadmins have more breaches than the guys who run their own ops using container orchestration etc. I think I'd go even odds $1k that over the next five years, most large scale data breaches will be at organizations where sys admins run the majority of ops.

There's a whole new category of errors you can make (making your bucket open, etc.) with cloud providers but the tooling has better defaults.

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

#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?

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

#29
post #17

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…

I would disagree: The problem is developers (and users in general, but their lack of formal training is an excuse) being comfortable using interfaces and abstractions they don't fully understand. Note that the result of this might sound like it makes the idea of a professional system administrator invalid but that's not true: I think the better SAs of the past had a thorough understanding of what their tools did and…

> 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 'emergent' property between separate self-contained programs is fully within that domain.

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

#30
post #17

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…

I would disagree: The problem is developers (and users in general, but their lack of formal training is an excuse) being comfortable using interfaces and abstractions they don't fully understand. Note that the result of this might sound like it makes the idea of a professional system administrator invalid but that's not true: I think the better SAs of the past had a thorough understanding of what their tools did and…

I am agreeing with what you wrote, though. Or at least I am trying to.

I have seen numerous times the results of that, where for instance, a developer creating a tool decides that his interpretation of a bad requirement is satisfied in a poor way. Or a sysadmin deciding that a default configuration is good enough because he did `mv conf.example to conf`, and it works.

I guess what I am trying to say is that the learning curve given the complexity of software / systems now a days, and the lack of judgement and training by the users / developers / sysadmins of those systems results in decisions where risk is not taken in to account.

I miss the time where people genuinely knew what they were doing, and had a mindset that allowed them to avoid / prevent risk in the decisions they take during their daily tasks.

Post reply on HN