Descrizione
Improper Resolution of Path Equivalence (CWE-41) in the active content confirmation of PeaZip from 10.5.0 before 11.3.0 on Windows allows a party who supplies an archive to have an entry opened without the warning the product shows before a file type with active content is handed to the system handler, because grid_obj_open compares each entry of the SECEXTCONST denylist against the listing's extension column for exact string equality, and that column holds ExtractFileExt of the name the archive declares. Windows removes trailing dots and spaces from the final path component, so an entry named payload.exe. resolves to payload.exe, while ExtractFileExt returns . for a name that ends in a dot and returns the extension with the space still attached for a name that ends in a space. Neither value matches any denylist entry. The row is not rejected before that either: checkfiledirname refuses control characters, the reserved characters * ? < > | and ", seven or more consecutive spaces, path separators and : inside the file name, and the Windows reserved device names, but not a trailing dot or a single trailing space. Both forms are legal in the ZIP and 7z name fields and neither can be typed in Explorer. The default configuration is affected, since seccond is 0, which applies the check to active content coming from archives, and the extension list is the SECEXTCONST default, which in the affected releases holds exe, cmd, msi, bat, ps1, vbs and reg. This results in no confirmation being shown for an entry whose name the attacker chooses, where the same entry named without the trailing character is shown one.
Tipo di vulnerabilità
CWE-41
Improper Resolution of Path Equivalence
The product is vulnerable to file system contents disclosure through path equivalence. Path equivalence involves the use of special characters in file and directory names. The associated manipulations are intended to generate multiple names for the same object.
Impatto sui sistemi
| Ambito | Impatto |
| Riservatezza, Integrità, Controllo degli accessi |
Leggere file o cartelle, Modificare file o cartelle, Aggirare i meccanismi di protezione |
Come si previene
Sviluppo · Validazione dell’input
Considera ogni input come potenzialmente malevolo. Adotta una validazione per «elenco di valori ammessi»: accetta solo gli input che rispettano rigorosamente le specifiche e rifiuta, o trasforma in qualcosa di conforme, tutto il resto. Nel validare considera tutte le proprietà rilevanti: lunghezza, tipo, intervallo dei valori ammessi, input mancanti o in più, sintassi, coerenza tra campi collegati e rispetto delle regole di business (per esempio «barca» è sintatticamente valido perché contiene solo lettere, ma non lo è se il campo deve contenere solo colori come rosso o blu). Non limitarti a cercare input malevoli o malformati: quasi certamente ne sfuggirà qualcuno, soprattutto se l’ambiente del codice cambia, lasciando all’attaccante lo spazio per aggirare la validazione. Le liste di valori vietati restano utili per rilevare possibili attacchi o scartare subito gli input più malformati.
Sviluppo · Codifica dell’output
Use and specify an output encoding that can be handled by the downstream component that is reading the output. Common encodings include ISO-8859-1, UTF-7, and UTF-8. When an encoding is not specified, a downstream component may choose a different encoding, either by assuming a default encoding or automatically inferring which encoding is being used, which can be erroneous. When the encodings are inconsistent, the downstream component might treat some character or byte sequences as special, even if they are not special in the original encoding. Attackers might then be able to exploit this discrepancy and conduct injection attacks; they even might be able to bypass protection mechanisms that assume the original encoding is also being used by the downstream component.
Sviluppo · Validazione dell’input
Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180). Make sure that the application does not decode the same input twice (CWE-174). Such errors could be used to bypass allowlist validation schemes by introducing dangerous inputs after they have been checked.
Tutte le 45 CVE di tipo CWE-41, con andamento e prevenzione