# CS登录通信分析

Cobalt Strike服务端和客户端通信过程，使用的是SSLSocket（安全Socket）其实就是在普通的明文Socket上套了一层TLS这样可以在一定程度上保证通信安全

还是先看代码aggressor\dialogs\Connect.class

![创建安全Socket然后请求服务端登录验证](/files/-MImmEIzrdjwmLsotXnf)

我们跟进到authenticate函数里

![](/files/-MImxw75vXxTLWwYV0xA)

看完代码现在我们来验证一下，打开Wireshark登录一下看看通信过程（注：别忘了解密TLS要不然看到的是加密的数据，自己谷歌java ssl Wireshark）

![Finished之前的那些包都是TLS或TCP握手过程（对这个不太明白的可以自行谷歌一下相关协议通信过程）](/files/-MImpEWojGNuyLazurLm)

从解密后的包里可以看到发送的数据，正如我们分析的代码，其结构如下

> 感谢Jas502n师傅指出此图片中的总长度标错，以修改为261字节

![](/files/-MgLaXu6-73CEMtQteBx)

数据发送到服务端后，cs接收数据并验证密码，基本过程如下图代码

![](/files/-MImyBBMieup3qjZE8TW)

![](/files/-MIn-0j8dVrQXXAzl-wm)

![](/files/-MIn0lGG3Uc3gMMKKYQU)

以上就是cs密码的认证过程，关于爆破我就不说了根据这个过程发包就完了记得使用TLS就行

至于那个魔数(48879) 判断版本，根据分析大概3.x之前的版本才会使用别的魔数，如果你爆破3.x(包括3.x)到4.x都不用在意这个问题，不过估计也爆不开啥（笑，毕竟稍微懂一些的估计密码都不会简单，端口都会改，注：故意钓鱼的除外）

老外写的一个爆破工具：<https://github.com/ryanohoro/csbruter>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wbglil.gitbook.io/cobalt-strike/cobalt-strike-yuan-li-jie-shao/untitled-2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
