Menu

Safe archive extraction must validate the final path
📰

Safe archive extraction must validate the final path

DEV Community: cybersecurity·johnettagaweraks·16 days ago
#tLtmJ7YF
Reading 0:00
15s threshold

Safe archive extraction must validate the final path

Archive extraction looks like a file operation until an archive contains a member named ../../etc/file , an absolute path, or a symbolic link that changes where the next member is written. The resulting problem is commonly called Zip Slip, but the same class of failure appears in tar files and custom archive formats.

Checking whether a filename contains .. is not a complete defense. A member can be a symlink, a hardlink, or a path that resolves differently because the destination directory contains an existing link. Two archive members can interact: the first creates a link and the second writes through it. A live directory where another process can create or replace paths adds another race.

Validate the object and the destination

Applications should use extraction filters or safe extraction APIs provided by the language or archive library.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.