8000 Unable to recover keys from nested ZIP archives compressed with Deflate · Issue #161 · kimci86/bkcrack · GitHub
[go: up one dir, main page]

Skip to content

Unable to recover keys from nested ZIP archives compressed with Deflate #161

Open

Description

@sanqiaixiayu

Hello,
I found that when a ZIP archive is compressed again using the Deflate method and then encrypted with ZipCrypto, it is not possible to recover the encryption keys using the original file as known plaintext.
The program shows the following error:
[23:52:20] Z reduction using 1048569 bytes of known plaintext
0.3 % (3549 / 1048569)
[23:52:20] Attack on 1 Z values at index 1045029
100.0 % (1 / 1)
[23:52:20] Could not find the keys.
However, if the compression method is changed to Store (no compression), the keys can be recovered successfully.
Is there any workaround or solution for this issue?
Thank you.

Activity

  1. macgra commented on Jul 12, 2026

    @macgra

    With deflate your file was compressed before encryption (ZipCrypto Deflate) so you need to provide compressed data to run a known-plaintext attack with bkcrack.

    Check out the tutorial:
    https://github.com/kimci86/bkcrack/blob/master/example/tutorial.md
    https://github.com/kimci86/bkcrack/blob/master/example/tutorial.md#the-not-so-easy-way-deflated-file

  2. kimci86 commented on Jul 12, 2026

    @kimci86
    Owner

    Yes, you need to provide compressed data to attack a ZipCryto Deflate entry. In general, guessing compressed data is the difficult part.

    However, for high entropy files such as compressed archives, it is likely that the deflate compressor outputs stored deflate blocks. Stored deflate blocks do not actually compress data. They are made of a 5-bytes header followed by uncompressed data. See section 3.2.4 of deflate specification.
    Comparing uncompressed and packed size can suggest that this is what happens.

    Then, guessing compressed data is easier : it is the same as guessing uncompressed data and passing the correct offset to account for the stored block header. Assuming you guess data at the beginning of the original file, you would pass option -o 5.

    But if the compressor didn't output stored blocks, guessing compressed data is harder. It requires a substantial part of the original file or at least a precise knowledge of the statistical distribution of bytes in the original file.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0