The LocalSystem account is the Windows equivalent of the root * nix account. It is even more privileged than an administrator account. When you work as LocalSystem, you have full access to each resource on the computer.
As others wrote, you must write your code to run with the least possible privileges.
The main difference between LocalService and NetworkService is that services running as NetworkService have the ability to authenticate to other computers in the domain (I consider it as the computer account).
Note that the LocalService and NetworkService accounts have the โImpersonateโ privilege, which is a potentially dangerous privilege - it allows the service to impersonate the user who is calling the service. If this user is an administrator, then even if your code works in a low-priority service, he can do everything that the administrator does. If an attacker can use the buffer overflow in your service with the least privileges, they can connect the APIs that you use to impersonate your caller and wait for a call with a high privilege level to call your service. This method is known as Token Kidnapping, and MSRC has an excellent blog post describing the problem (and contains links describing how to mitigate many of the other risks associated with using LocalService and NetworkService accounts).
source share