Summary
Gitea allows Git LFS object reuse in a way that can improperly authorize access to private source objects for users who only have repository-level permissions.
Under certain conditions, users without Code-unit access may still reuse Large File Storage (LFS) objects, potentially exposing content that should remain restricted.
Affected context
This vulnerability affects Gitea instances where Git LFS is enabled and object reuse is allowed across different authorization scopes.
It is most relevant in deployments that distinguish between general repository access and more restrictive Code-unit access, using these tiers to protect certain objects or content within a project.
The issue appears when LFS objects associated with private or otherwise restricted code can be referenced or reused by users who have repository access but are not intended to see specific code units.
Exploit preconditions
- Attack surface: Gitea Git LFS endpoints and workflows that support LFS object upload, download, or reuse.
- Required access: Valid user account with access to the target repository but without Code-unit level permissions.
- Trigger point: Operations that reference or reuse existing LFS objects (e.g., pushing, pulling, or re-linking LFS content) without re-enforcing finer-grained access checks.
- Why exploitation is possible: Authorization for LFS object reuse is tied to repository-level access rather than the more specific Code-unit authorization, allowing users to benefit from previously authorized LFS objects they should not individually access.
Why this happens
The root cause is insufficient authorization checks when handling Git LFS object reuse in Gitea.
The system enforces repository-level permissions but fails to consistently validate whether the requesting user has the appropriate Code-unit access for the underlying source object being reused.
This maps to CWE-639: Authorization Bypass Through User-Controlled Key and CWE-863: Incorrect Authorization, because the authorization logic assumes that repository access is sufficient, and does not properly bind LFS objects to the stricter permissions required for specific code units.
Potential impact
- Unauthorized users may access or reuse LFS objects tied to private or restricted code units.
- Sensitive content stored as LFS objects could be exposed to users who should only have limited repository visibility.
- Internal or proprietary assets embedded in LFS may be unintentionally disclosed.
- Access control policies relying on Code-unit permissions can be undermined, leading to broader data governance issues.
General mitigation guidance
Mitigation generally focuses on tightening authorization boundaries between repository-level access and finer-grained content permissions.
Useful patterns include:
- Ensuring that access checks for LFS object download and reuse apply the same authorization model as the protected source code or Code units.
- Treating LFS objects as protected resources that inherit the most restrictive permissions of the content they represent.
- Reducing reliance on implicit trust in repository membership for sensitive artifacts and explicitly modeling Code-unit–level permissions in storage and retrieval paths.
- Applying the principle of least privilege by minimizing which roles may interact with shared or reusable LFS objects, especially in multi-tenant or multi-role projects.
How teams detect issues like this
Detection can focus on both code and behavior:
- Static and code review: Look for authorization logic where LFS object access is only checked against repository-level permissions without verifying the underlying Code-unit authorization.
- Policy enforcement: Define security requirements that all storage backends (including LFS) must respect the highest applicable permission level for associated content.
- Runtime monitoring: Analyze access logs for patterns where users without Code-unit access are repeatedly retrieving or reusing LFS objects tied to restricted branches, files, or modules.
- Automated review tools and linters can be configured to flag endpoints or services where access decisions are based solely on coarse-grained repository roles.

