kovidgoyal/kitty · error

Ignoring encrypted rc command with timestamp {delta / 1e9:.1

Error message

Ignoring encrypted rc command with timestamp {delta / 1e9:.1f} seconds from now. Could be an attempt at a replay attack or an incorrect clock on a remote machine.

What it means

After decrypting an encrypted remote-control command, kitty compares its embedded timestamp with the local clock; if they differ by more than ±5 minutes the command is rejected to block replay attacks.

Source

Thrown at kitty/remote_control.py:72

    if not isinstance(pcmd, dict) or 'version' not in pcmd:
        log_error('JSON payload of remote command is invalid, must be an object with a version field')
        return {}
    pcmd.pop('password', None)
    if 'encrypted' in pcmd:
        if pcmd.get('enc_proto', '1') != RC_ENCRYPTION_PROTOCOL_VERSION:
            log_error(f'Ignoring encrypted rc command with unsupported protocol: {pcmd.get("enc_proto")}')
            return {}
        pubkey = pcmd.get('pubkey', '')
        if not pubkey:
            log_error('Ignoring encrypted rc command without a public key')
        d = AES256GCMDecrypt(encryption_key.derive_secret(base64.b85decode(pubkey)), base64.b85decode(pcmd['iv']), base64.b85decode(pcmd['tag']))
        data = d.add_data_to_be_decrypted(base64.b85decode(pcmd['encrypted']), True)
        pcmd = json.loads(data)
        if not isinstance(pcmd, dict) or 'version' not in pcmd:
            return {}
        delta = time_ns() - pcmd.pop('timestamp')
        if abs(delta) > 5 * 60 * 1e9:
            log_error(
                f'Ignoring encrypted rc command with timestamp {delta / 1e9:.1f} seconds from now.'
                ' Could be an attempt at a replay attack or an incorrect clock on a remote machine.'
            )
            return {}
    return pcmd


class CMDChecker:
    def __call__(self, pcmd: dict[str, Any], window: Optional['Window'], from_socket: bool, extra_data: dict[str, Any]) -> bool | None:
        return False


@lru_cache(maxsize=64)
def is_cmd_allowed_loader(path: str) -> CMDChecker:
    import runpy

    try:
        m = runpy.run_path(path)

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Sync clocks: enable NTP/chrony on both client and server machines
  2. Check timezone-independent system clock (UTC) correctness in VMs/dual-boot setups
  3. If it persists after sync, treat as suspicious and audit who has socket access
Defensive patterns

Strategy: validation

Validate before calling

from time import time_ns
assert abs(time_ns() - payload['timestamp']) <= 5 * 60 * 1e9, 'clock skew > 5 min'

Prevention

When it happens

Trigger: abs(time_ns() - pcmd['timestamp']) > 5*60*1e9 — the sending machine's clock is >5min off, or a captured payload is being replayed.

Common situations: System clock drift / NTP not synced on the client machine, dual-boot clock skew, VMs with paused time, or genuine replay attempts.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/4f1f70a70f803db1. Report an issue: GitHub.