gilbertchen / duplicacy

A new generation cloud backup tool
https://duplicacy.com
Other
5.13k stars 335 forks source link

Security Enhancement Proposal #668

Open sy2339226 opened 3 months ago

sy2339226 commented 3 months ago

Overview

I've identified several critical security concerns in the Duplicacy project that compromise the integrity and confidentiality of data. The issues pertain to the usage of deprecated cryptographic algorithms and insecure configurations. Below, I detail the problems and propose solutions to enhance the software's security posture.

Issue 1: Static Salt in Master Key Generation

In the file duplicacy/src/duplicacy_config.go, the master key generation uses a static salt, which is a significant security flaw. Static salts reduce the effectiveness of password hashing, making it easier for attackers to guess or crack passwords through dictionary or rainbow table attacks.

Recommendation

Transition to using dynamic, per-password salts for generating master keys. This ensures that even identical passwords will produce different hashes, enhancing resistance against attacks.

Issue 2: SHA1 for File Integrity Verification

Within duplicacy/src/duplicacy_b2client.go, SHA1 is employed as the hashing algorithm for file integrity checks. SHA1 is outdated and susceptible to collision attacks, meaning two different files could have the same hash value, undermining the trustworthiness of file verification processes.

Recommendation

Upgrade to SHA256 or a stronger hash function for file integrity checks. This change is crucial for maintaining data integrity against active adversaries.

Issue 3: Insecure SSH Cipher Suites and Algorithms

The file duplicacy/src/duplicacy_sftpstorage.go contains configurations that permit the use of weak and outdated cipher suites and algorithms, such as RC4, AES-CBC, and SHA1. These algorithms have known vulnerabilities that can be exploited by attackers:

Recommendation

Discontinue support for RC4, AES-CBC, and SHA1. Opt for modern, secure alternatives such as AES-GCM for symmetric encryption and SHA256 for hash functions. Ensure that key exchange mechanisms prioritize elliptic curve cryptography (ECC) for enhanced security.


Action Items

To address these vulnerabilities effectively, I propose the following steps:

  1. Update Master Key Generation: Implement a mechanism to generate dynamic salts for each password, improving the robustness of the hashing process.
  2. Hash Function Upgrade: Replace SHA1 with SHA256 for all file integrity checks, ensuring that data is protected against collision attacks.
  3. SSH Cipher Suite Revision: Modify the SSH client configuration to exclude RC4, AES-CBC, and SHA1, and promote the use of more secure ciphers and hash functions.

I am committed to contributing to the resolution of these issues and am available to collaborate with the Duplicacy team in implementing these changes. Let's work together to strengthen Duplicacy's security and protect our users' data.


Important Note

Before proceeding with these changes, it is imperative to conduct thorough testing and possibly consult with security experts to ensure that the updates do not inadvertently introduce new vulnerabilities or negatively impact system performance. A security audit may be beneficial to validate the effectiveness of the proposed enhancements.