在上文 ZIP
格式中的 核心目录区 中,我们强调了一个叫做通用位标记 (General purpose bit flag)
的 2
字节,不同比特位有着不同的含义。
Bit 0: If set, indicates that the file is encrypted.
(For Method 6 - Imploding)
Bit 1: If the compression method used was type 6,
Imploding, then this bit, if set, indicates
an 8K sliding dictionary was used. If clear,
then a 4K sliding dictionary was used.
...
Bit 6: Strong encryption. If this bit is set, you should
set the version needed to extract value to at least
50 and you must also set bit 0. If AES encryption
is used, the version needed to extract value must
be at least 51.
...
修改伪加密的方法:
16
进制下修改通用位标记binwalk -e
无视伪加密- 在
Mac OS
及部分Linux
(如Kali
) 系统中,可以直接打开伪加密的ZIP
压缩包 - 检测伪加密的小工具
ZipCenOp.jar
- 有时候用
WinRar
的修复功能(此方法有时有奇效,不仅针对伪加密)
我们需要熟悉 ZIP 文件格式,在 CTF-Wiki 阅读理解相关资料并画图:
我们参考核心目录的部分标志位:
Offset | Bytes | Description | 译 |
---|---|---|---|
0 | 4 | Central directory file header signature = 0x02014b50 | 核心目录文件 header 标识 =(0x02014b50 ) |
4 | 2 | Version made by | 压缩所用的 pkware 版本 |
6 | 2 | Version needed to extract (minimum) | 解压所需 pkware 的最低版本 |
8 | 2 | General purpose bit flag | 通用位标记伪加密 |
10 | 2 | Compression method | 压缩方法 |
我们用 HxD 修改通用位标记伪加密标志位:
把它改成00 00
保存后即可解压: