Skip to content

Czkawka deletes duplicate files without warning or asking for permissions. [EXTREMELY DANGEROUS] #46

Description

@she3o

when I run $ czkawka_cli dups -d $PWD , czkawka finds duplicate files and deletes them without asking for permission, giving a warning or showing that files were deleted in its output:

$ dd if=/dev/urandom of=file-1 bs=64M count=16
$ cp file-1 file-2
$ czkawka_cli dup -d $PWD
    Found 2 duplicated files in 1 groups with same content which took 512.00 MiB:
    Size - 512.00 MiB (536870896) - 2 files
    /home/she3sha3y/dups/file-1
    /home/she3sha3y/dups/file-2
----

czkawka deleted file-2 without saying in the output. Help does not say that this command deletes files

$ czkawka_cli dup -h
   czkawka_cli-dup 1.0.0
   Finds duplicate files

This is very VERY dangerous. If I run this from the home directory, or worse, as root from the root directory, it could break a system and I would not even know. Many language libraries have duplicate files e.g. use the same package manager, Python with init.py. I could have two similar binaries with different filenames. Breaking a system is as easy as (DON'T TRY THIS! ) sudo czkawka_cli dups -d/.

IMO the command should just print out dups and an option should be explicitly typed to invoke deletion (after asking permission) and preferably it should refuse to run at all as the root user or in directories like /usr/ /etc/ /bin/ and exit gracefully with a message Can't run this command as root, Can't run this command in /bin/ as it could potentially break your system.

This should be fixed urgently! Thank you in advance. 😀

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions