-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
encrypted zip files should not have undefined behavior #11
Comments
Proposal: detect when an entry is encrypted, and require the option This way, we have well defined behavior (the original goal of this issue), and we force clients to be aware of the encrypted state of their entries, and also be aware that yauzl is not going to help them decrypt anything. If someday yauzl did support decrypting entries, the I believe the number of bytes to assert in a compressed and encrypted file is neither the |
Just read the spec regarding the "Strong Encryption" methods introduced in version 6.2. Encrypting the central directory will (probably) cause an invalid signature error from yauzl when trying to read the first central directory record. Seems like good behavior. Regarding per-file encryption, there are three modes:
Those are the values you get from the General Purpose Bit Field when masking against I'm mostly against caring about the "strong" encryption in zip files, because i've never heard of anyone actually using it, it seems like an unnecessary feature by today's standards, and the descriptions in the zipfile are always accompanied by ads to incorporate PKWARE's proprietary, patented bullshit. I just want to know that when it does happen, yauzl doesn't have some obvious bug or produce bogus data without raising alarms for an easily detectable situation. From what I've gathered in my research, yauzl needs to be careful about general purpose bits 0 and 6, and from there the existing signature checks are already sufficient. |
For reference, the previous behavior for encrypted files was:
As expected, this isn't really "undefined behavior" in the C sense where it's a security vulnerability. Really the only problem would be confusing error messages and possibly some misleading data. |
From the docs:
encrypted zip files should, at the very least, have well-defined behavior. for example, returning an error and not crashing.
Same with ZIP64 files. The docs say the behavior is undefined, but the behavior should be defined to give an error and not crash.
The text was updated successfully, but these errors were encountered: