7 ms·
Forgejo <=16.0.3 Critical RCE
- deleted 2mo ago[deleted]
- rcleveng 2mo ago``` This git endpoint is seeing a high influx of requests for this repository, to preserve the availability of Codeberg your search request will not be processed. Sorry for the inconvenience and please try again later. ``` Any mirror?
- sbx320 2mo agoThe PR is still accessible https://codeberg.org/forgejo/forgejo/pulls/14300 https://codeberg.org/forgejo/forgejo/pulls/14300 Critical: fix: prevent template expansion from interfering with git repo initialization. When generating a new repository from a template repository, Forgejo clones the template repository, removes the .git folder, performs variable template expansion on files listed in .forgejo/template, and initializes a new git repository. During this process, variable template expansion could be misused in order to create a new .git folder, which git would adopt and incorporate during its initialization of a new git repository. A malicious template repository could be used to read arbitrary data from the Forgejo host, and to execute arbitrary processes on the Forgejo host, as a remote code execution attack. To address this issue, after variable expansion is completed, any existing .git folder is removed from the directory before the git repository is initialized.
- deleted 2mo ago[deleted]
- jzebedee 2mo agoRelevant change: Security bug fixes PR: Critical: fix: prevent template expansion from interfering with git repo initialization. When generating a new repository from a template repository, Forgejo clones the template repository, removes the .git folder, performs variable template expansion on files listed in .forgejo/template, and initializes a new git repository. During this process, variable template expansion could be misused in order to create a new .git folder, which git would adopt and incorporate during its initialization of a new git repository. A malicious template repository could be used to read arbitrary data from the Forgejo host, and to execute arbitrary processes on the Forgejo host, as a remote code execution attack. To address this issue, after variable expansion is completed, any existing .git folder is removed from the directory before the git repository is initialized.
- hephaes7us 2mo agoIt looks like this is a bit less concerning if you have turned off open account registration.
- Sphax 2mo agoCan't load the page but hopefully it's on an endpoint sitting behind my Tinyauth protection.
- amiga386 2mo agoYou should change the URL to https://codeberg.org/forgejo/forgejo/milestone/139655 https://codeberg.org/forgejo/forgejo/milestone/139655 > PR: Critical: fix: prevent template expansion from interfering with git repo initialization. When generating a new repository from a template repository, Forgejo clones the template repository, removes the .git folder, performs variable template expansion on files listed in .forgejo/template, and initializes a new git repository. During this process, variable template expansion could be misused in order to create a new .git folder, which git would adopt and incorporate during its initialization of a new git repository. A malicious template repository could be used to read arbitrary data from the Forgejo host, and to execute arbitrary processes on the Forgejo host, as a remote code execution attack. To address this issue, after variable expansion is completed, any existing .git folder is removed from the directory before the git repository is initialized.
- embedding-shape 2mo agoConciser: User's who can create new repositories, can exploit templates to do variable template expansion leading to being able to read arbitrary data from the Forgejo hosts. If you have open registrations or otherwise users you don't 100% trust with the ability to create new repository (which is the default I think?), they could potentially exploit this and you probably wanna upgrade ASAP. If you have only trusted users, or single user, seems it's fine. Of course, wanna upgrade anyway to not add escalation paths, but in the other situation it's graver.
- amluto 2mo ago> To address this issue, after variable expansion is completed, any existing .git folder is removed from the directory before the git repository is initialized. What happened to sandboxing the offending git invocation?
- PaoloBarbolini 2mo agoIf you are self-hosting Forgejo and haven't done it yet, consider creating a Codeberg account and following https://codeberg.org/forgejo/security-announcements/issues https://codeberg.org/forgejo/security-announcements/issues
- Macha 2mo agoSince the release notes is currently unreadable due to codeberg rate limits, the two fixes in the release notes are: https://codeberg.org/forgejo/forgejo/pulls/14301 https://codeberg.org/forgejo/forgejo/pulls/14301: *Critical:* fix: prevent template expansion from interfering with git repo initialization. When generating a new repository from a template repository, Forgejo clones the template repository, removes the `.git` folder, performs variable template expansion on files listed in `.forgejo/template`, and initializes a new git repository. During this process, variable template expansion could be misused in order to create a new `.git` folder, which git would adopt and incorporate during its initialization of a new git repository. A malicious template repository could be used to read arbitrary data from the Forgejo host, and to execute arbitrary processes on the Forgejo host, as a remote code execution attack. To address this issue, after variable expansion is completed, any existing `.git` folder is removed from the directory before the git repository is initialized. https://codeberg.org/forgejo/forgejo/pulls/14301 https://codeberg.org/forgejo/forgejo/pulls/14301: ensure authorization reducer is accessed when checking editable PRs in APIs. When editing a git repo contents through Forgejo's API, a specialized security control is used to permit repository maintainers to edit branches that they do not own when an open pull request with the "allow maintainer edit" option is present. This specialized security control did not take into account API-specific security restrictions, such as repo-specific access tokens. As a result, it was possible for an API access token with restricted permission to make modifications outside of that restricted permission. The specialized security control has been updated to take into account API authentication security restrictions. --- So if like me you run a private forgejo instance with closed signups and limited repository creation, you can wait for the update. Otherwise maybe take it off the public internet for a bit?
- keel-control 2mo agoThis was my first thought after they disallowed LLM contributions. They may not use AI to check for vulnerabilities but attackers are going to which puts themselves at the disadvantage.
- titularcomment 2mo agoI really disagree with their acceptable usage policy, but you can't say it with certainity that LLM contributions would be a fix for this. They generate so much noise (as the primary incentive behind an independent LLM scan is often cheap contributor brownie points for your CV) that it also could lead to bogus PRs being approved or helpful PRs being lost in the noise.
- otherme123 2mo agoWas this discovered by AI? Is all AI code 100% free of bugs? You are implying that just by allowing LLM contributions your product is free of bugs, and the LLM won't introduce new bugs. Of course, if the LLM introduces bugs, the solution is to add another layer of LLM looking for bugs, ad infinitum. Another post from today from Shopify, praising LLM to code their frontend, also stated that their LLM generated code is not ready to deploy, and needs to be reviewed: > It’s tempting to just point an LLM to the React Native codebase and try to one-shot the same features in native, but it doesn’t work. Even if you ask it to gather as much information as it can up front, freeze that into specs, task files, and then implement it, you end up with a huge amount of unmaintainable code that can’t be shipped. [...] each [build] must prove its behavior with tests, match the running app in a visual review, survive two adversarial code reviewers, and get a human's nod before it's committed and the next one starts.
- 1matin 2mo ago> They may not use AI to *check for vulnerabilities* you didn't read the comment, did you?
- cmrdporcupine 2mo ago> You are implying that just by allowing LLM contributions your product is free of bugs That... is not the implication of the comment you're replying to. You don't need to make it all fundamentalist.
- techknowlogick 2mo agoOnly posting here because I've been asked about it. Gitea is protected against both of these issues. (bias note: part of project leadership of Gitea) Edit: As a note, security incidents happen to everyone and we shouldn't shame anyone for reporting them, especially as that'd otherwise cause less issues to be reported overall.
- tredre3 2mo ago> Gitea is protected against both of these issues. Is Gitea's immunity just incidental because it was written by a different person, or is it due to a deliberate defensive system that prevents such bug/mistake from occurring?
- embedding-shape 2mo agoVery interested in knowing too, since the issues seems to not be related at all, or similar, so now this must mean a Gitea "project leader" would only say this if they have some sort of layer that doesn't require them to manually patch issues individually. Meaning, firewall? Would be weird if that's built-in into Gitea though... Hmm.
- jonstaab 2mo agoForgejo is a fork of gitea.
- ThePowerOfFuet 2mo agoHence the question...
- Macha 2mo agoIt looks like Gitea made the same fix (rm -r .git after template processing) back in February: https://github.com/go-gitea/gitea/commit/2176e84ab977011ff2bc3f3a9066020cc674f6b1#diff-491170640d4be1e5b696640c6d39f42b264825691b955aaa175935e182e9f0da# https://github.com/go-gitea/gitea/commit/2176e84ab977011ff2b... PR: https://github.com/go-gitea/gitea/pull/36734 https://github.com/go-gitea/gitea/pull/36734 So likely Gitea < 1.25.5 was vulnerable.
- innocent_name 2mo agoThe opex and security fine costs of moving off managed services like GitHub/GitLab are catching up.
- kstrauser 2mo agoThis vulnerability, which doesn’t affect my installation, would take approximately 5 minutes to patch if it did. With that exception, my server will have had approximately 99.999% uptime over the last several years. It would take a boatload of such events to equal the opex of GitHub hosting. That’s not an excuse to run amok, but it’s far from tipping the scales in GitHub’s cost favor.
- cyberpunk 2mo agoYep. I have one hanging off an openbsd machine on a tailnet, took me like... 5 minutes to update it, and it's not exactly a common setup...
- lukeify 2mo agoThe amount of time I need to spend maintaining my Forgejo instance this year, even after accounting for this RCE, has been less than the amount of time GitHub has been degraded or unavailable this year.
- lloydatkinson 2mo agoThat doesn't match my experience at all. I had a Foregjo instance on a Raspberry Pi, and maybe it's typical SD card issues, but the number of times that Forgejo has crashed because it locked its own database and couldn't continue and the number of times repos I mirror from GitHub just mysteriously stop syncing is quite probably the same number of times GitHub has been down this year.
- etdznots 2mo agoBruh sorry, stop running any RW services off an SD card, it has always been terrible and unfortunately it will remain terrible, you can buy a used SFF with >5x the compute and a sata ssd for the same price as a raspberry pi alternatively put an nvme hat on it
- dboreham 2mo agoQuick note that this is not an RCE in the typical sense that I can rock up to a Forgejo installation and execute code on the server. The attack vector here is via a template repo specified when initializing a new repo. The template repo could contain malicious code that then executes on the host server. So if you don't create new repos from mystery meat template repos, you should be ok.
- nightpool 2mo agoAre you sure? The change says "A malicious template repository could be used to read arbitrary data from the Forgejo host" (emphasis added). Couldn't an attacker create a template repo and then immediately create a new repo from their own template, causing the Forgejo process to execute their template code on the server?
- msm_ 2mo agoThey could, and this is definitely a RCE (a Remote Code Execution) vulnerability. GP confusion stems from the fact, that you (the forgejo user) must execute this attack on "your" instance. But of course the problem is that forgejo user can, in fact, be malicious, and use this vulnerability to escalate their priviliges from user to server. It can't be done without authenticating first, but there's nothing about RCE that says that it must be sent from unauthenticated connection.
- mitxela 2mo agoWould be good to label it "authenticated RCE" to make this clear
- msm_ 2mo ago>So if you don't create new repos from mystery meat template repos, you should be ok. You should be OK, but if attacker takes over your user (or any user in your forgejo instance) they can execute code on the host server - as you said yourself. In other words, it allows them to achieve remote code execution, so it's a RCE.
- nightpool 2mo agoWhat does the error message mean by "Your search request"? Why is viewing a single file in a repository considered a search request? That smells like poor caching somewhere
- bakugo 2mo agoTrying to open any codeberg.org page from my main Helium browser results in a 403 just saying "Bye". Opening in Chrome or Firefox works fine. Very confusing.
- bakugo 2mo agoUpdate: I raised this issue on their platform issue tracker, and was informed that it is, in fact, intentional. Sigh... https://codeberg.org/Codeberg/Community/issues/3084 https://codeberg.org/Codeberg/Community/issues/3084
- MikeTheSapien 2mo ago[dead]
- Ray-On-Emacs 2mo agoI've been seeing this for a few weeks using the Chromium-based Vivaldi. I assumed it had something to do with my IP address resolving to my US ISP. I cannot access the issue tracker. What exactly is intentional -- to exclude users of browsers other than Chrome and Firefox? FWIW, I can access my repo(s) with CLI git commands.
- Ray-On-Emacs 2mo agoOkay, I used MS Edge to find that "Chrome/150 and Chrome/152 work fine, it's specifically 151 that seems to be blocked." Time for a Vivaldi update...
- miguelgrinberg 2mo agoFor those on version 15 LTS, this fix was released with v15.0.8.
- snvzz 2mo agoUpdated mine now. The release notes[0]. 0. https://codeberg.org/forgejo/forgejo/src/branch/forgejo/release-notes-published/15.0.8.md https://codeberg.org/forgejo/forgejo/src/branch/forgejo/rele...
- rvz 2mo agoAs I said before for patching vulnerabilities in the age of AI [0], attackers are going to build exploits around this RCE with AI or even find more flaws with AI. This means you have no choice but to use AI to defend, find and patch these flaws before attackers quickly build and use these exploits to target users. You cannot afford to disallow or have a 100% ban on LLM contributions while attackers do not care and will use AI to find the flaws and attack you faster than you can triage it. [0] https://news.ycombinator.com/item?id=49262849 https://news.ycombinator.com/item?id=49262849
- pixl97 2mo agoIf nothing else having AI review anything security related may be a good idea.
- vyftec_wpsec 2mo ago[flagged]
- mmsc 2mo agoWonder how long it took from report to patch. IME codeberg has one of the rudest security teams in oss (fair enough or not, irrelevant). https://news.ycombinator.com/item?id=47941590 https://news.ycombinator.com/item?id=47941590 Is quite relevant
- embedding-shape 2mo agoIs that linked submission "your experience" or is there something else you're basing that on? Because that article you linked is kind of strange, read through the comments on what you linked.
- mfenniak 2mo agoForgejo's security team received disclosure of this issue on September 4th. (source: I am a member of that team)
- johnsea 2mo ago(Thanks for your work!)
- bitbasher 2mo agoThis is why I prefer simpler setups for personal use/hosting. Something like cgit that has no accounts has much less surface area for this kind of issue.
- teaearlgraycold 2mo agoGlad I have my Forgejo service set to auto update.
- tugback 2mo agoRemoving .git after expansion seems fragile. Sandboxing the git step would close the whole class of bugs.
- nirui 2mo agoI'm just reading the code here: // Before template expansion, .git was removed so that a fresh repo can be initialized; remove it again in case // some template variable usage has conflicted with this directory and impacts git operations. if err := root.RemoveAll(".git"); err != nil { return fmt.Errorf("unable to remove .git folder") } Why the `err` isn't carried by the error message? For security? Then maybe log it internally? User/operator can't really fix the problem if you keep giving them information this vague.
- n3mes1s 2mo agoI'm working on a tool to reproduce stuff like this exactly. Yep this is an RCE with the forgejo user on the host. https://www.pruva.dev/reproductions/REPRO-2026-00345 https://www.pruva.dev/reproductions/REPRO-2026-00345 for details. you can even start your version of the repro using github codespaces ======================================== REPRO-2026-00345 ======================================== Title: Forgejo <16.0.4 RCE via crafted template repository (.forgejo/template expansion recreates .git folder adopted by git init) Severity: CRITICAL CVE: CVE-2026-89094 ======================================== [pruva] Working directory: /workspaces/pruva-sandbox/pruva-results/REPRO-2026-00345 [pruva] Found script artifact: bundle/repro/reproduction_steps.sh [pruva] Downloaded 4 repro artifact(s), script: 324 lines [pruva] ========================================== [pruva] WARNING: This will execute code that [pruva] exploits a real vulnerability. [pruva] ========================================== [pruva] Auto-confirming in sandbox environment... [pruva] Running reproduction script... --- REPRODUCTION OUTPUT --- [09:39:29] ensuring container images are present [09:39:42] vulnerable image digest: sha256:214f4ae63ee78be1e445e58573c88dc7215e72091210852e0df94eaac1a25685 [09:39:42] fixed image digest: sha256:a263a1298e89e0bdf019005ce1927e9aadaa8f1bd2a94a3e66ad94e2a89e19ce [09:39:42] [vuln-1] starting container (codeberg.org/forgejo/forgejo:16.0.3-rootless) [09:39:52] [vuln-1] service healthy on 127.0.0.1:4011 [09:39:53] [vuln-1] admin user + token ready [09:39:55] [vuln-1] malicious template pushed [09:40:03] [vuln-1] generate API returned 201 [09:40:15] [vuln-1] marker=**** hook_id=**** hostdata=**** readme_ok=**** gen=201 [09:40:15] [vuln-2] starting container (codeberg.org/forgejo/forgejo:16.0.3-rootless) [09:40:25] [vuln-2] service healthy on 127.0.0.1:4012 [09:40:26] [vuln-2] admin user + token ready [09:40:28] [vuln-2] malicious template pushed [09:40:32] [vuln-2] generate API returned 201 [09:40:36] [vuln-2] marker=**** hook_id=**** hostdata=**** readme_ok=**** gen=201 [09:40:36] [fixed-1] starting container (codeberg.org/forgejo/forgejo:16.0.4-rootless) [09:40:40] [fixed-1] service healthy on 127.0.0.1:4111 [09:40:40] [fixed-1] admin user + token ready [09:40:41] [fixed-1] malicious template pushed [09:40:46] [fixed-1] generate API returned 201 [09:40:50] [fixed-1] marker=false hook_id=false hostdata=false readme_ok=**** gen=201 [09:40:50] [fixed-2] starting container (codeberg.org/forgejo/forgejo:16.0.4-rootless) [09:40:52] [fixed-2] service healthy on 127.0.0.1:4112 [09:40:53] [fixed-2] admin user + token ready [09:40:54] [fixed-2] malicious template pushed [09:40:58] [fixed-2] generate API returned 201 [09:41:02] [fixed-2] marker=false hook_id=false hostdata=false readme_ok=**** gen=201 [09:41:02] vuln markers: **** / **** ; hook-id: **** / **** ; hostdata: **** / **** ; gen: 201 / 201 [09:41:02] fixed markers: false / false ; readme-ok: **** / **** ; gen: 201 / 201 runtime_manifest.json written with 44 proof artifacts [09:41:02] VERDICT: CONFIRMED - remote code execution reproduced on Forgejo 16.0.3 via crafted template repository; fixed 16.0.4 unaffected --- END REPRODUCTION OUTPUT --- [pruva] ========================================== [pruva] VERIFICATION SUCCESSFUL [pruva] Duration: 93s [pruva] ========================================== [pruva] Logs: /workspaces/pruva-sandbox/pruva-results/REPRO- 2026-00345/logs/ - fixed-1 - fixed-2 - reproduction_steps.log - vuln-1 - vuln-2 [pruva] Results saved to: /workspaces/pruva-sandbox/pruva-results/REPRO-2026-00345 [pruva] Keeping work directory: /workspaces/pruva-sandbox/pruva-results/REPRO-2026-00345 Outcome: success User: vscode WorkspaceFolder: /workspaces/pruva-sandbox
- deleted 2mo ago[deleted]
- mrnaif 2mo agoOur forgejo instance got affected by this. I saw the news and thought we don't need to upgrade (yet), as registration is closed for new users, and users having access is only those we control. As it turns out, when in app.ini we have DISABLE_REGISTRATION = true, it doesn't actually disable registration... Even though no sign in or sign up form was rendered, the attacker used openid registration as in our config I had [openid] ENABLE_OPENID_SIGNIN = true ENABLE_OPENID_SIGNUP = true attacker created a fake openid server, registered this way, created like 100+ repositories, was able to create a superadmin account on forgejo, mint tokens, execute commands from the runner trying to escalate permissions - either via git hooks, or in runner itself. Luckily our runner was running on a separate isolated server, but potential damage could have been much worse. So yeah, everyone update ASAP if you don't want to spend half a day fixing the consequences (: