Skip to content

CHEF-19255 Fix named pipes to be more secure #797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

sa-progress
Copy link

Description

This PR implements security best practices for Windows named pipe usage in the local transport.

  • Randomizes pipe names
  • Sets strict ACLs on named pipes
  • Verifies pipe ownership before connecting
  • Ensures fully qualified paths are used for PowerShell execution

Related Issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New content (non-breaking change)
  • Breaking change (a content change which would break existing functionality or processes)

Checklist

  • I have read the CONTRIBUTING document.

Signed-off-by: sa-progress <[email protected]>
@sa-progress sa-progress requested a review from a team as a code owner June 17, 2025 12:44
Signed-off-by: sa-progress <[email protected]>
Signed-off-by: sa-progress <[email protected]>
Signed-off-by: sa-progress <[email protected]>
Signed-off-by: sa-progress <[email protected]>
@Nik08 Nik08 changed the title CHEF-19255 Inspec Bugcrowd Fix: Chef Privilege Escalation Vulnerability CHEF-19255 Fix named pipes to be more secure Jun 19, 2025
@Nik08 Nik08 requested a review from Copilot June 19, 2025 07:59
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances security for Windows named pipes in the local transport by enforcing ACLs, verifying ownership, and adding corresponding tests.

  • Enforce ownership checks before pipe connection and raise on unauthorized access
  • Configure strict pipe ACLs in PowerShell when starting the server
  • Introduce current_windows_user and pipe_owned_by_current_user? helpers with new tests

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
test/windows/local_test.rb Added specs for pipe ownership and Windows user detection logic
lib/train/transports/local.rb Enforce ACL checks, set pipe security rules, and add helper methods
Comments suppressed due to low confidence (1)

lib/train/transports/local.rb:236

  • Consider adding a unit test to cover the unauthorized access path in acquire_pipe, ensuring that PipeError is raised when the current user does not own the pipe.
            raise PipeError, "Unauthorized user '#{current_user}' tried to connect to pipe '#{pipe_name}'. Pipe is owned by '#{owner}'."

sa-progress and others added 2 commits June 19, 2025 14:36
…5-inspec-bugcrowd-chef-privilege-escalation-vulnerability
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.

3 participants