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 👇
Go aicertificationcloud-engineeringcybercybersecuritycybersecurity-analystcybersecurity-certificationcybersecurity-certificationscybersecurity-educationcybersecurity-jobscybersecurity-portfoliocybersecurity-projectscybersecurity-toolsgrchackinglearningpentestingproject-repositoryprojetcspython
// ©AngelaMos | 2026
// real_reports.rs
use lisdex_triage::boundary::{FaultAddress, LIBCASR_BOUNDARY, NULL_DEREFERENCE_BOUNDARY};
use lisdex_triage::classify::{DecidedBy, classify};
use lisdex_triage::severity::Severity;
const BAND_ADDRESS: u64 = 0x9000;
const SMALL_ADDRESS: u64 = 0x10;
const FAR_ADDRESS: u64 = 0x0010_0000;
const _: () = assert!(
BAND_ADDRESS > NULL_DEREFERENCE_BOUNDARY && BAND_ADDRESS < LIBCASR_BOUNDARY,
"the fixture must sit inside the band the two boundaries disagree about, or it controls nothing"
);
const ADDRESS_CASES: [(&str, u64, bool); 6] = [
("segv_read_small", SMALL_ADDRESS, false),
("segv_write_small", SMALL_ADDRESS, false),
("segv_read_band", BAND_ADDRESS, true),
("segv_write_band", BAND_ADDRESS, true),
("segv_read_far", FAR_ADDRESS, true),
("segv_write_far", FAR_ADDRESS, true),
];
const FIXTURES: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/fixtures");
const EXPECTED: [(&str, Severity, &str, DecidedBy); 13] = [
(
"heapw",
Severity::Exploitable,
"heap-buffer-overflow(write)",
DecidedBy::Casr,
),
(
"stackw",
Severity::Exploitable,
"stack-buffer-overflow(write)",
DecidedBy::Casr,
),
(
"globalw",
Severity::Exploitable,
"global-buffer-overflow(write)",
DecidedBy::Casr,
),
(
"uaf",
Severity::Exploitable,
"heap-use-after-free(write)",
DecidedBy::Casr,
),
(
"heapr",
Severity::NotExploitable,
"heap-buffer-overflow(read)",
DecidedBy::Casr,
),
(
"uafr",
Severity::NotExploitable,
"heap-use-after-free(read)",
DecidedBy::Casr,
),
(
"nullderef",
Severity::NotExploitable,
"SourceAvNearNull",
DecidedBy::Casr,
),
(
"leak",
Severity::NotExploitable,
"memory-leaks",
DecidedBy::Casr,
),
(
"dfree",
Severity::ProbablyExploitable,
"double-free",
DecidedBy::Lisdex,
),
(
"ub_sovf",
Severity::Undefined,
"signed integer overflow",
DecidedBy::Lisdex,
),
(
"ub_divzero",
Severity::Undefined,
"division by zero",
DecidedBy::Lisdex,
),
(
"ub_shift",
Severity::Undefined,
"shift exponent",
DecidedBy::Lisdex,
),
(
"ub_ptrovf",
Severity::Undefined,
"overflowed",
DecidedBy::Lisdex,
),
];
fn read(name: &str) -> String {
let path = format!("{FIXTURES}/{name}.txt");
std::fs::read_to_string(&path).unwrap_or_else(|err| panic!("fixture {path}: {err}"))
}
#[test]
fn every_real_captured_report_classifies_as_hand_labeled() {
let mut wrong = Vec::new();
for (name, severity, class, decided_by) in EXPECTED {
let Some(actual) = classify(&read(name)) else {
wrong.push(format!("{name}: refused, expected {}", severity.as_str()));
continue;
};
if actual.severity() != severity
|| !actual.class().contains(class)
|| actual.decided_by() != decided_by
{
wrong.push(format!(
"{name}: got {} / {} / {:?}, expected {} / {class} / {decided_by:?}",
actual.severity().as_str(),
actual.class(),
actual.decided_by(),
severity.as_str()
));
}
}
assert!(
wrong.is_empty(),
"these are real sanitizer reports captured from a running lab, not synthesised text: {wrong:#?}"
);
}
#[test]
fn the_fault_address_is_read_off_every_real_segv() {
for (name, address, _) in ADDRESS_CASES {
let classification = classify(&read(name)).expect(name);
assert_eq!(
classification.fault_address().address(),
Some(address),
"{name} must yield its real fault address; M7.4 redacts it out of kind, so nothing else in the parsed report carries it"
);
}
}
#[test]
fn the_boundary_splits_the_real_segv_corpus_where_chromium_says_it_should() {
for (name, address, security) in ADDRESS_CASES {
let classification = classify(&read(name)).expect(name);
assert_eq!(
classification.is_security_relevant(),
security,
"{name} faults at {address:#x}, and the adopted boundary is {NULL_DEREFERENCE_BOUNDARY}"
);
}
}
#[test]
fn the_disagreement_band_is_the_control_and_libcasr_still_calls_it_near_null() {
let band = classify(&read("segv_write_band")).expect("segv_write_band");
assert_eq!(
band.fault_address(),
FaultAddress::Wild(BAND_ADDRESS),
"an unread address defaults to security-relevant, so this control must see the real address or it passes for the wrong reason"
);
assert!(
band.class().contains("NearNull"),
"the fixture must reproduce the disagreement: libcasr's own boundary is 64 KiB, so it still classes this as near-null: {}",
band.class()
);
assert!(
band.is_security_relevant(),
"lisdex adopted Chromium's 32 KiB deliberately, so a fault libcasr calls near-null is still filed as security"
);
}
#[test]
fn a_write_near_null_is_rated_above_a_read_near_null() {
let write = classify(&read("segv_write_small")).expect("segv_write_small");
let read_only = classify(&read("segv_read_small")).expect("segv_read_small");
assert_eq!(write.severity(), Severity::ProbablyExploitable);
assert_eq!(read_only.severity(), Severity::NotExploitable);
assert!(
!write.is_security_relevant(),
"the severity tier and the security question are different axes; a write near null is the more dangerous of the two and is still a small fixed offset"
);
}
#[test]
fn a_crash_with_no_address_grammar_carries_no_fault_address() {
for name in ["dfree", "ub_shift", "leak"] {
let classification = classify(&read(name)).expect(name);
assert_eq!(
classification.fault_address(),
FaultAddress::Absent,
"{name} has no `on address` grammar, and a heap pointer or a prose address is not a fault address"
);
assert!(classification.is_security_relevant());
}
}
#[test]
fn the_fixtures_are_verbatim_captures_and_not_tidied_text() {
let untidy: Vec<&str> = EXPECTED
.iter()
.map(|(name, _, _, _)| *name)
.filter(|name| {
read(name)
.lines()
.any(|line| line.ends_with(' ') || line.ends_with('\t'))
})
.collect();
assert!(
untidy.len() >= 12,
"sanitizers emit trailing whitespace and a trailing newline, and this session measured a trailing newline silently flipping libcasr's UBSan verdict from a class to an error; a corpus a whitespace fixer has been over cannot reproduce that class of defect. Only {} of these still carry it, so the pre-commit exclusion for this directory is gone: {untidy:?}",
untidy.len()
);
}
#[test]
fn the_corpus_exercises_both_ends_of_the_taxonomy() {
let severities: Vec<Severity> = EXPECTED
.iter()
.filter_map(|(name, _, _, _)| classify(&read(name)))
.map(|classification| classification.severity())
.collect();
assert!(
severities.contains(&Severity::Exploitable),
"a severity layer that never returns EXPLOITABLE cannot be shown to discriminate"
);
assert!(severities.contains(&Severity::NotExploitable));
assert!(severities.contains(&Severity::ProbablyExploitable));
assert_eq!(severities.len(), EXPECTED.len(), "no report may be refused");
}
#[test]
fn a_write_and_a_read_of_the_same_bug_class_do_not_share_a_severity() {
let write = classify(&read("heapw")).expect("heapw");
let read_only = classify(&read("heapr")).expect("heapr");
assert_ne!(
write.severity(),
read_only.severity(),
"the same heap-buffer-overflow differing only in access direction must not collapse to one verdict; libcasr reads the direction from lines 1-2 of the anchored report and silently drops it if the report is not anchored"
);
}
#[test]
fn no_undefined_behaviour_report_is_marked_safe_by_the_taxonomy() {
for (name, _, _, _) in EXPECTED {
if !name.starts_with("ub_") {
continue;
}
let classification = classify(&read(name)).expect(name);
assert_eq!(
classification.decided_by(),
DecidedBy::Lisdex,
"libcasr stamps NOT_EXPLOITABLE on every UBSan finding without consulting the taxonomy, so {name} must not be routed through it"
);
assert_ne!(
classification.severity(),
Severity::NotExploitable,
"{name} would be suppressed by a verdict the deciding path is incapable of withholding"
);
}
}