portmaster icon indicating copy to clipboard operation
portmaster copied to clipboard

Self-defense and kill-switch

Open DevilInMachine opened this issue 5 years ago • 6 comments

What would you like to add or change?:

Protection of the Portmaster process from forced killing, as well as the function of stopping the Internet connection when the firewall (and in the future SPN) does not work.

Why do you and others need this?:

At the moment, Portmaster can be quite easily unloaded by any third-party utility for managing processes, which may be unsafe for users who want to have a guarantee of no data leaks from blocked processes and hosts, and also reduces the level of security against Trojans and viruses.

Perhaps it makes sense to add an extra small service, which would block the network connection in the event of some problem detection in Portmaster work.

DevilInMachine avatar Jun 03 '21 11:06 DevilInMachine

Protection of the Portmaster process from forced killing

You'll need to either be SysAdmin/root to stop the Portmaster, or manually click through the UI. I don't think there is a feasible protection against someone who is SysAdmin/root.

Maybe @ppacher can give some more insights here.

stopping the Internet connection when the firewall (and in the future SPN) does not work.

I haven't yet thought about a kill switch for the firewall, though this is so uncommon, I'm not sure it makes sense to build something like that. When the firewall runs, it runs. We haven't seen any serious problems while running.

The SPN, on the other side will be interrupted by the network often. There, we will have proper protection against leaks.

reduces the level of security against Trojans and viruses

See comment above. If the malware is SysAdmin/root you're going to have a very bad time anyway.

dhaavi avatar Jun 03 '21 19:06 dhaavi

A couple more thoughts on self-defense.

  • We do take this very seriously, and nothing should ever be able to interfere or control the Portmaster except for the user.
  • The Portmaster's API requires authentication for privileged access.
  • The UI components are authenticated.
  • We locked down the UI as much as we could, which should make it (nearly) impossible to use it as an attack vector.
  • We still need to evaluate if the file permissions on Windows are correct, but on Linux everything is protected and no user without root privileges is able to interfere with the Portmaster at all.

dhaavi avatar Jun 03 '21 19:06 dhaavi

Windows does have the concept of "protected processes" [1] that would prevent the portmaster from being stopped / injected. Though, I didn't read it through completely yet. For the kernel extension we can simply deny being unloaded AFAIK (not providing an unload routine for the driver) but I'm not sure if we can instruct the WFP to do the same. For example, even if a FS minifilter driver is not unload-able you can still remove the minifilter registration and thus bypass that.

[1] https://docs.microsoft.com/en-us/windows/win32/services/protecting-anti-malware-services-

ppacher avatar Jun 04 '21 07:06 ppacher

Just some thoughts on this that may help: (I'm not a coder, I'm just a normal user interested in security, so forgive some mistakes) For some Apps, such as Shadow Defender (used to freeze the system when testing Malware or Ransomware like Wannacry) or 3rd party Antivirus (Kaspersky for example) you can set a password for the app, which prevents anyone (I'm not sure if that's correct even when the user is an admin) from killing the process, uninstalling the software or modifying anything without entering the correct password. For Shadow Defender this was really important, otherwise a hacker could set shadow defender to exclude a folder while testing the malware and locating that malware to the excluded folder.

I'm not sure if that's a requiered feature in Portmaster, my opinion on this is: 1- The Firewall itself should prevent the device from being comprimised by a malware (by preventing outgoing connections except for certain apps). Once the device is already comprimsed, it doesn't make any difference if the firewall gets disabled or not. 2- However, if the Firewall was being used to enforce all connections through a VPN (kind of a Kill-Switch for VPNs with no clients), killing the firewall means revealing the real ip address. I personally need Portmaster on windows 10 for this specific reason, as I couldn't enforce all connections through my VPN using the windows firewall.

youdontneedtoknow22 avatar Jun 14 '21 20:06 youdontneedtoknow22

I do like the idea of protecting the User interface with an additional password. Although the portmaster only allows it's own UI to change settings an additional password/PIN protection would prevent other human users on the same machine to change settings.

For the protection part, as @dhaavi already mentioned, once malware has administrator rights you will have bad time anyway because there are so many ways to do bad things that I'm not sure trying to protect against this situation is something we have the resources to work on. I completely understand the need for a kill-switch if the SPN access gets killed and we will work on a proper protection for that.

ppacher avatar Jun 23 '21 09:06 ppacher

I am cleaning out old issues. If you feel this issue should not have been closed let me know.

Please keep in mind, the free version of Portmaster only has limited support. For free users our active Discord community as well as the chat bot are the fastest and best way to get their help. https://discord.gg/safing If you find our work brings value to you, please consider supporting it by purchasing Plus or Pro Packages https://safing.io/pricing/. If you are already a subscriber, first Thank You! and also if you want priority support pleas send in an email and let me know your username so I can prioritize your request accordingly.

Raphty avatar Aug 22 '23 11:08 Raphty