zip AES: passwords over 99 characters fail with bare `E_INVALIDARG` on create; valid archives from other tools report "Wrong password"
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 56/100
Direzione di ricerca
Start with the AES password limit in CPP/7zip/Crypto/WzAes.h and its handling in CPP/7zip/Crypto/WzAes.cpp. Then trace the create and extract paths named in the report: ZipHandlerOut.cpp:421 and ZipHandler.cpp:1130-1134. Reproduce with a 100-character AES password and verify successful create and extraction, or distinct, accurate errors if the limit remains.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment
- 7-Zip (z) 26.06 (arm64),
ip7z/7zip@d3296e3 - macOS 26.4.1 arm64, Apple clang 21.0.0
Description
The zip handler rejects AES passwords longer than 99 characters. The limit is not documented. On create the user gets System ERROR: E_INVALIDARG : One or more arguments are invalid and no archive. On extract, the same rejection is reported as ERROR: Wrong password, even when the password is correct. An archive written by libarchive (bsdtar) with a 100-character password therefore cannot be opened with 7-Zip.
Steps to reproduce
Z=7zz
d=$(mktemp -d) && cd "$d" && printf hello > a.txt
pw=$(python3 -c "print('P'*100,end='')")
$Z a -bd -tzip -mem=AES256 -p"$pw" t.zip a.txt ; echo rc=$? # rc=2, E_INVALIDARG, t.zip not created
pw99=$(python3 -c "print('P'*99,end='')")
$Z a -bd -tzip -mem=AES256 -p"$pw99" t99.zip a.txt ; echo rc=$? # rc=0
$Z a -bd -tzip -mem=ZipCrypto -p"$pw" z.zip a.txt ; echo rc=$? # rc=0 (ZipCrypto, same 100 chars)
$Z a -bd -p"$pw" t.7z a.txt ; echo rc=$? # rc=0 (7z, same 100 chars)
# interop: archive created by libarchive with a 100 char password
/usr/bin/tar --format zip --options zip:encryption=aes256 --passphrase "$pw" -cf bs.zip a.txt
mkdir xo && $Z x -bd -y -p"$pw" -oxo bs.zip ; echo rc=$?
# ERROR: Wrong password : a.txt (a 0-byte a.txt is also left behind, see 7Z-ENC-002)
Expected
The -p switch page says: "Specifies password." (https://7-zip.opensource.jp/chm/cmdline/switches/password.htm). It states no maximum length. The zip em parameter is described as "Sets a encryption method: ZipCrypto, AES128, AES192, AES256" (method.htm), also without a limit. The WinZip AES format derives keys with PBKDF2, which accepts any password length. Expected: success, or at least a message like "password is too long for zip AES (max 99)". A correct password must never be reported as wrong.
Actual
- create:
System ERROR: E_INVALIDARG : One or more arguments are invalid, rc=2, archive not created. - extract of a valid 100-character-password AES zip:
ERROR: Wrong password : a.txt, rc=2.
Root cause (analysis on d3296e3)
CPP/7zip/Crypto/WzAes.h:38:const UInt32 kPasswordSizeMax = 99; // 128;CPP/7zip/Crypto/WzAes.cpp:28:CryptoSetPassword()returnsE_INVALIDARGwhensize > kPasswordSizeMax.- Create:
CPP/7zip/Archive/Zip/ZipHandlerOut.cpp:421:if (options.Password.Len() > NCrypto::NWzAes::kPasswordSizeMax) return E_INVALIDARG;with no error text, so the console prints only the HRESULT. - Extract:
CPP/7zip/Archive/Zip/ZipHandler.cpp:1130-1134: any non-S_OK result ofcryptoSetPassword->CryptoSetPassword()is mapped tokWrongPassword.
Suggested fix
Raise or remove the limit (PBKDF2 has none). If it stays, document it on the -p / em pages, return a descriptive error on create, and report a distinct "password too long" result on extract instead of "Wrong password".
Found with a differential test setup (a model of the documented behavior, and for some reports an independent tool such as libarchive/bsdtar, compared against the real binary) and then checked by hand: every command above was re-run verbatim on the tested build, and the root cause was read in the source. Tested commit: d3296e3 (26.06).
- Lingua principale
- C++
- Stelle
- 4.6k
- Fork
- 519
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ip7z/7zip
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
area::installer documentation engine::sd enhancement wg::platform-core
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
lemonade-sdk/lemonade#4349 ·
I maintainer di solito rispondono entro 1 giorno
-
Python example: list a model's scenes and their camerasForse già presa @rudraparmar76 l’ha presa oggi. Apertadocumentation good first issue python
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
iamahsanmehmood/openskp#796 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
tenstorrent/tt-umd#4183 ·
I maintainer di solito rispondono entro 4 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
odelaneau/GLIMPSE#353 · 1 commento ·
I maintainer di solito rispondono entro 4 giorni