Download Winscp Powershell Module [BEST]

0 views
Skip to first unread message

Ann Iacobucci

unread,
Jan 21, 2024, 6:49:39 AM1/21/24
to laebuivilcha

The Posh-SSH module is a handy module to work with files over SFTP. To get started, open PowerShell as administrator and run Install-Module to download and install the module from the PowerShell Gallery. If prompted about an untrusted repository, type Y or A to confirm.

download winscp powershell module


DOWNLOAD >>> https://t.co/YQR4mcFKH7



Uploading files and folders is similar to listing files with the WinSCP module. To do so, run the Send-WinSCPItem command as shown below. By specifying the session (WinSCPSession), the local Path of the file to upload, and the RemotePath to where the file should go, Send-WinSCPItem will upload the file.

OperationStopped: The winscp.exe executable was not found at location of the assembly (C:\Program Files\WindowsPowerShell\Modules\WinSCP\5.13.7.0\bin), nor in an installation path. You may use Session.ExecutablePath property to explicitly set path to winscp.exe.

I reviewed the code, it looks like it should find it there. It looks like you have the WinSCP PowerShell module installed already, if you leave the path entry blank, it should load up this module and continue.

Dans ce tutoriel, je vais vous expliquer comment utiliser ce module WinSCP pour vous permettre de l'exploiter par vous-même dans vos scripts PowerShell. Le module est disponible sur GitHub et la PowerShell Gallery, voici les liens :

Hi Amigos,
I am facing issue with invoke PowerShell activity, I have an script for PowerShell WinSCP to download the first 3 latest excel files to my local desktop and trying to run it in studio.
I have multiple methods to just run this still getting nothing.
Here are some Screenshots and the script. btw script is working fine in powershell IE.
I have kept the username, password, hostname empty just for the security purpose.

You are right. sourcefire module/sensor does not act as SCP server so you can't use winSC to connect to it. But it does act as SCP client so you can use either firesight or any other SCP server and copy the files to scp server first and then using winscp to get them out.

This is useful if the install/uninstaller is just a wrapper which then calls the actual installer as its own child process. When this option is true then the module will wait for both processes to finish before returning.

Since extracting the passwords from these sorts of files has come in handy before, I decided to play with a few tools in a controlled environment. Hopefully other security assessors can read about them before needing them on a test. Perhaps more importantly, some additional exposure may help administrators and users realize the dangers of storing or distributing passwords in configuration files. For both VNC and WinSCP, I tested Windows-based tools as well as Metasploit modules.

Next, I tried the /post/windows/gather/credentials/vnc metasploit module. Since this module checks default installation locations for the UltraVNC.ini file and registry keys, and since I (intentionally) did not install my clients according to defaults, it was initially unsuccessful:

Therefore, if your access or privileges are limited for any reason, you may still be able to get your hands on an .ini file which may prove easier than searching the registry. When pointed at the .ini file, winscppwd extracts the password without issue:

In the above case, I can see that calc.exe is actually from MicrosoftCorporation. And for winscp.exe, I can see that the copy I have on the systemwhere I ran the check was signed by the Developer, Martin Prikryl.

Next, multiple scheduled tasks are created on the compromised systems to maintain persistence on them. At the same time, once the Cobalt strike module is running on the system, the actions to be taken can be varied by running additional scripts to search for tools that allow lateral movement and allow the attacker to further compromise the system.

Open a PowerShell terminal to test the connection to the SFTP server with WinSCP by giving a command like ...
winscp /command "open s :password@MYSERVER/" "put C:\Users\gkendall\Desktop\screenshots\sftp_upload\MyScreenshot.jpeg MyScreenshot.jpeg" "exit"

Go to the Editors module and add a new Editor setup like this ...
Name: WinSCP
Application: C:\Users\gkendall\AppData\Local\Programs\WinSCP\WinSCP.exe
Arguments: /command "open s :password@MYSERVER/" "put $filepath$ MyScreenshot.jpeg" "exit"

Multiple scheduled tasks executing batch files for persistence were also created in the machine. These batch files execute Python scripts leading to in-memory execution of Cobalt Strike beacons. Interestingly, the Python scripts use the marshal module to execute a pseudo-compiled (.pyc) code that is leveraged to download and execute the malicious beacon module in memory.

To obtain high-privileged credentials and escalate privileges, the threat actor used a Python script also containing the marshal module to execute a pseudo-compiled code for LaZagne. Another script to obtain Veeam credentials following the same structure was also identified in the environment.

This page contains detailed information about how to use the post/windows/gather/credentials/winscp metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

This module extracts weakly encrypted saved passwords fromWinSCP. It searches for saved sessions in the WindowsRegistry and the WinSCP.ini file. It cannot decryptpasswords if a master password is used.

df19127ead
Reply all
Reply to author
Forward
0 new messages