Regular Expression Denial of Service (ReDoS) in check_processes action (CWE-400)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6.5k
- Forks
- 787
- PR merge metrics
- No merged PRs in 30d
Description
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)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in contrib/linux/actions/checks/check_processes.py at byName and the re.search call around line 73; trace how the process name comes from command-line arguments. Determine whether matching should remain regex-based or be literal, then verify that crafted input cannot cause excessive regex backtracking and that normal process-name matching still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, security
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100