Lain is a local-first password manager for Windows. This document describes the security properties implemented by the current Lain 4.x codebase, the assumptions users should make when operating it, and how to report a suspected vulnerability.
Please do not publish exploitable details, proof-of-concept code, or unpatched vulnerability reports in public issues or discussions.
Use GitHub's private vulnerability reporting page when private vulnerability reporting is enabled for the repository. If that option is unavailable, contact the project maintainer through a private channel associated with the repository before disclosing the issue publicly.
Include the following information where possible:
- The affected Lain version and Windows version/build.
- The security impact and conditions required to reproduce it.
- Minimal reproduction steps or a proof of concept that does not expose real credentials.
- Whether the issue affects the vault, authentication, backup/recovery, updates, clipboard handling, browser import, or another component.
Do not send master passwords, recovery codes, security-key secrets, private signing keys, browser password exports, or personal vault files. Use synthetic test data when preparing a reproduction.
Please allow the maintainer an opportunity to investigate and prepare a fix before sharing technical details publicly.
Security reports are relevant to the Lain Windows application and its handling of:
- Vault encryption, authentication, parsing, integrity checks, and migration.
- Master-password and FIDO2/WebAuthn security-key authentication.
- Recovery, encrypted backup creation, restoration, and verification.
- Local storage, sensitive data in memory, and clipboard handling.
- Browser-export account import.
- Signed update-manifest validation and downloaded update verification.
Issues in Windows, .NET Framework, hardware authenticators, or third-party components are in scope when they create a security vulnerability in Lain's use of them.
- Lain is a Windows desktop application targeting .NET Framework 4.8.
- The vault is stored locally in the
Laindirectory beside the application. Lain does not require a cloud account or hosted vault service to create, unlock, edit, or use a vault. - The application uses the
LAINBOX1container. Its current data section isLAINVLT4; the optional security-key section uses the authenticatedLAINKEY2format. - When upgrading from a build that used the
Datadirectory, Lain moves the legacy directory toLainwithout rewriting the files. If both directories contain files, migration stops rather than merging or overwriting them. - The local encrypted backup is stored alongside the vault. It is useful for recovery from file-level damage, but it is not an independent backup against loss of the device, disk, Windows account, or application directory. Keep a separate backup in a separately protected location if that level of recovery is required.
The current vault format uses the following protections:
| Component | Implementation |
|---|---|
| Account-field encryption | AES-256-GCM through Windows CNG (bcrypt.dll) |
| GCM nonce | Fresh 12-byte nonce for each encrypted field |
| GCM authentication tag | 16 bytes (128 bits) |
| Field associated data | The field-format version is authenticated as associated data |
| Vault-file integrity | HMAC-SHA-256 over the serialized data section |
| Password key derivation | PBKDF2-HMAC-SHA-256 |
| New password-derived key baseline | 600,000 iterations with a fresh 16-byte salt |
| Derived key separation | 64 derived bytes split into separate 32-byte AES and HMAC keys |
New field writes use AES-256-GCM. The complete serialized data section is also authenticated with HMAC-SHA-256. The security-key section has its own integrity protection. Unknown cryptographic suite identifiers are rejected rather than silently downgraded.
Lain uses Windows CNG for AES-GCM because the application targets .NET Framework 4.8. Password-derived keys use the per-vault PBKDF2 parameters stored in the vault header. Existing work factors are validated and are not reduced; lower password KDF work factors are upgraded after a successful password-based unlock when the required password is available.
The LAINKEY2 format can still read older versioned CBC-plus-HMAC wrapping envelopes for compatibility. New wrapping writes use AES-256-GCM, and older envelopes are re-wrapped when the corresponding authentication factor is available.
Lain supports three unlock modes:
| Mode | Required factor(s) |
|---|---|
| Password only | Master password |
| Either | Master password or an enrolled security key |
| Both | Master password and an enrolled security key, or master password and the recovery code |
New password-only and Either-mode master passwords require at least 15 Unicode scalar values. Both mode requires at least 12. Passwords must also receive a Strong or Very strong result from Lain's local strength estimator. The estimator is a heuristic; it cannot guarantee that a password is unique or absent from breach data.
FIDO2 security-key operations use the Windows WebAuthn API and the hmac-secret / PRF extension. The current registration policy uses ES256 with P-256, requires user verification, and requests cross-platform authenticators. Assertions are checked locally against the stored credential public key and relying-party ID. Lain does not request WebAuthn attestation and therefore does not certify the authenticator's manufacturer or model.
A recovery code is an alternative second factor in Both mode; it does not replace the master password. Store recovery codes separately from the computer and the encrypted vault backup.
- More → Verify vault integrity performs a read-only check of the active vault and retained encrypted backups using the current unlocked key.
- Verification authenticates the container, vault integrity data, key material when present, and encrypted account fields.
- The verification action does not restore, rewrite, or delete files.
- A file that cannot be read or authenticated with the current key is reported as unverified. This result alone does not prove corruption; a backup may have been created using different key material, for example before a password or security-key change.
- During unlock, Lain can restore a backup only after authenticating the backup data with the supplied unlock factor. A recovery message is shown when a backup is used.
Lain provides configurable inactivity locking and can lock when the Windows session is locked, a remote session disconnects, or the device suspends. It also supports an optional lock-on-minimize setting and a manual Lock Vault command (Ctrl+L).
Copied values are placed on the Windows clipboard so they can be pasted into other applications. Lain sets clipboard-history/cloud-sync exclusion formats where supported, can clear its own clipboard contents after the configured timeout, and clears its own clipboard contents when the vault locks or the application closes. Cleanup checks clipboard ownership/sequence information so Lain does not intentionally clear newer content copied by another application.
Clipboard behavior is still subject to Windows, other applications, clipboard managers, and platform support. Do not treat clipboard exclusion or automatic clearing as a guarantee that another process cannot read copied content.
Vault creation, unlocking, editing, and local storage do not require a network connection. The application has two network-related features:
- Breach check: This check is explicitly user-initiated. Lain computes a SHA-1 hash of each password locally for compatibility with the Have I Been Pwned Pwned Passwords range API. It sends only the first five hexadecimal characters of each hash over HTTPS to
api.pwnedpasswords.com; it checks returned hash suffixes locally. The password and complete hash are not sent by this lookup. SHA-1 is used only for this lookup protocol, not for vault encryption or integrity. - Update check: Lain automatically checks for a newer version once after the main window is displayed by requesting
version.txtfrom the project's GitHub repository. If a newer version is found, the user is asked before the executable is downloaded and replaced. In the current application update flow, the downloaded executable is not independently verified against a signed update manifest or a SHA-256 digest before replacement. The source contains signed-manifest verification code and regression tests, but the current MainForm updater does not invoke that verification path. Treat updates as trusted only when obtained from the official GitHub Releases page, and verify any available release signature through Windows before running the installer or executable.
Do not distribute or commit the private release-signing key. If the updater is later changed to enforce signed-manifest verification, this section should be updated to describe the integrated behavior only after that behavior is confirmed in the release build.
The current vault format does not enable a post-quantum key-encapsulation mechanism: its KEM identifier is 0 (none). The current WebAuthn credential policy uses classical ES256/P-256 signatures. Lain should therefore not be described as post-quantum resistant.
Lain is designed to protect encrypted vault data at rest when an attacker obtains vault files but does not have the required authentication factors and the master password is sufficiently strong. This protection depends on the cryptographic implementation, Windows CNG, the operating system, and the user's handling of authentication factors.
Lain cannot guarantee protection when the endpoint itself is compromised. In particular, it is not designed to protect against:
- Malware, keyloggers, malicious accessibility/UI automation, or an attacker controlling the logged-in Windows account.
- Local administrators, kernel-level compromise, debugging/instrumentation, or process-memory inspection while the vault is unlocked.
- Screen capture, shoulder surfing, or observation while account data is displayed.
- Other applications or clipboard managers that read clipboard contents while a password is copied.
- Weak or reused master passwords exposed to offline guessing after encrypted vault files are obtained.
- Loss, theft, or destruction of the device or local application directory when no separate backup exists.
- Plaintext browser password-export CSV files created before import. Protect these exports and remove them when they are no longer needed.
The password KDF is PBKDF2-HMAC-SHA-256. It is not a memory-hard KDF, so choosing a long, unique master password remains important against offline guessing. Security-key modes add the factor requirements described above; the Either mode intentionally allows either configured method to unlock the vault, while Both requires both factors (or the password plus recovery code).
- Use a long, unique master password that is not used for another service.
- Consider Both mode when requiring a security key in addition to the master password is appropriate for your use case.
- Keep recovery codes and independent backups separate from the computer that stores the vault.
- Keep Windows and the installed .NET Framework updated, and use a standard Windows account for daily work where practical.
- Keep automatic locking enabled with an appropriate timeout, and lock the vault before leaving an unattended workstation.
- Treat copied passwords and browser-export CSV files as plaintext while they are outside the encrypted vault.
- Obtain application updates from the project's official GitHub Releases page and do not bypass update-signature or digest failures.
The repository includes a dependency-free Lain.SecurityTests regression-test executable. It covers cryptographic known-answer and tampering cases, PBKDF2 policy and upgrade behavior, WebAuthn credential/assertion validation, vault backup and integrity checks, legacy-folder migration, the signed-update-manifest verification helper, downloaded-file digest validation helper, browser CSV import handling, clipboard timeout bounds, external-link validation, and transactional account updates. The existence of tests for the update-verification helper does not mean the current MainForm updater invokes that helper; see Network behavior above.
Run the test executable on Windows with .NET Framework 4.8 after building the Release solution. Passing these tests is useful regression evidence, but it is not a formal security certification or a substitute for independent security review.