<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Gitea (&lt; 1.27.0) - CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/gitea--1.27.0/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata. Fed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Tue, 21 Jul 2026 20:15:57 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/gitea--1.27.0/feed.xml" rel="self" type="application/rss+xml"/><item><title>Gitea Branch Protection Bypass via Pull Request Retargeting</title><link>https://feed.craftedsignal.io/briefs/2026-07-gitea-branch-protection-bypass/</link><pubDate>Tue, 21 Jul 2026 20:15:57 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-07-gitea-branch-protection-bypass/</guid><description>An attacker with write access to a Gitea repository can bypass branch protection rules by exploiting a logic flaw, obtaining an 'official' approval on a pull request (PR) targeting an unprotected branch, then retargeting the PR to a protected branch, preserving the stale approval and leading to unauthorized code merges and privilege escalation.</description><content:encoded><![CDATA[<p>A critical vulnerability, CVE-2026-58439, affects Gitea versions prior to 1.27.0, enabling attackers with write access to a repository to bypass branch protection rules. The flaw stems from Gitea's failure to re-evaluate the <code>official</code> flag on existing pull request reviews when a PR's target branch is changed. This allows an attacker to first create a pull request (PR) targeting an unprotected branch, obtain a seemingly legitimate &quot;official: true&quot; approval from any non-whitelisted account, and then retarget the PR to a protected branch (e.g., <code>master</code>). Because the stale &quot;official: true&quot; flag is preserved, it satisfies the protected branch's required approval count, enabling the attacker to merge malicious code without true maintainer oversight. This bypass effectively escalates privileges and undermines secure code collaboration workflows.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker, with write access to a Gitea repository but not in the protected branch's approval whitelist, creates a temporary unprotected branch from the main branch using the Gitea API.</li>
<li>The attacker pushes a malicious commit to a feature branch derived from the main branch.</li>
<li>The attacker creates a new pull request (PR) targeting the <em>unprotected</em> temporary branch (<code>tmp-unprotected</code>) with their malicious feature branch using the Gitea API.</li>
<li>An accomplice (any non-admin, non-whitelisted user) approves this PR, which Gitea records as <code>official: true</code> because the target branch is unprotected.</li>
<li>The attacker then retargets the PR to the <em>protected</em> main branch (<code>master</code> in the example) by sending a <code>PATCH</code> request to the PR endpoint via the Gitea API.</li>
<li>Gitea's backend fails to re-evaluate or dismiss the existing reviews, preserving the stale <code>official: true</code> flag from the previous approval.</li>
<li>The attacker initiates a merge of the PR into the protected main branch by sending a <code>POST</code> request to the PR merge endpoint. The merge succeeds because the preserved <code>official: true</code> approval satisfies the protected branch's requirements, allowing unauthorized code changes.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of CVE-2026-58439 leads to a complete bypass of Gitea's branch protection mechanisms. This allows any user with write access to a repository to merge arbitrary code into protected branches, even if they are not authorized by the designated approval whitelist. This constitutes a significant privilege escalation, as it nullifies admin-configured security controls and enables unauthorized code injection into critical production or development branches. The direct consequence is the introduction of malicious or unapproved code, potentially leading to supply chain attacks, system compromise, or data breaches within the affected environment.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li><strong>Upgrade Gitea immediately</strong> to version 1.27.0 or later to patch CVE-2026-58439.</li>
<li><strong>Deploy the Sigma rule</strong> &quot;Detects CVE-2026-58439 Exploitation Attempt - Gitea Pull Request Retargeting&quot; to your SIEM to alert on attempts to retarget pull requests via the API.</li>
<li><strong>Review Gitea webserver logs</strong> for <code>PATCH</code> requests to <code>/api/v1/repos/*/pulls/*</code> followed by <code>POST</code> requests to <code>/api/v1/repos/*/pulls/*/merge</code> from users not typically associated with such administrative actions, especially for protected branches.</li>
</ul>
]]></content:encoded><category domain="severity">critical</category><category domain="type">advisory</category><category>branch-protection-bypass</category><category>code-repository</category><category>privilege-escalation</category><category>gitea</category><category>persistence</category><category>web-application</category><category>vulnerability</category><category>defense-evasion</category><category>network</category><category>credential-theft</category><category>mitm</category><category>certificate-validation-bypass</category><category>cve</category><category>code-hosting</category><category>supply-chain-attack</category><category>data-exfiltration</category></item></channel></rss>