Skip to content

πŸ›‘οΈ Sentinel: [CRITICAL] Fix Resource Exhaustion via subprocess.call Timeout Leak#102

Merged
manupawickramasinghe merged 1 commit into
mainfrom
sentinel/fix-subprocess-timeout-leak-12954097720962151169
Jun 26, 2026
Merged

πŸ›‘οΈ Sentinel: [CRITICAL] Fix Resource Exhaustion via subprocess.call Timeout Leak#102
manupawickramasinghe merged 1 commit into
mainfrom
sentinel/fix-subprocess-timeout-leak-12954097720962151169

Conversation

@ManupaKDU

Copy link
Copy Markdown
Contributor

🚨 Severity

CRITICAL

πŸ’‘ Vulnerability

The is_reachable function executed the ping utility using subprocess.call with a timeout parameter. However, subprocess.call does not kill the child process when the timeout expires; it only raises a TimeoutExpired exception. This leaves the ping process running indefinitely in the background, which can lead to resource exhaustion (DoS) as more timeout events occur.

🎯 Impact

Denial of Service (DoS) due to resource exhaustion. If many scan requests are made with unresponsive IP addresses, the background ping processes will pile up, consuming process IDs (PIDs), memory, and file descriptors until the host OS limits are hit and the service crashes.

πŸ”§ Fix

Updated is_reachable in testping1.py to use subprocess.run() instead of subprocess.call(), as subprocess.run() inherently kills the child process upon timeout, preventing resource leaks. Also updated the unit tests in test_testping1.py to mock subprocess.run.

βœ… Verification

  1. Run tests with python3 -m unittest test_testping1.py and verify all tests pass.
  2. Manually test using a known unresponsive IP (e.g. within a local subnet that does not exist) with a large number of max workers, and use ps aux | grep ping to verify there are no lingering ping processes after the script finishes.

PR created automatically by Jules for task 12954097720962151169 started by @ManupaKDU

…imeout Leak

When passing a `timeout` parameter to `subprocess.call()`, Python raises a `TimeoutExpired` exception but leaves the underlying child process running indefinitely, tying up system resources (PIDs, memory, file descriptors) which can lead to Denial of Service (DoS) as more timeout events occur.

This patch updates `is_reachable` to use `subprocess.run()` instead of `subprocess.call()`, as `subprocess.run()` inherently kills the child process upon timeout, preventing resource leaks.

Unit tests have been updated to mock `subprocess.run` instead of `subprocess.call`.

Co-authored-by: ManupaKDU <95234271+ManupaKDU@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@manupawickramasinghe manupawickramasinghe merged commit 91b0bba into main Jun 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants