PoC: Heap OOB Read in MemoryReadAdapter::read()
Security research PoC.
Vulnerability
caffe2::serialize::MemoryReadAdapter::read() performs memcpy(buf, data_+pos, n)
without checking pos+n <= size_. The size_ member is stored but never validated
in the read path, enabling heap buffer over-reads.
Files
poc_memoryread_oob.pyโ Full PoC with ASAN proof + code path reachabilitytest_oob_read.cppโ Standalone C++ ASAN test
Quick Start
# Run full PoC
python poc_memoryread_oob.py
# Or compile C++ test directly
g++ -fsanitize=address -g test_oob_read.cpp -o test_oob_read
./test_oob_read # ASAN: heap-buffer-overflow
Affected
All PyTorch versions (code has never had bounds checking). Tested on PyTorch 2.10.0.
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐ Ask for provider support