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

Remove ability for gvm user to obtain shell and restrict the port-forwards possible #181

Open
ndejong opened this issue May 26, 2021 · 2 comments
Assignees
Labels
help wanted Extra attention is needed Priority:Low

Comments

@ndejong
Copy link

ndejong commented May 26, 2021

Is your feature request related to a problem? Please describe.
Currently it appears sshd_config is restricted to the gvm user with nicely appropriate authentication and encryption settings.

However, this sshd_config does not prevent the gvm user from being able to establish a shell or creating arbitrary port-forwards.

In the undesirable situation where the associated SSH private-key ends up in the wrong hands it would be better if the gvm user had less freedoms and was more limited in what it can achieve beyond the ssh-port-forward requirement.

Describe the solution you'd like
Add restrictions to sshd_config and the gvm user by introducing configuration items as suggested below - I do not have a test/development environment available to confirm the config below can be cut-n-paste into place - presented here as a guide and outline the intent.

PermitTunnel no
GatewayPorts no
AllowTcpForwarding no
AllowStreamLocalForwarding no

Match User gvm
   AllowTcpForwarding yes
   PermitOpen 127.0.0.1:9390
   ForceCommand /bin/false

Describe alternatives you've considered
None

Additional context
None

@pixelsquared
Copy link
Member

The issue is that the GVM connects to a UNIX socket to talk to the scanner.
So setting AllowStreamLocalForwarding no will not work.

That is the reason that the "scanner id" exists so that each scanner has a unique filename.

You can see the script that is used to connect here.

Adding the following should be possible but I have not yet tested.

PermitTunnel no # The default is no already
AllowTcpForwarding no
ForceCommand /bin/false

If you have any other ideas on how we could improve the security of the remote scanners that would be helpful.

@austinsonger austinsonger added the help wanted Extra attention is needed label Jun 12, 2021
@Dexus
Copy link
Contributor

Dexus commented Jul 27, 2021

We can do something like described here: https://www.skreutz.com/posts/unix-domain-socket-forwarding-with-openssh/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed Priority:Low
Projects
None yet
Development

No branches or pull requests

4 participants