The vulnerability lies in the user signup process where default permissions are not correctly sanitized. The http.signupHandler function in http/auth.go creates new users and applies default settings using settings.UserDefaults.Apply. The core of the vulnerability is that signupHandler failed to remove the Execute permission and Commands list after applying these defaults. This allows a newly registered user to inherit command execution capabilities if they are enabled in the default user template.
The patch, found in commit b6a4fb1f27f4d894b384c0f3acacda276d1338a5, directly addresses this by adding code to signupHandler to explicitly disable the Execute permission and clear the Commands list for any user created via the signup form.
An exploit would involve two main stages, reflected in the identified functions:
- Creation of a privileged user: The attacker makes a request that is handled by
http.signupHandler. This function calls settings.UserDefaults.Apply to copy the permissions, creating a user with command execution rights.
- Command Execution: The attacker, now logged in as the new user, sends a command. This request is handled by
http.commandsHandler, which checks the user's Execute permission. Since the permission was improperly granted during signup, the check passes, and the command is executed.