9 Star 1 Fork 30

src-openEuler/python-setuptools

CVE-2022-40897

已完成
CVE和安全问题
创建于  
2023-01-04 11:41

一、漏洞信息
漏洞编号:CVE-2022-40897
漏洞归属组件:python-setuptools
漏洞归属的版本:65.5.1之前
CVSS V3.0分值:
BaseScore:7.5 High
Vector:CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
漏洞简述:
Python Packaging Authority (PyPA) setuptools before 65.5.1 allows remote attackers to cause a denial of service via HTML in a crafted package or custom PackageIndex page. There is a Regular Expression Denial of Service (ReDoS) in package_index.py.
漏洞公开时间:2022-12-23 08:15
漏洞创建时间:2023-01-04 11:41:12
漏洞详情参考链接:
https://nvd.nist.gov/vuln/detail/CVE-2022-40897

更多参考(点击展开)
参考来源 参考链接 来源链接
nvd https://github.com/pypa/setuptools/blob/fe8a98e696241487ba6ac9f91faa38ade939ec5d/setuptools/package_index.py#L200
nvd https://pyup.io/posts/pyup-discovers-redos-vulnerabilities-in-top-python-packages/
nvd https://github.com/pypa/setuptools/compare/v65.5.0...v65.5.1
nvd https://github.com/pypa/setuptools/commit/43a9c9bfa6aa626ec2a22540bea28d2ca77964be
nvd https://pyup.io/vulnerabilities/CVE-2022-40897/52495/
redhat https://access.redhat.com/security/cve/CVE-2022-40897
suse_bugzilla http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2022-40897 https://bugzilla.suse.com/show_bug.cgi?id=1206667
suse_bugzilla https://www.cve.org/CVERecord?id=CVE-2022-40897 https://bugzilla.suse.com/show_bug.cgi?id=1206667
suse_bugzilla https://github.com/pypa/setuptools/blob/fe8a98e696241487ba6ac9f91faa38ade939ec5d/setuptools/package_index.py#L200 https://bugzilla.suse.com/show_bug.cgi?id=1206667
suse_bugzilla http://www.cvedetails.com/cve/CVE-2022-40897/ https://bugzilla.suse.com/show_bug.cgi?id=1206667
suse_bugzilla https://pyup.io/posts/pyup-discovers-redos-vulnerabilities-in-top-python-packages/ https://bugzilla.suse.com/show_bug.cgi?id=1206667
ubuntu https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-40897 https://ubuntu.com/security/CVE-2022-40897
ubuntu https://github.com/pypa/setuptools/blob/fe8a98e696241487ba6ac9f91faa38ade939ec5d/setuptools/package_index.py#L200 https://ubuntu.com/security/CVE-2022-40897
ubuntu https://pyup.io/posts/pyup-discovers-redos-vulnerabilities-in-top-python-packages/ https://ubuntu.com/security/CVE-2022-40897
ubuntu https://nvd.nist.gov/vuln/detail/CVE-2022-40897 https://ubuntu.com/security/CVE-2022-40897
ubuntu https://launchpad.net/bugs/cve/CVE-2022-40897 https://ubuntu.com/security/CVE-2022-40897
ubuntu https://security-tracker.debian.org/tracker/CVE-2022-40897 https://ubuntu.com/security/CVE-2022-40897
debian https://security-tracker.debian.org/tracker/CVE-2022-40897
cve_search https://github.com/pypa/setuptools/blob/fe8a98e696241487ba6ac9f91faa38ade939ec5d/setuptools/package_index.py#L200
cve_search https://pyup.io/posts/pyup-discovers-redos-vulnerabilities-in-top-python-packages/
cve_search https://github.com/pypa/setuptools/compare/v65.5.0...v65.5.1
cve_search https://github.com/pypa/setuptools/commit/43a9c9bfa6aa626ec2a22540bea28d2ca77964be
cve_search https://pyup.io/vulnerabilities/CVE-2022-40897/52495/
github_advisory https://nvd.nist.gov/vuln/detail/CVE-2022-40897 https://github.com/advisories/GHSA-r9hx-vwmv-q579
github_advisory https://github.com/pypa/setuptools/blob/fe8a98e696241487ba6ac9f91faa38ade939ec5d/setuptools/package_index.py#L200 https://github.com/advisories/GHSA-r9hx-vwmv-q579
github_advisory https://pyup.io/posts/pyup-discovers-redos-vulnerabilities-in-top-python-packages/ https://github.com/advisories/GHSA-r9hx-vwmv-q579
github_advisory https://pyup.io/vulnerabilities/CVE-2022-40897/52495/ https://github.com/advisories/GHSA-r9hx-vwmv-q579
github_advisory https://setuptools.pypa.io/en/latest/ https://github.com/advisories/GHSA-r9hx-vwmv-q579
amazon_linux https://alas.aws.amazon.com/cve/html/CVE-2022-2257.html https://alas.aws.amazon.com/ALAS-2022-1639.html
amazon_linux https://alas.aws.amazon.com/cve/html/CVE-2022-2264.html https://alas.aws.amazon.com/ALAS-2022-1639.html
amazon_linux https://alas.aws.amazon.com/cve/html/CVE-2022-2284.html https://alas.aws.amazon.com/ALAS-2022-1639.html
amazon_linux https://alas.aws.amazon.com/cve/html/CVE-2022-2285.html https://alas.aws.amazon.com/ALAS-2022-1639.html
amazon_linux https://alas.aws.amazon.com/cve/html/CVE-2022-2286.html https://alas.aws.amazon.com/ALAS-2022-1639.html
amazon_linux https://alas.aws.amazon.com/cve/html/CVE-2022-2287.html https://alas.aws.amazon.com/ALAS-2022-1639.html
amazon_linux https://alas.aws.amazon.com/cve/html/CVE-2022-2288.html https://alas.aws.amazon.com/ALAS-2022-1639.html
amazon_linux https://alas.aws.amazon.com/cve/html/CVE-2022-2289.html https://alas.aws.amazon.com/ALAS-2022-1639.html
amazon_linux https://alas.aws.amazon.com/cve/html/CVE-2022-2304.html https://alas.aws.amazon.com/ALAS-2022-1639.html
amazon_linux https://alas.aws.amazon.com/cve/html/CVE-2022-2343.html https://alas.aws.amazon.com/ALAS-2022-1639.html
amazon_linux https://alas.aws.amazon.com/cve/html/CVE-2022-2344.html https://alas.aws.amazon.com/ALAS-2022-1639.html
amazon_linux https://alas.aws.amazon.com/cve/html/CVE-2022-2345.html https://alas.aws.amazon.com/ALAS-2022-1639.html
amazon_linux https://alas.aws.amazon.com/cve/html/CVE-2022-2816.html https://alas.aws.amazon.com/ALAS-2022-1639.html
amazon_linux https://alas.aws.amazon.com/cve/html/CVE-2022-2817.html https://alas.aws.amazon.com/ALAS-2022-1639.html
amazon_linux https://alas.aws.amazon.com/cve/html/CVE-2022-2819.html https://alas.aws.amazon.com/ALAS-2022-1639.html
amazon_linux https://alas.aws.amazon.com/cve/html/CVE-2022-3037.html https://alas.aws.amazon.com/ALAS-2022-1639.html
nvd https://github.com/pypa/setuptools/blob/fe8a98e696241487ba6ac9f91faa38ade939ec5d/setuptools/package_index.py#L200
nvd https://pyup.io/posts/pyup-discovers-redos-vulnerabilities-in-top-python-packages/
nvd https://github.com/pypa/setuptools/compare/v65.5.0...v65.5.1
nvd https://github.com/pypa/setuptools/commit/43a9c9bfa6aa626ec2a22540bea28d2ca77964be
nvd https://pyup.io/vulnerabilities/CVE-2022-40897/52495/
debian https://security-tracker.debian.org/tracker/CVE-2022-40897

漏洞分析指导链接:
https://gitee.com/openeuler/cve-manager/blob/master/cve-vulner-manager/doc/md/manual.md
漏洞数据来源:
其它
漏洞补丁信息:

详情(点击展开)
影响的包 修复版本 修复补丁 问题引入补丁 来源
https://github.com/pypa/setuptools/commit/43a9c9bfa6aa626ec2a22540bea28d2ca77964be nvd

二、漏洞分析结构反馈
影响性分析说明:
setuptools65.5.1之前的版本中存在着一个正则表达式拒绝服务的Dos漏洞。当攻击者以调用setuptools中的package_index模块的REL变量的时候,如果该变量调用的函数中传入的参数带有很长的空字符串,会极大的消耗系统的资源
openEuler评分:
7.5
Vector:CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
受影响版本排查(受影响/不受影响):
1.openEuler-20.03-LTS-SP1(44.1.1):受影响
2.openEuler-20.03-LTS-SP3(44.1.1):受影响
3.openEuler-22.03-LTS(59.4.0):受影响
4.openEuler-22.03-LTS-SP1(59.4.0):受影响

修复是否涉及abi变化(是/否):
1.openEuler-20.03-LTS-SP1(44.1.1):是
2.openEuler-20.03-LTS-SP3(44.1.1):是
3.openEuler-22.03-LTS(59.4.0):是
4.openEuler-22.03-LTS-SP1(59.4.0):是

三、漏洞修复
安全公告链接:https://www.openeuler.org/zh/security/safety-bulletin/detail/?id=openEuler-SA-2023-1004

评论 (12)

zhuofeng 创建了CVE和安全问题 2年前
openeuler-ci-bot 添加了
 
sig/Base-service
标签
2年前

在setuptools65.5.1之前的版本中存在着一个正则表达式拒绝服务的Dos漏洞。当攻击者以调用setuptools中的package_index模块的REL变量的时候,如果该变量调用的函数中传入的参数带有很长的空字符串,会极大的消耗系统的资源

在使用setuptools的package_index模块时,看看是否有调用到REL这个,如果没有,则忽略。有的话再查看REL调用的函数,比如search,match,findall,fullmatch等等函数参数中是否带有很长的空字符串,类似这样setuptools.package_index.REL.search('< rel=' + ' ' * 2**12),如果有的话,请去掉这些空字符串。

复现代码:

import setuptools.package_index as sp
sp.REL.search('< rel=' + ' ' * 2**12)

会长时间运行

其中该cve还涉及到了接口变更。

变更一,如果st中字符串(复现代码中的字符串st)包含rel = 字符,如果=(rel后面的等号)前后的空字符串超过10位(不包含10位),修复前正常返回,修复后返回None

复现代码:

import setuptools.package_index as ap
st = '< rel ='+ ' '*11 + '>'
print(ap.REL.search(st))

或者

import setuptools.package_index as ap
st = '< rel' +' '*11 + '= >'
print(ap.REL.search(st))

修复前

>>> import setuptools.package_index as ap
>>> st = '< rel ='+ ' '*11 + '>'
>>> print(ap.REL.search(st))
<re.Match object; span=(0, 19), match='< rel =           >'>

修复后:

>>> import setuptools.package_index as ap
>>> st = '< rel ='+ ' '*11 + '>'
>>> print(ap.REL.search(st))
None

变更二,如果st中字符串(复现代码中的字符串st)包含<rel = >字符,如果最后一个>字符前面=字符后面没有非空字符串时,也就是说=字符后面>字符前面没有其他字符,那么修复前正常返回,修复后返回None

复现代码:

import setuptools.package_index as ap
st = '< rel = >'
print(ap.REL.search(st))

修复前:

>>> import setuptools.package_index as ap
>>> st = '< rel = >'
>>> print(ap.REL.search(st))
<re.Match object; span=(0, 9), match='< rel = >'>

修复后:

>>> import setuptools.package_index as ap
>>> st = '< rel = >'
>>> print(ap.REL.search(st))
None

当调用setuptools中的package_index模块的REL变量的时候,如果该变量调用的函数中传入的参数带有很长的空字符串,会极大的消耗系统的资源,所以上游限制了不超过10个空字符串。如果业务中有使用REL调用相关函数时,需要注意长度超过10的空字符串带来的影响。

openeuler-ci-bot 修改了描述 2年前
openeuler-ci-bot 负责人设置为hexiaowen 2年前
openeuler-ci-bot 添加了
 
CVE/UNFIXED
标签
2年前
openeuler-ci-bot 计划开始日期设置为2023-01-04 2年前
openeuler-ci-bot 计划截止日期设置为2023-01-18 2年前
openeuler-ci-bot 优先级设置为主要 2年前

影响性分析说明:setuptools65.5.1之前的版本中存在着一个正则表达式拒绝服务的Dos漏洞。当攻击者以调用setuptools中的package_index模块的REL变量的时候,如果该变量调用的函数中传入的参数带有很长的空字符串,会极大的消耗系统的资源

openEuler评分: (评分和向量)7.5

受影响版本排查(受影响/不受影响):
1.openEuler-20.03-LTS-SP1(44.1.1):受影响
2.openEuler-20.03-LTS-SP3(44.1.1):受影响
3.openEuler-22.03-LTS(59.4.0):受影响
4.openEuler-22.03-LTS-SP1(59.4.0):受影响

修复是否涉及abi变化(是/否):
1.openEuler-20.03-LTS-SP1(44.1.1):是
2.openEuler-20.03-LTS-SP3(44.1.1):是
3.openEuler-22.03-LTS(59.4.0):是
4.openEuler-22.03-LTS-SP1(59.4.0):是

openeuler-ci-bot 修改了描述 2年前

影响性分析说明:setuptools65.5.1之前的版本中存在着一个正则表达式拒绝服务的Dos漏洞。当攻击者以调用setuptools中的package_index模块的REL变量的时候,如果该变量调用的函数中传入的参数带有很长的空字符串,会极大的消耗系统的资源

openEuler评分: (评分和向量)7.5
Vector:CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

受影响版本排查(受影响/不受影响):
1.openEuler-20.03-LTS-SP1(44.1.1):受影响
2.openEuler-20.03-LTS-SP3(44.1.1):受影响
3.openEuler-22.03-LTS(59.4.0):受影响
4.openEuler-22.03-LTS-SP1(59.4.0):受影响

修复是否涉及abi变化(是/否):
1.openEuler-20.03-LTS-SP1(44.1.1):是
2.openEuler-20.03-LTS-SP3(44.1.1):是
3.openEuler-22.03-LTS(59.4.0):是
4.openEuler-22.03-LTS-SP1(59.4.0):是

openeuler-ci-bot 修改了描述 2年前
zhuofeng 通过合并 Pull Request !31: fix CVE-2022-40897任务状态待办的 修改为已完成 2年前
openeuler-ci-bot 任务状态已完成 修改为待办的 2年前
openeuler-ci-bot 移除了
 
sig/Base-service
标签
2年前
openeuler-ci-bot 移除了
 
CVE/UNFIXED
标签
2年前
openeuler-ci-bot 添加了
 
CVE/UNFIXED
标签
2年前
openeuler-ci-bot 添加了
 
sig/Base-service
标签
2年前
zhuofeng 通过合并 Pull Request !32: fix CVE-2022-40897任务状态待办的 修改为已完成 2年前
openeuler-ci-bot 任务状态已完成 修改为待办的 2年前
openeuler-ci-bot 移除了
 
CVE/UNFIXED
标签
2年前
openeuler-ci-bot 移除了
 
sig/Base-service
标签
2年前
openeuler-ci-bot 添加了
 
CVE/UNFIXED
标签
2年前
openeuler-ci-bot 添加了
 
sig/Base-service
标签
2年前
openeuler-sync-bot 通过合并 Pull Request !34: [sync] PR-31: fix CVE-2022-40897任务状态待办的 修改为已完成 2年前
openeuler-ci-bot 任务状态已完成 修改为待办的 2年前
openeuler-ci-bot 移除了
 
CVE/UNFIXED
标签
2年前
openeuler-ci-bot 移除了
 
sig/Base-service
标签
2年前
openeuler-ci-bot 添加了
 
CVE/UNFIXED
标签
2年前
openeuler-ci-bot 添加了
 
sig/Base-service
标签
2年前
openeuler-sync-bot 通过合并 Pull Request !36: [sync] PR-32: fix CVE-2022-40897任务状态待办的 修改为已完成 2年前
openeuler-ci-bot 移除了
 
CVE/UNFIXED
标签
2年前
openeuler-ci-bot 移除了
 
sig/Base-service
标签
2年前
openeuler-ci-bot 添加了
 
CVE/FIXED
标签
2年前
openeuler-ci-bot 添加了
 
sig/Base-service
标签
2年前
openeuler-ci-bot 添加了
 
abi-changed
标签
2年前
openeuler-ci-bot 修改了描述 2年前
openeuler-ci-bot 修改了描述 2年前
openeuler-ci-bot 移除了
 
CVE/FIXED
标签
4个月前
openeuler-ci-bot 移除了
 
sig/Base-service
标签
4个月前
openeuler-ci-bot 移除了
 
abi-changed
标签
4个月前
openeuler-ci-bot 添加了
 
CVE/UNAFFECTED
标签
4个月前
openeuler-ci-bot 添加了
 
abi-changed
标签
4个月前
openeuler-ci-bot 添加了
 
sig/Base-service
标签
4个月前

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(2)
5329419 openeuler ci bot 1632792936 zhuofeng-zhuofeng6
1
https://gitee.com/src-openeuler/python-setuptools.git
git@gitee.com:src-openeuler/python-setuptools.git
src-openeuler
python-setuptools
python-setuptools

搜索帮助