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

Feature Request: Socks Session Manager - out of file handles #594

Open
ad0nis opened this issue Mar 29, 2019 · 7 comments
Open

Feature Request: Socks Session Manager - out of file handles #594

ad0nis opened this issue Mar 29, 2019 · 7 comments

Comments

@ad0nis
Copy link

ad0nis commented Mar 29, 2019

When relaying on especially noisy networks, I've run into multiple situations that completely exhausted file handles on my attacking system due to the number of authenticated sessions I've collected in ntlmrelayx.py. It would be great if there was some way to manage connected sessions, such as disconnecting specific users/machines, adding users/machines to a list of principals not to be relayed... My situation right now is that I have so many useless machine relays that I cannot collect any more privileged user relays, effectively stopping my attack until ntlmrelayx.py is restarted, losing time and effort for the earlier caught valid sessions. Would be wonderful if this could delete sessions matched by a regular expression/wildcard for removing many system sessions at once.

@asolino
Copy link
Collaborator

asolino commented Mar 29, 2019 via email

@ad0nis
Copy link
Author

ad0nis commented Apr 1, 2019

I don't have an exact count for how many sessions I was up to before hitting this error, but I could see that the error had been hit in the ntlmrelayx.py socks console because errors were being thrown like the following:
"[-] SMBCLient error: [Errno Connection Error (10.1.2.3:445)] [Errno 24] Too many open files"

@ad0nis
Copy link
Author

ad0nis commented Apr 1, 2019

I don't have a good example of it on hand, but this problem got to the point where even running "socks" in the socks console would fail to list the authenticated sessions until a file handle opened... (Just adding more detail, hoping that helps.)

@dirkjanm
Copy link
Contributor

dirkjanm commented Jun 8, 2019

In the meanwhile, there is a startservers and stopservers command so you can (temporarily) turn off the listening part for new relay connections while continuing using the SOCKS features, which was added exactly for this reason.

@ad0nis
Copy link
Author

ad0nis commented Oct 28, 2021

OK - It's been a while since I've had this crop up, but it still happens on especially noisy networks, or in situations where I get lazy and target every system without SMB signing required... At one point, I did a little debugging and realized that this may actually just be hitting max open file descriptors/handles defaults in kali... If you run ulimit -a on kali, you'll find a maximum open file descriptors of 1024. I believe this is the limit I was running up against... What I would propose as a solution would be to get that count at start time, and then relay up to that count minus two, to ensure there is always one remaining file handle to run socks with, and one remaining file handle to relay an attacker connection through the proxy. From there, adding a warning once that max count is hit so that the user knows that no further relayed sessions would be ideal, perhaps even telling them that they can increase this limit, and warning of instability if the limit is increased...

@mpgn
Copy link
Contributor

mpgn commented Oct 28, 2021

check #1113 @ad0nis

@ad0nis
Copy link
Author

ad0nis commented Nov 3, 2021

@mpgn: Responded in #1113.

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

4 participants