Skip to content

Building 70 Projects ranging from beginner to advanced so anyone can β€” learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company πŸ‘‡

fix(lisdex): crash_site named <unknown>@asanlab on 3 of 8 real crashes

CarterPerez-devd71afb90befc
diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-core/src/report.rs b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-core/src/report.rs
index 194041a2..c472ef2e 100644
--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-core/src/report.rs
+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-core/src/report.rs
@@ -88,7 +88,12 @@ impl SanitizerReport {
#[must_use]
pub fn crash_site(&self) -> Option<&str> {
- self.significant_frames().first().copied()
+ let significant = self.significant_frames();
+ significant
+ .iter()
+ .copied()
+ .find(|frame| !is_unsymbolized_frame(frame))
+ .or_else(|| significant.first().copied())
}
#[must_use]
@@ -368,6 +373,12 @@ SUMMARY: AddressSanitizer: stack-buffer-overflow (/t/harness+0x10e881) in __asan
==12==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000018 at pc 0x4a1
#0 0x7f0c8a2 (/lib/x86_64-linux-gnu/libc.so.6+0x21b97)
#1 0x7f0c8b3 (/out/libpng.so+0x1234) (BuildId: aabb)
+";
+ const INTERCEPTOR_ON_TOP: &str = "\
+==12==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000000018 at pc 0x4a1
+ #0 0x55a5aee0a111 (/out/target+0x1111) (BuildId: aabb)
+ #1 0x55a5aee0a222 in heap_write /src/target.c:12:3
+ #2 0x55a5aee0a333 in main /src/target.c:40:5
";
const SAME_MODULE_UNSYMBOLIZED_A: &str = "\
==12==ERROR: AddressSanitizer: heap-use-after-free on address 0x602000000010 at pc 0x4a1
@@ -542,6 +553,31 @@ pngrutil.c:1204:7: runtime error: left shift of negative value -1
assert_eq!(overflow.crash_site(), Some("LLVMFuzzerTestOneInput"));
}
+ #[test]
+ fn crash_site_skips_an_unresolved_interceptor_for_the_real_function() {
+ let report = SanitizerReport::parse(INTERCEPTOR_ON_TOP).unwrap();
+ assert_eq!(
+ report.significant_frames().first().copied(),
+ Some("<unknown>@target"),
+ "the fixture must reproduce the shape: an unresolved frame sits on top"
+ );
+ assert_eq!(
+ report.crash_site(),
+ Some("heap_write"),
+ "naming <unknown>@module as the crash site tells a human nothing; measured on 3 of 8 real reports, where the unresolved ASAN interceptor sat above the real function"
+ );
+ }
+
+ #[test]
+ fn crash_site_falls_back_when_nothing_resolved() {
+ let report = SanitizerReport::parse(UNSYMBOLIZED).unwrap();
+ assert_eq!(
+ report.crash_site(),
+ Some("<unknown>@libc.so.6"),
+ "with no symbol anywhere the first frame is still the best available answer"
+ );
+ }
+
#[test]
fn noise_frames_do_not_dominate_the_stack_hash() {
let report = SanitizerReport::parse(PNG003_CANARY).unwrap();