Please report security problems privately to the maintainer, not in a public issue: through the repository's private vulnerability reporting (security advisories) where the hosting offers it, or by direct message to the maintainer. Say what is affected, how to reproduce it and what an attacker gains. You get an answer within a few days; a fix and a note in the release come before details are public.
slimkvm controls another computer like a local keyboard and, optionally, its power button. Treat it like root access to that computer:
- Reachable only from your LAN or through a VPN, never directly from the internet.
- A long password and the two-factor login (TOTP).
- The KVM host itself kept up to date (
unattended-upgrades) and reachable by the admins only.
- A slimkvm login is worth root on the target. Whoever logs in has its keyboard: Ctrl+Alt+Del,
then
ein the boot menu andinit=/bin/shgives a root shell without any password of the target. Only expose slimkvm in your LAN or through a VPN, use a long password and the two-factor login. - Harden the target if that matters to you (each with a price in an emergency):
systemctl mask ctrl-alt-del.target(Ctrl+Alt+Del no longer reboots – also not from the Keys menu), a GRUB password (boot entries cannot be edited without it), a BIOS/UEFI password and boot order (no booting from foreign media). Keep these passwords where you find them when the target is broken. - Sessions: cookie
__Host-slimkvm(Secure; HttpOnly; SameSite=Strict), ends after 8 hours (session_hours). After 30 minutes without input (idle_minutes) keyboard, mouse, power and settings are refused until the password (and code) is entered again; watching goes on. 5 wrong codes or passwords inside a session end it. Every request and every WebSocket message is checked against the session, so open WebSockets end with it. A password change on the page logs out the other sessions; a change on the host (slimkvm.py auth, Ansible, reset) or of the list of revoked client certificates logs out all of them. - Everything except
/login,/setupand the stylesheet needs a session. POST and WebSocket must come from the page itself (Origin check). Strict CSP. - Login: scrypt; one password check at a time (the lockout holds against parallel attempts and scrypt cannot fill the memory). Lockout per address (IPv6: per /64) for login and setup code: after 3 wrong attempts 5 minutes, after 3 more 15, then 45, at most 60 – longer locks only lock out the owner, scrypt and the one-at-a-time check keep guessing slow anyway. A successful login or a day without failures resets it; in memory only. Wrong attempts inside a session (unlock, power code, account) count for that session, not the address: people behind one VPN address cannot lock each other out. Each TOTP code is accepted once. Changing the password or the second factor needs the current password (and the code while it is on).
- Power menu: with the two-factor login on, the server wants a fresh code for every power action. That stops misclicks and quick sabotage with a stolen session, not a determined attacker (see above: the keyboard alone can reboot the target). The dialog's focus is on Cancel when no code is asked. Stopping or updating slimkvm waits for a running action and opens the relay in any case.
- A fresh install accepts a password only together with the setup code from the host (8 characters,
only in
/var/lib/slimkvm/setup-code, readable by root, not in the journal). - Optional SSO: the user header is believed only from
trusted_proxies(default: localhost), never from other clients; the proxy has to strip client-sent copies. The user gets a slimkvm session that ends as soon as a request comes without the user (logged out at the proxy, removed from the group). - Optional mTLS: with
client_caset, only devices with a client certificate of your CA get through the TLS handshake (ADVANCED.md); revoked ones are refused at once. If the list of revoked certificates is missing or unreadable, every certificate is refused. - tesseract.js does not run in the page: the OCR host worker (
/ocr/host.js) runs it with its own CSP, which allows only tesseract.js and its worker – no fetch, no WebSocket, no other worker. The tesseract worker (/ocr/worker.min.js) may compile WebAssembly and load only its core and the language models. So even a manipulated tesseract.js could not type on the target or press its power button (checked in Firefox with test scripts under both policies). - Requests: bodies only with a valid
Content-Lengthup to 4 KB (no chunked bodies); at most 16 connections per address and 64 in total. slimkvm.service: unprivileged user, read-only system except its state directory, only serial, capture, GPU and hidraw devices, system call filter,MemoryMax,TasksMax,LimitNOFILE,IPAddressAllow=only localhost, private ranges and 100.64.0.0/10 (neither slimkvm nor its ffmpeg can reach the internet). Who may connect:[server] allow(default: the private ranges), refusals logged. ffmpeg may only use files and pipes.slimkvm-eventsruns as root (it may call scripts that read root-only tokens) but sandboxed.- Files written as root by
slimkvm.py auth(also from Ansible) are created withO_NOFOLLOW|O_EXCLand handed over by file handle: the service user cannot redirect them with symlinks. - tesseract.js is pinned with its sha512; update it with
dev/vendor-tesseract-js.shwhen needed. Everything else comes from Debian (security updates viaunattended-upgradesrecommended). - If the KVM host itself is compromised, nothing above helps: it holds the TOTP key in clear text and has the keyboard and the power button. Keep it updated and reachable only by the admins.