Skip to content

fix(security): enforce auth, secure key storage, harden input - #1

Open
vpsouza wants to merge 1 commit into
LiboShen:mainfrom
vpsouza:security/pentest-fixes
Open

vpsouza wants to merge 1 commit into
LiboShen:mainfrom
vpsouza:security/pentest-fixes

Conversation

@vpsouza

@vpsouza vpsouza commented Mar 23, 2026

Copy link
Copy Markdown

Summary

Addresses critical and high-severity vulnerabilities found during a penetration test of the macOS host:

  • [CRITICAL] Enforce signature verification — messages with invalid Ed25519 signatures are now rejected (was bypassed in PoC mode)
  • [CRITICAL] Paired-device authorization — only messages from known paired clients (verified by public key) are accepted; unknown devices are rejected
  • [CRITICAL] Device ID cross-check — from field verified against paired client record to prevent spoofing
  • [HIGH] AppleScript injection fix — app names sanitized before interpolation in window activation fallback
  • [HIGH] Private key → macOS Keychain — Ed25519 key stored via flutter_secure_storage instead of plaintext SharedPreferences, with automatic migration and fallback
  • [HIGH] Input injection rate limiting — 120 events/sec cap + 4KB paste text limit
  • [MEDIUM] CLI socket authentication — Unix domain socket requires a random auth token (chmod 600 token file)

Version bumped to 1.6.0+17.

Test plan

  • Verify existing pairing flow still works (pair new device, reconnect)
  • Confirm unpaired devices cannot connect (should see "Rejecting message from unknown/unpaired public key" in logs)
  • Confirm forged signatures are rejected (should see "Signature verification failed")
  • Verify private key migrates to Keychain on first launch after update
  • Test input injection works normally (mouse, keyboard, paste) within rate limits
  • Verify CLI afk notify still works with token file
  • Test on macOS, verify no Keychain permission popups block the app

🤖 Generated with Claude Code

Address critical and high-severity vulnerabilities found during penetration test:

- Reject messages with invalid Ed25519 signatures (was bypassed in PoC mode)
- Verify sender public key against paired clients list before processing
- Cross-check fromDeviceId against paired client record to prevent spoofing
- Sanitize app names in AppleScript to prevent injection
- Migrate private key from SharedPreferences to flutter_secure_storage (macOS Keychain)
- Add 120 events/sec rate limit and 4KB paste length cap on input injection
- Add token-based auth on CLI Unix domain socket

Bump version to 1.6.0+17.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant