Skip to content

fix SSH MITM, file permissions, pin dependencies#440

Open
kpshukla wants to merge 1 commit intocryptosharks131:v1.11.0from
kpshukla:security-fixes
Open

fix SSH MITM, file permissions, pin dependencies#440
kpshukla wants to merge 1 commit intocryptosharks131:v1.11.0from
kpshukla:security-fixes

Conversation

@kpshukla
Copy link
Copy Markdown

Summary

  • Paramiko SSH MITM fix — replaced AutoAddPolicy() with load_system_host_keys() + RejectPolicy() in gui/views.py. The SSH client now loads the user's ~/.ssh/known_hosts and rejects any unrecognised host, preventing man-in-the-middle attacks on LAN SSH connections.
  • Password file permissionsdata/lndg-admin.txt is now created with mode=0o600 and os.chmod applied after write, restricting access to owner only (was world-readable by default).
  • Pin dependencies — added minimum version bounds to all packages in requirements.txt (e.g. Django>=4.2,<5.0, cryptography>=41.0, paramiko>=3.4) to prevent installation of vulnerable or breaking versions.

Notes

These fixes are scoped specifically to the local/single-user LNDg deployment model (localhost, LAN only). Other potential findings (open redirect, query param handling, security headers) were reviewed and deemed low/negligible risk given that context.

Test plan

  • Verify SSH channel DB size feature still works for hosts present in ~/.ssh/known_hosts
  • Run pip install -r requirements.txt to confirm no dependency conflicts
  • Run a fresh initialize.py and confirm data/lndg-admin.txt has permissions 600

🤖 Generated with Claude Code

- Fix Paramiko SSH MITM vulnerability: replace AutoAddPolicy with
  load_system_host_keys() + RejectPolicy to reject unknown hosts
- Restrict lndg-admin.txt password file permissions to 0o600 (owner
  read/write only) using touch(mode=) and os.chmod
- Pin all dependencies in requirements.txt with minimum version bounds
  to prevent installation of vulnerable versions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kpshukla kpshukla changed the title Security: fix SSH MITM, file permissions, pin dependencies fix SSH MITM, file permissions, pin dependencies Mar 19, 2026
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