Commit graph

53 commits

Author SHA1 Message Date
Nathan Moin Vaziri
131d59ba39 fix: reject symlink targets that escape extraction dir
Symlink archive entries had their stored target passed directly to
mz_os_make_symlink without checking containment, so a malicious
archive could create a link pointing outside the extraction root.

Add mz_path_is_symlink_target_safe to verify a link target resolves
within the destination directory, and apply it to both the UNIX1
extrafield and entry-content link targets. Reject symlink entries
outright when no destination base is set, since the target cannot be
validated without one.

Assisted-By: Claude Opus 4.8
2026-06-29 15:25:48 -07:00
Ren yiwei
ff303ab67d docs: update memory stream test link 2026-06-21 12:10:19 -07:00
Nathan Moin Vaziri
6b9defc73c mz_os: split file and link attribute getters (#797)
mz_os_get_file_attribs used lstat on POSIX and GetFileAttributesW
on Win32, both of which return the link's own attributes rather
than the target's. Callers that wanted to follow a symlink had no
way to ask for that, so mz_zip_writer_add_file produced followed
entries tagged ISLNK and readers that tried to recreate them as
symlinks.

Flip mz_os_get_file_attribs to stat on POSIX and to a CreateFile +
GetFileInformationByHandle path on Win32 when the entry is a
reparse point. Add mz_os_get_link_attribs preserving the original
lstat / GetFileAttributesW semantics. Update mz_zip_writer_add_file
to pick the right getter for each branch and to skip symlinks
cleanly when neither store_links nor follow_links is set.

Refs #797.
2026-04-26 18:40:25 -07:00
Paul Marquess
7ef1662e68
Update markdown files to reference PPMD compression (#958) 2026-02-04 17:08:35 -05:00
Nathan Moinvaziri
5a3c62cf70
Fix arbitrary file write vulnerability via temp file symlink #938 2026-01-21 13:48:10 -08:00
Nathan Moinvaziri
bb282ace22
Fixed arbitrary file write vulnerability via symlinks. #936 2026-01-21 13:48:10 -08:00
Bastian Germann
71ff3329bd Drop "Attacking and Repairing the WinZip Encryption Scheme"
The paper is not freely redistributable: "To copy otherwise, to republish,
to post on servers or to redistribute to lists, requires prior specific
permission and/or a fee."

It is assumed that minizip-ng has not gained permission to redistribute
it. Therefore, drop it.
2025-09-18 11:37:06 -07:00
Bastian Germann
a421f7f404 Drop WinZip's AES Encryption Information
The Copyright of the WinZip document is by Corel Corporation.
All rights are reserved, which includes the right to distribute copies
of the document. Therefore, drop it and reference it via URL.
2025-09-18 11:37:06 -07:00
Bastian Germann
45610c1bfc Drop PKWARE's APPNOTE
appnote.txt explicitly forbids reproduction or distribution in 1.4.2.
Therefore, drop it and reference it via URL.
2025-09-18 11:37:06 -07:00
Peter Harris
152e7468c3 harden mz_zip_writer_add_file against link following
There is a small race where a file can be replaced with a link between the
call to mz_os_is_symlink and the call to mz_stream_os_open. Add
MZ_OPEN_MODE_NOFOLLOW to make sure that (on POSIX) a link cannot be
followed.
2025-06-16 16:14:24 -07:00
lu_jiakai
227f2d35be Updage usage of Buffered Stream 2025-05-26 07:56:47 -07:00
Yasuhiro Hatta
34111e29e9 FIx typo in mz_zip_file.md 2024-11-11 13:56:38 -05:00
Nathan Moinvaziri
0c3a741b36 Remove left over signing code from v3. 2024-02-16 18:32:53 -08:00
Thomas Gamper
78b87216bf mz_os.md - update mz_os_utf8_string_create and mz_os_utf8_string_delete documentation 2023-06-08 11:25:14 -07:00
Nathan Moinvaziri
e54c61a99b Fixed no args should be in create function description in docs. 2023-05-17 16:12:16 -07:00
Nathan Moinvaziri
0abac89d7d Added min OS info to readme. 2023-04-24 19:01:08 -07:00
Nathan Moinvaziri
fcde5c5ba7 Added optional support for AES CBC mode to mz_crypt_aes. 2023-04-17 14:32:06 -07:00
Nathan Moinvaziri
217adc9363 Remove first param from create functions.
Better handle low memory situations.
2023-04-09 11:14:26 -07:00
Nathan Moinvaziri
3da04514cd Remove signing feature.
Too much work to maintain and rarely used. Continue to use v3 for that feature.
2023-04-09 11:14:26 -07:00
Nathan Moinvaziri
a3ed70ade8 Added WinZip AES attack paper to docs. 2023-04-06 16:34:05 -07:00
Nathan Moinvaziri
f07faecdde Remove all comparisons to NULL. 2023-02-19 16:04:13 -08:00
Nathan Moinvaziri
9829913018 Remove MZ_WINRT_API, use newer API if targeting newer version of Windows 2023-02-17 09:47:02 -08:00
lemtys
804e057b73 Fix typo in mz_zip_rw docs. 2023-02-12 15:57:34 -08:00
Nathan Moinvaziri
04ffa8efd7 Move info on minizip streams to docs. 2023-02-12 15:21:14 -08:00
Nathan Moinvaziri
9e754e5a62 Added mz_zip_entry_get_compress_stream to get the compression stream for an entry. 2022-04-27 10:56:23 -07:00
Nathan Moinvaziri
8847f22979 Add support for ioapi in compatibility layer. #566 2021-05-08 12:15:00 -07:00
Nathan Moinvaziri
db95894646 Updated name of project to minizip-ng. 2021-01-23 16:19:05 -08:00
Thomas Gamper
162bee2973 mz_zip_rw.md - document new append parameter, update example 2021-01-01 16:51:38 -08:00
Nathan Moinvaziri
8f76968037 Added max_seek parameter to mz_zip_extrafield_find to limit the amount we search for extrafield. #543
Co-authored-by: Vlad Lipskiy <eswcvlad@yahoo.com>
2020-12-23 11:26:30 -08:00
Nathan Moinvaziri
0030fa2fc8 Exposed function to seek to local header. 2020-12-21 19:31:07 -08:00
Tim Gates
69fe69aaf6 docs: fix simple typo, verisons -> versions
There is a small typo in doc/README.md.

Should read `versions` rather than `verisons`.
2020-12-12 15:32:42 -08:00
Nathan Moinvaziri
a9fb9258f8
Fixed link to zlib-ng repository 2020-11-05 13:16:38 -08:00
Nathan Moinvaziri
c4668ed5ca Added support for XZ format.
Use official LZMA/XZ repository.
2020-10-25 11:58:02 -07:00
Nathan Moinvaziri
237a057cc9 Added xcode instruction to readme doc. 2020-10-24 18:47:10 -07:00
Nathan Moinvaziri
7cb06eff8a Added missing extrafield doc. 2020-10-24 18:41:42 -07:00
Nathan Moinvaziri
58d8af815e Added support for setting recover option in mz_zip_reader before opening the file. 2020-07-30 10:20:21 -07:00
Nathan Moinvaziri
1f4758bd7f Added support for ZSTD. #498
Co-authored-by: Force Charlie <fcharlie@users.noreply.github.com>
2020-06-14 22:02:12 -07:00
Paul Joyce
57ebd46756 fix TOC errors, minor doco updates 2020-06-14 22:00:00 -07:00
Nathan Moinvaziri
04187f084c Added more information about mz_zip_file fields. #492 2020-06-08 15:13:07 -07:00
Nathan Moinvaziri
d045b4f6b2 Remove extra whitespace. 2020-05-07 14:51:22 -07:00
Nathan Moinvaziri
2a2e90870c Added documentation for mz_zip_set_data_descriptor. 2020-05-07 14:49:45 -07:00
Nathan Moinvaziri
55ff896a48 Fixed return value description for mz_zip_reader_entry_read. #465 2020-04-13 15:08:00 -07:00
Nathan Moinvaziri
513cae1218 Added missing links to markdown docs. 2020-02-12 08:53:59 -08:00
Nathan Moinvaziri
5be3472def Added zip writer documentation. 2020-02-10 20:38:59 -08:00
Nathan Moinvaziri
60a07e9c87 Added zip reader documentation. 2020-02-08 21:14:02 -08:00
Nathan Moinvaziri
082c59a801 Added starting point for documentation. 2020-02-08 09:55:20 -08:00
Nathan Moinvaziri
d49fc77083 Added initial documentation. 2020-02-08 09:23:28 -08:00
Viktor Szakats
8f397f826d minor URL correction, remove EOL spaces, add EOF newlines. 2019-09-15 20:11:28 +00:00
Viktor Szakats
b11be60c0c use HTTPS, whitespace and newlines fixes
This is the only remaining HTTP link now: http://result42.com
2019-09-15 18:55:59 +00:00
Nathan Moinvaziri
5afeb430ee Added InfoZip app note. 2018-10-17 19:42:40 -07:00