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
fix(lisdex): B89 - the symbolizer was fine, the container was reaching for the network
CarterPerez-dev25561d427100
diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/src/symbolize.rs b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/src/symbolize.rsindex e7e712a5..2c20c38b 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/src/symbolize.rs+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/src/symbolize.rs@@ -8,6 +8,9 @@ use std::process::{Command, Stdio};pub const LLVM_SYMBOLIZER_BIN: &str = "llvm-symbolizer";+pub const DEBUGINFOD_URLS: &str = "DEBUGINFOD_URLS";+pub const DEBUGINFOD_DISABLED: &str = "";+const UNKNOWN_SYMBOL: &str = "??";const FRAME_PREFIX: char = '#';const MODULE_OFFSET_MARKER: &str = "+0x";@@ -153,16 +156,21 @@ pub fn symbolize_report(report: &str) -> String {apply_symbols(report, &symbols)}-fn run_symbolizer(module: &str, offsets: &[u64]) -> Option<BTreeMap<(String, u64), Symbol>> {- let mut child = Command::new(LLVM_SYMBOLIZER_BIN)+fn symbolizer_command(module: &str) -> Command {+ let mut command = Command::new(LLVM_SYMBOLIZER_BIN);+ command.arg(format!("--obj={module}")).arg("--functions=short").arg("--demangle")+ .env(DEBUGINFOD_URLS, DEBUGINFOD_DISABLED).stdin(Stdio::piped()).stdout(Stdio::piped())- .stderr(Stdio::null())- .spawn()- .ok()?;+ .stderr(Stdio::null());+ command+}++fn run_symbolizer(module: &str, offsets: &[u64]) -> Option<BTreeMap<(String, u64), Symbol>> {+ let mut child = symbolizer_command(module).spawn().ok()?;{let stdin = child.stdin.as_mut()?;@@ -178,6 +186,8 @@ fn run_symbolizer(module: &str, offsets: &[u64]) -> Option<BTreeMap<(String, u64#[cfg(test)]mod tests {+ use std::ffi::OsStr;+use super::*;const RAW: &str = "\@@ -257,4 +267,18 @@ mod tests {fn symbolizing_a_report_without_frames_is_a_noop() {assert_eq!(symbolize_report("nothing here\n"), "nothing here\n");}++ #[test]+ fn the_symbolizer_never_inherits_a_debuginfod_server() {+ let command = symbolizer_command("/opt/out/harness");+ let found = command+ .get_envs()+ .find(|(key, _)| *key == OsStr::new(DEBUGINFOD_URLS))+ .map(|(_, value)| value);+ assert_eq!(+ found,+ Some(Some(OsStr::new(DEBUGINFOD_DISABLED))),+ "the container exports DEBUGINFOD_URLS, and a symbolizer that inherits it attempts a network fetch per query and never returns; reproduced as a 30s hang on the live crash path"+ );+ }}