博主 小野博客
小野博客 小野(Hirono)博客的个人网站,主要讲述关于小野的一些陈芝麻烂谷子事。网络、生活、我的主张,也是一个自留地
菜单

Typecho 1.2.0 评论框存在XSS漏洞

读书破万卷,下笔如有神。 (唐·杜甫·奉赠韦左丞二十二韵)
📚日志文章 共 577 字 计 1212 次阅读 需要 1 分钟
本文最后更新于2023年4月4日,已经过了1004天没有更新,若内容或图片失效,请留言反馈

Typecho1.2评论网址处存在XSS漏洞,如果被插入脚本,及时恢复到最近一次备份或检查其他文件是否存在shell。插入的js脚本,一个是发送cookie,另一个是往默认模板的404页面插入一句话木马。目前typecho没发布修复教程,但是github仓库已更新修复代码,预发布了1.2.1-rc版本。

防护

关闭评论
目前没有看到官方没有发布修复教程,我还是建议暂时关闭评论功能,如果不想关闭教程可以看看方法二。

修改文件

根据Typecho仓库的提交历史,可以查看到 b989459 提交内容。

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

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

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

//209行

$comment['url'] = $this->request->filter('trim', 'url')->url;

//308行

$trackback['url'] = $this->request->filter('trim', 'url')->url;
昵称
邮箱
站点
填写信息
返回
发表
返回留言
  1. 头像 小野
    @
    小野
    头像木有了
    · Windows · Chrome · 中国台湾省
  2. 头像 lin
    @
    lin
    Asking questions are really pleasant thing if you are not understanding something entirely, but this paragraph gives pleasant understanding yet.
    · Windows · Chrome · 新加坡
    1. 头像 小野
      @
      小野 @lin
      Really?Are you ashamed to advertise to me
      · Android · Chrome · 中国广播电视网络有限公司
  3. 头像 slot
    @
    slot
    不要打广告,用名字ok?
    · MacOS · Safari · 新加坡