
Archive Alchemist is a tool for creating specially crafted archives to test extraction vulnerabilities.
Features
- Create ZIP and TAR archives with malicious patterns
- Support for path traversal attacks
- Support for symlinks and hardlinks
- Ability to set special permission bits (setuid, setgid, sticky bit)
- Fine-grained control over file attributes (mode, uid, gid, mtime)
- Multiple manipulation commands: add, replace, append, modify
- Multiple helper commands: extract, list, read
- Create polyglot files (prepend archive with data + adjust headers)
Tips
Suggested working directory setup
The most convenient way to test multiple payloads/tests for an archive is to use a local working directory and the replace command with --content-directory flag to "sync" the local directory to the archive:- Extract into working directory: ./archive-alchemist.py target.zip extract -o workingdir/
- Make changes to file(s) in workingdir/
- Build archive from working directory: ./archive-alchemist.py target_poc.zip replace --content-directory workingdir/ ""
- Test using target_poc.zip
- GOTO #2
Blind detect symlink support
If you know that the target service uses bla/file.json, you can:- Extract into working directory: ./archive-alchemist.py target.zip extract -o workingdir/
- Copy workingdir/bla/file.json to workingdir/bla/file2.json
- Build archive from working directory: ./archive-alchemist.py target_poc.zip add --content-directory workingdir/ ""
- Change bla/file.json to a symlink to bla/file2.json: ./archive-alchemist.py target_poc.zip replace --symlink file2.json "bla/file.json"
- Test using target_poc.zip. If it works normally, the target likely supports symlinks!
Blind detect path traversal support
If you know that the target service uses bla/file.json, you can:- Extract into working directory: ./archive-alchemist.py target.zip extract -o workingdir/
- Copy workingdir/bla/file.json to workingdir/bla/blu/file.json
- Build archive from working directory: ./archive-alchemist.py target_poc.zip add --content-directory workingdir/ ""
- Add bla/blu/../file.json to the archive: ./archive-alchemist.py target_poc.zip add --content-file "workingdir/bla/blu/file.json" "bla/blu/../file.json"
- Test using target_poc.zip. If it works normally, the target likely supports path traversal! (Although there might be additional checks to make sure that you dont traverse outside of the target directory)