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

Uninstall flow not working #932

Open
alexgumo7 opened this issue Jun 9, 2021 · 6 comments
Open

Uninstall flow not working #932

alexgumo7 opened this issue Jun 9, 2021 · 6 comments
Assignees

Comments

@alexgumo7
Copy link

Environment

  • How did you install GRR? N/A
  • What GRR version are you running?: 3.4.2.4
  • What operating system does the GRR server run on? N/A
  • What operating system does the affected GRR client run on, if applicable? Windows 10

Describe the issue
I have tried to kill the GRR process and remove the persistence in a client by using the administrative flows Kill and Uninstall (with the kill flag). When executing, the client crashes but after that, the connection is still active.
Is this a known problem? Or maybe there's a requisite for these flows to work that I am not aware of?

@mol123 mol123 self-assigned this Jun 9, 2021
@mol123
Copy link
Contributor

mol123 commented Jun 9, 2021

I'm assuming that the installation is not using fleetspeak (the next generation, experimental, communication framework, which can be enabled at install time).

TL;DR: A restart of the client machine is necessary.

The GRR installation installs a Windows service. The service runs the nanny / the GRR monitor. The nanny starts the GRR agent and monitors it. If the agent crashes, the monitor restarts it.

My understanding is that the Uninstall flow disables the Windows Service, but doesn't actively stop it. So it won't get automatically started at the next boot.

The Kill flow kills the client, but it will be respawned automatically by the nanny.

@alexgumo7
Copy link
Author

This clarifies why it wasn't working. However, in most of the cases the machines cannot be restarted. Is there another approach in order to kill and stop the service without restarting?

@mol123
Copy link
Contributor

mol123 commented Jun 10, 2021

There is functionality to execute arbitrary Python code on the client:

https://grr-doc.readthedocs.io/en/latest/investigating-with-grr/pushing-code.html#deploying-arbitrary-python-code

So it would be possible to upload and then execute the following snippet:

import subprocess
subprocess.check_call(["sc", "stop", "GRR Monitor"])

However, I'm not completely sure if this will work, since it would stop the service from within GRR itself.

Note, that the actual service name ("GRR Monitor") in the above example can be customized using the config and might differ in your installation. The respective config variable is Nanny.service_name.

@mol123
Copy link
Contributor

mol123 commented Jun 10, 2021

Actually, I think the python snippet might be worth a try.

@alexgumo7
Copy link
Author

alexgumo7 commented Jun 11, 2021

I've tried ExecutePythonHack and it's working. The procedure would be the following:

  • Launch flow Uninstall to disable the service.
  • Launch ExecutePythonHack with the snippet provided previously to stop the service.

However, I would suggest changing the description of the flow Uninstall as it says that it stops the service when actually it's not doing that.

Thanks!

@mol123
Copy link
Contributor

mol123 commented Jun 11, 2021

I agree that the description should be adapted, I'll make the respective change.

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

2 participants