Views
No views yet
mio_circle::Reader::buffer_info() handles Circle external buffers by checking only the starting offset with std::vector::at(), then returning the attacker-controlled size to callers. A Circle file can set an external buffer to start at the final byte of the file and advertise a much larger size. circledump then reads past the end of the file buffer while dumping that buffer.poc/external_offset_oob.circle20962ae3e01d2489f1ba6766f4d804414e5e5cb490589a23aa986f97abe0abd5offset=231, size=4096poc/asan-circledump-direct.stderr.txt.1ERROR: AddressSanitizer: heap-buffer-overflow
2READ of size 1
3circledump::dump_buffer(...) Dump.cpp:48
4circledump::dump_model(...) Dump.cpp:404
5operator<<(...) Dump.cpp:479
6circledump_direct_driver.cpp:41
70 bytes after 232-byte regionflatc/libflatbuffers, regenerate the Circle schema header, then compile the direct circledump core driver with ASan:1cmake -S /tmp/flatbuffers-23.5.26 -B /tmp/flatbuffers-23.5.26-build \
2 -G Ninja -DFLATBUFFERS_BUILD_TESTS=OFF -DFLATBUFFERS_INSTALL=OFF -DCMAKE_BUILD_TYPE=Release
3cmake --build /tmp/flatbuffers-23.5.26-build --target flatc flatbuffers -j2
4
5clang++ -std=c++17 -O1 -g -fsanitize=address,undefined -fno-omit-frame-pointer \
6 -I/tmp/flatbuffers-23.5.26/include \
7 -I/tmp/circle-include-current \
8 -I/path/to/ONE/compiler/mio-circle/include \
9 -I/path/to/ONE/compiler/circledump/include \
10 -I/path/to/ONE/compiler/circledump/src \
11 poc/circledump_direct_driver.cpp \
12 /path/to/ONE/compiler/circledump/src/Dump.cpp \
13 /path/to/ONE/compiler/circledump/src/MetadataPrinter.cpp \
14 /path/to/ONE/compiler/circledump/src/OpPrinter.cpp \
15 /path/to/ONE/compiler/mio-circle/src/Reader.cpp \
16 /path/to/ONE/compiler/mio-circle/src/Helper.cpp \
17 /tmp/flatbuffers-23.5.26-build/libflatbuffers.a \
18 -o /tmp/circledump_direct_driver_current
19
20ASAN_OPTIONS=abort_on_error=0:symbolize=1 \
21 /tmp/circledump_direct_driver_current poc/external_offset_oob.circleTECHNICAL_NOTES.md.