Skip to content

ProtectedKeyProvider: DataProtectionScope.LocalMachine allows any local process to decrypt keys #160

@Christophe-Rogiers

Description

@Christophe-Rogiers

Security concern

ProtectedKeyProvider uses DataProtectionScope.LocalMachine when calling ProtectedData.Unprotect:

return ProtectedData.Unprotect(encrypted, null, DataProtectionScope.LocalMachine);

This means any process running on the machine — even under a low-privilege user — can decrypt the AES key file. Additionally, no entropy (second parameter) is provided, further reducing the protection.

Impact

If an attacker gains any code execution on the host, they can read and decrypt the key file used by Servy to protect service credentials.

Suggested fix

  • Consider using DataProtectionScope.CurrentUser if the service account is consistent
  • Add an entropy parameter (additionalEntropy) to restrict decryption further

File

src/Servy.Core/Security/ProtectedKeyProvider.cs — line 82

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions