0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[漏洞通告]jackson-2634/jackson-databind JNDI注入导致远程代码执行/官方更新白名单机制

Last updated at Posted at 2020-03-02

漏洞描述

近日,亚信安全网络攻防实验室跟踪到jackson-databind更新了两个jndi注入的黑名单类,由threedr3amV1ZkRA提交.官方同时更新安全机制,该安全机制为白名单思想,官方不再推荐使用enableDefaultTyping,而是推荐使用使用activateDefaultTyping设置可信的Java类满足业务需求.这一白名单机制,进一步保证了jackson-databind应用的安全性,同时不影响业务的灵活性.

漏洞编号

Jackson内部编号2634

漏洞威胁等级

中危

不受影响范围

jackson-databind = 2.9.10.4
jackson-databind >= 2.10.0(使用enableDefaultTypingactivateDefaultTyping设置可信类除外)

漏洞验证

这里选用2.10.2作为例子

原本代码如下
mapper.enableDefaultTyping();
image.png
可见官方已经不在推荐使用

新的用法为如下

PolymorphicTypeValidator ptv = BasicPolymorphicTypeValidator.builder().allowIfSubType(可信的类名.class).build();
mapper.activateDefaultTyping(ptv);

这里以2634中的br.com.anteros.dbcp.AnterosDBCPConfig举例

将原本的mapper.enableDefaultTyping();需要修改为如下两行

image.png

如果项目包中存在br.com.anteros.dbcp.AnterosDBCPConfig且开发者设置了br.com.anteros.dbcp.AnterosDBCPConfig为可信类,则将存在jndi注入隐患.

以下为两个黑名单类的演示(设置为可信类)

image.png

image.png

当然 Jackson的老兄弟fastjson同样受到两个黑名单类的影响

image.png

image.png

修复建议

1.更新jackson-databind到最新版本
2.使用高版本JDK

时间轴

[0] 2020/03/02 Jackson官方发布更新
[1] 2020/03/02 亚信安全网络攻防实验室分析&复现该漏洞并发布漏洞通告

Reference

https://medium.com/@cowtowncoder/on-jackson-cves-dont-panic-here-is-what-you-need-to-know-54cd0d6e8062
https://github.com/cowtowncoder/jackson-compat-minor/blob/db762a72da8c17befa4a14f90438858bbd498f3d/desc/cve-2634-ibatis-anteros.txt

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?