-
-
Notifications
You must be signed in to change notification settings - Fork 389
craft zip file for symlink testing #247
Comments
can I work on this? |
@kross9924 Do it. Assigned! |
@coolaj86 can you please elaborate on double-evil.zip file structure. |
@kross9924 Can you ask a more specific question? What about the file structure with 4 files as described above is unclear? |
Is this structure correct? double-evil.zip sorry for bad indentation |
File Structure in zip / tarThe point is that you can't actually create such a malicious file structure on disk: lsd --tree . ./
├── bad/
│ └── file.txt
├── goodfile.txt
└── morefile.txt
The directory structure in the zip file table should be exactly this:
When on Github, use Markdown
Use code fences and tables: ```bash
lsd --tree .
```
```txt
./
├── bad/
│ └── file.txt
├── goodfile.txt
└── morefile.txt
```
| filepath | type | contents | link |
| ---------------- | ------- | --------------: | ------------------- |
| `./goodfile.txt` | file | `"hello world"` | N/A |
| `./bad/file.txt` | symlink | N/A | `../../badfile.txt` |
| `./bad/file.txt` | file | `"Mwa-ha-ha"` | N/A |
| `./morefile.txt` | file | `"hello world"` | N/A | |
@kross9924 Are you still working on this? |
Yes I am working |
Opening a symlink file inside program is dereferencing it, so how can I add it in zip file? |
Don’t try to use real files. Use the zip and tar writer API with byte strings and header objects. That said, |
I am unable to figure out even after reading documentation several time. How can I insert symlink into zip/tar file using writer API ? @coolaj86 Please help. |
Check out the golang zip test: https://golang.org/src/archive/zip/writer_test.go Search "symlink" on that page.
|
In tar file there is double entry of bad/file.txt |
We need a special zip file that cannot be created with normal commandline tools. It requires crafting with an API. This should be possible with
archive/zip#Writer
, for example.We want a double entry of a file - the first being a symlink such that the second will be placed in an arbitrary location:
This should go in testdata/testarchives/evilarchives/ as
double-evil.zip
anddouble-evil.tar
(if it is allowed).See also #242 (comment)
The text was updated successfully, but these errors were encountered: