PowerShell / PowerShell/Win32-OpenSSH

Handle leak, locked file after using ssh connection to user account

Open
#2,204 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-sshd Investigate Issue-Bug
Dominant language
No language data
Stars
8.3k
Forks
819
PR merge metrics
No merged PRs in 30d

Description

Prerequisites
  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.
Steps to reproduce

After connecting using ssh from machine A to machine B .DAT files are marked as "Open by System".

Steps:

  • Download OpenSSH from Optional Feaures.
  • Create a new account on machine B, do not login to this account.
  • Connect from machine A to machine B using ssh.
  • Close connection, remove account on machine B.
  • In the users is leftover folder with .DAT files inside which are open by a system.

Comment:
Tested VM hyper-V and another physical machine.
Tried finding handle in resource monitor and using Handler.exe from sysinternal. Handle isn;t listed in any of.

Tried to duplicate handle using c++ and close binary/library reponsible for keeping it alive. Program couldn't find any binary or library which have this handle open. Regardless it's listed as open by System.

Expected behavior
.DAT files shouldn't lock removing this folder. Handles to them should be closed and i should be able to remove user folder. (C:\Users\userfolder)
Actual behavior
.DAT files are locked and removing them is impossible until restart.
Error details

No response

Environment data
Both server and client. 

Name                           Value                                                                                   
----                           -----                                                                                   
PSVersion                      5.1.22621.2506                                                                          
PSEdition                      Desktop                                                                                 
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                 
BuildVersion                   10.0.22621.2506                                                                         
CLRVersion                     4.0.30319.42000                                                                         
WSManStackVersion              3.0                                                                                     
PSRemotingProtocolVersion      2.3                                                                                     
SerializationVersion           1.1.0.1
Version

9.5

Visuals

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue on Windows with Win32-OpenSSH 9.5 using the listed account-creation, SSH connection, and account-removal steps. Observe the .DAT files and system handles after closing the connection; done means the handles close and the user folder can be removed without restarting. No source files or tests are named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, powershell
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.