Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Malformed mach object can cause OOM when parsed #479

Closed
5225225 opened this issue Jan 4, 2022 · 1 comment
Closed

Malformed mach object can cause OOM when parsed #479

5225225 opened this issue Jan 4, 2022 · 1 comment

Comments

@5225225
Copy link

5225225 commented Jan 4, 2022

This is seems to be inside goblin. (Which is weird, I thought that crate was well fuzzed?)

fn main() {
    let data = b"\xfe\xed\xfa\xce\xce\xfa\xff\xfe\xcf*\x06;\xfe\xfa\xce\xff\xff\xff\xff0\xce:\xfa\xffj\xfe\xcf*\x06\x00;\xc6";
    symbolic::debuginfo::macho::MachObject::parse(data);
}
==511870==ERROR: AddressSanitizer: requested allocation size 0x137ffff0280 (0x137ffff1280 after adjustments for alignment, red zones etc.) exceeds maximum supported size of 0x10000000000 (thread T0)
    #0 0x55935ca6c49d in malloc /rustc/llvm/src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:129:3
    #1 0x55935e09f7de in goblin::mach::MachO::parse::h2911619bbe3c6e71 (/home/jess/.cache/cargo/target/x86_64-unknown-linux-gnu/release/mach+0x269e7de)
    #2 0x55935cd9e0cf in symbolic_debuginfo::macho::MachObject::parse::he7798c7c3eea637c (/home/jess/.cache/cargo/target/x86_64-unknown-linux-gnu/release/mach+0x139d0cf)
    #3 0x55935caa0f24 in rust_fuzzer_test_input (/home/jess/.cache/cargo/target/x86_64-unknown-linux-gnu/release/mach+0x109ff24)
    #4 0x55935e69d9a8 in __rust_try libfuzzer_sys.028fe43b-cgu.0
    #5 0x55935e6996bd in LLVMFuzzerTestOneInput (/home/jess/.cache/cargo/target/x86_64-unknown-linux-gnu/release/mach+0x2c986bd)
    #6 0x55935e6b2901 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/home/jess/.cache/cargo/target/x86_64-unknown-linux-gnu/release/mach+0x2cb1901)
    #7 0x55935e6a683a in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (/home/jess/.cache/cargo/target/x86_64-unknown-linux-gnu/release/mach+0x2ca583a)
    #8 0x55935e6aa852 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/home/jess/.cache/cargo/target/x86_64-unknown-linux-gnu/release/mach+0x2ca9852)
    #9 0x55935c9efd42 in main (/home/jess/.cache/cargo/target/x86_64-unknown-linux-gnu/release/mach+0xfeed42)
    #10 0x7fca96b13b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
@5225225 5225225 changed the title Malformed macho object can cause OOM when parsed Malformed mach object can cause OOM when parsed Jan 4, 2022
@Swatinem
Copy link
Member

Swatinem commented Jan 4, 2022

I created m4b/goblin#298 with a fix for this.

Big thanks @5225225 ❤️ this is awesome work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants