GitHub Advisoryadvisory · Go
GHSA-7wvc-rvp7-w99x Gitea: LFS authentication bypass via malformed SSH sub-verb allows unauthorized read access to private repositories
HIGH
Official page ↗
- Aliases
- CVE-2026-58423
- Ecosystem
- Go
- Packages
- code.gitea.io/gitea
- Severity
- High
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N
- Weaknesses
- CWE-287
- Reviewed
- 2026-07-21
Affected packages
• Go code.gitea.io/gitea: >= 1.23.0, < 1.26.3 → fixed in 1.26.3
Description
Summary
A flaw in SSH LFS sub-verb handling allows any authenticated SSH user to obtain valid LFS credentials for any repository on the instance, including private repositories they have no access to. This enables unauthorized download of all LFS objects from any private repository.
Details
In `cmd/serv.go`, the `getAccessMode` function determines the required access level for SSH operations. For LFS verbs (`git-lfs-authenticate`, `git-lfs-transfer`), it switches on the sub-verb (`upload`/`download`). If the sub-verb is neither, execution falls through to:
```go
setting.PanicInDevOrTesting("unknown verb: %s %s", verb, lfsVerb)
return perm.AccessModeNone
```
In production (`IsProd=true`), `PanicInDevOrTesting` only logs an error and does not panic. `AccessModeNone` (value `0`) is then passed to `ServCommand` in `routers/private/serv.go`, where the permission check block at line ~322 evaluates:
```go
if repoExist &&
(mode > perm.AccessModeRead ||
repo.IsPrivate ||
owner.Visibility.IsPrivate() ||
(user != nil && user.IsRestricted) ||
setting.Service.RequireSignInViewStrict) {
...
if userMode ","size":}]}'
Returns download URL with valid authorization header
4. Download private LFS content
curl -H "Authorization: Bearer eyJ..." \
"https://gitea-instance/admin/private-repo.git/info/lfs/objects/"
Returns the private LFS object content
```
Impact
Any user with SSH access to a Gitea instance (which includes any registered user if self-registration is enabled) can read LFS objects from any private repository on the instance, regardless of their actual repository permissions. This is a confidentiality breach affecting all Gitea deployments running in production mode with SSH and LFS enabled (the default configuration).
Suggested fix
Validate the LFS sub-verb before calling `getAccessMode`, or return an error instead of `AccessModeNone` for unknown verbs:
```go
case git.CmdVerbLfsAuthenticate, git.CmdVerbLfsTransfer:
switch lfsVerb {
case git.CmdSubVerbLfsUpload:
return perm.AccessModeWrite
case git.CmdSubVerbLfsDownload:
return perm.AccessModeRead
default:
return fail(ctx, "Unknown LFS verb", "Unknown LFS verb: %s", lfsVerb)
}
```
Related
Alias · CVE (1)
- CVE-2026-58423 LFS authentication bypass via malformed SSH sub-verb allows unauthorized read access to private repositories vulnerability
Weakness · CWE (1)
- CWE-287 Improper Authentication weakness
References
- https://github.com/go-gitea/gitea/security/advisories/GHSA-7wvc-rvp7-w99x web
- https://nvd.nist.gov/vuln/detail/CVE-2026-58423 advisory
- https://github.com/go-gitea/gitea/pull/38008 web
- https://github.com/go-gitea/gitea/commit/42513398c05ca6bdf71da76cb6f9baaebe8cb924 web
- https://github.com/go-gitea/gitea/commit/8f4b7ebbf6061bd44b1ab3824f17f37b87fb1740 web
- https://blog.gitea.com/release-of-1.26.3-and-1.26.4 web
- https://github.com/go-gitea/gitea package
- https://github.com/go-gitea/gitea/releases/tag/v1.26.4 web