Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Regular Expression Denial of Service (ReDoS) in check_processes action (CWE-400)

未关闭 适合新手
#6,387 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
python
领域
cli, security

调研方向

从 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 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

StackStorm/st2 的其他 Issue

查看 StackStorm/st2 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。