Safe Archive Extraction Requires Validating the Final Resolved Path
Extracting archives can overwrite files outside the intended directory through crafted names, absolute paths, or links, a flaw often called Zip Slip. Checking filenames for '..' is insufficient because symlinks and hardlinks, including ones created by earlier members, can redirect writes. Developers should use the safe extraction filters or APIs their language and archive library provide, extract into a fresh, non-shared directory, and recheck the resolved destination after each link operation. Tests should confirm that malicious members are rejected before touching the filesystem, including cases where the destination already contains a symlink, and that size and file-count limits hold. The extractor's default policy should be reviewed and recorded, since defaults can change across releases.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in