Skip to content

Latest commit

 

History

History
228 lines (185 loc) · 13.3 KB

security.en.md

File metadata and controls

228 lines (185 loc) · 13.3 KB

Security

← README

This is a tool that reaches production servers over SSH, so the following is not design intent. It is what the code does today, with the file to check it against.

Host key verification

Yes. Keys are verified against an OpenSSH-format known_hosts (internal/sshcore/hostkey.go).

  • On first contact you get the address, the key type and the SHA256 fingerprint, and you choose: reject / trust once / trust always. Only "always" writes to the file
  • A key that contradicts the recorded one drops the connection. You get a full-screen warning, and there is no option anywhere in the code to continue past it, and you are not even asked. That is the signature of a man-in-the-middle
  • Permissions are 0700 on the directory, 0600 on the file

Important

LiteDeck does not use ~/.ssh/known_hosts. It keeps its own file at <OS config dir>/litedeck/known_hosts. A host you have already reached with ssh will therefore still prompt once here. The format is identical, so copying the existing line across skips it.

Authentication

ssh-agent, private key file (with passphrase), password, and keyboard-interactive for 2FA and OTP. The order tried is configured per host.

  • Put ssh-agent first if you can. The key never enters this process
  • OTP and 2FA answers are never stored. A one-time code is worthless the second time

Bastions (ProxyJump)

A bastion is treated as a login of its own (internal/sshcore/conn.go).

  • Its host key is verified exactly as the target's is. A separate fingerprint, a separate prompt
  • Its password is stored under its own entry and never overwrites the target's
  • The target's host key check is unchanged. Tunnelling does not weaken it — the bastion forwards bytes and vouches for nobody
  • Closing the session closes the bastion connection with it. Leaving it open is an idle login sitting on somebody else's jump host

A chain of hops is refused. Doing quietly what has never been verified is worse.

Reading the server's sshd configuration

The network tab reads /etc/ssh/sshd_config and its Include targets over SFTP (internal/app/sshdconfig.go). It reads, runs no command, and needs no root. It changes nothing — there is no editing feature.

Its limit: it knows only what the files declare. sshd's compiled-in defaults differ between distributions, so they are not guessed, and any file this account could not read is named as a gap.

Credential storage

If a secret is stored, it goes only into the OS credential store: macOS Keychain, Windows Credential Manager, Linux Secret Service (internal/secret/secret.go).

  • LiteDeck never writes a secret to a file of its own. Where no credential store is reachable the answer is not a weaker file format but not storing it. You are asked every time, and the "remember this" checkbox is not shown at all rather than promising something it cannot keep
  • Storing is opt-in at each prompt. Every host has a forget stored passwords action
  • If a stored sudo password stops working because it changed on the server, it deletes itself. Otherwise the keychain keeps answering before the dialog appears and you can never correct it
  • hosts.json holds addresses, usernames and paths to key files. No secrets

sudo

Nothing is escalated on your behalf (internal/app/sudo.go). Commands run as the user you logged in as. If the server refuses, the UI asks whether to retry as administrator and you press the button. Silently prefixing sudo would make the Command Log stop matching what you believe you asked for, and that log is the only reason to trust this app.

  • The password travels on stdin only: sudo -S -p '' -- <cmd>. In argv it would be visible in the remote process table to every other user on that machine, and would appear verbatim in the Command Log. That is why the Command Log is safe to display in full
  • NOPASSWD is detected with sudo -n true, and then nothing is asked. Prompting for a password the server does not want is not just pointless. It trains you to type your password into any dialog
  • MCP uses this same lock and nothing else. While you have the padlock open on the Security tab, svc_control, container_control and proc_signal run as root. The password is still typed into LiteDeck alone; no tool takes it or returns it, and there is no tool that opens the lock — so no model can ask anybody for their password. With the lock shut, the answer says to open it in the app and the command goes out as the login user
  • An MCP call never raises a password dialog. A dialog that appears with nobody in front of the screen gets answered for the wrong reason, or teaches its reader to answer any dialog at all

The MCP endpoint

Turning on MCP integration opens one local HTTP endpoint. That single endpoint speaks for every server you have shared, so what is written here decides whether the feature is safe (internal/mcp/http.go).

  • Bound to 127.0.0.1 only. There is no setting to expose it elsewhere. The absence of that option is the only thing making this endpoint safe
  • Bearer token, stored in settings, compared in constant time, and changed only by the rotate button. Rotating on the app's schedule would break the client config you pasted in, at a moment you did not choose
  • Origin is checked. A browser page can POST to loopback, and DNS rebinding can make that look same-origin. The MCP spec asks for this; a real MCP client sends no Origin at all
  • Rate limited to 1.5 calls a second, burst of 8. Not politeness: the Exec pool is three channels wide, so an agent burst does not slow the server down, it starves the GUI you are looking at
  • Per-server opt-in, and deleting files is a separate switch. Registering a host, or sharing it to be read, does not grant deletion
  • The approval policy belongs to the app. No tool changes it and no parameter relaxes it, so a model has no way to request its own approval. That the protocol carries no trustworthy statement of a client's intent was verified against Claude Code 2.1.22
  • Undo copies live on this machine and clear after 7 days by default (1–90 days and a size cap are set in the MCP panel). What each change wrote is kept beside it, so it can be shown as a diff. Nothing is left on the server
  • The AI work record (ai-log.jsonl) keeps 30 days on this machine only. Besides tool, target and result it holds command lines and the head of their output (4 KB), which can contain secrets, so like the copies it is 0600

Stated plainly:

  • With "stop asking" on, prompt injection wins. Text planted in a log or a file can steer the model, and in that mode nobody sees it in time. What remains is not defence but attribution and blast radius: everything in the Command Log, the mode expiring on its own, and the fact that it is set per host
  • Only files can be undone. A service restart or a killed process has no copy behind it. Those are the recoverable kind, which is why they are offered; recursive directory deletion and removing containers or images are not offered at all
  • Running a command cannot be undone. run_command has to be switched on per server (off by default), and with it on the default mode still asks every time. "Don't ask overnight" does cover it, though: that mode is switched on for unattended work, and stopping at the first command would defeat the point — and killing a process or restarting a service is just as irreversible. The reason it exists at all is auditing: the same command typed in the terminal tab leaves nothing in the Command Log, and one that goes through MCP leaves all of it. The reasoning is in the MCP doc
  • The MCP layer never touches credentials. The token is for this endpoint only, and SSH credentials stay in the OS keychain as described above

Settings sync (with a file)

Your host list and approval policies can be written to one encrypted file, and read back on another machine (internal/cfgsync). There is no account, no relay and no repository. Where the file goes is up to you — Google Drive, Dropbox, iCloud, a stick, an email to yourself.

What it does not do, first

  • No secret is in the file. Passwords, key passphrases, sudo passwords, private keys and the MCP token are not exported. They live in the OS credential store, as described above
  • Not even the private key's path. A key is named by its public-key fingerprint and label. /Users/me/.ssh/id_ed25519 does not exist on the other machine
  • Hosts imported from ~/.ssh/config are not exported. That file is already your own way of carrying hosts between machines
  • Lose the passphrase and the file cannot be opened. A recovery path would mean LiteDeck holds the key
  • It is not a sync. Nothing merges, no revisions are tracked, and nothing notices two machines editing at once. It is a snapshot of one moment
  • Not available in server mode. It reads and writes the disk of the machine the app runs on

What is in the file

The whole thing is one JSON document whose contents are XChaCha20-Poly1305 ciphertext. The only plaintext is the format name and version, the KDF parameters, the salt, the wrapped key, when it was made, and the UUID of the machine that made it — a UUID, not a machine name. The file ends up in a cloud folder, and a list of the user's computers is not free to give away.

  • Vault key: 32 random bytes. KEK: argon2id(passphrase, salt, time, memory, threads)
  • The parameters are read from the file, not from constants in the binary, so a file written on a Raspberry Pi opens elsewhere. They are bounded, though: the file is something an attacker could have written, and Argon2 does what it is told
  • The extension is .ldbackup. A .json invites somebody to open it in an editor and fix it, and a fixed file no longer opens

Importing is not restoring

AI permissions in the file that are wider than this machine's are not applied by default. The import screen names what would widen ("Shared with AI clients · Running commands") and it takes ticking a box, there and then. Whoever exported the file decided what an AI client may do to those servers, and they were not sitting at this desk. For the same reason:

  • A host seen for the first time starts at the app's defaults: not shared, ask before writing, no command execution, no file deletion
  • Anything stricter is applied as it is. Tightening needs no confirmation
  • Host keys are taken automatically only where that address has none. Where a different one is already trusted, nothing is touched and both fingerprints are shown — there is no way to tell a rebuilt server from somebody in the middle
  • A tombstone in a file is not a delete. It is a snapshot, and opening an old backup must not remove the hosts added since
  • A record whose rev is lower than one this machine has already seen is not applied, and is warned about

Where the file ends up

A cloud folder is indexed by somebody else's software and reachable through somebody else's account recovery. The file holds no passwords and no keys, but it holds every server's address and account name, which is a map of what to attack. That is why the passphrase floor is twelve characters.

Exporting and importing are not exposed to MCP. The box that widens permissions exists only in the GUI, and a test pins that — a model must not be able to approve its own permissions.

What it does not do, stated up front

  • It cannot fully bound how long a password stays in memory. The one copy that lives long enough to matter — the sudo password a turned lock holds until the connection ends — is kept as bytes and zeroed when the lock is released. Every other copy is still a string and cannot be erased: the one x/crypto/ssh takes at the moment of authentication, and the one made to hand it over. Both live for a single call and become garbage at once, but a core or heap dump taken in that moment could show them
  • Release binaries are unsigned. A SHA256 checksum is not a signature
  • The integrity check on a resumed transfer looks at the seam, not at everything already transferred — the 64KB before the resume point. A source edited to exactly the same length, outside that window, could get through (features in detail)
  • What has been exercised on real hardware is listed in what is and is not verified. On a Raspberry Pi 4 that is whole-folder transfers with resume, a completed sudo escalation, the terminal PTY and live log tailing; on a real Windows server, ending a session and a cold WSL start. What has not been exercised is in the same table
  • There is no audit log. The Command Log stays on your machine and goes nowhere. A log the client writes is not an audit
  • Dependency vulnerabilities are checked by govulncheck ./... in CI, on pushes to main and every PR

Found a vulnerability? Please email cpprhtn@naver.com rather than opening a public issue.