Security Model
Transport security
- SSH connections (SFTP, SCP, Shell fallback, Jump Host) are always encrypted by the SSH protocol.
- Use HTTPS for all PHP Agent / PHP Shell traffic. Avoid plain HTTP on any network you do not fully control.
- LAN Pair authenticates both computers with the pairing password (SPAKE2) and encrypts the whole session with AES-256-GCM.
Password and credential storage
| Storage mode | INI format | Description |
| TC Master Password | password=! | Delegated to Total Commander's own CryptProc API |
| DPAPI | password=dpapi:<base64> | Windows CryptProtectData, bound to your Windows user account |
| Explicit plaintext | password=plain:<text> | Opt-in only; use only in isolated environments |
| Legacy XOR | <decimal triplets> | Read-only; used by very old plugin versions — never written for new sessions |
- All decrypted password buffers are zeroed from memory (
SecureZeroMemory) immediately after use.
- Jump Host credentials are stored and encrypted separately from target-host credentials.
- The PHP Agent PSK is stored as a salted SHA-256 hash inside
sftp.php — the raw secret is not written to disk on the server.
SSH host identity verification
- The server's fingerprint is stored in
sftpplug.ini on first connection, as SHA256 in the form OpenSSH prints it (SHA256:…), so it can be checked on the server with ssh-keygen -lf. The confirmation shows the MD5 as well. An MD5 stored by an earlier version still matches and is rewritten as SHA256 on that connection, without a prompt.
- On every subsequent connection the fingerprint is compared. A mismatch raises an explicit warning dialog — you must confirm before connecting.
- Jump Host (bastion) keeps a separate stored fingerprint from the final target host.
- Accepting a new fingerprint should always be a deliberate decision.
LAN Pair cryptography
- The pairing password, the same on both computers, becomes a pair key through PBKDF2-HMAC-SHA256 with 120,000 iterations, salted with the two computers' ids.
- The computers prove the key to each other with SPAKE2 (RFC 9382, P-256). Neither the password nor the key is transmitted, and a recorded exchange gives nothing to guess the password against offline; an attacker who joins in gets one guess per connection, each costing a second.
- Everything after the handshake is encrypted and authenticated with AES-256-GCM, with a separate key per direction and numbered frames: an altered, replayed or reordered frame ends the connection.
- Pairing requires the password. After a successful handshake the key is stored encrypted with Windows DPAPI, per peer pair, and used for later sessions.
- Session timeout is enforced between operations; active transfers are never killed mid-stream.
- The cryptography is OpenSSL (statically linked) and Windows BCrypt — no third-party DLLs.
Plugin error isolation
Every exported plugin function is wrapped by an exception firewall. If an unexpected error occurs inside the plugin:
- The exception is caught before it can reach Total Commander.
- The current operation is aborted and an appropriate error code is returned to TC.
- A diagnostic dialog is shown with the error type and call location.
- Total Commander continues running normally — a plugin bug cannot crash the host process.
Key file security
- Private key files (PEM/PPK) are read only at connection time and not stored in the session profile.
- PPK v2 and v3 are converted to an in-memory PEM form — the conversion result is never written to disk.
- Argon2 (PPK v3 key derivation) is statically compiled into the plugin — no separate DLL is involved.
Operational recommendations
- Use DPAPI password storage (default) rather than plain-text for all sessions.
- Restrict access to the TC directory containing
sftpplug.ini — it holds encrypted credentials.
- Restrict URL exposure for PHP Agent deployments; use HTTPS with a valid certificate.
- Rotate SSH keys and PHP Agent passwords periodically.
- Do not commit
sftpplug.ini or sftp.php with live credentials to public repositories.
- Keep the plugin and PHP runtime up to date.
Important: Security depends on TLS configuration, server hardening, and secret management together — not on the plugin alone.
Back to index