Описание
Soft Serve is missing an authorization check in LFS lock deletion
LFS Lock Force-Delete Authorization Bypass
Summary
An authorization bypass in the LFS lock deletion endpoint allows any authenticated user with repository write access to delete locks owned by other users by setting the force flag. The vulnerable code path processes force deletions before retrieving user context, bypassing ownership validation entirely.
Severity
- CWE-863: Incorrect Authorization
- CVSS 3.1: 5.4 (Medium) —
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L
Affected Code
File: pkg/web/git_lfs.go
Function: serviceLfsLocksDelete (lines 831–945)
Endpoint: POST /<repo>.git/info/lfs/locks/:lockID/unlock
The control flow processes req.Force at line 905 before retrieving user context at line 919:
Proof of Concept
Setup: Two users with write access to the same repository—User A (lock owner) and User B (attacker).
-
User A creates a lock:
curl -X POST http://localhost:23232/repo.git/info/lfs/locks \ -H "Authorization: Basic <user_a_token>" \ -H "Content-Type: application/vnd.git-lfs+json" \ -d '{"path": "protected-file.bin"}' -
User B deletes User A's lock using force flag:
curl -X POST http://localhost:23232/repo.git/info/lfs/locks/1/unlock \ -H "Authorization: Basic <user_b_token>" \ -H "Content-Type: application/vnd.git-lfs+json" \ -d '{"force": true}' -
Result: Lock deleted successfully with
200 OK. Expected:403 Forbidden.
Suggested Fix
Retrieve user context and validate authorization before processing the force flag:
Impact
Affected Deployments: Soft Serve instances with LFS enabled and repositories with multiple collaborators.
Exploitation Requirements:
- Authenticated session
- Write access to target repository
Consequences:
- Unauthorized deletion of other users' locks
- Bypass of LFS file coordination mechanisms
- Potential workflow disruption in collaborative environments
Limitations: Does not grant file access, escalate repository permissions, or affect repositories where the attacker lacks write access.
Пакеты
github.com/charmbracelet/soft-serve
< 0.11.2
0.11.2
Связанные уязвимости
Soft Serve is a self-hostable Git server for the command line. Prior to version 0.11.2, an authorization bypass in the LFS lock deletion endpoint allows any authenticated user with repository write access to delete locks owned by other users by setting the force flag. The vulnerable code path processes force deletions before retrieving user context, bypassing ownership validation entirely. This issue has been patched in version 0.11.2.