diff --git a/components/fatfs/sbom.yml b/components/fatfs/sbom.yml index ae0a2e80d96..63fb1f5372b 100644 --- a/components/fatfs/sbom.yml +++ b/components/fatfs/sbom.yml @@ -3,3 +3,6 @@ version: 'R0.16' supplier: 'Organization: Espressif Systems (Shanghai) CO LTD' originator: 'Person: ChaN' description: 'Generic FAT Filesystem Module for embedded systems.' +cve-exclude-list: + - cve: CVE-2026-6682 + reason: Integer overflow in exFAT mount size validation. Patched by promoting the cluster-heap and bitmap-base multiplies to 64-bit in mount_volume(). diff --git a/components/fatfs/src/ff.c b/components/fatfs/src/ff.c index b5290534475..f6011ac4e2a 100644 --- a/components/fatfs/src/ff.c +++ b/components/fatfs/src/ff.c @@ -3560,7 +3560,7 @@ static FRESULT mount_volume ( /* FR_OK(0): successful, !=0: an error occurred */ fs->volbase = bsect; fs->database = bsect + ld_32(fs->win + BPB_DataOfsEx); fs->fatbase = bsect + ld_32(fs->win + BPB_FatOfsEx); - if (maxlba < (QWORD)fs->database + ncl * fs->csize) return FR_NO_FILESYSTEM; /* (Volume size must not be smaller than the size required) */ + if (maxlba < (QWORD)fs->database + (QWORD)ncl * fs->csize) return FR_NO_FILESYSTEM; /* CVE-2026-6682: promote to 64-bit before multiply to avoid integer overflow that would accept an undersized volume */ fs->dirbase = ld_32(fs->win + BPB_RootClusEx); /* Get bitmap location and check if it is contiguous (implementation assumption) */ @@ -3576,7 +3576,7 @@ static FRESULT mount_volume ( /* FR_OK(0): successful, !=0: an error occurred */ } bcl = ld_32(fs->win + i + 20); /* Bitmap cluster */ if (bcl < 2 || bcl >= fs->n_fatent) return FR_NO_FILESYSTEM; /* (Wrong cluster#) */ - fs->bitbase = fs->database + fs->csize * (bcl - 2); /* Bitmap sector */ + fs->bitbase = fs->database + (LBA_t)fs->csize * (bcl - 2); /* Bitmap sector (CVE-2026-6682: 64-bit multiply to avoid overflow) */ for (;;) { /* Check if bitmap is contiguous */ if (move_window(fs, fs->fatbase + bcl / (SS(fs) / 4)) != FR_OK) return FR_DISK_ERR; cv = ld_32(fs->win + bcl % (SS(fs) / 4) * 4);