Skip to content

Fix insecure FTP/FTPS/SFTP default configuration - #234

Merged
erikraft merged 1 commit into
masterfrom
fix/ftp-sftp-secure-defaults
Oct 16, 2026
Merged

erikraft merged 1 commit into
masterfrom
fix/ftp-sftp-secure-defaults

Conversation

@erikraft

Copy link
Copy Markdown
Owner

Security fix for Strix finding

Addresses the HIGH-severity finding reported on PR #232 (CWE-798).

Changes

  • Generate and persist a cryptographically random per-install password for FTP/FTPS and SFTP when credentials are missing or match weak legacy defaults.
  • Migrate existing installations once: disable anonymous FTP login and enable FTPS by default; replace weak default passwords while preserving existing strong credentials.
  • Keep FTPS enabled as the fallback in both the service and settings UI.
  • Enforce credential strength at the server boundary for both FTP/FTPS and SFTP: reject blank/short (under 12 characters), username-equal, and known weak passwords rather than starting the server.
  • Add the same localized security error in the default resources and all 39 localized resource directories.
  • Keep the existing opt-in settings available; users can deliberately change FTPS/anonymous settings after the one-time migration.

Scope

Android-only: the Web/Desktop repository does not contain these Android FTP/SFTP server services, so no Web/Desktop changes are needed.

Validation

  • Reviewed the current master implementations of FtpServerService, SftpServerService, and both settings screens.
  • No local Gradle build, lint, device test, or live FTP/FTPS/SFTP transfer test has been run here.
  • Keep this PR in Draft until CI compiles successfully and the defaults/migration are manually verified on an Android device.
  • No FTP/FTPS/SFTP integration tests were added to CI.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 96b86e9a-8ab6-4d01-b3a9-89a016a28ca1
📥 Commits

Reviewing files that changed from the base of the PR and between c782bba and f2e05c6.

📒 Files selected for processing: 45
  • app/src/main/java/com/erikraft/drop/FtpSecurityDefaults.java
  • app/src/main/java/com/erikraft/drop/FtpServerService.java
  • app/src/main/java/com/erikraft/drop/FtpSettingsActivity.java
  • app/src/main/java/com/erikraft/drop/SftpServerService.java
  • app/src/main/java/com/erikraft/drop/SftpSettingsActivity.java
  • app/src/main/res/values-af-rZA/ftp_security.xml
  • app/src/main/res/values-ar-rSA/ftp_security.xml
  • app/src/main/res/values-bg-rBG/ftp_security.xml
  • app/src/main/res/values-ca-rES/ftp_security.xml
  • app/src/main/res/values-cs-rCZ/ftp_security.xml
  • app/src/main/res/values-da-rDK/ftp_security.xml
  • app/src/main/res/values-de-rDE/ftp_security.xml
  • app/src/main/res/values-el-rGR/ftp_security.xml
  • app/src/main/res/values-es-rES/ftp_security.xml
  • app/src/main/res/values-fi-rFI/ftp_security.xml
  • app/src/main/res/values-fr-rFR/ftp_security.xml
  • app/src/main/res/values-hi-rIN/ftp_security.xml
  • app/src/main/res/values-hr-rHR/ftp_security.xml
  • app/src/main/res/values-hu-rHU/ftp_security.xml
  • app/src/main/res/values-in-rID/ftp_security.xml
  • app/src/main/res/values-it-rIT/ftp_security.xml
  • app/src/main/res/values-iw-rIL/ftp_security.xml
  • app/src/main/res/values-ja-rJP/ftp_security.xml
  • app/src/main/res/values-ko-rKR/ftp_security.xml
  • app/src/main/res/values-mk-rMK/ftp_security.xml
  • app/src/main/res/values-ne-rNP/ftp_security.xml
  • app/src/main/res/values-nl-rNL/ftp_security.xml
  • app/src/main/res/values-no-rNO/ftp_security.xml
  • app/src/main/res/values-pl-rPL/ftp_security.xml
  • app/src/main/res/values-pt-rBR/ftp_security.xml
  • app/src/main/res/values-pt-rPT/ftp_security.xml
  • app/src/main/res/values-ro-rRO/ftp_security.xml
  • app/src/main/res/values-ru-rRU/ftp_security.xml
  • app/src/main/res/values-sk-rSK/ftp_security.xml
  • app/src/main/res/values-sl-rSI/ftp_security.xml
  • app/src/main/res/values-sr-rRS/ftp_security.xml
  • app/src/main/res/values-sr-rSP/ftp_security.xml
  • app/src/main/res/values-sr/ftp_security.xml
  • app/src/main/res/values-sv-rSE/ftp_security.xml
  • app/src/main/res/values-tr-rTR/ftp_security.xml
  • app/src/main/res/values-uk-rUA/ftp_security.xml
  • app/src/main/res/values-vi-rVN/ftp_security.xml
  • app/src/main/res/values-zh-rCN/ftp_security.xml
  • app/src/main/res/values-zh-rTW/ftp_security.xml
  • app/src/main/res/values/ftp_security.xml
+---------------------------------------+
| CI/CD: Carrots In / Defects Canceled. |
+---------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@erikraft
erikraft force-pushed the fix/ftp-sftp-secure-defaults branch from 328b1c3 to f2e05c6 Compare October 16, 2026 22:50
@erikraft
erikraft marked this pull request as ready for review October 16, 2026 22:55
@strix-security

strix-security Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Strix Security Review

No security issues found.

Review summary

Reviewed the FTP/FTPS/SFTP secure-defaults fix. The change correctly replaces weak/hardcoded default credentials with per-install cryptographically random passwords (SecureRandom, 24-byte Base64), enforces a minimum credential-strength policy at the server boundary for both FTP/FTPS and SFTP (fail-closed via IllegalStateException on weak values), and migrates anonymous login off and FTPS on once. The migration is idempotent and preserves existing strong credentials while regenerating weak ones. The legacy "android" fallback default remains in code but is unreachable because migration regenerates weak/empty values and the boundary check rejects any weak credential before the server can start. Data flows were traced across all changed functions; no new vulnerability, fix bypass, or regression was found in the changed code. The 40 added resource files are pure localized strings.

Updated for f2e05c6.


Reviewed by Strix
Re-run review · Configure security review settings

@erikraft
erikraft merged commit 6331cc7 into master Oct 16, 2026
7 of 8 checks passed
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