firebase - hoek原型(prototype)污染是否容易受到firebase包的影响?

标签 firebase angularfire

这是关于 npm 包“hoek”中的原型(prototype)污染安全漏洞,它是 firebase@3.x.x 的子依赖项

Version dependency of firebase on hoek

Hackone 网址:https://hackerone.com/reports/310439

Snyk 网址:https://snyk.io/test/npm/firebase/3.9.0?severity=high&severity=medium&severity=low

虽然 firebase 团队已经在这个 pr 中修复了它:https://github.com/firebase/firebase-js-sdk/issues/515在包 firebase@4.x.x

我想了解这是否真的对 firebase 构成安全威胁,因为依赖 firebase@3.x.x 的人不能直接升级到@4.x.x,因为这是一个重大变化,特别是如果他们使用不支持 firebase@4 的 angularfire@2.x.x。
未解决问题:https://github.com/firebase/angularfire/issues/934

根据上面的hackone url,问题的影响是:

This shows that an attacker can add attributes to all existing object on the server. Additional attribute can be used to change the execution code flow or cause error on every subsequent request by replacing "toString" or "valueOf".

This vulnerability is guaranteed to at least obtain denial of service as all the library allow the property "toString" and "valueOf" to be replaced by a "String". This breaks the express module and forces the server to either crash or return a 500 to every subsequent request.

More complex payload can be crafted to gain remote code execution (see PoC in #309391).



通过阅读本文,我了解到直接/间接使用 hoek 包的应用程序只有在服务器上运行时才会受到攻击。

因此,由于使用 angularfire@2.x.x 的应用程序使用 firebase@3.x.x 仅提供给客户端而不在服务器上运行。

它仍然脆弱吗?

最佳答案

更新!!

我刚刚发布了一个 npm 包,为无法更新到易受攻击包的补丁版本的人修复原型(prototype)污染问题。您可以安装following package :

yarn add no-pollution

简单地说require它位于您的 javascript 项目的入口点。
require('no-pollution');

针对导致原型(prototype)污染的易受攻击方法的扩展、合并、克隆类型进行了测试。但是,目前不适用于易受攻击的路径分配方法,但这对于您的 firebase 包来说应该足够了。

旧答案

确实,原型(prototype)污染漏洞在服务器端的风险比在客户端的风险更大。因为它可以很容易地用于进行拒绝服务 (DoS) 攻击或远程代码执行 (RCE) 攻击。

通常所有的业务逻辑都发生在后端,只有可用的信息显示在前端。但这并不能改变这样一个事实,即有人可以污染您的对象的原型(prototype)并且可以在您的应用程序上执行未缩进的代码执行。

这会在您的应用程序上产生一个严重的漏洞,这也将允许攻击者同时执行 DoS 或 RCE,但它受到难度级别和客户端可以访问的资源级别的限制。但这并不能改变您的应用程序存在可被利用来造成严重损害的安全漏洞这一事实。在 Snyk 上阅读更多相关信息

为 firebase 4 重新编写整个代码库可能是一个困难且耗时的过程,但除非 angular fire 决定为 firebase 4 提供支持,否则您最终将不得不这样做......

关于firebase - hoek原型(prototype)污染是否容易受到firebase包的影响?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50564246/

相关文章:

firebase - 错误: reCAPTCHA container is either not found or already contains inner elements

javascript - 将 sendEmailVerification 与 AngularFire 结合使用

angularjs - 具有 OAuth 浏览器重定向方法的 AngularFire 无限 $digest 循环

java - 使用 FirebaseRecyclerAdapter 的 RecyclerView 不显示项目 - FirebaseUI (3.1.3)

android - Firebase Firestore 阻止客户端在文档中创建字段

swift - 如何在 Firebase 中存储警报文本?

iOS Firebase Swift,在 OnDisconnect 上使用以监控在线状态不起作用

javascript - AngularFire 检查是否存在相同标题的项目

angularjs - 单元测试 AngularFire karma 错误

android - Firebase 离线功能和 addListenerForSingleValueEvent