在上文 ZIP 格式中的 核心目录区 中,我们强调了一个叫做通用位标记 (General purpose bit flag)2 字节,不同比特位有着不同的含义。

    1. Bit 0: If set, indicates that the file is encrypted.
    2. (For Method 6 - Imploding)
    3. Bit 1: If the compression method used was type 6,
    4. Imploding, then this bit, if set, indicates
    5. an 8K sliding dictionary was used. If clear,
    6. then a 4K sliding dictionary was used.
    7. ...
    8. Bit 6: Strong encryption. If this bit is set, you should
    9. set the version needed to extract value to at least
    10. 50 and you must also set bit 0. If AES encryption
    11. is used, the version needed to extract value must
    12. be at least 51.
    13. ...

    修改伪加密的方法:

    • 16 进制下修改通用位标记
    • binwalk -e 无视伪加密
    • Mac OS 及部分 Linux(如 Kali ) 系统中,可以直接打开伪加密的 ZIP 压缩包
    • 检测伪加密的小工具 ZipCenOp.jar
    • 有时候用 WinRar 的修复功能(此方法有时有奇效,不仅针对伪加密)

    我们需要熟悉 ZIP 文件格式,在 CTF-Wiki 阅读理解相关资料并画图:

    0.png

    我们参考核心目录的部分标志位:

    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 修改通用位标记伪加密标志位:

    1.png

    把它改成00 00保存后即可解压:

    2.png