Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
Tools/GitHubGitHub/grigorovichvlad/cve-2026-125423
Privilege EscalationVulnerability AnalysisExploitationWeb Application ExploitationPapers & ResearchLearning & EducationRed Teaming
GitHubgrigorovichvlad/cve-2026-125423

CVE-2026-125423

Write-up and Go lab PoC for CVE-2026-125423, a Gitea auto-init race that turns a symlinked README into a server-side Git hook overwrite and RCE. Fixed in 28.4.0.

View Repository
4 days agoNot yet reviewed
Share

CVE-2026-125423: racing Gitea auto-init to RCE

This is my write-up and lab PoC for CVE-2026-125423, also known as GHSA-6m4f-m9vc-7946.

Short version: Gitea let a new repository accept pushes before auto-init was finished. If my push landed early enough, the initial-commit code cloned my tree. A symlinked README.md then redirected a file write into a server-side Git hook. The next internal push ran that hook as the Gitea OS user.

Not bad for a file that is supposed to contain documentation.

Severity: High, 8.5 in the GitHub advisory
Affected: <= 28.3.0
Fixed: 28.4.0
Access needed: a regular account that can create a repository and push to it
No admin, SSH, Actions, or runner needed

Warning: the PoC is active. It creates private test repositories, pushes Git objects, overwrites a server-side hook during exploitation, and writes marker files. Run it only in a disposable lab that you own. Do not point it at production or random internet targets.

The bug

Repository creation looks simple from the outside. You call the API with auto_init=true, Gitea creates the bare repo, adds a README, makes the first commit, and pushes it.

Under the hood, there was a small but useful gap:

  1. The repository record and bare repo already existed.
  2. The repo could accept a push.
  3. Auto-init was still running.
  4. Auto-init cloned the current repo instead of starting with a clean local repo.

So there was a race between my push and Gitea's clone. If my ref became visible at the right moment, my content ended up in the temporary worktree.

That alone should not be enough for RCE. The second bug made it interesting.

The chain

1. Push a symlink as README.md

Git stores symlinks with mode 120000. I created a valid Git tree where README.md pointed here:

../../../gitea-repositories/<owner>/<repo>.git/hooks/post-receive.d/gitea

That path works with the standard relative layout used in my lab. No client-side symlink support was needed because the PoC builds the Git object directly.

2. Let auto-init clone it

prepareRepoCommit called CloneRepoToLocal. Checkout was enabled, and no fixed trusted branch was selected.

If the pushed ref won the race, Git checked out README.md as a symlink in the temporary worktree.

3. Turn the README write into a hook overwrite

Gitea generated the default README and wrote it with:

os.WriteFile(filepath.Join(tmpDir, "README.md"), []byte(res), 0o644)

The path already existed as my symlink. os.WriteFile followed it and truncated the target.

The 0644 mode did not help. It is used when creating a file, but it does not remove the executable bit from an existing hook.

4. Use the repository description as shell content

The default README starts with a Markdown heading:

# <repository-name>

To a shell, that is just a comment. The repository description comes after it, and the description was controlled by me.

After the overwrite, the hook contained the generated README, including my commands.

5. Wait for Gitea to push

The internal initialization push triggered post-receive. Git ran the overwritten delegate hook as the Gitea service account.

No Actions runner or client-side trick was involved. The command ran through the server-side Git hook path.

What counted as proof

I used three markers:

  • GITEA_HOOK_RCE in a server-side file;
  • the output of id in another file;
  • GITEA_AUTO_CONFIRMED at a fresh, run-specific /avatars/<run-id>.txt URL.

For the HTTP check, status 200 alone was not enough. Gitea can return a fallback avatar with status 200. The body had to be exactly:

GITEA_AUTO_CONFIRMED

The URL was new for every run. That made the result much harder to explain away as an old file or a lucky response.

Local avatar storage was only needed for this HTTP proof. It was not part of the vulnerability itself.

Limits

This was a race, not a magic reliable RCE button.

An attempt could fail because the push arrived too late. The payload also depended on the server checking out symlinks and on the relative path resolving to the writable hook.

I did not claim any of these:

  • unauthenticated RCE;
  • root access;
  • container escape;
  • access to the Docker host;
  • one payload working on every possible installation.

The public advisory lists successful testing on Gitea 28.3.0, 28.2.0, 1.27.1, and 1.25.5, with SQLite, MySQL, and PostgreSQL included in the testing summary.

The fix

The maintainers fixed both sides of the problem:

  • auto-init now builds the first commit in a fresh directory instead of cloning existing repo content;
  • a new repository only becomes ready and accepts pushes after initialization is complete.

The main patch was #40376, with #40383 as the release backport.

The fix shipped in Gitea 28.4.0. If you run Gitea, upgrade. Disabling Actions or the hook editor does not fix this chain.

The PoC

The included autoinit_hook_race.go is a cleaned-up version of my research harness.

The payload is fixed and non-destructive. It writes the marker, saves id, and creates the exact HTTP proof in auto mode.

The PoC uses basic auth with the disposable lab account. It cleans up tracked test repositories, but marker files still need to be checked and removed manually.

Build

A recent Go toolchain and Git are required.

go build -o poc ./autoinit_hook_race.go

Run in a disposable lab

Use a vulnerable local version, a non-admin test account, and local avatar storage. The default marker paths assume /var/lib/gitea/data. Change them if your lab uses another data directory.

./poc \
  -base 'http://127.0.0.1:3000' \
  -user 'labuser' \
  -password '<disposable-lab-password>' \
  -auto

Auto mode prints a fresh proof URL and only reports success after the exact marker is returned. Manual mode is available without -auto; it defaults to eight sequential attempts and leaves confirmation to the server-side marker files.

To check an old HTTP marker without creating repositories or pushing:

./poc \
  -proof-only \
  -proof-url 'http://127.0.0.1:3000/avatars/<run-id>.txt'

Do not reuse real passwords. Passing passwords on the command line can expose them through shell history or local process inspection.

Disclosure and credits

I reported the issue privately. The maintainers reviewed it, prepared the patch, backported it, and published the advisory together with the fixed release.

  • Reporter: grigorovichvlad
  • Fix: bircni and lunny

Thanks to the Gitea team for the quick and clean disclosure process.

Links

  • CVE: https://www.cve.org/CVERecord?id=CVE-2026-125423
  • GitHub advisory: https://github.com/go-gitea/gitea/security/advisories/GHSA-6m4f-m9vc-7946
  • Release notes: https://blog.gitea.com/release-of-28.4.0/
  • Fixed release: https://github.com/go-gitea/gitea/releases/tag/v28.4.0
  • Main patch: https://github.com/go-gitea/gitea/pull/40376
  • Backport: https://github.com/go-gitea/gitea/pull/40383
  • NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-125423

NVD does its own processing and can lag behind the CVE record and vendor advisory. The official CVE record is already published.

Final note

This code is for education and authorized lab testing only. If you are looking at an actual Gitea server rather than a lab snapshot, the useful next step is not running the PoC. It is upgrading to 28.4.0 or later.

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    977
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    564
  • 3

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    352
  • 4

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    344
  • 5

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    322
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    308

Explore all tools

Browse our collection of tools

View all tools →