zznQの捉虫日记
我并不是一名专业的漏洞挖掘研究员,偶尔会对生活和工作接触到或感兴趣的软件进行简单研究。
这里会记录下我捉虫的思路,大多数会很水,但希望能越捉越好。
我主要分为了三类:BUG(算不上漏洞的)、Vulnerability、Tool(挖掘工具的研究)。
BUG
A memory error bug caused by race conditions in multithreaded use of curl_cffi
在试用 grok2api_python 时会多次出现这个错误:
我看了下依赖库,首先定位到curl_cffi。它通过访问低级C接口操作堆栈,这里可能会存在问题。打印完整的堆栈信息:
python(32059,0x31402b000) malloc: Corruption of tiny freelist 0x1048d6cb0: size too small (1/57)
python(32059,0x31402b000) malloc: *** set a breakpoint in malloc_error_break to debug
Fatal Python error: Aborted
Thread 0x00000003341ab000 (most recent call first):
File "../grok2api_python/.venv/lib/python3.12/site-packages/curl_cffi/curl.py", line 362 in perform
File "../grok2api_python/.venv/lib/python3.12/site-packages/curl_cffi/requests/session.py", line 593 in perform
...
进一步分析发现,问题的根因是在多线程并发情况下使用 curl_cffi 的 streaming 功能时,存在条件竞争,导致内存错误。
Directory Traversal in sing-box-for-apple iCloud Path Parameter
singbox 是支持通过 urlscheme 去创建配置文件的,就想审计这部分能不能目录穿越,跟踪到NewProfileView.createProfileBackground 函数 let profileConfig = profileConfigDirectory.appendingPathComponent("config_\(nextProfileID).json")
文件名被改写后就不存在漏洞了。
创建 iCloud 类型配置时,path 参数存在目录穿越BUG:code
singbox 开启了AppSandbox,既无法穿越到容器目录外,也不能远程调用,只能在本地创建,故只能算个水BUG。
Slice Out-of-Bounds Panic in beep(mp3.Decode)
通过 go fuzzing 发现的bug:
root cause 是它的上游依赖库:https://github.com/hajimehoshi/go-mp3 ,go-mp3 仓库已归档,即只能在报告在 beep 仓库。解决方法我想只能是用 recover()
去捕获panic。
Vulnerability
Tool
Stalker in Fuzzing
关于 Stalker 的设计思路:Anatomy of a code tracer
Stalker 基于动态重新编译:当一个线程即将执行下一条指令前,先将目标指令拷贝一份到新建的内存中,然后在新内存中对代码进行插桩,如下图所示:
后续我为furlzz - iOS URL schemes fuzzer 使用Stalker添加覆盖率反馈。