Windows 下vcpkg 与bindiff


vcpkg 是 微软的一种包管理方式,对于curl之类的库,目前看使用 vcpkg可能是比较好的下载安装方式,比自己编译简单太多。

遇到了一个需要逆向的程序,经过人肉特征分析,程序里发现使用了 curl 的一个老版本,这个版本的二进制已经不提供下载了,虽然通过 web.archive.org 拿到了要的版本,但是是 mingw 的,而且没有调试信息用起来不方便。

于是,记录一下 vcpkg 操作的过程。

下载不提了,假设安装完 vcpkg 后,在一个空白的工作目录,建立 vcpkg.json

{
   "name": "curl-test",
    "dependencies": [ "curl", "libsodium" ],
    "overrides": [
        { "name": "curl", "version": "8.0.0" }
    ]
}

然后在这个目录执行 (我要分析的程序静态链接了curl,而且是32位的)

..\vcpkg\vcpkg.exe install --triplet x86-windows

上边这个配置文件的例子其实是成功不了的,错误提示是

error: C:\Work\packages\vcpkg.json was rejected because it uses "overrides" and does not have a "builtin-baseline". This can be fixed by removing the uses of "overrides" or adding a "builtin-baseline".
See `vcpkg help versioning` for more information.

我没找到正确姿势,但是看到这个baseline 跟git版本疑似有关,偷懒但是生效了

第一步,加一个 "builtin-baseline":"HEAD",再次执行,报错变成了

the top-level builtin-baseline (HEAD) was not a valid commit sha: expected 40 hexadecimal characters.You can use the current commit as a baseline, which is:
        "builtin-baseline": "61f610845fb206298a69f708104a51d651872877"
note: updating vcpkg by rerunning bootstrap-vcpkg may resolve this failure.

直接改json。

接下来,bindiff的问题。

一般程序不可能静态链接一个 debug 版本的库,所以直接用 ida pro分析 release 版本的二进制,而 vcpkg 的目录里带了调试信息,在 match的时候会比较简单。

#EOF


Leave a Reply

Your email address will not be published. Required fields are marked *