hedgedoc hedgedoc 输入验证不恰当

admin 2023-12-01 14:58:28 Ali_nvd 来源:ZONE.CI 全球网 0 阅读模式
hedgedoc hedgedoc 输入验证不恰当

CVE编号

CVE-2021-29474

利用情况

暂无

补丁情况

N/A

披露时间

2021-04-27
漏洞描述
HedgeDoc (formerly known as CodiMD) is an open-source collaborative markdown editor. An attacker can read arbitrary `.md` files from the server's filesystem due to an improper input validation, which results in the ability to perform a relative path traversal. To verify if you are affected, you can try to open the following URL: `http://localhost:3000/..%2F..%2FREADME#` (replace `http://localhost:3000` with your instance's base-URL e.g. `https://demo.hedgedoc.org/..%2F..%2FREADME#`). If you see a README page being rendered, you run an affected version. The attack works due the fact that the internal router passes the url-encoded alias to the `noteController.showNote`-function. This function passes the input directly to findNote() utility function, that will pass it on the the parseNoteId()-function, that tries to make sense out of the noteId/alias and check if a note already exists and if so, if a corresponding file on disk was updated. If no note exists the note creation-function is called, which pass this unvalidated alias, with a `.md` appended, into a path.join()-function which is read from the filesystem in the follow up routine and provides the pre-filled content of the new note. This allows an attacker to not only read arbitrary `.md` files from the filesystem, but also observes changes to them. The usefulness of this attack can be considered limited, since mainly markdown files are use the file-ending `.md` and all markdown files contained in the hedgedoc project, like the README, are public anyway. If other protections such as a chroot or container or proper file permissions are in place, this attack's usefulness is rather limited. On a reverse-proxy level one can force a URL-decode, which will prevent this attack because the router will not accept such a path.
解决建议
建议您更新当前系统或软件至最新版,完成漏洞的修复。
参考链接
https://github.com/hedgedoc/hedgedoc/security/advisories/GHSA-p528-555r-pf87
受影响软件情况
# 类型 厂商 产品 版本 影响面
1
运行在以下环境
应用 hedgedoc hedgedoc * Up to (excluding) 1.8.0
CVSS3评分 5.8
  • 攻击路径 网络
  • 攻击复杂度 低
  • 权限要求 无
  • 影响范围 已更改
  • 用户交互 无
  • 可用性 无
  • 保密性 低
  • 完整性 无
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N
CWE-ID 漏洞类型
CWE-20 输入验证不恰当
CWE-22 对路径名的限制不恰当(路径遍历)
- avd.aliyun.com
weinxin
版权声明
本站原创文章转载请注明文章出处及链接,谢谢合作!