[REQ] wcx_ftp.ini encryption

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

timsky
Junior Member
Junior Member
Posts: 11
Joined: 2005-06-22, 16:08 UTC

Post by *timsky »

Mr. Ghisler are there any changes?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48097
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

TC 7.5 will use AES-256 from CryptoAPI with SHA256 (implemented inside of TC), I'm currently working exactly on this function. I haven't received any reply yet from the maker of the AES plugin, so sadly this function will be available only in Windows XP and later.

Perhaps someone else can take over the AES plugin if the author is no longer maintaining it. Only small changes will be needed, I can send detailed instructions if anyone would like to take over. The plugin uses Delphi, though, so the developper would need to be able to recompile the project with Delphi.
Author of Total Commander
https://www.ghisler.com
timsky
Junior Member
Junior Member
Posts: 11
Joined: 2005-06-22, 16:08 UTC

Post by *timsky »

That's great! :)
When do you plan release TC 7.5?
octane
Junior Member
Junior Member
Posts: 9
Joined: 2006-06-29, 12:06 UTC

Post by *octane »

AES, well. Where will you store the encryption-key or will there a "master-password" for this SecStore?
StatusQuo
Power Member
Power Member
Posts: 1524
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo »

octane wrote:AES, well. Where will you store the encryption-key or will there a "master-password" for this SecStore?
I think this is answered here:
ghisler(Author) wrote:The user will need to type it in every time a stored password is used (it may be remembered for a certain time)
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48097
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Currently my implementation works like this:
1. User uses Ctrl+F - New or Edit dialog
2. There is a new checkbox "Use master password to protect your passwords"
3. User enters FTP site password, checks the option in 2, and clicks OK
4. User is asked for master password
5. TC looks for ini file value AESVerify which contains a random value encrypted with the password in the form byte1 byte2 byte3 byte4. If the value is found, it is decrypted with the master password. If byte1=byte3 and byte2=byte4, then the password is OK. If not, TC shows an error.
6. If AESVerify is not found, TC asks user to confirm master password, then creates AESVerify value and stores it.
7. The ftp password is encrypted with the master password. For each password, a different random seed value is created and stored with the encrypted password. This is done so even if a user uses the same ftp password for two configurations, the encrypted data will be different.
8. The master password is remembered in memory, but not as a string, but instead in an array of pointers where each pointer points to one character. In addition, each character is XORed with a random value (different random value for each character). This way the password isn't stored in plain text in memory, except for a very short time when the AES key is derived.
9. The key is currently remembered until Total Commander is minimized. I also plan to add a user-configurable timeout. It would also be nice to "forget" the key when the screen saver kicks in - does anyone know how to detect that?
10. The AES master key is derived via SHA256 of the password and a seed value. In addition, that key is then encrypted 1000 times with another, random AES key which is stored in the wcx_ftp.ini. This method (which was implemented in some other password safe tool) is used to make brute force attacks very slow.
11. The password edit box doesn't react normally to WM_CHAR messages. Instead, I install a WH_KEYBOARD_LL (and if this isn't possible, WH_KEYBOARD) hook. Since the last-installed hook will be called first, this will override any keyloggers which have installed a hook before TC.

Any other suggestions to make that more secure?
Author of Total Commander
https://www.ghisler.com
StatusQuo
Power Member
Power Member
Posts: 1524
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo »

ghisler(Author) wrote:9. [...]It would also be nice to "forget" the key when the screen saver kicks in - does anyone know how to detect that?
BOOL WINAPI SystemParametersInfo( SPI_GETSCREENSAVERRUNNING, ... )
should give the info - at least passively, for Win2k and up. Here is a workaround for NT4 / Win95 (using a hook; search for SPI_GETSCREENSAVERRUNNING).

MSDN Lib link
Example in C
Example in VB6
Example in Python


Maybe a more active notification can be achieved by monitoring some system message,
like WM_SYSCOMMAND Notification ( MSDN Link ) with parameter SC_SCREENSAVE:
MSDN Lib wrote:A window receives this message [...]

SC_SCREENSAVE
Executes the screen saver application specified in the [boot] section of the System.ini file.
Example:

Code: Select all

LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{  switch (message)
   {  case WM_SYSCOMMAND:
      {  switch (wParam)
         {  case SC_SCREENSAVE:
[...]
Example implementation in C, and another (very similiar) one, in a bigger project
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2ghisler(Author)
Your approach sounds very promising - especially when looking at the problems recently found in Truecrypt and FileVault. A few questions/remarks:

1. Which function do you use to delete data in memory?
2. It would be great if you would provide a password storing mechanism for plug-ins. Something like a key chain seen in other operating systems such as Linux or OS X.
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

ghisler(Author) wrote:9. The key is currently remembered until Total Commander is minimized.
I don't like it. It's surely security enchantment, but it's counterproductive.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48097
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2StatusQuo
Thanks for the hints, but none of them worked. The SystemParametersInfo didn't return true on Windows 2000 when password protection of the screen saver was off, and the SC_SCREENSAVE notification is only sent to the program which currently has the focus, no other programs.

I did find a solution which works, though: When TC doesn't have focus, check with a timer whether there is a 'WindowsScreenSaverClass' window. This is for the case when there is no password protection, then the screen saver runs on the same desktop. Otherwise call OpenDesktop('Screen-saver',... and if it works, enumerate the windows on that desktop and check that they aren't on the same desktop as TC (this is necessary due to a bug in Windows).

2Lefteous
1. I simply overwrite it withv zeroes before freeing the memory.
2. I'm considering this too, but I need some way to prevent that plugin A stores some passwords, and then plugin B reads them and sends them to a cracker.

2m^2
What would you suggest then? You can't really expect that a user re-enters the password every time, this would be even more annoying as the Vista security dialogs.
Author of Total Commander
https://www.ghisler.com
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2ghisler(Author)
I simply overwrite it withv zeroes before freeing the memory.
You might consider using SecureZeroMemory depending on how you currently zeroing the data.
I'm considering this too
Great :-)
Last edited by Lefteous on 2008-02-25, 20:37 UTC, edited 1 time in total.
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

I suggest that forgetting in these situations should be optional.
IMO a button to forget password will do just fine for great majority of users.
ADDED: Actually my contact with Vista is the reason for this suggestion. Reentering the password every time I connect to ftp server after minimizing TC would be almost as annoying as what MS wants to sell us.
User avatar
fenix_productions
Power Member
Power Member
Posts: 1979
Joined: 2005-08-07, 13:23 UTC
Location: Poland
Contact:

Post by *fenix_productions »

Why not to make this re-entering optional?
If someone sets this in INI file it will be his fault only. The default settings should be "as less bothering as it possible".

Personally: I have KeePass locked each time its minimized. I can accept asking for master password every-time it is focused because I am using this app rarely. I think that some people will accept it for the prize of being safe.

PS. Will there be any possibility for the user to see what passwords he put for any FTP server?
"When we created the poke, we thought it would be cool to have a feature without any specific purpose." Facebook...

#128099
User avatar
m^2
Power Member
Power Member
Posts: 1413
Joined: 2006-07-12, 10:02 UTC
Location: Poland
Contact:

Post by *m^2 »

fenix_productions wrote:PS. Will there be any possibility for the user to see what passwords he put for any FTP server?
Sure. You know Revelation. :P
User avatar
Hacker
Moderator
Moderator
Posts: 13073
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

fenix_productions,
The default settings should be "as less bothering as it possible".
Should the default settings not be "as secure as possible"?

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Post Reply