8000 Minizip fails to extract password protected zip file · Issue #527 · zlib-ng/minizip-ng · GitHub
[go: up one dir, main page]

Skip to content

Minizip fails to extract password protected zip file  #527

Closed

Description

@pp771

We are observing that minizip is failing to extract a password-protected file, even if a valid password is provided.
In case of an invalid password, the library throws an error stating invalid password.
Need to look into this issue ASAP.

We are observing this issue on the Windows version of the library.

Activity

  1. nmoinvaz commented on Oct 23, 2020

    @nmoinvaz
    Member

    You will have to provide more details.

  2. pp771 commented on Oct 23, 2020

    @pp771
    Author

    Can you tell me under which scenario "PASSWORD_ERROR" is thrown, we get error code '8' for "PASSWORD_ERROR"?
    We have confirmed that Winzip is successfully able to extract the file using the same password.

  3. nmoinvaz commented on Oct 23, 2020

    @nmoinvaz
    Member

    That is not a error number I am familiar with.

  4. pp771 commented on Oct 26, 2020

    @pp771
    Author

    Ignore the earlier message, The error number is -108 i.e. MZ_PASSWORD_ERROR(-108).
    And the api failing is unzOpenCurrentFilePassword(uf, password);.
    The API is expected to return UNZ_OK(0).

  5. pp771 commented on Oct 26, 2020

    @pp771
    Author

    Screenshot 2020-10-26 at 11 31 49 AM

  6. nmoinvaz commented on Oct 26, 2020

    @nmoinvaz
    Member

    What version of the library are you using? What type of encryption is the zip using?

  7. pp771 commented on Oct 26, 2020

    @pp771
    Author

    There is no issue when encrypted using minizip. The issue is with other libs encryption.

  8. pp771 commented on Oct 26, 2020

    @pp771
    Author

    The issue is observed with "2.9.1", "2.10.0".

  9. pp771 commented on Oct 26, 2020

    @pp771
    Author

    As per xceed API, by default algo is "xemCompatible". We do not set anything explicitly.

  10. nmoinvaz commented on Oct 26, 2020

    @nmoinvaz
    Member

    I don't use Xceed. Please make sure you are using the latest version of minizip library as older versions may have bugs related to this. Attach a zip file and the password.

  11. Eswcvlad commented on Nov 26, 2020

    @Eswcvlad
    Contributor

    I actually have the same issue after trying to upgrade from 1.2 to the latest version with both legacy and new APIs and it seems like I've figured out, what is causing it.

    Here is an example archive (password is "123"):
    compressed.zip

    It is encrypted with basic ZipCrypto, has data descriptors and NTFS file time extra fields.

    Decryption is actually correct, but the problem is in the verification. It should use bytes from the original "last mod file date/time" fields in the local file header, but instead it uses the converted file_info.modified_date as the baseline, which can get overwritten from NTFS/UNIX time extra fields. And, as an example in the archive above, timezone is different in the NTFS extra field, so there is a mismatch.

    So, as expected, when I comment the
    mz_zip_ntfs_to_unix_time(ntfs_time, &file_info->modified_date);
    line in mz_zip.c it works fine as it starts using the original field for verification.

  12. nmoinvaz commented on Nov 27, 2020

    @nmoinvaz
    Member

    Hmm. I'm not sure how I want to fix that. I don't want to add a new field for modified_time to mz_file_info.

  13. nmoinvaz commented on Dec 1, 2020

    @nmoinvaz
    Member

    This should be resolved in the dev branch now.

  14. added
    encryptionEncryption/decryption issue
    fixedIssue or bug has been fixed
    and removed
    need more infoThere is not enough information
    on Dec 1, 2020
  15. Eswcvlad commented on Dec 2, 2020

    @Eswcvlad
    Contributor

    Looks like it fixed the issue for me. Thanks!

    Not sure though, if it is the same issue @pp771 was having.

  16. pp771 commented on Feb 10, 2021

    @pp771
    Author

    This issue is not fixed for our encrypted files. We still get the -102 error code with the latest Minizip 3.0 version. However, the same encrypted files are getting decrypted using other libs and tools like Zip-archive, Winrar.
    Please look into this.

  17. nmoinvaz commented on Feb 10, 2021

    @nmoinvaz
    Member

    Please provide an example zip and more debug info.

  18. nmoinvaz commented on Feb 10, 2021

    @nmoinvaz
    Member

    Also feel free to track down the issue yourself and submit a PR.

  19. kippler commented on Dec 23, 2022

    @kippler

    oops. I'm sorry. I had posted the comment in the wrong place. Your code has no problems. I'm so sorry again.

  20. nmoinvaz commented on Dec 23, 2022

    @nmoinvaz
    Member

    Can you submit a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    encryptionEncryption/decryption issuefixedIssue or bug has been fixed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0