Skip to content

feat: keystroke obfuscation#135

Merged
kruton merged 1 commit into
mainfrom
obfuscation
May 5, 2026
Merged

feat: keystroke obfuscation#135
kruton merged 1 commit into
mainfrom
obfuscation

Conversation

@kruton
Copy link
Copy Markdown
Member

@kruton kruton commented May 5, 2026

Modeled after OpenSSH keystroke obfuscation "send chaff" technique to assist in defeating keystroke timing attacks.

Copilot AI review requested due to automatic review settings May 5, 2026 08:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces outbound keystroke-timing obfuscation for interactive (PTY) SSH sessions by quantizing write timing and sending SSH_MSG_PING “chaff” packets between real keystrokes, modeled after OpenSSH’s approach.

Changes:

  • Add obscureKeystrokeTimingIntervalMs to SshClientConfig and plumb it through SshClientSshConnectionSessionChannel.
  • Implement KeystrokeObfuscator timing logic and integrate it into SessionChannel.write() with a background chaff-sending loop.
  • Add unit/integration tests covering obfuscator timing behavior and chaff emission/cadence, and update sshlib/api.txt.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
sshlib/src/main/kotlin/org/connectbot/sshlib/client/KeystrokeObfuscator.kt Adds the timing/state machine for interval scheduling and chaff-window tracking.
sshlib/src/main/kotlin/org/connectbot/sshlib/client/SessionChannel.kt Routes writes through obfuscation when PTY + ping support + interval enabled; launches chaff loop.
sshlib/src/main/kotlin/org/connectbot/sshlib/client/SshConnection.kt Adds config parameter plumbing and introduces sendChaff() using SSH_MSG_PING.
sshlib/src/main/kotlin/org/connectbot/sshlib/SshClientConfig.kt Adds public configuration knob and builder documentation for keystroke timing obfuscation.
sshlib/src/main/kotlin/org/connectbot/sshlib/SshClient.kt Passes new config field into SshConnection.
sshlib/src/test/kotlin/org/connectbot/sshlib/client/KeystrokeObfuscatorTest.kt Unit tests for timing behavior (activation, delay, interval advance, fuzz bounds).
sshlib/src/test/kotlin/org/connectbot/sshlib/client/KeystrokeObfuscationTest.kt Integration-style tests validating when chaff is sent and encrypted-wire size/cadence expectations.
sshlib/api.txt Updates public API surface to include the new config property and constructor parameter.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/client/SshConnection.kt Outdated
Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/client/SessionChannel.kt Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/client/SessionChannel.kt Outdated
Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/client/SessionChannel.kt Outdated
Comment thread sshlib/src/main/kotlin/org/connectbot/sshlib/SshClientConfig.kt
Modeled after OpenSSH keystroke obfuscation "send chaff" technique to
assist in defeating keystroke timing attacks.
@kruton kruton merged commit 3857f73 into main May 5, 2026
10 checks passed
@kruton kruton deleted the obfuscation branch May 5, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants