Mybatis 漏洞集合

漏洞描述

MyBatis 远程代码执行漏洞 (CVE-2020-26945) ,建议 将 MyBatis 升级到 3.5.6 及以上版本,这里直接升级到 3.5.7 ,mybatis-spring 升级到 2.0.6,参考如下

1、下载地址

mybatis-3.5.7.zip

2、升级步骤(以下操作均用安装用户操作如 isearch 用户)


1、查找需要替换的文件
  find /isearch/isa/datas/tomcat/ -name mybatis-3*.jar
  find /isearch/isa/datas/tomcat/ -name mybatis-spring-1.\*.jar
  
2、重命名原文件(x需改成查询到替换的文件名)
   mv /isearch/isa/datas/tomcat/ROOT/WEB-INF/lib/mybatis-3.4.x.jar /isearch/isa/datas/tomcat/ROOT/WEB-INF/lib/mybatis-3.4.x.jar.bak
   mv /isearch/isa/datas/tomcat/Snapshot/WEB-INF/lib/mybatis-3.4.x.jar /isearch/isa/datas/tomcat/Snapshot/WEB-INF/lib/mybatis-3.4.x.jar.bak
   mv /isearch/isa/datas/tomcat/ROOT/WEB-INF/lib/mybatis-spring-1.3.x.jar /isearch/isa/datas/tomcat/ROOT/WEB-INF/lib/mybatis-spring-1.3.x.jar.bak
   mv /isearch/isa/datas/tomcat/Snapshot/WEB-INF/lib/mybatis-spring-1.3.x.jar /isearch/isa/datas/tomcat/Snapshot/WEB-INF/lib/mybatis-spring-1.3.x.jar.bak

3、将附件中的所有lib上传到/isearch/isa/datas/tomcat/ROOT/WEB-INF/lib/、/isearch/isa/datas/tomcat/Snapshot/WEB-INF/lib/目录下 

4、重启tomcat
 

3、还原


1、备份文件还原
   mv /isearch/isa/datas/tomcat/ROOT/WEB-INF/lib/mybatis-3.4.x.jar.bak /isearch/isa/datas/tomcat/ROOT/WEB-INF/lib/mybatis-3.4.x.jar
   mv /isearch/isa/datas/tomcat/Snapshot/WEB-INF/lib/mybatis-3.4.x.jar.bak /isearch/isa/datas/tomcat/Snapshot/WEB-INF/lib/mybatis-3.4.x.jar
   mv /isearch/isa/datas/tomcat/ROOT/WEB-INF/lib/mybatis-spring-1.3.x.jar.bak /isearch/isa/datas/tomcat/ROOT/WEB-INF/lib/mybatis-spring-1.3.x.jar
   mv /isearch/isa/datas/tomcat/Snapshot/WEB-INF/lib/mybatis-spring-1.3.x.jar.bak /isearch/isa/datas/tomcat/Snapshot/WEB-INF/lib/mybatis-spring-1.3.x.jar

2、将替换文件重命名
  mv /isearch/isa/datas/tomcat/ROOT/WEB-INF/lib/mybatis-3.5.7.jar /isearch/isa/datas/tomcat/ROOT/WEB-INF/lib/mybatis-3.5.7.jar.bak
  mv /isearch/isa/datas/tomcat/Snapshot/WEB-INF/lib/mybatis-3.5.7.jar /isearch/isa/datas/tomcat/Snapshot/WEB-INF/lib/mybatis-3.5.7.jar.bak
  mv /isearch/isa/datas/tomcat/ROOT/WEB-INF/lib/mybatis-spring-2.0.6.jar /isearch/isa/datas/tomcat/ROOT/WEB-INF/lib/mybatis-spring-2.0.6.jar.bak
  mv /isearch/isa/datas/tomcat/Snapshot/WEB-INF/lib/mybatis-spring-2.0.6.jar /isearch/isa/datas/tomcat/Snapshot/WEB-INF/lib/mybatis-spring-2.0.6.jar.bak
 
3、重启tomcat