Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> - env variables are often easily accessible by other processes

A process would need to have the same permission (same user) or root to read /proc/$PID/environ no? or what mechanism is there for a process to read another process env vars (not children processes, that was already mentioned)? unless of course, a process dumped them in some world-readable file (like logs as mentioned) or some other silly way



Exactly. The operating system already offers security for environment variables: use it. And you get the benefit of increased security in other places by not sharing users between applications.


except no it does not, env variables wherent designed to be secure and the degree of secruity the system provides is like a bad joke if you take security serious

still works if your system is a single application container

otherwise it does not


I'm not sure I agree. If that were true, the security of the user system itself would also be a bad joke and it's not. Regardless, what I meant is that the OP made it sound like they're using the same server and user and container for multiple applications, but if they did things correctly, the risk of sharing environment variables across applications wouldn't exist.


The problem is the env stays readily accessible to most programs with similar permissions and all child programs if no special actions are taken.

This is (part of) the reason programs accept secrets like passwords normally only (or strongly recommended) over stdin or similar instead of env variable or cmdline.

Or why it's not rare (or was in the past, probably is today) to have a encrypted cert file and inject the password to it through a side channel.

It's also not rare for programs to dump environment variables in various situations, including to logs. Or e.g. an intrusion detection program might snapshot all programs running + their cmd arguments + their (creation) env and then run analysis on it.

And while you can use e.g. selinux and similar to add a ton of security and prevent such issues, or use systemd to run the program under ad-hoc users with minimal permissions and various isolation it's very often not done.

EDIT:

To be clear I'm not saying you can't use secrets in environment variables safely.

I'm saying by default by their design environment variables are not "secure for secret passing". But many things for which stuff like that is true can, under the right circumstances, still be used securely.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: