目标达成 感谢每一位支持者 — 我们达成了 100% 目标!

目标: 1000 元 · 已筹: 1359 元

100%

CVE-2022-46505 PoC — MatrixSSL 安全漏洞

来源
关联漏洞
标题: MatrixSSL 安全漏洞 (CVE-2022-46505)
Description:Inside Secure MatrixSSL是法国Inside Secure公司的一个针对小型应用程序和设备而设计的嵌入式、开源SSLv3协议栈。 MatrixSSL 4.5.1-open 版本及之前版本存在安全漏洞,该漏洞源于无法安全地检查 SessionID 字段,从而导致滥用可以解密秘密数据的全零 MasterSecret。
Description
MatrixSSL session resume bug
介绍
# details-for-CVE-2022-46505
MatrixSSL session resume bug
## 1. Description of bug

An issue in MatrixSSL 4.5.1-open and earlier leads to failure to securely check the SessionID field, resulting in the misuse of an **all-zero MasterSecret** that can decrypt secret data.

## 2. Affected version

MatrixSSL 4.5.1-open and earlier

## 3. Vulnerability Type

tls resume session decryption

## 4. Bug details

The matrixssl server stores negotiated session information through a list. 

```c
static sslSessionEntry_t g_sessionTable[SSL_SESSION_TABLE_SIZE]; 
// SSL_SESSION_TABLE_SIZE is 32
```

```c
typedef struct
{
    unsigned char id[SSL_MAX_SESSION_ID_SIZE]; // 32
    unsigned char masterSecret[SSL_HS_MASTER_SIZE]; // 48
    const sslCipherSpec_t *cipher;
    unsigned char majVer;
    unsigned char minVer;
    short extendedMasterSecret;           /* was the extension used? */
    psTime_t startTime;
    int32 inUse;
    DLListEntry chronList;
} sslSessionEntry_t;
```

The first four bytes of the SessionID field are a **little-endian sequence** number ranging **from 0 to 31.** 

![Untitled](Untitled.png)

Matrixssl determines whether the session is a resume session by matching the length of the session ID received with the four-byte quick index. 

However, when the storage list is initialized, MasterSecret is all zeros. 

Therefore, the malicious Client can send a **one-byte SessionID** for all-zero MasterSecret session resumption. When the server receives a single byte sessionid, the following bytes default to 0. Therefore, it can be validated and indexed to the list, and the MasterSecret corresponding to that sequence number in the list may still be 0. If this happens, we can **calculate the key and decrypt the TLS communication data.**

`./matrixssl/matrixssl.c  —>  int32 matrixResumeSession(ssl_t *ssl)`

![Untitled](Untitled%201.png)

![Untitled](Untitled%202.png)

**Adding console output for debug :** 

![Untitled](Untitled%203.png)

**Testing result :**

![Untitled](Untitled%204.png)

![Untitled](Untitled%205.png)

**Use all-zero MasterSecret to decrypt !**

![Untitled](Untitled%206.png)
文件快照

登录后查看神龙缓存的 POC 文件快照

登录查看
备注
    1. 建议优先通过来源进行访问。
    2. 本地 POC 快照面向订阅用户开放;当原始来源失效或无法访问时,本地镜像作为订阅权益的一部分提供。
    3. 持续抓取、验证、维护这份 POC 档案需要不少投入,因此本地快照已纳入付费订阅。您的订阅是让这份资料能继续走下去的关键,由衷感谢。 查看订阅方案 →