/

CVE-2026-58421

Severity:

HIGH RISK

(7.5)

ReDoS in CODEOWNERS Matching (CWE-284) DoS Risk

CVE-2026-58421

Deferred

Vulnerability type

Category:

Regular Expression Denial of Service (ReDoS)

CWE:

CWE-284

Impact:

Denial of Service via resource exhaustion

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

An unauthenticated regular expression denial of service (ReDoS) vulnerability in CODEOWNERS pattern matching can cause excessive CPU consumption during access control checks.

When crafted patterns or paths trigger worst-case regex behavior, an attacker can repeatedly invoke matching to degrade performance, leading to denial of service for affected repository or service operations.

Affected context

This vulnerability arises in environments that use CODEOWNERS-style pattern matching, typically within repository hosting or code review systems.

It manifests when pattern evaluation relies on complex or unbounded regular expressions, and match operations are executed on user-controllable inputs such as file paths or requests.

The risk is higher where matching is performed synchronously on critical request paths and where resource limits (CPU time, request timeouts) are not strictly enforced.

Exploit preconditions

  • Attack surface: Public or semi-public endpoints that trigger CODEOWNERS or ownership resolution (e.g., viewing diffs, submitting changes, or listing files).
  • Required access: No authentication or low-privilege access if an attacker can submit or cause evaluation of crafted paths or file structures.
  • Trigger point: Execution of regex-based pattern matching against attacker-influenced input during ownership or access checks.
  • Why exploitation is possible: The matching engine performs worst-case backtracking on certain inputs, consuming disproportionate CPU and blocking service responsiveness.

Why this happens

The underlying issue is reliance on backtracking regular expressions without constraints for pattern matching in security-relevant logic.

When regexes are applied to untrusted or attacker-controlled data, certain patterns combined with specific inputs can cause exponential backtracking, known as ReDoS.

In the context of CWE-284 (Improper Access Control), ownership and access control mechanisms depend on this pattern matching; if they can be stalled or blocked via costly regex evaluation, attackers can indirectly disrupt authorization and related operations.

Abstractly, this reflects an insecure pattern where performance-sensitive, security-related code paths use expressive regex engines without considering adversarial input or runtime limits.

Potential impact

  • Service may become partially or fully unavailable due to CPU exhaustion.
  • Requests involving CODEOWNERS resolution could hang or time out under load.
  • Other tenants or repositories on shared infrastructure can experience degraded performance.
  • Operational teams may need to restart or throttle services, disrupting normal workflows.
  • Access control workflows (e.g., code review assignments) can be delayed or fail unpredictably.

General mitigation guidance

Mitigation typically focuses on reducing regex complexity and limiting exposure of pattern matching to untrusted inputs.

Common defensive patterns include:

  • Avoiding overly complex or ambiguous regex constructs in CODEOWNERS and similar configuration rules.
  • Preferring simpler glob-style matching or deterministic parsing over general-purpose regex for ownership resolution.
  • Enforcing resource limits and timeouts on pattern evaluation, especially in synchronous request paths.
  • Validating and constraining configuration patterns before use, rejecting rules that exhibit pathological matching behavior.
  • Isolating ownership and access control computations from critical availability paths, or executing them in worker contexts with bounded resources.

How teams detect issues like this

Detection generally involves a mix of configuration review and performance monitoring.

Helpful approaches include:

  • Static analysis or linting that flags high-risk regex constructs (e.g., nested quantifiers, catastrophic backtracking patterns) in CODEOWNERS-like configuration.
  • Code review guidelines that discourage complex regex usage in access control or ownership mapping logic.
  • Observability dashboards and alerts for CPU spikes or latency increases correlated with pattern matching endpoints.
  • Load and fuzz testing that exercises pattern matching with adversarial inputs to surface worst-case performance.
  • Automated configuration scanners that simulate regex evaluation and measure execution time, flagging slow patterns for remediation.

Sources

SourceLink
blog.gitea.comblog.gitea.com/release-of-1.26.3-and-1.26.4/
github.comgithub.com/go-gitea/gitea/pull/38011
github.comgithub.com/go-gitea/gitea/releases/tag/v1.26.4
github.comgithub.com/go-gitea/gitea/security/advisories/GHSA-v96j-25gv-g2w9

Frequently asked

questions

Yes. If endpoints that rely on CODEOWNERS pattern matching are exposed over the network without strong input constraints, an attacker can remotely trigger ReDoS behavior by submitting crafted paths or changes.

In many cases, only the ability to cause evaluation of paths or patterns is required, which may be available to unauthenticated or minimally authenticated users depending on how the service exposes repository metadata.

The safest approach is to replace complex, backtracking-prone regex usage with constrained glob matching or deterministic parsing, and to validate configuration to disallow pathological patterns. Additionally, enforce strict timeouts and resource limits around any remaining regex-based logic.

Adopt coding and configuration standards that restrict regex complexity, integrate automated linting for regular expressions, and treat pattern matching in access control or ownership logic as a performance-critical component that must be tested under adversarial input conditions.

Find out what's already
exploitable in your codebase.