Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store .sorry and .oldshell outside of user dir #156

Open
kpengboy opened this issue May 18, 2020 · 3 comments
Open

Store .sorry and .oldshell outside of user dir #156

kpengboy opened this issue May 18, 2020 · 3 comments

Comments

@kpengboy
Copy link
Member

kpengboy commented May 18, 2020

We currently store the sorry reason and old shell in the ~/.sorry and ~/.oldshell files respectively of the sorried user. This is a dangerous practice, because:

  • If the user had something valuable in the ~/.sorry file, we overwrite it.
  • If the user had an existing ~/.oldshell file, we lose the info about the old shell.
  • Worst of all, ~/.sorry could be a symlink created by an attacker to point to important system files. In that case, we would just overwrite those files. (And the scary thing is the script, running as root, actually has permissions to do this.)

We should store this information elsewhere, preferably in a directory that only we control.

@cg505
Copy link
Member

cg505 commented May 28, 2020

Worst of all, ~/.sorry could be a symlink created by an attacker to point to important system files. In that case, (And the scary thing is we are writing to those files with a script running as root.)

This can be addressed without moving these files outside of the user homedir (and probably should since this is definitely a concern). FWIW, we will overwrite the symlink unless it is to a directory (in which case we will place the sorryfile in the linked directory).

@kpengboy
Copy link
Member Author

Still though, I think that assuming we control certain arbitrary files in the user's homedir is an antipattern.

@axmmisaka
Copy link
Contributor

axmmisaka commented Jun 11, 2020

While storing stuff elsewhere would be a better idea (or probably in a separate db or somethin), a workaround would be create placeholders owned by sudo at ~/.sorry and ~/.oldshell and stuff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants