From ed5d516c219b34c2dd4ecd7fbfc5b5341ce14a7c Mon Sep 17 00:00:00 2001 From: Spencer McIntyre Date: Tue, 23 May 2023 15:18:00 -0400 Subject: [PATCH] Sync the .NET working path for Powershell sessions See: https://github.com/PowerShell/PowerShell/issues/10278 --- lib/msf/core/post/file.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/msf/core/post/file.rb b/lib/msf/core/post/file.rb index a06fe282c7fc..051f2d46d3eb 100644 --- a/lib/msf/core/post/file.rb +++ b/lib/msf/core/post/file.rb @@ -49,7 +49,7 @@ def cd(path) if session.type == 'meterpreter' session.fs.dir.chdir(e_path) elsif session.type == 'powershell' - cmd_exec("Set-Location -Path \"#{e_path}\"") + cmd_exec("Set-Location -Path \"#{e_path}\";[System.IO.Directory]::SetCurrentDirectory($(Get-Location))") else session.shell_command_token("cd \"#{e_path}\"") end