胡萝卜披露:Forgejo
Carrot Disclosure: Forgejo

原始链接: https://dustri.org/b/carrot-disclosure-forgejo.html

一位安全研究人员调查了现在被 Fedora 使用的代码托管平台 Forgejo,并在一个晚上的工作中发现了大量漏洞。这些包括服务器端请求伪造 (SSRF)、缺乏内容安全策略 (CSP)、加密问题、身份验证缺陷、拒绝服务可能性和信息泄露。 该研究人员成功地将这些漏洞串联起来,实现了远程代码执行 (RCE)、泄露密钥以及获得持久性账户访问权限,甚至演示了创建后门管理员账户。虽然 RCE 需要开放注册和非默认配置,但问题的数量之多引发了对代码库整体安全性的担忧。 研究人员没有采取传统的完全披露方式,而是选择了一种“胡萝卜披露”方法——公开演示一个关键漏洞的利用方式(已删除输出),以激励 Forgejo 进行全面的安全审计并解决潜在问题。这种策略旨在迫使供应商提高安全性,而不仅仅是修复单个问题。研究人员提供了概念验证代码和详细说明发现的笔记。

这个Hacker News讨论围绕Forgejo(dustri.org)的安全漏洞披露,Forgejo是一个自托管Git服务。用户“bo0tzz”发布了一个“Carrot Disclosure”——展示了一个潜在的远程代码执行(RCE)漏洞。 然而,评论者批评了披露的方式。一位用户认为作者的语气带有指责,并质疑其动机,称赞Forgejo直接的披露流程。另一位批评了漏洞演示,指出它只能破坏具有完全访问权限的*本地*实例,而不是远程服务器——质疑其实际影响,并担心鉴于获得的访问级别,可能存在恶意使用。 还有一个观点提到,即使当前未使用,维护安全功能也很重要,并以Linux内核为例。
相关文章

原文

Since Fedora moved from Pagure to Forgejo, I finally had an incentive to take a good look at Forgejo's security posture. The results aren't pretty to be honest: SSRF in a lot of places, no CSP/Trusted-Types, a bit of ghetto templating in javascript, cryptographic malpractices, overlooks in the authentication mechanisms (OAuth2, OTP, sessions/access handling, post-compromission recovery, …), a bunch of low-hanging DoS, information leak all over the place, various TOCTOU, … All in all, it took me one evening after work to find a good amount of vulnerabilities (adding to the one I got from looking at gitea at some point in the past), and chain them to obtain a full-blown RCE, some secrets leaks, a bunch of persistent account access, a handful of OAuth2 privesc, …

Fortunately (or unfortunately depending who you're asking), the RCE relies on open registration, and on a configuration option set to a non-default value (which is the case on some instances I've looked at, so nothing exotic), meaning that its selling value is pretty low/nonexistent. I could disclose the bugs to Forgejo, they even have a Security Policy, with a lot of MUST/MUST NOT about what I must or mustn't do should I decide to go this way. But given the sorry state of the codebase, I'm pretty sure I could spend another evening and find another chain. I could fix the issues myself and send pull-requests, but oh well.

I discussed the conundrum with a friend of mine, and was told to put my money where my mouth is, and just go with carrot disclosure that I usually advocate for in this kind of situation:

Carrot Disclosure, dangling a metaphorical carrot in front of the vendor to incentivise change. The main idea is to only publish the (redacted) output of the exploit for a critical vulnerability, to showcase that the software is exploitable. Now the vendor has two choices: either perform a holistic audit of its software, fixing as many issues as possible in the hope of fixing the showcased vulnerability; or losing users who might not be happy running a known-vulnerable software. Users of this disclosure model are of course called Bugs Bunnies.

So without further ado:

$ python3 ./poc/chain_alpha.py --target http://127.0.0.1:3000 > out.txt
$ grep Backdoor out.txt 
[+]   Backdoor admin created: svc_ljeopgid / dukecepapsygiqks!A1
$ tail -n17 out.txt 

================================================================
[+] COMMAND EXECUTION CONFIRMED!
================================================================

Server-side hook output (received via git push stderr):

  remote: ==========================================
  remote: FORGEJO RCE PoC - Command Execution Proof
  remote: ==========================================
  remote: hostname: chernabog
  remote: uid:      uid=1000(jvoisin) gid=1000(jvoisin) groups=1000(jvoisin),10(wheel) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
  remote: date:     Tue Apr 28 19:16:59 UTC 2026
  remote: proof:    chernabog
  remote: ==========================================

================================================================
$ sha256 ./poc/chain_alpha.py
c10d28a5ff74646683953874b035ca6ba56742db2f95198b54e561523e1880d7  ./poc/chain_alpha.py
$ ls -l ./poc
total 140
-rw-r--r--. 1 jvoisin jvoisin 23530 Apr 28 21:18 chain_alpha.py
-rw-r--r--. 1 jvoisin jvoisin  6382 Apr 28 01:14 chain_beta.py
-rw-r--r--. 1 jvoisin jvoisin 11410 Apr 28 21:54 chain_gamma.py
-rw-r--r--. 1 jvoisin jvoisin 10334 Apr 28 22:20 leak_secrets.py
-rw-r--r--. 1 jvoisin jvoisin  9171 Apr 28 23:15 merge.py
-rw-r--r--. 1 jvoisin jvoisin 83861 Apr 27 23:59 NOTES.md
$
联系我们 contact @ memedata.com