自己使用Nestjs 搭配 Sequelize ,在安装新包的时候提示有Critical 风险。有漏洞嘛,要第一时间处理,要处理,除了升级,还要看一下这个漏洞如何复现。

粗略得到结果如下:

CVE-2023-25813

I、漏洞复现:

https://github.com/advisories/GHSA-wrh9-cjv3-2hpw

开发代码:

User.findAll({
where: or(
literal('soundex("firstName") = soundex(:firstName)'),
{ lastName: lastName },
),
replacements: { firstName },
})

用户输入:

{
"firstName": "OR true; DROP TABLE users;",
"lastName": ":firstName"
}

Sequelize预编译出SQL:

SELECT * FROM users WHERE soundex("firstName") = (:firstName) OR "lastName" = ':firstName'

占位符替换,最终会得到如下SQL:

SELECT * FROM users WHERE soundex("firstName") = soundex('OR true; DROP TABLE users;') OR "lastName" = ''OR true; DROP TABLE users;''

妥妥的SQL注入,高危风险。

II、漏洞预防

Do not use the replacements and the where option in the same query if you are not using Sequelize >= 6.19.1

  • 升级sequelize版本。
  • where 与replacements 不要同时出现。

CVE-2023-22578

不算漏洞的漏洞,不要将用户输入作为列名。

https://github.com/advisories/GHSA-8mwq-mj73-qv68

https://github.com/sequelize/sequelize/discussions/15694

ephys解释如下:

Hi!

At the present time I do not know.

The problem is that, while I did make the changes to remove a footgun in v7, that behavior was not a bug but a deliberate feature implemented by one of the previous teams that worked on Sequelize, and there are codebases relying on it.

Backporting #15374 would introduce a breaking change in a minor release. We've exceptionally done that in the past when we fixed a major issue (#14519), but I am not convinced that it's warranted for this one.

The reason I think releasing this breaking change in a minor release is unwarranted is that it can only be a problem if you use user-provided values as the name of a column to select. Even without the fix, you should make sure that input is safe as the query will crash if the input is not a valid attribute name.

We're stuck between a rock and a hard place. We can either introduce a breaking change in a minor release, or have a critically vulnerability warning.

We need to check with the people that published that vulnerability if they would consider a big bold warning that that property accepts arbitrary SQL (and therefore that user data should not be used in it) to be sufficient to dismiss the audit warning

CVE-2023-25813 漏洞的更多相关文章

  1. CVE补丁安全漏洞【学习笔记】

    更新安卓系统的CVE补丁网站:https://www.cvedetails.com/vulnerability-list/vendor_id-1224/product_id-19997/version ...

  2. 漏洞都是怎么编号的CVE/CAN/BUGTRAQ/CNCVE/CNVD/CNNVD

    在一些文章和报道中常常提到安全漏洞CVE-1999-1046这样的CVE开头的漏洞编号,这篇文章将常见的漏洞ID的表示方法做下介绍: 1.以CVE开头,如CVE-1999-1046这样的 CVE 的英 ...

  3. 支持nmap批量漏洞扫描的script

    NSE脚本,会在NMAP扫描时,通过-sV发现的端口详细信息对应到CVE相应的漏洞: nmap -sS -sV --script=vulscan www.scip.ch -p25 下面是该脚本的说明和 ...

  4. Nagios Looking Glass 本地文件包含漏洞

    漏洞名称: Nagios Looking Glass 本地文件包含漏洞 CNNVD编号: CNNVD-201310-682 发布时间: 2013-10-31 更新时间: 2013-10-31 危害等级 ...

  5. Apache Struts2 s2-020补丁安全绕过漏洞

    CNVD-ID CNVD-2014-01552 发布时间 2014-03-11 危害级别 高 影响产品 Apache struts 2.0.0-2.3.16 BUGTRAQ ID 65999 CVE ...

  6. WordPress Backdoor未授权访问漏洞和信息泄露漏洞

    漏洞名称: WordPress Backdoor未授权访问漏洞和信息泄露漏洞 CNNVD编号: CNNVD-201312-497 发布时间: 2013-12-27 更新时间: 2013-12-27 危 ...

  7. OpenSSL 拒绝服务漏洞

    漏洞名称: OpenSSL 拒绝服务漏洞 CNNVD编号: CNNVD-201312-058 发布时间: 2013-12-05 更新时间: 2013-12-05 危害等级:    漏洞类型:   威胁 ...

  8. Python‘ssl.match_hostname()’函数SSL证书验证安全绕过漏洞

    漏洞名称: Python‘ssl.match_hostname()’函数SSL证书验证安全绕过漏洞 CNNVD编号: CNNVD-201312-033 发布时间: 2013-12-04 更新时间: 2 ...

  9. Linux Kernel‘ieee80211_radiotap_iterator_init()’函数拒绝服务漏洞

    漏洞名称: Linux Kernel‘ieee80211_radiotap_iterator_init()’函数拒绝服务漏洞 CNNVD编号: CNNVD-201312-041 发布时间: 2013- ...

  10. Linux Kernel ‘/net/socket.c’本地信息泄露漏洞

    漏洞名称: Linux Kernel ‘/net/socket.c’本地信息泄露漏洞 CNNVD编号: CNNVD-201312-037 发布时间: 2013-12-04 更新时间: 2013-12- ...

随机推荐

  1. 深入Typescript--03-Typescript中的类(努力加餐饭)

    Typescript中的类 一.TS中定义类 class Pointer{ x!:number; // 实例上的属性必须先声明 y!:number; constructor(x:number,y?:n ...

  2. Sundial (二)

    相关重要的组件一览 Triggers(触发器)相关类 保存触发器相关参数,例如起止时间,次数,间隔时间等,其中Sundial支持多种类型触发器 多种类型的触发器必须重写GetNextOccurrenc ...

  3. Win10下yolov8 tensorrt模型加速部署【实战】

    Win10下yolov8 tensorrt模型加速部署[实战] TensorRT-Alpha基于tensorrt+cuda c++实现模型end2end的gpu加速,支持win10.linux,在20 ...

  4. Nginx实现跨域

    server { listen 80; server_name localhost 127.0.0.1; location / { # 允许跨域请求的"域" add_header ...

  5. 获取Excel列标

    /// <summary> /// 获取Excel列标 A B C...Z等 /// </summary> /// <param name="col" ...

  6. 通过URL地址将图片保存到本地

    今天一朋友问我如何通过URL地址将图片保存下来. 特地找了些资源,实现了一下代码: using System; using System.Drawing; using System.Drawing.I ...

  7. CSP-J初赛知识点

    就要初赛了,知识点还没怎么看,今天花一个小时来整理一下,希望大家在初赛中有个好成绩## 计算机常识IT : Information Technology 信息技术代别         年代       ...

  8. Vim-Adventures 有趣的Vim小游戏

    入门介绍 Vim-Adventures是一个让初学者练习如何使用 Vim 的小游戏.它一共有 TODO 个 关卡,每个关卡都对应不同的 Vim 练习.一进网页我们可以看到这个画面: 点进去后就自动来到 ...

  9. rt-thread模糊到清晰系列: ipc.c

    #include <rtthread.h> #include <rthw.h> #ifdef RT_USING_HOOK extern void (*rt_object_try ...

  10. 【ASP.NET Core】标记帮助器——元素筛选

    前一篇中老周从标记帮助的底层介绍关键性的接口,如 ITagHelper ,它是一个标志,用于识别哪些类属于 Tag Helper. 标记帮助器毕竟是针对 HTML 标记的,所以得筛选.说白了就是我写的 ...