突发!Log4j 爆“核弹级”漏洞,Flink、Kafka等至少十多个项目受影响

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"昨晚,对很多程序员来说可能是一个不眠之夜。12 月 10 日凌晨,Apache 开源项目 Log4j 的远程代码执行漏洞细节被公开,由于 Log4j 的广泛使用,该漏洞一旦被攻击者利用会造成严重危害。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"据悉,Apache Log4j 2.x <= 2.14.1 版本均回会受到影响。根据“"},{"type":"link","attrs":{"href":"https:\/\/mp.weixin.qq.com\/s?__biz=MzA5MDc1NDc1MQ==&mid=2247490981&idx=1&sn=a6cbdc953c90467a598149167fca0c28&scene=21#wechat_redirect","title":"","type":null},"content":[{"type":"text","text":"微步在线研究响应中心"}]},{"type":"text","text":"”消息,可能的受影响应用包括但不限于:Spring-Boot-strater-log4j2、Apache Struts2、Apache Solr、Apache Flink、Apache Druid、Elasticsearch、Flume、Dubbo、Redis、Logstash、Kafka 等。很多互联网企业都连夜做了应急措施。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"截至本文发出,斗鱼、京东、网易、深信服和汽车产业安全应急响应中心皆发文表示,鉴于该漏洞影响范围比较大,业务自查及升级修复需要一定时间,暂不接收 Log4j2 相关的远程代码执行漏洞。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/wechat\/images\/d4\/d42f909789c3b8d422f36c848b89c136.png","alt":null,"title":null,"style":null,"href":null,"fromPaste":false,"pastePass":false}},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"lookup 功能造成的漏洞"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Log4j 是一款开源 Java 日志记录工具。日志记录主要用来监视代码中变量的变化情况,周期性的记录到文件中供其他应用进行统计分析工作;跟踪代码运行时轨迹,作为日后审计的依据;担当集成开发环境中的调试器的作用,向文件或控制台打印代码的调试信息。因此,对于程序员来说,日志记录非常重要。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"在强调可重用组件开发的今天,Apache 提供的强有力的日志操作包 Log4j。Log4j 可以轻松控制 log 信息是否显示、log 信息的输出端类型、输出方式、输出格式,更加细致地控制日志的生成过程,而其通过配置文件可以灵活地进行配置而不需要大量的更改代码。因此,很多互联网企业都选择使用 Log4j 。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2014 年,Log4j 2 发布。Log4j 2 是对 Log4j 的重大升级,完全重写了 log4j 的日志实现。Log4j 2 提供了 Logback 中可用的许多改进,同时修复了 Logback 架构中的一些固有问题,目前已经更新到 2.15.0 版本。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Log4j2 也支持 SLF4J,可以自动重新加载日志配置,并支持高级过滤选项。此外它还允许基于 lambda 表达式对日志语句进行延迟评估,为低延迟系统提供异步记录器,并提供无垃圾模式以避免由垃圾收集器操作引起的任何延迟。通过其他语言接口,企业也可以在 C、C++、.Net、PL\/SQL 程序中使用 Log4j。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"此次漏洞的出现,正是由用于 Log4j 2 提供的 lookup 功能造成的,该功能允许开发者通过一些协议去读取相应环境中的配置。但在实现的过程中,并未对输入进行严格的判断,从而造成漏洞的发生。“微步在线研究响应中心”做了漏洞复现:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/wechat\/images\/eb\/eb48a747e39c17b4752feb8fd8f1e70c.png","alt":null,"title":null,"style":null,"href":null,"fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"简单来说,就是在打印日志时,如果发现日志内容中包含关键词 ${,那么这个里面包含的内容会当做变量来进行替换,导致攻击者可以任意执行命令。详细漏洞披露可查看:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"link","attrs":{"href":"https:\/\/issues.apache.org\/jira\/projects\/LOG4J2\/issues\/LOG4J2-3201?filter=allissues","title":"","type":null},"content":[{"type":"text","text":"https:\/\/issues.apache.org\/jira\/projects\/LOG4J2\/issues\/LOG4J2-3201?filter=allissues"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"由于线上 web 业务的任何数据都可能写入 Log4j,甚至一些 pre-auth 的地方,比如注册、登录,实际攻击入口取决于业务具体情况。目前百度搜索、苹果 iCloud 搜索、360 搜索等都出现了该问题。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https:\/\/static001.geekbang.org\/wechat\/images\/44\/4428c291b95a85d5ca58a2d080ff51d4.png","alt":null,"title":null,"style":null,"href":null,"fromPaste":false,"pastePass":false}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":"center","origin":null},"content":[{"type":"text","text":"图源:公众号"},{"type":"link","attrs":{"href":"https:\/\/mp.weixin.qq.com\/s?__biz=MzI5MDQ2NjExOQ==&mid=2247496216&idx=1&sn=2c85e1ad985e8a37c5ec2b7a5bded7cd&scene=21#wechat_redirect","title":"","type":null},"content":[{"type":"text","text":"“信安之路”"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"12 月 10 日上午,"},{"type":"link","attrs":{"href":"https:\/\/mp.weixin.qq.com\/s?__biz=MzI5MzY2MzM0Mw==&mid=2247486239&idx=1&sn=dd3eed8e9065a7f78758effd6ffe2578&scene=21#wechat_redirect","title":"","type":null},"content":[{"type":"text","text":"阿里云安全团队"}]},{"type":"text","text":"再次发出预警,发现 Apache Log4j 2.15.0-rc1 版本存在漏洞绕过,建议及时更新至 Apache Log4j 2.15.0-rc2 版本。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"对于这次漏洞,有网友评价说道,“可以说是灾难性的漏洞,比之前的 fastjson 和 shiro 还要严重,这个漏洞估计在之后三四年内还会继续存在….”"}]},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"快速检测及修复方案"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"针对此次漏洞,“微步在线研究响应中心”也给出了一些应急方案。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"1. 紧急缓解措施"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"(1)修改 jvm 参数 -Dlog4j2.formatMsgNoLookups=true"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"(2)修改配置 log4j2.formatMsgNoLookups=True"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"(3)将系统环境变量 FORMAT_MESSAGES_PATTERN_DISABLE_LOOKUPS 设置为 true"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"2. 检测方案"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"(1)由于攻击者在攻击过程中可能使用 DNSLog 进行漏洞探测,建议企业可以通过流量监测设备监控是否有相关 DNSLog 域名的请求,微步在线的 OneDNS 也已经识别主流 DNSLog 域名并支持拦截。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"(2)根据目前微步在线对于此类漏洞的研究积累,我们建议企业可以通过监测相关流量或者日志中是否存在“jndi:ldap:\/\/”、“jndi:rmi”等字符来发现可能的攻击行为。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","marks":[{"type":"strong"}],"text":"3. 修复方案"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"检查所有使用了 Log4j 组件的系统,官方修复链接如下:"},{"type":"link","attrs":{"href":"https:\/\/github.com\/apache\/logging-log4j2\/releases\/tag\/log4j-2.15.0-rc1","title":"","type":null},"content":[{"type":"text","text":"https:\/\/github.com\/apache\/logging-log4j2\/releases\/tag\/log4j-2.15.0-rc1"}]}]},{"type":"heading","attrs":{"align":null,"level":4},"content":[{"type":"text","text":"安全应该是一个持续的过程"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"每个人都知道安全的重要性,但安全问题还是频繁发生。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"去年 5 月,360 网络安全响应中心发布“ Fastjson 远程代码执行漏洞通告”。通告称,Java 库 fastjson <= 1.2.68 版本存在远程代码执行漏洞,漏洞被利用可直接获取服务器权限。该漏洞评定为“高危漏洞”,影响面“广泛”。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"前年,阿里云应急响应中心监测到,Apach Shiro 官方披露了其 cookie 持久化参数 rememberMe 加密算法存在漏洞,攻击者利用 Padding Oracle 攻击手段可构造恶意的 rememberMe 值,绕过加密算法验证,执行 java 反序列化操作,最终可导致远程命令执行获取服务器权限,风险极大。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"安全本身并不是一个能够创造价值的功能,反而更像是需要消耗价值以确保功能稳定的功能。中小企业常常没有足够的资金投入安全建设,而有资金的企业也会把这部分预算将到最低。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"网络攻击成功的可能性以及潜在损失的程度是难以实现估计的,决策者通常是依靠经验判断来做决定投入金额。根据 Alex Blau 在哈佛商业评论中的文章中提到的,决策者在作出决定时,会有以下三个误区:"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"numberedlist","attrs":{"start":1,"normalizeStart":1},"content":[{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":1,"align":null,"origin":null},"content":[{"type":"text","text":"将网络安全视为一种防御。在这个过程中,强大的防火墙和有能力的工程师可以让他们远离威胁。"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":2,"align":null,"origin":null},"content":[{"type":"text","text":"认为遵守 NIST 或 FISMA 等安全框架就足够安全。"}]}]},{"type":"listitem","attrs":{"listStyle":null},"content":[{"type":"paragraph","attrs":{"indent":0,"number":3,"align":null,"origin":null},"content":[{"type":"text","text":"以为如果近期没有发生安全漏洞,那么看起来没有问题的部分就不需要修复。"}]}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"这些想法的问题在于,网络安全不是要解决有限的问题,而应该是一个持续进行的过程。麻省理工学院数字经济倡议主任 Erik Brynjolfsson 表示,对抗网络威胁应该被归到“更高级别的优先考虑项”。他认为,一些修复并不复杂。虽然增加一些额外的小操作会让整个流程变长,并增加一点成本,但会让企业和个人更加安全。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"Brynjolfsson 提出,在网络安全方面,使用公开可用的密码学通常比为特定公司构建的专有系统更加安全。"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章