自己使用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. Angular8中共享模块,共享组件的写法(anular其他模块组件引用方法)

    Angular8中共享模块,共享组件的写法(anular其他模块组件引用方法) 第一步:全局创建一个共享的module 这里示例创建一个模块common-share 创建完成后,会生成两个文件 文件1 ...

  2. DLL的两种加载方式

    案例简述 在某项目中,需要使用两个不同版本的HCNetSDK库,我们通常使用的静态加载DLL的方式不能满足该需求,故用到动态加载DLL的方式. 背景技术及术语解释 静态加载:也称隐式调用,指在运行程序 ...

  3. 解决win7嵌入式系统无法DoublePulsar问题

    0x01 前言 渗透过程中总是会遇到千奇百怪的问题,比如前段时间内网横向时用MS17010打台win7,EternalBlue已经提示win了,可是DoublePulsar就是死活一直报错,最后我查阅 ...

  4. linux基础(部分讲解)

    linux常见岗位 Linux运维工程师.Linux高级架构师.运维开发工程师.数据库管理员.云计算架构师 作为python后端可以从事的linux岗位: 自动化运维.容器运维.DBA 注意:会的越多 ...

  5. drf-序列化器、反序列化、反序列化校验

    1.APIView执行流程 1.之前我们是基于django原生的View编写接口,drf提供给咱们的一个类APIView,以后使用drf写视图类,都是继承这个类及其子类,APIView本身就是继承了D ...

  6. C-03\浮点数转换与编码和补码

    工程生成文件格式了解(常用) 工具 文件 作用 vc++6.0 .dsw 最高级别的配置文件,记录了整个工作空间的配置信息,是一个纯文本的文件,创建新项目时自动生成 vc++6.0 .dsp 配置文件 ...

  7. Vue06 数据绑定

    1 Vue模板语法 Vue模板语法分为两大类,插值语法和指令语法 1.1 插值语法 1)功能:用于解析标签体内容 2)写法:{{xxx}} xxx是js表达式,且可以直接读取到vue实例里面的属性 3 ...

  8. .Net Core后端架构实战【1-项目分层框架设计】

    摘要:基于.NET Core 7.0WebApi后端架构实战[1-项目结构分层设计]  2023/02/05, ASP.NET Core 7.0, VS2022 引言 从实习到现在回想自己已经入行四年 ...

  9. 模拟实现strlen的三种方法

    一.strlen()的工作原理 二.模拟实现strlen的三种方法 计数器方法 指针-指针 递归的方法 三.库函数实现strlen的思路 四.库函数的strlen同上面模拟实现strlen的区别 一. ...

  10. Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation

    1.出现问题 查询数据时报如题错误 2.解决方案 建表时需指定字符集,例如: -- ---------------------------- -- Table structure for testTa ...