Developer & Security

Authentication and Security

PocketMC secures server credentials, remote administrative access, and operating system resources through native Windows APIs, cryptographic memory scrubbing, and isolated process boundaries.

DPAPI Credential Encryption

Sensitive credentials are never written to disk in plaintext. This includes cloud backup OAuth refresh tokens (Google Drive, Dropbox, OneDrive), Playit.gg agent secrets, CurseForge API keys, LLM provider tokens, and Remote Control user password hashes.

On Windows, PocketMC encrypts every secret using the native Windows Data Protection API (ProtectedData.Protect) scoped to DataProtectionScope.CurrentUser. PocketMC applies a v2 protection scheme:

  • SID-Bound Entropy: The encryption operation incorporates optional entropy derived from the SHA-256 hash of your Windows user Security Identifier (SID) combined with an internal application salt string. Even if another user account on the same machine reads the configuration file, Windows DPAPI rejects decryption.
  • Format Prefix: Encrypted payloads are formatted as dpapi:v2:<base64>, allowing seamless version migration if encryption parameters change.
  • Memory Scrubbing: Immediately after encryption or decryption completes, PocketMC calls CryptographicOperations.ZeroMemory on all plaintext byte buffers and intermediate arrays. This ensures raw credentials do not linger in managed garbage collection heaps or memory dump files.

Session Authentication and Invalidation

The embedded Kestrel web server authenticates administrators using ASP.NET Core cookie authentication:

  • Cookie Name: PocketMCRemoteAuth.
  • Security Flags: Configured with HttpOnly, SameSite=Strict, and a 24-hour expiration lifespan.
  • Password Storage: User passwords are encrypted using PBKDF2 with SHA-256 and individual per-user salts.
  • Security Stamp Invalidation: Each user profile holds a GUID security stamp. Whenever you change a password or modify permission flags, PocketMC rotates this stamp. Every incoming request validates the cookie claims against the live security stamp in memory; if they do not match, the session is rejected immediately.

User Permission Flags

Sub-user accounts can be granted selective capabilities to manage servers without granting full administrative ownership:

Permission FlagCapabilities Granted
AllowRemoteConsoleCommandsStream real-time terminal output and submit commands to the server STDIN.
AllowRemotePlayerActionsExecute Kick, Ban, Pardon, Op, and De-op operations on players.
AllowRemoteServerSettingsView and update values in server.properties.
AllowRemoteServerAddonsInspect installed plugins and mods, toggle their state, or uninstall them.
AllowRemoteFileManagerBrowse directories, read text files under 1 MB, upload files up to 100 MB, and delete files.
AllowRemoteServerBackupsInspect backup history and trigger manual RCON-safe backups.
AllowedInstanceIdsRestricts account visibility strictly to the listed server GUIDs.

Brute-Force Rate Limiting

The Remote Control host protects endpoints using an in-memory token bucket rate limiter:

  • Login Protection: Authentication requests to /api/login are capped at 5 failed attempts per minute per IP address. Additional attempts are blocked with HTTP 429 until the cooldown expires.
  • Terminal Flooding: Console commands submitted through the REST API or WebSocket are limited to 30 requests per minute per instance.

Windows UWP Loopback Exemption

Minecraft Bedrock Edition on Windows runs inside a Universal Windows Platform (UWP) AppContainer sandbox. By default, Windows network isolation prohibits UWP applications from sending network traffic to loopback addresses (127.0.0.1 or localhost).

When hosting a Bedrock server locally, this policy prevents the host player from joining their own game. PocketMC registers the official network isolation exemption using the Windows native utility:

Loopback Exemption Command
CheckNetIsolation.exe LoopbackExempt -a -p="Microsoft.MinecraftUWP_8wekyb3d8bbwe"