Regular Expression Denial of Service (ReDoS) in check_processes action (CWE-400)
还没有人认领这个 Issue。
评估
调研方向
从 contrib/linux/actions/checks/check_processes.py 中的 byName 和第 73 行附近的 re.search 调用开始;追踪进程名称如何来自命令行参数。确定匹配是否应继续基于正则表达式,还是应采用字面匹配,然后验证经过构造的输入不会导致正则表达式过度回溯,并且正常的进程名称匹配仍然有效。
由索引模型根据 Issue 内容生成。
描述
Summary
Static analysis (Snyk SAST) identified a Regular Expression Denial of Service (ReDoS) vulnerability where unsanitized user input from command line arguments is passed directly to re.search without validation.
Affected File
contrib/linux/actions/checks/check_processes.py (line 73)
def byName(self, name):
self.name = name
self.process(criteria="name")
self.show()
The name parameter is set from CLI input and later used in re.search at line 73:
if re.search(self.name, pInfo[1]):
self.interestingProcs.append(pInfo)
Impact
A user-supplied process name is used directly as a regular expression pattern. A crafted input string with pathological backtracking patterns (e.g., (a+)+$) could cause the regex engine to consume significant CPU time, effectively causing a denial of service.
While this is contrib code, it ships with StackStorm and may be deployed by users without modification.
Recommended Fix
If regex matching is intentional, sanitize the input or set a timeout. If literal string matching is sufficient, use a simple string comparison instead of re.search:
# Option 1: Escape regex special characters for literal matching
if re.search(re.escape(self.name), pInfo[1]):
# Option 2: Use simple string containment check
if self.name in pInfo[1]:
References
- CWE-400: Uncontrolled Resource Consumption
- Detected by: Snyk Code (SAST)
- 主要语言
- Python
- 星标
- 6.5k
- 派生
- 792
- 平均合并
- 1 天 3 小时
- 30 天内合并 PR
- 4
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
StackStorm/st2 的其他 Issue
-
yaml.FullLoader used instead of SafeLoader in pack metadata parsing (CWE-502)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 86/100
StackStorm/st2#6393 · 1 条评论 ·
-
Git worktree directories created with chmod 777 (CWE-732)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
StackStorm/st2#6392 ·
-
难度 2/5 1-3 小时 新手友好度 76/100
StackStorm/st2#6389 ·
-
难度 4/5 3-5 天 新手友好度 55/100
StackStorm/st2#6391 ·
-
CORS middleware reflects Origin with Allow-Credentials, enabling cross-origin attacks (CWE-346)可能已有人在做 @R-zin 于 12 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 68/100
StackStorm/st2#6390 ·
相似的 Issue
-
area:core-platform effort:S priority:P3 status:in-review type:test
难度 2/5 1 小时以内 新手友好度 80/100
randomparity/kdive#3246 · 1 条评论 ·
维护者通常 1 天内回复
-
Requantification library converts m/z to mass with the hydrogen-atom mass instead of the proton mass未关闭bug
难度 1/5 1 小时以内 新手友好度 85/100
nf-core/metaboigniter#130 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
common-workflow-language/cwl-utils#477 ·
维护者通常 1 天内回复
-
Add dependabot未关闭feat
难度 2/5 1 小时以内 新手友好度 72/100
open-nudge/opentemplate#204 ·
维护者通常 1 天内回复
-
github-stale-ci-pr-closer: KV state is double-wrapped, never persists, and hits the depth-32 limit可能已有人在做 @VascoSch92 今天认领。 未关闭priority:medium ready-for-dev
难度 2/5 1-3 小时 新手友好度 72/100
OpenHands/extensions#781 ·
维护者通常 1 天内回复