You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
像这种客户端类的网络逆向,我们需要借助一些网络监听工具:比如WireShark、Reqable、Proxyman等
我接下来使用的便是Proxyman:
我们先在windsurf editor中发起一次ai 对话操作
这里稍微岔开一下话题,做过开发基本都知道。
tcp/udp等传输层协议开发socket server都有一个共性,它们在做数据传输时会出现包与包之间的粘连问题。
所以开发者为了解决这个问题,一般使用关键字节分割或者头部标注的方式告知接收方每个包的起始位置和结束位置。
比如会在遇到特征字节做切割,像http报文会用
\n\n
表示头部信息,\n\n\n\n
表示body内容,并通过头部信息Content-Length
来读取body的长度。又或者像grpc这样头部标注 0000 0011 代表当前数据包的大小。
那回到正题。
windsurf 在请求中是采用头部标注的方式处理的:
这个可以从 0000 0000 0000 0011 这种类似的二进制中猜测出它的意思
从上面的hex截图中,我们可以看到:
01 00 00 2E F9 1F 8B 08 00 00 00 00 00 00 FF DC
,也许会有人不太理解这里是什么东西,其实这就是byte字节的文本展现,只不过一些编辑器在显示的时候会选择将每个字节转换成16进制来简化页面上的显示,也更容易理解所以从头部开始分析,我们将它转成2进制看看:
01 00 00 2E F9
00000001 00000000 00000000 00001110 11111001
而前面还有一个
00000001
是什么意思呢?我猜测是用来标注数据类型的,比如protobuf、gzip 、br等。实际上也是如此我们尝试来将这4个字节转换成int 10进制

计算结果长度是12025

我们在编辑器里看看这个包 12025 x 2 = 24,050
看,是不是正好回应了我们之前的猜想呢?
可是这个包体依旧不知道什么东西,我们进行下一步分析:
1F8B08000000000000FFDCBD5B6C1C4D7618FC53E .... 略 .... F616C86E83C7B0000
这里其实也是有特征的,
1F8B
就是gzip的编码魔数头了。还有其它的魔数头比如
Java-Class
的CAFEBASE
、JPEG
的FFD8FF
,感兴趣的可以去看看我收集的一些 常见魔数头文章接下来就需要编写一些代码来解码分析了
我们先将它gzip解码看看:
这其实是一种开发中bean序列化数据和反序列化的一种体现,从刚开始看到的请求头中就可以看到
application/connect+proto
。所以这其实就是protobuf序列化的具体体现。
typeid length data
+--------+--------+--------+
|xxxxxxxx|xxxxxxxx|xxxxxxxx|
+--------+--------+--------+
这是protobuf每个字段的序列化格式
typeid: 数据类型 (tagNum + tagType)
length:字段包长度 (可变:根据不同的数据类型定义length的数据长度)
data: 数据包(length长度的数据包)
以上就是大概的解析思路
也可以通过protoc工具直接解析
protoc --decode_raw < raw.bin
不过自带的这个工具并不能直接告诉你它的字段类型,所以我推荐还是使用在线解析工具 protobuf-decoder

可以看到,tagNum tagType 都有标注出来。
那我们就可以推测它的每个字段定义和功能了,这里不再赘述。
具体请查看 windsurf.proto
Beta Was this translation helpful? Give feedback.
All reactions