|
|||||||||||
|
RE: Saved Terminal Server Sessions
From: Michael Howard <mikehow(at)microsoft.com>
Date: Tue Dec 31 2002 - 14:31:34 EST
Cheers, Michael
-----Original Message-----
st0ff st0ff wrote:
Hi, I guess you are talking about ".RDP" files. The password is encrypted using the CryptProtectData() standard API. You can use the code below (from MSDN), to decrypt it ; however you will have to impersonate the user somehow to make this code run, because the encryption key used is derivated from the user context (the Windows logon password I guess).
//-------------------------------------------------------------------- // RDPCrack.c // // This is modified sample code from MSDN // This code requires Windows 2000 or XP // Don't forget to link CRYPT32.LIB // #include void HandleError(char *s);
void main()
// Put encrypted password string here
// String conversion
for (unsigned int i=0; i<(cbDataOutput); i++) {
sscanf(&(szEncodedPwd[i+i]), "%02x", &data);
pbDataOutput[i] = data;
} DataOut.pbData = pbDataOutput; DataOut.cbData = cbDataOutput;
// Decryption
&DataOut, // [in] Input data
&pDescrOut, // (Optional) [out] Description string
NULL, // (Optional) [in] Entropy (not used by MS)
NULL, // Reserved
NULL, // (Optional) PromptStruct
0, // Flags
&DataVerify)) // [out] Output data
{
wprintf(L"The decrypted data is: %s\n", (WCHAR
*)DataVerify.pbData);
printf("The description of the data was: %S\n", pDescrOut); } else
{
HandleError("Decryption error!");
}
LocalFree(pDescrOut);
void HandleError(char *s)
fprintf(stderr, "An error occurred in running the program. \n");
fprintf(stderr, "%s\n",s);
fprintf(stderr, "Error number %x.\n", GetLastError());
fprintf(stderr, "Program terminating. \n");
exit(1);
} This list is provided by the SecurityFocus Security Intelligence Alert (SIA) Service. For more information on SecurityFocus' SIA service which automatically alerts you to the latest security vulnerabilities please see: https://alerts.securityfocus.com/ This list is provided by the SecurityFocus Security Intelligence Alert (SIA) Service. For more information on SecurityFocus' SIA service which automatically alerts you to the latest security vulnerabilities please see: https://alerts.securityfocus.com/ Received on Tue Dec 31 15:47:11 2002 This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:02:31 EDT |
||||||||||
|
|||||||||||