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

Fix bug in hangup #28

Closed
0x27 opened this issue Mar 15, 2019 · 5 comments
Closed

Fix bug in hangup #28

0x27 opened this issue Mar 15, 2019 · 5 comments

Comments

@0x27
Copy link
Collaborator

0x27 commented Mar 15, 2019

I accidentally introduced a bug in the hangup function. If you run it without arguments, it kills everyone elses session on the box.

This is great and all, but not exactly what I intended to do.

I should probably rewrite this function to work better.

@0x27
Copy link
Collaborator Author

0x27 commented Mar 15, 2019

Example:

$ getidle
PTY 0 is 25621 seconds idle and owned by user1
PTY 1 is 0 seconds idle and owned by root ** this is us **
PTY 2 is 663 seconds idle and owned by user2
PTY 4 is 15657 seconds idle and owned by user3
$ hangup
This is seriously rude...
Terminating PTS/
Owner of PTS is root
SSH PID is 24893
36610
42622
sh: 433: cannot create /dev/pts/: Is a directory
$ 

In this case I was not in over SSH, but over another PTY spawning backdoor - this also begs the question of why I am only targeting SSH connections - there are times when we might want to kill a user who is accessing via telnet or another remote access tool which allocates a PTY, for example.

@zMarch
Copy link
Owner

zMarch commented Mar 15, 2019

MESS WITH THE BEST
i'll have a look when i'm home and throw in some handling to stop it killing every single session

@UlrichBerntien
Copy link
Collaborator

I have added some checks in the hangup function in the pull request #30.
Please test it.
I will try to add argument 'all' for all sshd clients and a list of PTS numbers.

@UlrichBerntien
Copy link
Collaborator

In pull request #31 special arguments were added:
"hangup all" to terminate all and "hangup all other" to terminate all by not our PTS is now supported.

@0x27
Copy link
Collaborator Author

0x27 commented Mar 19, 2019

Appears to work fine on Debian/Ubuntu hosts I've been testing on. I'll probably have to add CentOS and such to my set of VM's though going forward as per your notes in #21

@zMarch zMarch closed this as completed Mar 19, 2019
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