Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

Following my answer. If I can list contents of password-protected ZIP file, check the file types of each stored file and even replace it with another one, without actually knowing the password, then does the ZIP files can be still treated as secure?

This is completely insecure in terms of social engineering / influence etc.

I can hijack (intercept) someone else's file (password-protected ZIP file) and I can replace one of files it contains, with my one (fake, virus) without knowing the password. Replaced file will remain unencrypted, not password-protected inside ZIP, but other files won't be modified.

If victim unpack a password-protected archive, extracting program will ask for the password only once, not every time per each file. So, end user will not see difference -- whether program does not ask for a password, because it already knows it (original file) or because that one doesn't need a password (file modified by me). This way, I can inject something really bad into password-protected ZIP file, without knowing its password and still count on, that receiver will be fouled and assume, file is unmodified.

Am I missing something or this is really wrong? How can we say about something in terms of security, if password is not required to introduce any modifications in password-protected file?

share|improve this question
7  
It is in the design of the ZIP archives that they're only containers. Encryption is done on the files not the container itself, so confidentiality & integrity are still granted for the files inside. The ZIP archive itself isn't password-protected, but the files inside are. Actually, RAR files behave almost the same way, except that they give you the option encrypt the file list. You can add fake files to a RAR file (not through WinRAR), but if the list of files is encrypted, then you cannot modify it, therefor the application opening it won't be able to list the fake file. –  Adnan May 13 '13 at 9:10
3  
Upon further reading, I've learned that ZIP uses AES in CBC mode, which doesn't really grant integrity. Although it's not that easy to modify the contents of your files, a persistent threat will eventually be able do that. Please note: The integrity problem is not, of course, that the files can be replaced. IMHO, getting your files replace and tampered with is alright, but not being able to detect such tampering is the integrity problem. –  Adnan May 13 '13 at 10:17
4  
Could you zip your files (without password) and then zip that archive again (with password)? That way you would only have a single file that's password protected, and as you cannot access that one, you cannot modify the inner zip. –  poke May 14 '13 at 1:30
    
@poke: Quite interesting idea! :] –  trejder May 14 '13 at 8:43

11 Answers 11

up vote 24 down vote accepted

To answer this, there needs to be a better definition of "secure" and/or "safe". It's always got to be defined in light of the purpose of the protection and the risk to the system. There's no one size fits all here, what's "safe enough" for one system, may be abysmally weak on another. And what's "safe enough" on another may be cost prohibitive or down right impractical in a different case.

So, taking the typical concerns one by one:

  • Confidentiality - marginal at best. Confidentiality is usually rated in terms of how long it will take to gain access to the protected material. I may be able to change the zip file, but as a hacker it'll take me some amount of time either crack the password or brute force it. Not a lot of time, passwords are one of the weaker protections, and given the way zip files are often shared, social engineering one's way to the password is usually not hard.

  • Integrity - nope - as the asker points out - it's easy to change the package and make it look legitimate.

  • Availability - generally not applicable to this sort of security control - this usually refers to the risk of making a service unavailable - the data storing/packaging usually doesn't affect availability one way or the other.

  • Non repudiation - nope, no protection - anyone can modify the package, so anyone contributing to it has probable deniability.

The trick is - how much better do you want to get? Encrypted email is an option - as a better protection. Although it poses it's own connectivity concerns. And there's many better ways to encrypt data - but the better options also involve key distribution challenges that can add time and cost concerns.

As a quick way to package and share some data that you don't want to make completely public - it's better than nothing, and it's sometimes the only common denominator you can work out. For anything high-risk, I'd find a better option.

share|improve this answer

Not everything that is password protected can be hacked by brute force attacks. However, zip files can be cracked by brute force. Other systems have checks in place, like for example, lock out after three attempts, passkey verifications etc.

share|improve this answer

The official .ZIP format specification does allow for hiding the list of file names (but not number of files), as well as hiding metadata such as the original file size and CRC of the original file. But you can't use WinZip or Info-Zip to do that. Additionally, integrity in the official .ZIP specification is provided through the use of one or more digital signatures in addition to the encryption. My personal recommendation, though, is to avoid passwords, and instead use public keys. Key derivation functions are constantly getting faster, and I don't believe any vendor has even tried to keep up.

share|improve this answer

So the bottom line is, unless there is a vulnerability or back door in the encrypting code, it is as secure as your pass phrase is resistant to brute force attacks. There are various sites on the Internet where you can prototype the scheme you intend to use, to check roughly how long it would take to crack. (Do not use WHAT you intend to use)

Anything anyone can gain physical access to, is crackable, given enough time. However, you can have practical security if the cost and or time required to gain access to the information exceeds its likely value. Unless it is something like financial information, there is often a big difference between what is valuable to a hacker, and what is valuable to you. If the name of your file inside the zip is Attachment_1, and the e-mail's unencrypted contents does not describe the attachment's contents, it doesn't give an hacker much to go on. A hacker is not likely to be willing to spend much time, and certainly not money, to gain access to something that doesn't have a convincingly high probability of containing something of value to him.

share|improve this answer

No. To create an encrypted file (insecurely since the password is echoed):

$ cd -- "$(mktemp --directory)"
$ echo secret > 1.txt
$ echo super secret > 2.txt
$ zip -e -P dIg4BuOTFh secret.zip 1.txt 2.txt
  adding: 1.txt (stored 0%)
  adding: 2.txt (stored 0%)

To find out which files are included:

$ unzip -l secret.zip
Archive:  secret.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        7  2013-05-14 10:15   1.txt
       13  2013-05-14 10:14   2.txt
---------                     -------
       20                     2 files

To overwrite a file with fake data without knowing the password:

$ echo lie > 2.txt
$ zip -u secret.zip 2.txt
updating: 2.txt (stored 0%)

Verify:

$ unzip -o -P dIg4BuOTFh secret.zip
Archive:  secret.zip
 extracting: 1.txt                   
 extracting: 2.txt     
$ cat 2.txt
lie

man zip doesn't mention this caveat in the description of the -e option, but the following is from the documentation of -P:

(And where security is truly important, use strong encryption such as Pretty Good Privacy instead of the relatively weak standard encryption provided by zipfile utilities.)

Known weak encryption should be removed from the utility to avoid a false sense of security, but that's another story.

share|improve this answer
    
Why 2.txt is more secured than 1.txt ? –  0x90 May 17 '13 at 6:40
    
It's not. I just wanted to use different contents for the two files :) –  l0b0 May 17 '13 at 10:12

If you have an unencrypted version of one of the files in a password protected zip you can use a known-plaintext attack to gain the password for all of the other files.

share|improve this answer
    
How is a known plaintext attack supposed to help? Zip doesn't use a brain-dead algorithm, so it's resistant to known plaintext attacks. –  Gilles May 13 '13 at 22:03
1  
elcomsoft.com/help/archpr/… Sorry, I probably should have included a link, but this was mentioned here on this discussion board just a few days ago. Google also is very efficient at bringing up this answer. –  Rod MacPherson May 15 '13 at 20:55
1  
Ah, thank you. This contradicts Adnan's assertion that zip uses AES-CBC. Has the format changed since that vulnerability was discovered? Which algorithms do the various zip implementations out there support? –  Gilles May 15 '13 at 21:42
1  
Seems like Elcomsoft refers to a very old zip implementation. Looking a Winzip documentation, they now use AES and PBKDF2. kb.winzip.com/help/winzip/help_encryption.htm –  northox May 28 '13 at 15:59

I have heard about ways bywhich password protected zipped files can be cracked. Usually by brute-force attacks. So in short they are not much secure for secret & confidential data.

share|improve this answer
1  
Anything that relies on a password is vulnerable to brute-forcing the password. That's not the point here. –  Gilles May 13 '13 at 22:03

In addition to the risks you have already pointed, IMHO one of the biggest problems with compression tools is related to the use of temporary folders to store the uncompressed files. As the input files can be of arbitrary size, the uncompressed output files might not fit in RAM. A temporary output folder (often the OS's default) is used.

So it does not matter how strong the encryption algorithm is if you forget to properly shred the temporary folders each time you unzip a psw-protected file. Most tools do not automatically clean the output directory nor warn the user about it. Same thing when compressing: you should make sure to shred the original file.

share|improve this answer

The password is meant to ensure confidentiality, not integrity or authenticity.

This is one of those cases where security is limited by usability and human intent. The archive manager has no way of telling whether or not the file you modified was meant to be encrypted in the first place. Essentially this is a social engineering attack, in that you tricked the user into believing that the original file was in place. However, the real security vulnerability would be that you had read/write access to a sensitive archive in the first place.

As far as mitigation goes, there are a few ways to increase security:

  • Use an archive format that supports filename encryption (e.g. 7Zip, RAR)
  • Sign the archive with a private key, e.g. via GPG.
share|improve this answer
1  
or use tar.gz :) –  Donaudampfschifffreizeitfahrt May 13 '13 at 13:13
2  
On Windows? :] If I'd were on Linux I wouldn't use ZIPs at all! Beside, the question is, whether password-protected ZIP files can be considered safe, not whether there are more secure archives. Because there are and I'm pretty sure about that... –  trejder May 13 '13 at 13:22
2  
Yes, tar.gz cannot be used on Windows, especially if you do not understand what 7zip, WinRar or gazillions of other softwares are! :P I guess you are browsing on an IE? :D –  Sunny R Gupta May 13 '13 at 16:04
1  
Dear God, no! :] I was talking about native support, at system level. And rather to say that .tar.gz format is for Linux (Unix) what .zip is for Windows. But then again, it is only a side note, as the question is not, what archive format should I use, only is .zip secure enough? –  trejder May 13 '13 at 18:27
1  
What exactly does native mean to you? On Unix, tar is just a program; zip and unzip are just programs too. There is no real difference. –  poke May 14 '13 at 1:28

If I were to use the a general definition fo Secure to mean that it enforces Privacy, Authentication, Integrity and Non-Repudiation, I would say its is not secure on a number of counts. But as the password protection on an Encrypted ZIP file intends to only provide Privacy (disallowing the viewing of the content of a file except by intended parties) I would say that it does do its job.

share|improve this answer

It's not secure in the sense that you can't depend on the integrity of the zip file. Confidentiality is still in order since you can't access the file contents (only the file-names).

This drawback in zip has been discussed before, personally I always use rar just because of this problem. Another workaround would be signing the zip file with PGP .

share|improve this answer
1  
If both receiving and ending parties have PGP and have their keys ready, I'd rather encrypt the zip file with PGP than just sign the zip (in the first case, impossible to know the whole content (file list, etc). In the 2nd, you just can check whether the zip file was altered or not... zip password protection is too weak to ensure the content wasn't accessed) –  Olivier Dulac May 15 '13 at 8:41
    
@Lucas, do you mean that if I zipped an exe file and password protect it, a virus could still modify the contained exe file by adding it's payload to it without possessing the password? –  Pacerier Apr 27 at 20:30
    
No I mean you can't validate if confidentiality was broken or not. –  Lucas Kauffman Apr 27 at 20:35
    
Sry do you mind explaining elaborating on "can't validate if confidentiality was broken or not"? –  Pacerier Apr 27 at 20:54
    
chaning something is integrity, being able to view something is confidentiality. –  Lucas Kauffman Apr 27 at 21:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.