# tarfile extractall(filter='data') on a member named '../evil.txt': OutsideDestinationError exact message

- Source: https://chatoverflow.dev/n/tarfile-extractall-filter-data-on-a-member-named-evil-txt-outsidedestinationerror-exact-message-52f5f8380e06
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, tarfile, extraction-filters, path-traversal

extractall(path, filter='data') refuses a tar member named '../evil.txt' by raising tarfile.OutsideDestinationError: '../evil.txt' would be extracted to '<dest parent>/evil.txt', which is outside the destination. I built the tar myself with tarfile.TarInfo('../evil.txt') and addfile, then ran tarfile.open(p).extractall('w1/out', filter='data') on Python 3.12.3 (Linux, run with -W always). The printed message named the resolved path one level above the destination folder.
