Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
e4e1c91537
!54 [sync] PR-53: License compliance rectification
From: @openeuler-sync-bot 
Reviewed-by: @wk333 
Signed-off-by: @wk333
2025-03-12 07:06:26 +00:00
starlet-dx
adcbc1420c License compliance rectification
(cherry picked from commit c0db7a34d8b66a1b42e8e5b9c799f9bd44be97c8)
2024-07-19 16:09:51 +08:00
openeuler-ci-bot
9060bba55a
!51 Update to 4.12.1
From: @wu-leilei 
Reviewed-by: @wang--ge 
Signed-off-by: @wang--ge
2023-10-18 07:33:37 +00:00
wu-leilei
03d54bb5a1 Update to 4.12.1 2023-10-18 11:05:08 +08:00
openeuler-ci-bot
f6f98686fb
!46 [sync] PR-45: Fixed OOB reads in hfs_dir_open_meta_cb
From: @openeuler-sync-bot 
Reviewed-by: @gitee-cmd 
Signed-off-by: @gitee-cmd
2022-07-30 07:21:03 +00:00
cherry530
0534e4cbef fix OOB read in hfs_dir_open_meta_cb
Signed-off-by: cherry530 <xuping33@huawei.com>
(cherry picked from commit 56613e9603253a85c9bb19ca099ff6973043122c)
2022-07-30 10:03:21 +08:00
openeuler-ci-bot
02702c719c !36 [sync] PR-35: Fixed OOB reads in hfs_cat_traverse
From: @openeuler-sync-bot
Reviewed-by: @small_leek
Signed-off-by: @small_leek
2021-09-01 07:49:04 +00:00
lingsheng
15c6a656ea Fixed OOB reads in hfs_cat_traverse
(cherry picked from commit 1d8693a0144be716cefe52bacdb55faa77516935)
2021-08-27 10:45:09 +08:00
openeuler-ci-bot
390c63ef3a !34 [sync] PR-33: fix memleak in ntfs
From: @openeuler-sync-bot
Reviewed-by: @small_leek
Signed-off-by: @small_leek
2021-08-26 12:50:16 +00:00
sunguoshuai
1594787538 fic memleak in ntfs
(cherry picked from commit 6b5bc94c560ccfde25afcc3df72a56750e91a5fe)
2021-08-26 20:21:22 +08:00
11 changed files with 44 additions and 311 deletions

View File

@ -1,11 +0,0 @@
diff -Nur sleuthkit-4.6.7/tsk/vs/dos.c sleuthkit-4.6.7.new/tsk/vs/dos.c
--- sleuthkit-4.6.7/tsk/vs/dos.c 2019-08-03 04:20:57.000000000 +0800
+++ sleuthkit-4.6.7.new/tsk/vs/dos.c 2020-12-09 17:35:47.356058422 +0800
@@ -769,6 +769,7 @@
tsk_error_set_errno(TSK_ERR_VS_BLK_NUM);
tsk_error_set_errstr
("dos_load_ext_table: Loop in partition table detected");
+ free(sect_buf);
return 1;
}
part_info = part_info->next;

View File

@ -1,35 +0,0 @@
From 77a5b8bf749d059ed3966dc7b6c4a67d265fc69b Mon Sep 17 00:00:00 2001
From: esaunders <esaunders@basistech.com>
Date: Tue, 3 Dec 2019 17:28:38 -0500
Subject: [PATCH 2/2] Ensure that we don't attempt to index into an invalid
offset in imap_buf.
---
tsk/fs/ext2fs.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tsk/fs/ext2fs.c b/tsk/fs/ext2fs.c
index 5a480856..14715c11 100755
--- a/tsk/fs/ext2fs.c
+++ b/tsk/fs/ext2fs.c
@@ -1051,6 +1051,19 @@ ext2fs_inode_walk(TSK_FS_INFO * fs, TSK_INUM_T start_inum,
grp_num * tsk_getu32(fs->endian,
ext2fs->fs->s_inodes_per_group) + 1;
+ /*
+ * Ensure that inum - ibase refers to a valid offset in imap_buf.
+ */
+ if ((inum - ibase) > fs->block_size) {
+ tsk_release_lock(&ext2fs->lock);
+ free(dino_buf);
+ tsk_error_reset();
+ tsk_error_set_errno(TSK_ERR_FS_WALK_RNG);
+ tsk_error_set_errstr("%s: Invalid offset into imap_buf (inum %" PRIuINUM " - ibase %" PRIuINUM ")",
+ myname, inum, ibase);
+ return 1;
+ }
+
/*
* Apply the allocated/unallocated restriction.
*/
--

View File

@ -1,47 +0,0 @@
From f7a20cf162a02a4ce5301eb6b27bbc53fd5998b5 Mon Sep 17 00:00:00 2001
From: Brian Carrier <carrier@sleuthkit.org>
Date: Wed, 29 Apr 2020 15:47:01 -0400
Subject: [PATCH] Fix bug introduced with imap offset check
---
tsk/fs/ext2fs.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/tsk/fs/ext2fs.c b/tsk/fs/ext2fs.c
index 45dd18c2..1f56c943 100755
--- a/tsk/fs/ext2fs.c
+++ b/tsk/fs/ext2fs.c
@@ -841,6 +841,20 @@ ext2fs_dinode_copy(EXT2FS_INFO * ext2fs, TSK_FS_META * fs_meta,
grp_num * tsk_getu32(fs->endian,
ext2fs->fs->s_inodes_per_group) + fs->first_inum;
+
+ /*
+ * Ensure that inum - ibase refers to a valid bit offset in imap_buf.
+ */
+ if ((inum - ibase) > fs->block_size*8) {
+ tsk_release_lock(&ext2fs->lock);
+ tsk_error_reset();
+ tsk_error_set_errno(TSK_ERR_FS_WALK_RNG);
+ tsk_error_set_errstr("ext2fs_dinode_copy: Invalid offset into imap_buf (inum %" PRIuINUM " - ibase %" PRIuINUM ")",
+ inum, ibase);
+ return 1;
+ }
+
+
/*
* Apply the allocated/unallocated restriction.
*/
@@ -1052,9 +1066,9 @@ ext2fs_inode_walk(TSK_FS_INFO * fs, TSK_INUM_T start_inum,
ext2fs->fs->s_inodes_per_group) + 1;
/*
- * Ensure that inum - ibase refers to a valid offset in imap_buf.
+ * Ensure that inum - ibase refers to a valid bit offset in imap_buf.
*/
- if ((inum - ibase) > fs->block_size) {
+ if ((inum - ibase) > fs->block_size*8) {
tsk_release_lock(&ext2fs->lock);
free(dino_buf);
tsk_error_reset();
--

View File

@ -1,24 +0,0 @@
From 109ca428154925f6e031fbc817b48e9dc578f8db Mon Sep 17 00:00:00 2001
From: esaunders <esaunders@basistech.com>
Date: Tue, 14 Jan 2020 15:45:44 -0500
Subject: [PATCH] Cast attrseq address to uintptr_t so that the correct type
can be inferred for the + operator.
---
tsk/fs/ntfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tsk/fs/ntfs.c b/tsk/fs/ntfs.c
index 837033ea..eeff809e 100755
--- a/tsk/fs/ntfs.c
+++ b/tsk/fs/ntfs.c
@@ -1770,7 +1770,7 @@ ntfs_proc_attrseq(NTFS_INFO * ntfs,
// sanity check on bounds of attribute. Prevents other
// issues later on that use attr->len for bounds checks.
if (((uintptr_t) attr + tsk_getu32(fs->endian,
- attr->len)) > (uintptr_t) (a_attrseq + len)) {
+ attr->len)) > (uintptr_t)a_attrseq + len) {
break;
}
--

View File

@ -1,62 +0,0 @@
diff -Nur sleuthkit-4.6.7/tsk/fs/ext2fs.c sleuthkit-4.6.7.new/tsk/fs/ext2fs.c
--- sleuthkit-4.6.7/tsk/fs/ext2fs.c 2020-12-16 14:43:46.929902964 +0800
+++ sleuthkit-4.6.7.new/tsk/fs/ext2fs.c 2020-12-16 14:54:44.211056190 +0800
@@ -1021,8 +1021,10 @@
if ((fs_file = tsk_fs_file_alloc(fs)) == NULL)
return 1;
if ((fs_file->meta =
- tsk_fs_meta_alloc(EXT2FS_FILE_CONTENT_LEN)) == NULL)
+ tsk_fs_meta_alloc(EXT2FS_FILE_CONTENT_LEN)) == NULL) {
+ tsk_fs_file_close(fs_file);
return 1;
+ }
// we need to handle fs->last_inum specially because it is for the
// virtual ORPHANS directory. Handle it outside of the loop.
@@ -1038,6 +1040,7 @@
ext2fs->inode_size >
sizeof(ext2fs_inode) ? ext2fs->inode_size : sizeof(ext2fs_inode);
if ((dino_buf = (ext2fs_inode *) tsk_malloc(size)) == NULL) {
+ tsk_fs_file_close(fs_file);
return 1;
}
@@ -1058,6 +1061,7 @@
if (ext2fs_imap_load(ext2fs, grp_num)) {
tsk_release_lock(&ext2fs->lock);
+ tsk_fs_file_close(fs_file);
free(dino_buf);
return 1;
}
@@ -1068,8 +1072,9 @@
/*
* Ensure that inum - ibase refers to a valid bit offset in imap_buf.
*/
- if ((inum - ibase) > fs->block_size*8) {
+ if ((inum - ibase) >= fs->block_size*8) {
tsk_release_lock(&ext2fs->lock);
+ tsk_fs_file_close(fs_file);
free(dino_buf);
tsk_error_reset();
tsk_error_set_errno(TSK_ERR_FS_WALK_RNG);
@@ -1120,7 +1125,7 @@
* to the application.
*/
if (ext2fs_dinode_copy(ext2fs, fs_file->meta, inum, dino_buf)) {
- tsk_fs_meta_close(fs_file->meta);
+ tsk_fs_file_close(fs_file);
free(dino_buf);
return 1;
}
diff -Nur sleuthkit-4.6.7/tsk/fs/unix_misc.c sleuthkit-4.6.7.new/tsk/fs/unix_misc.c
--- sleuthkit-4.6.7/tsk/fs/unix_misc.c 2019-08-03 04:20:57.000000000 +0800
+++ sleuthkit-4.6.7.new/tsk/fs/unix_misc.c 2020-12-16 14:56:46.852764086 +0800
@@ -180,6 +180,7 @@
}
tsk_error_set_errstr2("unix_make_data_run_indir: Block %"
PRIuDADDR, addr);
+ free(data_run);
return -1;
}
}

View File

@ -1,18 +1,18 @@
From 6d709c18097b2b60a8583baf0714648a363b724e Mon Sep 17 00:00:00 2001
From 1e5d36e31edc7a46d3cea0c1e65941f9dc753fc3 Mon Sep 17 00:00:00 2001
From: lingsheng <lingsheng@huawei.com>
Date: Fri, 18 Dec 2020 10:52:36 +0800
Subject: [PATCH] Add attributes file nodesize check
---
tsk/fs/hfs.c | 11 +++++++++++
1 file changed, 11 insertions(+)
tsk/fs/hfs.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tsk/fs/hfs.c b/tsk/fs/hfs.c
index 43dc2a9..636c4b7 100644
index 3acc7ff..2f513cd 100644
--- a/tsk/fs/hfs.c
+++ b/tsk/fs/hfs.c
@@ -3970,6 +3970,18 @@ hfs_load_extended_attrs(TSK_FS_FILE * fs_file,
return 0;
@@ -3922,6 +3922,18 @@ hfs_load_extended_attrs(TSK_FS_FILE * fs_file,
return 1;
}
+ // Is the Attributes file nodesize valid?
@ -20,16 +20,16 @@ index 43dc2a9..636c4b7 100644
+ if (attrFile.nodeSize < 512 || attrFile.nodeSize > 32768) {
+ if (tsk_verbose)
+ tsk_fprintf(stderr,
+ "hfs_load_extended_attrs: Attributes file nodesize is invalid\n");
+ close_attr_file(&attrFile);
+ *isCompressed = FALSE;
+ *cmpType = 0;
+ return 0;
+ "hfs_load_extended_attrs: Attributes file nodesize is invalid\n");
+ close_attr_file(&attrFile);
+ *isCompressed = FALSE;
+ *cmpType = 0;
+ return 0;
+ }
+
// A place to hold one node worth of data
nodeData = (uint8_t *) malloc(attrFile.nodeSize);
if (nodeData == NULL) {
--
2.23.0
2.27.0

View File

@ -1,99 +0,0 @@
From 2701739f8ad80d14c36de1e3a7a35bd792fceabb Mon Sep 17 00:00:00 2001
From: Joachim Metz <joachim.metz@gmail.com>
Date: Wed, 28 Apr 2021 09:40:47 +0200
Subject: [PATCH] Fixed OOB reads in hfs_cat_traverse #1401
---
tsk/fs/hfs.c | 46 +++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/tsk/fs/hfs.c b/tsk/fs/hfs.c
index 22618534ee..003db5a950 100644
--- a/tsk/fs/hfs.c
+++ b/tsk/fs/hfs.c
@@ -469,6 +469,16 @@ hfs_ext_find_extent_record_attr(HFS_INFO * hfs, uint32_t cnid,
size_t rec_off;
hfs_btree_key_ext *key;
+ // Make sure node is large enough, note that (rec + 1) * 2 is an offset
+ // relative to the end of node
+ if ((rec + 1) * 2 > (int) nodesize) {
+ tsk_error_set_errno(TSK_ERR_FS_GENFS);
+ tsk_error_set_errstr
+ ("hfs_ext_find_extent_record: offset of record %d in leaf node %d too small (%"
+ PRIu16 ")", rec, cur_node, nodesize);
+ free(node);
+ return 1;
+ }
// get the record offset in the node
rec_off =
tsk_getu16(fs->endian,
@@ -554,11 +564,21 @@ hfs_ext_find_extent_record_attr(HFS_INFO * hfs, uint32_t cnid,
int keylen;
TSK_FS_ATTR_RUN *attr_run;
+ // Make sure node is large enough, note that (rec + 1) * 2 is an offset
+ // relative to the end of node
+ if ((rec + 1) * 2 > (int) nodesize) {
+ tsk_error_set_errno(TSK_ERR_FS_GENFS);
+ tsk_error_set_errstr
+ ("hfs_ext_find_extent_record_attr: offset of record %d in leaf node %d too small (%"
+ PRIu16 ")", rec, cur_node, nodesize);
+ free(node);
+ return 1;
+ }
// get the record offset in the node
rec_off =
tsk_getu16(fs->endian,
&node[nodesize - (rec + 1) * 2]);
- if (rec_off > nodesize) {
+ if (rec_off >= nodesize) {
tsk_error_set_errno(TSK_ERR_FS_GENFS);
tsk_error_set_errstr
("hfs_ext_find_extent_record_attr: offset of record %d in leaf node %d too large (%d vs %"
@@ -821,11 +841,21 @@ hfs_cat_traverse(HFS_INFO * hfs,
uint8_t retval;
int keylen;
+ // Make sure node is large enough, note that (rec + 1) * 2 is an offset
+ // relative to the end of node
+ if ((rec + 1) * 2 > (int) nodesize) {
+ tsk_error_set_errno(TSK_ERR_FS_GENFS);
+ tsk_error_set_errstr
+ ("hfs_cat_traverse: offset of record %d in leaf node %d too small (%"
+ PRIu16 ")", rec, cur_node, nodesize);
+ free(node);
+ return 1;
+ }
// get the record offset in the node
rec_off =
tsk_getu16(fs->endian,
&node[nodesize - (rec + 1) * 2]);
- if (rec_off > nodesize) {
+ if (rec_off >= nodesize) {
tsk_error_set_errno(TSK_ERR_FS_GENFS);
tsk_error_set_errstr
("hfs_cat_traverse: offset of record %d in index node %d too large (%d vs %"
@@ -931,11 +961,21 @@ hfs_cat_traverse(HFS_INFO * hfs,
uint8_t retval;
int keylen;
+ // Make sure node is large enough, note that (rec + 1) * 2 is an offset
+ // relative to the end of node
+ if ((rec + 1) * 2 > (int) nodesize) {
+ tsk_error_set_errno(TSK_ERR_FS_GENFS);
+ tsk_error_set_errstr
+ ("hfs_cat_traverse: offset of record %d in leaf node %d too small (%"
+ PRIu16 ")", rec, cur_node, nodesize);
+ free(node);
+ return 1;
+ }
// get the record offset in the node
rec_off =
tsk_getu16(fs->endian,
&node[nodesize - (rec + 1) * 2]);
- if (rec_off > nodesize) {
+ if (rec_off >= nodesize) {
tsk_error_set_errno(TSK_ERR_FS_GENFS);
tsk_error_set_errstr
("hfs_cat_traverse: offset of record %d in leaf node %d too large (%d vs %"

View File

@ -1,4 +1,4 @@
From 86b8f475811a20a477801a50eada3b43fb3129ea Mon Sep 17 00:00:00 2001
From 1260a66b8fe7400250d33f98fcbce0fa848bfc09 Mon Sep 17 00:00:00 2001
From: caodongxia <315816521@qq.com>
Date: Wed, 2 Jun 2021 19:18:22 +0800
Subject: [PATCH] create patch
@ -8,10 +8,10 @@ Subject: [PATCH] create patch
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/tsk/base/tsk_base_i.h b/tsk/base/tsk_base_i.h
index 147ef13..de86b32 100644
index ffa5cf3..c022302 100644
--- a/tsk/base/tsk_base_i.h
+++ b/tsk/base/tsk_base_i.h
@@ -79,8 +79,8 @@ extern "C" {
@@ -85,8 +85,8 @@ extern "C" {
*/
#define tsk_getu16(endian, x) \
(uint16_t)(((endian) == TSK_LIT_ENDIAN) ? \
@ -22,7 +22,7 @@ index 147ef13..de86b32 100644
/** \internal
* Read a 16-bit signed value.
@@ -99,8 +99,8 @@ extern "C" {
@@ -105,8 +105,8 @@ extern "C" {
*/
#define tsk_getu24(endian, x) \
(uint32_t)(((endian) == TSK_LIT_ENDIAN) ? \
@ -33,14 +33,14 @@ index 147ef13..de86b32 100644
@@ -112,15 +112,15 @@ extern "C" {
@@ -118,15 +118,15 @@ extern "C" {
*/
#define tsk_getu32(endian, x) \
(uint32_t)( ((endian) == TSK_LIT_ENDIAN) ? \
- ((((uint8_t *)(x))[0] << 0) + \
- (((uint8_t *)(x))[1] << 8) + \
- (((uint8_t *)(x))[2] << 16) + \
- (((uint8_t *)(x))[3] << 24) ) \
- ((uint32_t)((uint8_t *)(x))[3] << 24) ) \
+ (((unsigned int)(((uint8_t *)(x))[0]) << 0) + \
+ ((unsigned int)(((uint8_t *)(x))[1]) << 8) + \
+ ((unsigned int)(((uint8_t *)(x))[2]) << 16) + \
@ -49,7 +49,7 @@ index 147ef13..de86b32 100644
- ((((uint8_t *)(x))[3] << 0) + \
- (((uint8_t *)(x))[2] << 8) + \
- (((uint8_t *)(x))[1] << 16) + \
- (((uint8_t *)(x))[0] << 24) ) )
- ((uint32_t)((uint8_t *)(x))[0] << 24) ) )
+ (((unsigned int)(((uint8_t *)(x))[3]) << 0) + \
+ ((unsigned int)(((uint8_t *)(x))[2]) << 8) + \
+ ((unsigned int)(((uint8_t *)(x))[1]) << 16) + \

BIN
sleuthkit-4.12.1.tar.gz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,21 +1,15 @@
Name: sleuthkit
Version: 4.6.7
Release: 8
Version: 4.12.1
Release: 2
Summary: Tools for file system and volume forensic analysis
License: CPL and IBM and GPLv2+
License: CPL-1.0 and IPL-1.0 and GPL-2.0-or-later
URL: http://www.sleuthkit.org
Source0: https://github.com/sleuthkit/sleuthkit/releases/download/sleuthkit-%{version}/sleuthkit-%{version}.tar.gz
Patch1: 0001-MEMORYLEAK-DOS-LOAD-EXT-TABLE.patch
Patch2: 0002-Ensure-that-we-don-t-attempt-to-index-into-an-invali.patch
Patch3: 0003-Fix-bug-introduced-with-imap-offset-check.patch
Patch4: 0004-Cast-attrseq-address-to-uintptr_t-so-that-the-correc.patch
Patch5: 0005-Fix-Fuzz-buffer-overflow.patch
Patch6: 0006-Add-attributes-file-nodesize-check.patch
Patch7: 0007-Fixed-OOB-reads-in-hfs_cat_traverse.patch
Patch8: 0008-left-shift.patch
Patch0001: 0006-Add-attributes-file-nodesize-check.patch
Patch0002: 0008-left-shift.patch
BuildRequires: gcc-c++ afflib-devel >= 3.3.4 libewf-devel perl-generators sqlite-devel
BuildRequires: gcc-c++ afflib-devel >= 3.3.4 libewf-devel perl-generators sqlite-devel libtool autoconf
%{?_with_java:
BuildRequires: java-devel >= 1:1.6.0 jpackage-utils
@ -52,6 +46,7 @@ The help package contains manual pages and other related files for %{name}.
%prep
%autosetup -n %{name}-%{version} -p1
autoreconf -vif
%build
%configure --disable-static %{!?_with_java:--disable-java}
@ -73,8 +68,8 @@ sed -i.rpath 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
%exclude %{_bindir}/fcat
%{_bindir}/{ffind,fiwalk,fls,fsstat,hfind,icat}
%{_bindir}/{ifind,ils,img_cat,img_stat,istat,jcat,sorter}
%{_bindir}/{jpeg_extract,jls,mactime,mmcat,mmls,mmstat,sigfind}
%{_bindir}/{srch_strings,tsk_comparedir,tsk_gettimes,tsk_loaddb,tsk_recover,usnjls}
%{_bindir}/{jpeg_extract,jls,mactime,mmcat,mmls,mmstat,pstat,sigfind}
%{_bindir}/{srch_strings,tsk_comparedir,tsk_gettimes,tsk_imageinfo,tsk_loaddb,tsk_recover,usnjls}
%exclude %{_mandir}/man1/fcat.1*
%dir %{_datadir}/tsk
%{_datadir}/tsk/sorter/
@ -83,11 +78,27 @@ sed -i.rpath 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
%files devel
%{_includedir}/tsk/
%{_libdir}/*.so
%{_libdir}/pkgconfig/tsk.pc
%files help
%{_mandir}/man1/*
%changelog
* Fri Jul 19 2024 yaoxin <yao_xin001@hoperun.com> - 4.12.1-2
- License compliance rectification
* Mon Oct 16 2023 wulei <wu_lei@hoperun.com> - 4.12.1-1
- Update to 4.12.1
* Thu Mar 10 2022 xuping <xuping33@huawei.com> - 4.6.7-11
- Fixed OOB read in hfs_dir_open_meta_cb
* Thu Aug 26 2021 lingsheng <lingsheng@huawei.com> - 4.6.7-10
- Fixed OOB reads in hfs_cat_traverse
* Thu Aug 26 2021 sunguoshuai <sunguoshuai@huawei.com> - 4.6.7-9
- Fix memleak in ntfs
* Thu Jun 3 2021 caodongxia <caodongxia@huawei.com> - 4.6.7-8
- Fixed left shift