[Typecho漏洞]Typecho博客程序评论网址处存在存储型XSS漏洞

道锋潜鳞
2023-04-01 / 3 评论 / 195 阅读 / 正在检测是否收录...

前言

前几天, Typecho 博客程序被曝出评论网址处存在存储型XSS漏洞,不少人已经被攻击,目前 Typecho 暂未发布修复该漏洞的教程,但是 Typecho 的 Github 仓库的最新代码已修复该漏洞,并预发布了 Typecho 1.2.1-rc 版本。

Test

漏洞发现时间

影响版本

Issues

https://github.com/typecho/typecho/issues/1545

https://github.com/typecho/typecho/issues/1546

漏洞公开POC

这个漏洞危险系数很高,目前,该漏洞公开的POC有:

  1. 获取Cookie
  2. 通过默认模板的 404.php 写入一句话木马

解决方式

  1. 关闭评论
    目前,Typecho 暂未发布修复该漏洞的教程,可以通过暂时关闭评论功能防止该漏洞被利用于攻击你的网站。
  2. 更新程序
    目前,Typecho 的 Github 仓库的最新代码已修复该漏洞,并预发布了 Typecho 1.2.1-rc 版本,你可以更新到 Typecho 1.2.1-rc 以防止该漏洞被利用于攻击你的网站。
    Typecho 1.2.1-rc : https://github.com/typecho/typecho/releases/tag/v1.2.1-rc
  3. 自行修改代码
    根据 Typecho 的 Github 仓库的提交历史,可以查看到 fix #1545 and close #1547-b989459 提交中修复该漏洞修改的代码如下:

202304011500227932.webp

202304011500452141.webp

1. var/Widget/Base/Comments.php 文件第 271 行

echo '<a href="' . $this->url . '"'

修改为

echo '<a href="' . Common::safeUrl($this->url) . '"'

2. var/Widget/Feedback.php 文件第 209 行和 308 行

//209 行
$comment['url'] = $this->request->filter('trim')->url;
//308 行
$trackback['url'] = $this->request->filter('trim')->url;

修改为

//209 行
$comment['url'] = $this->request->filter('trim', 'url')->url;
//308 行
$trackback['url'] = $this->request->filter('trim', 'url')->url;

3. var/Widget/Options.php 文件第 85 行

* @property bool $commentsRequireURL

修改为

* @property bool $commentsRequireUrl
2

评论 (3)

取消
  1. 头像
    松鼠老方
    Android · Google Chrome

    c刚看到,在学校自行修改代码把漏洞补上了[受虐滑稽]

    回复
    1. 头像
      道锋潜鳞 作者
      Windows 10 · Google Chrome
      @ 松鼠老方

      笑死了,不对,你站不是上线拉建的吗

      回复
      1. 头像
        松鼠老方
        Android · Google Chrome
        @ 道锋潜鳞

        博客是租虚拟主机用Typecho建的()

        回复