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
feat(lisdex): M10 - the console, the installer, and the public docs
CarterPerez-dev621b715eca43
diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/Cargo.lock b/PROJECTS/advanced/zero-day-vulnerability-scanner/Cargo.lockindex 2090609f..fb257c1a 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/Cargo.lock+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/Cargo.lock@@ -118,18 +118,78 @@ dependencies = ["bytemuck",]+[[package]]+name = "atomic-waker"+version = "1.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"+[[package]]name = "autocfg"version = "1.5.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"+[[package]]+name = "axum"+version = "0.8.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "31b698c5f9a010f6573133b09e0de5408834d0c82f8d7475a89fc1867a71cd90"+dependencies = [+ "axum-core",+ "bytes",+ "futures-util",+ "http",+ "http-body",+ "http-body-util",+ "hyper",+ "hyper-util",+ "itoa",+ "matchit",+ "memchr",+ "mime",+ "percent-encoding",+ "pin-project-lite",+ "serde_core",+ "serde_json",+ "serde_path_to_error",+ "sync_wrapper",+ "tokio",+ "tower",+ "tower-layer",+ "tower-service",+]++[[package]]+name = "axum-core"+version = "0.5.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1"+dependencies = [+ "bytes",+ "futures-core",+ "http",+ "http-body",+ "http-body-util",+ "mime",+ "pin-project-lite",+ "sync_wrapper",+ "tower-layer",+ "tower-service",+]+[[package]]name = "base64"version = "0.22.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"+[[package]]+name = "base64"+version = "0.23.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5"+[[package]]name = "bit-set"version = "0.5.3"@@ -201,9 +261,9 @@ dependencies = [[[package]]name = "cc"-version = "1.4.0"+version = "1.4.2"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5add81bb678e6cb321aff7fa0dc7689ad82b112dbc032cea19f91d6b8e3582b9"+checksum = "5d262e149917187838d5b42777c8253bcb64500067342904e7d429499a6f277e"dependencies = ["find-msvc-tools","shlex",@@ -236,9 +296,9 @@ dependencies = [[[package]]name = "clang"-version = "2.0.0"+version = "2.1.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "84c044c781163c001b913cd018fc95a628c50d0d2dfea8bca77dad71edb16e37"+checksum = "b2ed30b30e1e17966b55ddd0b9dd2758fd824f0a6da6875c8abb17e6aba47c28"dependencies = ["clang-sys","libc",@@ -246,9 +306,9 @@ dependencies = [[[package]]name = "clang-sys"-version = "1.8.1"+version = "1.9.1"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"+checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a"dependencies = ["glob","libc",@@ -257,9 +317,9 @@ dependencies = [[[package]]name = "clap"-version = "4.6.4"+version = "4.6.6"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "d91e0c145792ef73a6ad36d27c75ac09f1832222a3c209689d90f534685ee5b7"+checksum = "473c7e07f409a8d772161724aa8db6a765a2532a70f9667eeb7b49d3d02fbdca"dependencies = ["clap_builder","clap_derive",@@ -267,9 +327,9 @@ dependencies = [[[package]]name = "clap_builder"-version = "4.6.2"+version = "4.6.6"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "f09628afdcc538b57f3c6341e9c8e9970f18e4a481690a64974d7023bd33548b"+checksum = "7b48fea5a88e9ae728a2dcbedbfc0e730f7d60da42e1cb049a83c9fb8b789889"dependencies = ["anstream","anstyle",@@ -326,9 +386,9 @@ dependencies = [[[package]]name = "cookie"-version = "0.18.1"+version = "0.18.2"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747"+checksum = "1a373e3602691c3cdea496d2f0ee5935151e6168fe87739483c463db1b2f2f87"dependencies = ["percent-encoding","time",@@ -594,9 +654,9 @@ dependencies = [[[package]]name = "find-msvc-tools"-version = "0.1.9"+version = "0.1.10"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"+checksum = "26b73573e6edcd2af0cdf47bd6cb58f0b3839491263c314eaad1ccf24430e1de"[[package]]name = "finl_unicode"@@ -641,23 +701,32 @@ dependencies = ["percent-encoding",]+[[package]]+name = "futures-channel"+version = "0.3.34"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4"+dependencies = [+ "futures-core",+]+[[package]]name = "futures-core"-version = "0.3.33"+version = "0.3.34"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2cd50c473c80f6d7c3670a752354b8e569b1a7cbfdc0419ec88e5edad85e0dc7"+checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e"[[package]]name = "futures-task"-version = "0.3.33"+version = "0.3.34"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b231ed28831efb4a61a08580c4bc233ec56bc009f4cd8f52da2c3cb97df0c109"+checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd"[[package]]name = "futures-util"-version = "0.3.33"+version = "0.3.34"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "a77a90a256fce34da66415271e30f94ee91c57b04b8a2c042d9cf3220179deaa"+checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc"dependencies = ["futures-core","futures-task",@@ -787,12 +856,76 @@ dependencies = ["itoa",]+[[package]]+name = "http-body"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c"+dependencies = [+ "bytes",+ "http",+]++[[package]]+name = "http-body-util"+version = "0.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c"+dependencies = [+ "bytes",+ "futures-core",+ "http",+ "http-body",+ "pin-project-lite",+]+[[package]]name = "httparse"version = "1.10.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"+[[package]]+name = "httpdate"+version = "1.0.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"++[[package]]+name = "hyper"+version = "1.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d22053281f852e11534f5198498373cbb59295120a20771d90f7ed1897490a72"+dependencies = [+ "atomic-waker",+ "bytes",+ "futures-channel",+ "futures-core",+ "http",+ "http-body",+ "httparse",+ "httpdate",+ "itoa",+ "pin-project-lite",+ "smallvec",+ "tokio",+]++[[package]]+name = "hyper-util"+version = "0.1.20"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"+dependencies = [+ "bytes",+ "http",+ "http-body",+ "hyper",+ "pin-project-lite",+ "tokio",+ "tower-service",+]+[[package]]name = "iana-time-zone"version = "0.1.65"@@ -998,7 +1131,7 @@ checksum = "bde5057d6143cc94e861d90f591b9303d6716c6b9602309150bd068853c10899"dependencies = ["hashbrown 0.16.1","portable-atomic",- "thiserror 2.0.19",+ "thiserror 2.0.20",][[package]]@@ -1035,7 +1168,7 @@ dependencies = ["gdb-command","kodama","regex",- "thiserror 2.0.19",+ "thiserror 2.0.20",][[package]]@@ -1082,11 +1215,12 @@ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"[[package]]name = "lisdex"-version = "0.0.0"+version = "0.1.0"dependencies = ["clap","lisdex-build","lisdex-core",+ "lisdex-dashboard","lisdex-fuzz","lisdex-harness","lisdex-ingest",@@ -1101,74 +1235,87 @@ dependencies = [[[package]]name = "lisdex-build"-version = "0.0.0"+version = "0.1.0"dependencies = ["lisdex-core","lisdex-ingest","serde","serde_json",- "thiserror 2.0.19",+ "thiserror 2.0.20",][[package]]name = "lisdex-core"-version = "0.0.0"+version = "0.1.0"dependencies = ["rusqlite","sha2",- "thiserror 2.0.19",+ "thiserror 2.0.20",+]++[[package]]+name = "lisdex-dashboard"+version = "0.1.0"+dependencies = [+ "axum",+ "lisdex-core",+ "lisdex-monitor",+ "serde",+ "serde_json",+ "thiserror 2.0.20",+ "tokio",][[package]]name = "lisdex-fuzz"-version = "0.0.0"+version = "0.1.0"dependencies = ["lisdex-core",- "thiserror 2.0.19",+ "thiserror 2.0.20",][[package]]name = "lisdex-harness"-version = "0.0.0"+version = "0.1.0"dependencies = ["lisdex-core","lisdex-surface","serde",- "thiserror 2.0.19",+ "thiserror 2.0.20",][[package]]name = "lisdex-ingest"-version = "0.0.0"+version = "0.1.0"dependencies = ["lisdex-core",- "thiserror 2.0.19",+ "thiserror 2.0.20",][[package]]name = "lisdex-llm"-version = "0.0.0"+version = "0.1.0"dependencies = ["lisdex-core","serde","serde_json",- "thiserror 2.0.19",+ "thiserror 2.0.20","ureq",][[package]]name = "lisdex-monitor"-version = "0.0.0"+version = "0.1.0"dependencies = ["lisdex-core","lisdex-fuzz","lisdex-triage",- "thiserror 2.0.19",+ "thiserror 2.0.20",][[package]]name = "lisdex-report"-version = "0.0.0"+version = "0.1.0"dependencies = ["lisdex-core","lisdex-triage",@@ -1181,12 +1328,12 @@ version = "0.1.0"dependencies = ["clang","serde",- "thiserror 2.0.19",+ "thiserror 2.0.20",][[package]]name = "lisdex-triage"-version = "0.0.0"+version = "0.1.0"dependencies = ["libcasr","lisdex-core",@@ -1194,12 +1341,12 @@ dependencies = [[[package]]name = "lisdex-tui"-version = "0.0.0"+version = "0.1.0"dependencies = ["lisdex-core","lisdex-monitor","ratatui",- "thiserror 2.0.19",+ "thiserror 2.0.20",][[package]]@@ -1248,6 +1395,12 @@ dependencies = ["winapi",]+[[package]]+name = "matchit"+version = "0.8.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3"+[[package]]name = "memchr"version = "2.8.3"@@ -1269,6 +1422,12 @@ dependencies = ["autocfg",]+[[package]]+name = "mime"+version = "0.3.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"+[[package]]name = "minimal-lexical"version = "0.2.1"@@ -1642,7 +1801,7 @@ dependencies = ["palette","serde","strum",- "thiserror 2.0.19",+ "thiserror 2.0.20","unicode-segmentation","unicode-truncate","unicode-width",@@ -1825,9 +1984,9 @@ dependencies = [[[package]]name = "rustls-webpki"-version = "0.103.13"+version = "0.103.14"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e"+checksum = "0527518605e68109d875e248ea259b6758801cf165e4b2c2733ae3b51f12535a"dependencies = ["ring","rustls-pki-types",@@ -1901,6 +2060,17 @@ dependencies = ["zmij",]+[[package]]+name = "serde_path_to_error"+version = "0.1.20"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457"+dependencies = [+ "itoa",+ "serde",+ "serde_core",+]+[[package]]name = "sha2"version = "0.10.9"@@ -1973,6 +2143,16 @@ version = "1.15.2"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"+[[package]]+name = "socket2"+version = "0.6.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4"+dependencies = [+ "libc",+ "windows-sys 0.61.2",+]+[[package]]name = "stable_deref_trait"version = "1.2.1"@@ -2051,6 +2231,12 @@ dependencies = ["unicode-ident",]+[[package]]+name = "sync_wrapper"+version = "1.0.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"+[[package]]name = "synstructure"version = "0.13.2"@@ -2103,7 +2289,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "4676b37242ccbd1aabf56edb093a4827dc49086c0ffd764a5705899e0f35f8f7"dependencies = ["anyhow",- "base64",+ "base64 0.22.1","bitflags 2.13.1","fancy-regex","filedescriptor",@@ -2149,11 +2335,11 @@ dependencies = [[[package]]name = "thiserror"-version = "2.0.19"+version = "2.0.20"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "09a43598840e33d5b0331f38c5e30d13bb11c11210a4b58f0d9b18a5a5eefcd9"+checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f"dependencies = [- "thiserror-impl 2.0.19",+ "thiserror-impl 2.0.20",][[package]]@@ -2169,9 +2355,9 @@ dependencies = [[[package]]name = "thiserror-impl"-version = "2.0.19"+version = "2.0.20"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "43cbfe0cf76104d42a574802844187e84a305e531ed54455f11fbde0f10541cd"+checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af"dependencies = ["proc-macro2","quote",@@ -2220,6 +2406,58 @@ dependencies = ["zerovec",]+[[package]]+name = "tokio"+version = "1.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed"+dependencies = [+ "libc",+ "mio",+ "pin-project-lite",+ "socket2",+ "tokio-macros",+ "windows-sys 0.61.2",+]++[[package]]+name = "tokio-macros"+version = "2.7.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 3.0.3",+]++[[package]]+name = "tower"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"+dependencies = [+ "futures-core",+ "futures-util",+ "pin-project-lite",+ "sync_wrapper",+ "tokio",+ "tower-layer",+ "tower-service",+]++[[package]]+name = "tower-layer"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"++[[package]]+name = "tower-service"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"+[[package]]name = "typenum"version = "1.20.1"@@ -2269,11 +2507,11 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"[[package]]name = "ureq"-version = "3.3.0"+version = "3.4.0"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "dea7109cdcd5864d4eeb1b58a1648dc9bf520360d7af16ec26d0a9354bafcfc0"+checksum = "972d7902c8735f2695410b8aed7df6ed12a47394aa1c8d7af49f0497b731a94d"dependencies = [- "base64",+ "base64 0.23.1","cookie_store","flate2","log",@@ -2289,11 +2527,11 @@ dependencies = [[[package]]name = "ureq-proto"-version = "0.6.0"+version = "0.6.1"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e994ba84b0bd1b1b0cf92878b7ef898a5c1760108fe7b6010327e274917a808c"+checksum = "da5f78b09e6941e1a0f2e30e695e4b120377b54d5e0aec11b594bb57b3971613"dependencies = [- "base64",+ "base64 0.23.1","http","httparse","log",@@ -2712,18 +2950,18 @@ dependencies = [[[package]]name = "zerocopy"-version = "0.8.55"+version = "0.8.56"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b5a105cd7b140f6eeec8acff2ea38135d3cab283ada58540f629fe51e46696eb"+checksum = "556764e583adb45a9f8d413c2a147fa7e8d821e48e12b14fd560b607998b75eb"dependencies = ["zerocopy-derive",][[package]]name = "zerocopy-derive"-version = "0.8.55"+version = "0.8.56"source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "0fe976fb70c78cd64cccfe3a6fc142244e8a77b70959b30faf9d0ac37ee228eb"+checksum = "f2ab42fc20575779bd240faa45f94a74256f755c0fa9e89f0ede20d91d0cdfc1"dependencies = ["proc-macro2","quote",diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/Cargo.toml b/PROJECTS/advanced/zero-day-vulnerability-scanner/Cargo.tomlindex 1cd6d011..2211e8ca 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/Cargo.toml+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/Cargo.toml@@ -6,6 +6,7 @@ resolver = "3"members = ["crates/*"][workspace.package]+version = "0.1.0"edition = "2024"rust-version = "1.97"license = "AGPL-3.0"@@ -22,6 +23,8 @@ serde = { version = "1", features = ["derive"] }serde_json = "1"ureq = { version = "3", features = ["json"] }ratatui = "0.30"+axum = { version = "0.8", default-features = false, features = ["http1", "json", "tokio"] }+tokio = { version = "1", default-features = false, features = ["rt", "net", "time"] }lisdex-core = { path = "crates/lisdex-core" }lisdex-fuzz = { path = "crates/lisdex-fuzz" }lisdex-ingest = { path = "crates/lisdex-ingest" }@@ -33,6 +36,7 @@ lisdex-triage = { path = "crates/lisdex-triage" }lisdex-report = { path = "crates/lisdex-report" }lisdex-monitor = { path = "crates/lisdex-monitor" }lisdex-tui = { path = "crates/lisdex-tui" }+lisdex-dashboard = { path = "crates/lisdex-dashboard" }[workspace.lints.rust]unsafe_code = "deny"diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/README.md b/PROJECTS/advanced/zero-day-vulnerability-scanner/README.mdnew file mode 100644index 00000000..09d1d551--- /dev/null+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/README.md@@ -0,0 +1,139 @@+# lisdex++Point-and-run zero-day scanner for C and C++ parsers. Give it a source tree, get+back distinct bugs with severities and a disclosure-ready reproducer.++No API key. No account. No cloud. Everything runs locally.++```sh+curl -fsSL https://angelamos.com/lisdex/install.sh | bash+```++## What it does++```+source tree -> entry points -> harness -> instrumented build -> campaign+ -> crash pile -> distinct bugs -> severity -> advisory + reproducer+```++A real campaign against libpng: **182 crash files, 2 distinct bugs**. Getting+from the first number to the second is most of what this tool is for.++## Use it++```sh+# what in this tree parses untrusted bytes?+lisdex surface ./libpng++# build it under AddressSanitizer with no hand-written build script+lisdex build https://github.com/glennrp/libpng --work /tmp/lisdex++# fuzz it+lisdex fuzz --target /tmp/lisdex/builds/libpng/afl/harness \+ --seeds ./corpus --findings /tmp/out --db /tmp/lisdex.sqlite++# watch it+lisdex tui --db /tmp/lisdex.sqlite --findings /tmp/out+lisdex serve --db /tmp/lisdex.sqlite --findings /tmp/out++# what did it find, and how bad?+lisdex crashes --db /tmp/lisdex.sqlite --campaign 1++# draft the disclosure+lisdex bundle --db /tmp/lisdex.sqlite --campaign 1 --out /tmp/bundles+```++`lisdex bundle` writes one directory per distinct bug: the advisory in human and+machine form, the exact crashing bytes, the sanitizer report, and an executable+`reproduce.sh`.++## Commands++| Command | What it does |+|---|---|+| `surface` | Rank the parser entry points of a source tree |+| `harness` | Synthesize a harness for a ranked entry point, with no LLM |+| `verify` | Run the four harness oracles against one harness source file |+| `build` | Auto-build a target under sanitizers |+| `fuzz` | Run an AFL++ campaign |+| `coverage` | Report the coverage curve a campaign recorded |+| `corpus` | Distil a corpus to the smallest set reaching the same edges |+| `crashes` | List the crashes persisted for a campaign |+| `minimize` | Minimize one reproducer per distinct bug |+| `advisory` | Draft a coordinated-disclosure advisory per distinct bug |+| `bundle` | Write a self-contained reproducer bundle per distinct bug |+| `tui` | Terminal dashboard over a live campaign |+| `serve` | Local web console over the same state |+| `llm` | Report which optional booster tier is configured |++## What it refuses to do++These are deliberate, and they are the reason to trust the rest of the output.++- **It will not key a crash it cannot symbolize.** An unsymbolized frame is a+ module plus an offset, shared by every crash of that kind in that module.+ Bucketing on it merges unrelated bugs. lisdex reports the crash unkeyed+ instead.+- **It will not guess an affected version range, a CVSS score, or attacker+ reachability.** A campaign fuzzed one build. Those fields are required keys+ typed string-or-null, and both CVE and GHSA accept an unknown.+- **It will not emit a harness that fuzzes handle plumbing.** If an entry point+ needs an opaque context lisdex cannot build, it refuses and says which+ parameter blocked it.+- **It will not report a planted bug.** Crashes from a benchmark-instrumented+ build are stamped NOT DISCLOSABLE with no filing route.++## The optional booster++lisdex works fully keyless. A local model can be attached as an optional+booster, and it only ever *proposes* an answer that lisdex's own oracles then+accept or refuse.++```sh+just ollama-up+just ollama-model # qwen2.5-coder:14b-instruct-q6_K, Apache-2.0+lisdex llm --ask+```++There is no degraded keyless mode. The booster is an accelerator, never a+requirement.++## Requirements++Linux, a C compiler, and AFL++. The installer handles all three, including+`libclang`, which `lisdex surface` loads at runtime.++lisdex drives AFL++ as a separate process and does not link or vendor it. AFL+++is AGPL-3.0-or-later; lisdex is AGPL-3.0; the installer fetches AFL++ upstream+and unmodified.++## Learn++The `learn/` folder is the long version.++- [00-OVERVIEW.md](learn/00-OVERVIEW.md) - what this is and how to run it+- [01-CONCEPTS.md](learn/01-CONCEPTS.md) - memory corruption, sanitizers, why+ crash counts lie, what disclosure requires+- [02-ARCHITECTURE.md](learn/02-ARCHITECTURE.md) - the pipeline and the design+ decisions that cost the most+- [03-IMPLEMENTATION.md](learn/03-IMPLEMENTATION.md) - how each stage works+- [04-CHALLENGES.md](learn/04-CHALLENGES.md) - extensions, and two things not to+ build++## Development++```sh+just dev-up # the toolchain container+just dev-verify # prove AFL++, ASAN, cmplog and the LTO pass all work+just test # the workspace suite+just check # fmt, clippy -D warnings, tests+just magma-libpng # build the Magma validation rig+just m9-gate # one milestone's exit gate, end to end+```++Everything runs in Docker. The exit gates run real campaigns against a+Magma-instrumented libpng and check the result against canary ground truth.++## License++AGPL-3.0.diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-build/Cargo.toml b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-build/Cargo.tomlindex cc0d0d74..b0f8fb60 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-build/Cargo.toml+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-build/Cargo.toml@@ -3,7 +3,7 @@[package]name = "lisdex-build"-version = "0.0.0"+version.workspace = trueedition.workspace = truerust-version.workspace = truelicense.workspace = truediff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-core/Cargo.toml b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-core/Cargo.tomlindex a6ebfd4b..b6dd5071 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-core/Cargo.toml+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-core/Cargo.toml@@ -3,7 +3,7 @@[package]name = "lisdex-core"-version = "0.0.0"+version.workspace = trueedition.workspace = truerust-version.workspace = truelicense.workspace = truediff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-dashboard/Cargo.toml b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-dashboard/Cargo.tomlnew file mode 100644index 00000000..5e820253--- /dev/null+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-dashboard/Cargo.toml@@ -0,0 +1,24 @@+# ©AngelaMos | 2026+# Cargo.toml++[package]+name = "lisdex-dashboard"+version.workspace = true+edition.workspace = true+rust-version.workspace = true+license.workspace = true+authors.workspace = true++[dependencies]+lisdex-monitor = { workspace = true }+axum = { workspace = true }+tokio = { workspace = true }+serde = { workspace = true }+thiserror = { workspace = true }++[dev-dependencies]+lisdex-core = { workspace = true }+serde_json = { workspace = true }++[lints]+workspace = truediff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-dashboard/src/console.html b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-dashboard/src/console.htmlnew file mode 100644index 00000000..93f76e89--- /dev/null+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-dashboard/src/console.html@@ -0,0 +1,355 @@+<!doctype html>+<!--+©AngelaMos | 2026+console.html+-->+<html lang="en">+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width, initial-scale=1">+<title>lisdex console</title>+<style>+:root {+ --ink: #e8eefc; --slate: #7682a4; --dusk: #465070; --edge: #343c60;+ --panel: #0f111e; --deep: #080a13;+ --cyan: #14d7eb; --magenta: #ff2daf; --violet: #af55ff; --blue: #3c96fa;+ --green: #37fa91; --amber: #ffbe46; --red: #ff3e60;+}+* { box-sizing: border-box; }+body {+ margin: 0; background: var(--deep); color: var(--ink);+ font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;+}+header { padding: 14px 18px 0; }+.wordmark { font-size: 20px; font-weight: 700; letter-spacing: .42em; }+.wordmark span:nth-child(1) { color: var(--magenta); }+.wordmark span:nth-child(2) { color: var(--violet); }+.wordmark span:nth-child(3) { color: #6e6efa; }+.wordmark span:nth-child(4) { color: var(--blue); }+.wordmark span:nth-child(5) { color: var(--cyan); }+.wordmark span:nth-child(6) { color: var(--green); }+.tagline { color: var(--dusk); letter-spacing: normal; font-size: 12px; margin-left: 12px; font-weight: 400; }+.status { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }+.badge { padding: 2px 10px; border-radius: 3px; color: var(--panel); font-weight: 700; letter-spacing: .08em; }+.field { color: var(--slate); }+.field b { color: var(--ink); font-weight: 700; margin-left: 6px; }+.rule { height: 2px; margin: 12px 0 0; background: linear-gradient(90deg,+ var(--violet), #6366f1, var(--blue), #0ea5e9, #14dcc8, var(--green)); }+nav { display: flex; gap: 2px; padding: 12px 18px 0; }+nav button {+ background: var(--panel); color: var(--slate); border: 1px solid var(--edge);+ border-bottom: none; padding: 6px 16px; cursor: pointer; font: inherit;+ border-radius: 4px 4px 0 0;+}+nav button[aria-selected="true"] { color: var(--cyan); border-color: var(--cyan); font-weight: 700; }+main { padding: 0 18px 24px; }+.grid { display: grid; gap: 12px; }+.cols { grid-template-columns: minmax(0, 1fr) 320px; }+@media (max-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr); } }+.panel {+ background: var(--panel); border: 1px solid var(--edge); border-radius: 8px;+ padding: 10px 12px; min-width: 0;+}+.panel h2 {+ margin: 0 0 8px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase;+}+.stat { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }+.stat span { color: var(--slate); }+.stat b { font-weight: 700; }+table { width: 100%; border-collapse: collapse; font-size: 12px; }+th {+ text-align: left; color: var(--slate); font-weight: 700; padding: 4px 8px 4px 0;+ border-bottom: 1px solid var(--edge); font-size: 11px; letter-spacing: .1em;+}+td { padding: 4px 8px 4px 0; border-bottom: 1px solid #1b2036; }+tbody tr { cursor: pointer; }+tbody tr:hover td { background: #161b30; }+tbody tr[aria-selected="true"] td { background: #1d2340; }+.sev-EXPLOITABLE { color: var(--red); font-weight: 700; }+.sev-PROBABLY_EXPLOITABLE { color: var(--amber); }+.sev-NOT_EXPLOITABLE { color: var(--cyan); }+.sev-UNDEFINED { color: var(--violet); }+.sev-UNCLASSIFIED { color: var(--slate); }+.bar { height: 10px; border-radius: 5px; background: #1b2036; overflow: hidden; }+.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); }+pre {+ margin: 6px 0 0; padding: 8px; background: var(--deep); border: 1px solid var(--edge);+ border-radius: 6px; color: var(--slate); overflow-x: auto; font-size: 11px;+}+.notice { color: var(--amber); }+.muted { color: var(--dusk); }+footer { padding: 0 18px 20px; color: var(--dusk); font-size: 11px; }+.hidden { display: none; }+</style>+</head>+<body>+<header>+ <div class="wordmark"><span>L</span><span>I</span><span>S</span><span>D</span><span>E</span><span>X</span><span class="tagline">keyless memory-corruption scanner</span></div>+ <div class="status" id="status"></div>+ <div class="rule"></div>+</header>+<nav id="tabs">+ <button data-panel="overview" aria-selected="true">Overview</button>+ <button data-panel="findings" aria-selected="false">Findings</button>+ <button data-panel="instances" aria-selected="false">Instances</button>+</nav>+<main>+ <section id="overview" class="grid cols">+ <div class="panel">+ <h2 style="color: var(--cyan)">Coverage <span class="muted" id="curve-src"></span></h2>+ <svg id="chart" viewBox="0 0 800 300" preserveAspectRatio="none" style="width:100%;height:300px"></svg>+ <div class="stat"><span id="chart-lo"></span><span id="chart-hi"></span></div>+ </div>+ <div class="panel">+ <h2 style="color: var(--violet)">Telemetry</h2>+ <div id="telemetry"></div>+ <h2 style="color: var(--green); margin-top: 14px">Edge coverage</h2>+ <div class="bar"><i id="edgebar" style="width:0%"></i></div>+ <div class="stat"><span id="edgetext"></span></div>+ </div>+ </section>+ <section id="findings" class="grid cols hidden">+ <div class="panel">+ <h2 style="color: var(--red)">Findings</h2>+ <table><thead><tr><th>Severity</th><th>Key</th><th>Seen</th><th>Site</th></tr></thead>+ <tbody id="findings-rows"></tbody></table>+ </div>+ <div class="panel">+ <h2 style="color: var(--violet)">Report</h2>+ <div id="finding-detail" class="muted">select a finding</div>+ </div>+ </section>+ <section id="instances" class="grid hidden">+ <div class="panel">+ <h2 style="color: var(--green)">Instances</h2>+ <table><thead><tr><th>Instance</th><th>Role</th><th>Exec rate</th><th>Execs</th><th>Edges</th><th>Map</th><th>Crashes</th></tr></thead>+ <tbody id="instances-rows"></tbody></table>+ </div>+ </section>+</main>+<footer id="footer"></footer>+<script>+const RAMP = ["#8b5cf6", "#6366f1", "#3b82f6", "#0ea5e9", "#14dcc8", "#34ff91"];+const PHASE = {+ FUZZING: "var(--green)", BUILDING: "var(--amber)", PENDING: "var(--slate)",+ COMPLETED: "var(--cyan)", FAILED: "var(--red)",+};+let selected = 0;+let latest = null;++const count = (n) => n.toLocaleString("en-US");+const density = (p) => p.toFixed(2) + "%";+const rate = (v) => {+ if (!isFinite(v) || v < 0) return "-";+ if (v >= 1e6) return (v / 1e6).toFixed(2) + "M/s";+ if (v >= 1e3) return (v / 1e3).toFixed(1) + "k/s";+ return v.toFixed(0) + "/s";+};+const duration = (s) => {+ const h = Math.floor(s / 3600), m = Math.floor((s % 3600) / 60), x = s % 60;+ if (h > 0) return `${h}h ${String(m).padStart(2, "0")}m ${String(x).padStart(2, "0")}s`;+ if (m > 0) return `${m}m ${String(x).padStart(2, "0")}s`;+ return `${x}s`;+};+const el = (tag, cls, text) => {+ const n = document.createElement(tag);+ if (cls) n.className = cls;+ if (text !== undefined) n.textContent = text;+ return n;+};++function status(data) {+ const box = document.getElementById("status");+ box.replaceChildren();+ const c = data.campaign;+ if (!c) {+ box.append(el("span", "muted", "no campaign in store"));+ return;+ }+ const badge = el("span", "badge", c.phase);+ badge.style.background = PHASE[c.phase] || "var(--slate)";+ box.append(badge, el("b", null, c.target), el("span", "muted", "#" + c.id));+ const fields = [+ ["elapsed", duration(data.summary.elapsed_secs)],+ ["bugs", data.summary.distinct_bugs],+ ["crashes", data.summary.total_crashes],+ ];+ if (data.totals) fields.push(["afl", data.totals.afl_version]);+ for (const [k, v] of fields) {+ const f = el("span", "field", k);+ f.append(el("b", null, v));+ box.append(f);+ }+}++function chart(curve) {+ const svg = document.getElementById("chart");+ svg.replaceChildren();+ document.getElementById("chart-lo").textContent = "";+ document.getElementById("chart-hi").textContent = "";+ if (curve.length < 2) return;+ const xs = curve.map((p) => p.secs), ys = curve.map((p) => p.edges);+ const x0 = Math.min(...xs), x1 = Math.max(...xs);+ const y0 = Math.min(...ys);+ let y1 = Math.max(...ys);+ if (y1 - y0 < 1) y1 = y0 + 1;+ const px = (v) => ((v - x0) / (x1 - x0 || 1)) * 800;+ const py = (v) => 300 - ((v - y0) / (y1 - y0)) * 296 - 2;+ const step = Math.max(1, Math.floor(curve.length / RAMP.length));+ for (let b = 0; b < RAMP.length; b++) {+ const from = b * step;+ const to = b === RAMP.length - 1 ? curve.length : Math.min(curve.length, from + step + 1);+ if (to - from < 2) continue;+ const d = curve.slice(from, to).map((p, i) =>+ `${i === 0 ? "M" : "L"}${px(p.secs).toFixed(1)},${py(p.edges).toFixed(1)}`).join("");+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");+ path.setAttribute("d", d);+ path.setAttribute("fill", "none");+ path.setAttribute("stroke", RAMP[b]);+ path.setAttribute("stroke-width", "2");+ path.setAttribute("vector-effect", "non-scaling-stroke");+ svg.append(path);+ }+ document.getElementById("chart-lo").textContent = count(y0) + " edges";+ document.getElementById("chart-hi").textContent = count(y1) + " edges";+}++function telemetry(data) {+ const box = document.getElementById("telemetry");+ box.replaceChildren();+ const t = data.totals;+ const rows = [+ ["execs", t ? count(t.execs_done) : "-", "var(--ink)"],+ ["combined rate", t ? rate(t.execs_per_sec) : "-", "var(--magenta)"],+ ["corpus", data.curve.length ? count(data.curve[data.curve.length - 1].corpus) : "-", "var(--ink)"],+ ["peak edges", count(data.summary.peak_edges), "var(--cyan)"],+ ["map density", t ? density(t.map_density_pct) : "-", "var(--blue)"],+ ["saved crashes", t ? count(t.saved_crashes) : "-", "var(--amber)"],+ ["distinct bugs", data.summary.distinct_bugs, "var(--red)"],+ ["unkeyed", data.summary.unkeyed_crashes, "var(--violet)"],+ ["instances", data.instances.length, "var(--green)"],+ ];+ for (const [k, v, colour] of rows) {+ const row = el("div", "stat");+ const value = el("b", null, v);+ value.style.color = colour;+ row.append(el("span", null, k), value);+ box.append(row);+ }+ const ratio = t ? t.edge_ratio : 0;+ document.getElementById("edgebar").style.width = (ratio * 100).toFixed(2) + "%";+ document.getElementById("edgetext").textContent = t+ ? `${count(t.edges_found)} / ${count(t.total_edges)} (${density(ratio * 100)})`+ : "no instance has reported a coverage map";+ document.getElementById("curve-src").textContent = data.summary.curve_instance || "";+}++function findings(data) {+ const body = document.getElementById("findings-rows");+ body.replaceChildren();+ if (selected >= data.findings.length) selected = 0;+ data.findings.forEach((f, i) => {+ const tr = el("tr");+ tr.setAttribute("aria-selected", String(i === selected));+ const sev = el("td", null, f.severity + (f.security_relevant ? "" : " (non-security)"));+ sev.className = "sev-" + f.severity;+ const key = el("td", f.keyed ? null : "muted", f.short_key);+ const site = el("td", null, f.crash_site || "-");+ site.style.color = "var(--cyan)";+ tr.append(sev, key, el("td", "muted", "x" + f.crash_count), site);+ tr.onclick = () => { selected = i; render(latest); };+ body.append(tr);+ });+ detail(data.findings[selected]);+}++function detail(f) {+ const box = document.getElementById("finding-detail");+ box.replaceChildren();+ if (!f) {+ box.className = "muted";+ box.textContent = "no crash has been persisted for this campaign yet";+ return;+ }+ box.className = "";+ const rows = [+ ["class", f.class], ["kind", f.kind], ["severity", f.severity],+ ["decided by", f.decided_by], ["reproducer", count(f.input_bytes) + " B"],+ ["stack key", f.key_status],+ ];+ for (const [k, v] of rows) {+ const row = el("div", "stat");+ row.append(el("span", null, k), el("b", null, v));+ box.append(row);+ }+ box.append(el("h2", null, "Frames"));+ if (f.frames.length === 0) {+ box.append(el("div", "muted", "none survived the noise filter"));+ }+ f.frames.forEach((frame, i) => {+ const row = el("div", "stat");+ const name = el("b", null, frame);+ name.style.color = "var(--cyan)";+ row.append(el("span", null, "#" + i), name);+ box.append(row);+ });+ box.append(el("h2", null, "Sanitizer report"), el("pre", null, f.sanitizer_report));+}++function instances(data) {+ const body = document.getElementById("instances-rows");+ body.replaceChildren();+ data.instances.forEach((inst, i) => {+ const tr = el("tr");+ const name = el("td", null, inst.name);+ name.style.color = RAMP[i % RAMP.length];+ const role = el("td", null, inst.main ? "main" : "secondary");+ if (inst.main) role.style.color = "var(--green)";+ tr.append(name, role, el("td", null, rate(inst.execs_per_sec)),+ el("td", null, count(inst.execs_done)), el("td", null, count(inst.edges_found)),+ el("td", null, density(inst.map_density_pct)), el("td", null, count(inst.saved_crashes)));+ body.append(tr);+ });+}++function render(data) {+ if (!data) return;+ latest = data;+ status(data);+ chart(data.curve);+ telemetry(data);+ findings(data);+ instances(data);+ const footer = document.getElementById("footer");+ footer.replaceChildren();+ if (data.notices.length) {+ for (const notice of data.notices) footer.append(el("div", "notice", "! " + notice));+ } else {+ footer.append(el("div", "muted",+ "nothing is re-analysed here; every number is read from the campaign's own artifacts"));+ }+}++for (const button of document.querySelectorAll("#tabs button")) {+ button.onclick = () => {+ for (const other of document.querySelectorAll("#tabs button")) {+ const on = other === button;+ other.setAttribute("aria-selected", String(on));+ document.getElementById(other.dataset.panel).classList.toggle("hidden", !on);+ }+ };+}++async function poll() {+ try {+ const response = await fetch("/api/snapshot");+ if (response.ok) render(await response.json());+ } catch (err) {+ document.getElementById("footer").textContent = "console lost the lisdex process: " + err;+ }+}+poll();+setInterval(poll, 1000);+</script>+</body>+</html>diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-dashboard/src/lib.rs b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-dashboard/src/lib.rsnew file mode 100644index 00000000..dd34b96d--- /dev/null+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-dashboard/src/lib.rs@@ -0,0 +1,188 @@+// ©AngelaMos | 2026+// lib.rs++pub mod wire;++use std::io;+use std::net::{IpAddr, Ipv4Addr, SocketAddr};+use std::sync::Arc;++use axum::Router;+use axum::extract::State;+use axum::http::{StatusCode, header};+use axum::response::{IntoResponse, Response};+use axum::routing::get;+use lisdex_monitor::snapshot::{MonitorError, Snapshot, Source};++use crate::wire::Console;++pub const DEFAULT_PORT: u16 = 47119;+pub const DEFAULT_HOST: IpAddr = IpAddr::V4(Ipv4Addr::LOCALHOST);+const OFF_MACHINE_WARNING: &str = "warning: this console is bound off-loopback, so anyone who can reach this address can read \+ the crash inputs and unfixed vulnerabilities it serves";+pub const CONSOLE_ROUTE: &str = "/";+pub const SNAPSHOT_ROUTE: &str = "/api/snapshot";++const CONSOLE_HTML: &str = include_str!("console.html");+const HTML_CONTENT_TYPE: &str = "text/html; charset=utf-8";++#[derive(Debug, thiserror::Error)]+pub enum DashboardError {+ #[error("could not start the console server: {0}")]+ Io(#[from] io::Error),+ #[error("{0}")]+ Monitor(#[from] MonitorError),+}++#[must_use]+pub fn loopback(port: u16) -> SocketAddr {+ SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), port)+}++pub fn router(source: Source) -> Router {+ Router::new()+ .route(CONSOLE_ROUTE, get(console))+ .route(SNAPSHOT_ROUTE, get(snapshot))+ .with_state(Arc::new(source))+}++pub fn serve(source: Source, addr: SocketAddr) -> Result<(), DashboardError> {+ Snapshot::read(&source)?;+ let runtime = tokio::runtime::Builder::new_current_thread()+ .enable_all()+ .build()?;+ runtime.block_on(async move {+ let listener = tokio::net::TcpListener::bind(addr).await?;+ let bound = listener.local_addr()?;+ println!("lisdex console http://{bound}");+ if !bound.ip().is_loopback() {+ eprintln!("{OFF_MACHINE_WARNING}");+ }+ println!("press ctrl-c to stop");+ axum::serve(listener, router(source)).await+ })?;+ Ok(())+}++async fn console() -> Response {+ (+ StatusCode::OK,+ [(header::CONTENT_TYPE, HTML_CONTENT_TYPE)],+ CONSOLE_HTML,+ )+ .into_response()+}++async fn snapshot(State(source): State<Arc<Source>>) -> Response {+ match Snapshot::read(&source) {+ Ok(snapshot) => axum::Json(Console::of(&snapshot)).into_response(),+ Err(err) => (+ StatusCode::INTERNAL_SERVER_ERROR,+ axum::Json(Error {+ error: err.to_string(),+ }),+ )+ .into_response(),+ }+}++#[derive(serde::Serialize)]+struct Error {+ error: String,+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn the_console_binds_loopback_so_a_local_campaign_is_not_published_to_the_network() {+ let addr = loopback(DEFAULT_PORT);+ assert!(+ addr.ip().is_loopback(),+ "this console reads crash inputs and unfixed vulnerabilities; binding anything but loopback would publish them"+ );+ assert_eq!(addr.port(), DEFAULT_PORT);+ }++ #[test]+ fn the_default_bind_address_stays_on_this_machine() {+ assert!(+ DEFAULT_HOST.is_loopback(),+ "a wider default would publish unfixed vulnerabilities to the network the moment someone runs the console without reading the flags"+ );+ assert_eq!(DEFAULT_HOST, loopback(DEFAULT_PORT).ip());+ }++ #[test]+ fn binding_off_loopback_is_possible_but_says_what_it_costs() {+ let exposed = SocketAddr::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), DEFAULT_PORT);+ assert!(+ !exposed.ip().is_loopback(),+ "a container has to bind 0.0.0.0 to be reachable through a published port, so the code must be able to tell the difference and warn"+ );+ assert!(OFF_MACHINE_WARNING.contains("unfixed vulnerabilities"));+ }++ #[test]+ fn the_default_port_is_not_one_something_else_is_likely_to_hold() {+ for taken in [80_u16, 443, 3000, 5000, 5173, 8000, 8080, 8081, 8140, 9090] {+ assert_ne!(+ DEFAULT_PORT, taken,+ "the obvious port is the one already in use; the console must not fight for it"+ );+ }+ assert!(+ (30000..=60000).contains(&DEFAULT_PORT),+ "a console that grabs a low or well-known port loses the race with whatever already holds it"+ );+ }++ #[test]+ fn the_console_page_loads_nothing_from_the_network() {+ for loader in [+ "src=\"http",+ "src=\"//",+ "href=\"http",+ "href=\"//",+ "@import",+ "srcset",+ "<iframe",+ ] {+ assert!(+ !CONSOLE_HTML.contains(loader),+ "the console must fetch nothing off this machine; a keyless local tool cannot depend on a CDN being reachable, and this page renders unfixed vulnerabilities"+ );+ }+ assert!(CONSOLE_HTML.contains("<style>"));+ assert!(CONSOLE_HTML.contains("<script>"));+ }++ #[test]+ fn the_only_absolute_url_on_the_page_is_the_svg_namespace_the_dom_requires() {+ let absolute: Vec<&str> = CONSOLE_HTML+ .match_indices("://")+ .map(|(at, _)| {+ let start = CONSOLE_HTML[..at]+ .rfind(['"', '\'', ' ', '('])+ .map_or(0, |i| i + 1);+ let rest = &CONSOLE_HTML[start..];+ let end = rest.find(['"', '\'', ' ', ')']).unwrap_or(rest.len());+ &rest[..end]+ })+ .collect();+ assert_eq!(+ absolute,+ vec!["http://www.w3.org/2000/svg"],+ "createElementNS needs that namespace string and no browser ever fetches it; any other absolute URL is a real network dependency"+ );+ }++ #[test]+ fn the_console_page_reads_the_route_the_server_actually_serves() {+ assert!(+ CONSOLE_HTML.contains(SNAPSHOT_ROUTE),+ "the page fetches its data from a path the router must really answer"+ );+ }+}diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-dashboard/src/wire.rs b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-dashboard/src/wire.rsnew file mode 100644index 00000000..156e7b89--- /dev/null+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-dashboard/src/wire.rs@@ -0,0 +1,188 @@+// ©AngelaMos | 2026+// wire.rs++use lisdex_monitor::snapshot::Snapshot;+use serde::Serialize;++#[derive(Debug, Clone, PartialEq, Eq, Serialize)]+pub struct Campaign {+ pub id: i64,+ pub target: String,+ pub phase: &'static str,+}++#[derive(Debug, Clone, PartialEq, Eq, Serialize)]+pub struct Summary {+ pub live: bool,+ pub elapsed_secs: u64,+ pub peak_edges: u64,+ pub distinct_bugs: usize,+ pub total_crashes: usize,+ pub unkeyed_crashes: usize,+ pub curve_instance: Option<String>,+}++#[derive(Debug, Clone, PartialEq, Serialize)]+pub struct Totals {+ pub execs_done: u64,+ pub execs_per_sec: f64,+ pub edges_found: u64,+ pub total_edges: u64,+ pub edge_ratio: f64,+ pub map_density_pct: f64,+ pub saved_crashes: u64,+ pub afl_version: String,+}++#[derive(Debug, Clone, Copy, PartialEq, Serialize)]+pub struct Point {+ pub secs: u64,+ pub edges: u64,+ pub corpus: u64,+ pub execs_per_sec: f64,+ pub total_execs: u64,+ pub saved_crashes: u64,+ pub map_density_pct: f64,+}++#[derive(Debug, Clone, PartialEq, Serialize)]+pub struct Instance {+ pub name: String,+ pub main: bool,+ pub execs_done: u64,+ pub execs_per_sec: f64,+ pub edges_found: u64,+ pub total_edges: u64,+ pub saved_crashes: u64,+ pub map_density_pct: f64,+}++#[derive(Debug, Clone, PartialEq, Eq, Serialize)]+pub struct Finding {+ pub keyed: bool,+ pub short_key: String,+ pub key_status: String,+ pub crash_count: usize,+ pub severity: &'static str,+ pub security_relevant: bool,+ pub class: String,+ pub kind: String,+ pub crash_site: Option<String>,+ pub frames: Vec<String>,+ pub input_bytes: usize,+ pub decided_by: &'static str,+ pub sanitizer_report: String,+}++#[derive(Debug, Clone, PartialEq, Serialize)]+pub struct Console {+ pub campaign: Option<Campaign>,+ pub summary: Summary,+ pub totals: Option<Totals>,+ pub curve: Vec<Point>,+ pub instances: Vec<Instance>,+ pub findings: Vec<Finding>,+ pub notices: Vec<String>,+}++impl Console {+ #[must_use]+ pub fn of(snapshot: &Snapshot) -> Console {+ Console {+ campaign: snapshot.campaign().map(|campaign| Campaign {+ id: campaign.id,+ target: campaign.target.clone(),+ phase: campaign.phase.as_str(),+ }),+ summary: Summary {+ live: snapshot.is_live(),+ elapsed_secs: snapshot.elapsed_secs(),+ peak_edges: snapshot.peak_edges(),+ distinct_bugs: snapshot.distinct_bugs(),+ total_crashes: snapshot.total_crashes(),+ unkeyed_crashes: snapshot.unkeyed_crashes(),+ curve_instance: snapshot.curve_instance().map(str::to_owned),+ },+ totals: snapshot.totals().map(|totals| Totals {+ execs_done: totals.execs_done,+ execs_per_sec: totals.execs_per_sec,+ edges_found: totals.edges_found,+ total_edges: totals.total_edges,+ edge_ratio: totals.edge_ratio(),+ map_density_pct: totals.map_density_pct,+ saved_crashes: totals.saved_crashes,+ afl_version: totals.afl_version.clone(),+ }),+ curve: snapshot+ .curve()+ .iter()+ .map(|point| Point {+ secs: point.secs,+ edges: point.edges,+ corpus: point.corpus,+ execs_per_sec: point.execs_per_sec,+ total_execs: point.total_execs,+ saved_crashes: point.saved_crashes,+ map_density_pct: point.map_density_pct,+ })+ .collect(),+ instances: snapshot+ .instances()+ .iter()+ .map(|instance| Instance {+ name: instance.name.clone(),+ main: instance.is_main,+ execs_done: instance.execs_done,+ execs_per_sec: instance.execs_per_sec,+ edges_found: instance.edges_found,+ total_edges: instance.total_edges,+ saved_crashes: instance.saved_crashes,+ map_density_pct: instance.map_density_pct,+ })+ .collect(),+ findings: snapshot+ .findings()+ .iter()+ .map(|finding| Finding {+ keyed: finding.is_keyed(),+ short_key: finding.short_key(),+ key_status: finding.key_status(),+ crash_count: finding.crash_count,+ severity: finding.severity.as_str(),+ security_relevant: finding.is_security_relevant,+ class: finding.class.clone(),+ kind: finding.kind.clone(),+ crash_site: finding.crash_site.clone(),+ frames: finding.frames.clone(),+ input_bytes: finding.input_bytes,+ decided_by: finding.decider(),+ sanitizer_report: finding.sanitizer_report.clone(),+ })+ .collect(),+ notices: snapshot+ .notices()+ .iter()+ .map(|notice| notice.message())+ .collect(),+ }+ }+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn an_empty_campaign_serialises_without_inventing_a_campaign() {+ let console = Console::of(&Snapshot::empty());+ assert!(console.campaign.is_none());+ assert!(console.totals.is_none());+ assert!(console.curve.is_empty());+ assert!(console.findings.is_empty());+ assert_eq!(console.summary.distinct_bugs, 0);+ assert!(+ !console.summary.live,+ "a snapshot with no campaign cannot be live"+ );+ }+}diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-dashboard/tests/console.rs b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-dashboard/tests/console.rsnew file mode 100644index 00000000..a314778d--- /dev/null+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-dashboard/tests/console.rs@@ -0,0 +1,345 @@+// ©AngelaMos | 2026+// console.rs++use std::io::{BufRead, BufReader, Read, Write};+use std::net::{SocketAddr, TcpStream};+use std::path::PathBuf;++use lisdex_core::campaign::{Campaign, CampaignStatus};+use lisdex_core::crash::Crash;+use lisdex_core::store::Store;+use lisdex_dashboard::{SNAPSHOT_ROUTE, loopback, router};+use lisdex_monitor::snapshot::Source;++const REAL_PLOT: &str = include_str!("../../lisdex-fuzz/tests/fixtures/plot_data.txt");+const REAL_UNSYMBOLIZED: &str = include_str!("../../lisdex-triage/tests/fixtures/heapw.txt");++const KEYED_WRITE_REPORT: &str = "\+=================================================================+==53767==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7bd6bfde0020 at pc 0x558474e40fd9+WRITE of size 32 at 0x7bd6bfde0020 thread T0+ #0 0x558474e40fd8 in png_handle_PLTE /src/libpng/pngrutil.c:992:4+ #1 0x558474e41111 in png_read_info /src/libpng/pngread.c:160:10+SUMMARY: AddressSanitizer: heap-buffer-overflow (/out/harness+0xcdfd8) in png_handle_PLTE+";++const KEYED_READ_REPORT: &str = "\+=================================================================+==53768==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7bc207fe0020 at pc 0x55afa18b1a77+READ of size 1 at 0x7bc207fe0020 thread T0+ #0 0x55afa18b1a76 in png_handle_tRNS /src/libpng/pngrutil.c:1470:9+ #1 0x55afa18b2200 in png_read_info /src/libpng/pngread.c:171:10+SUMMARY: AddressSanitizer: heap-buffer-overflow (/out/harness+0x114a76) in png_handle_tRNS+";++const MAIN_STATS: &str = "\+start_time : 1784982517+last_update : 1784983139+run_time : 600+fuzzer_pid : 2790+cycles_done : 64+execs_done : 34283406+execs_per_sec : 71170.98+corpus_count : 1413+bitmap_cvg : 19.74%+saved_crashes : 80+saved_hangs : 0+edges_found : 13647+total_edges : 69140+afl_banner : lisdex_libpng_read+afl_version : ++5.02c+target_mode : persistent shmem_testcase deferred+";++struct Lab {+ root: PathBuf,+}++impl Lab {+ fn new(name: &str) -> Lab {+ let root = std::env::temp_dir().join(format!(+ "lisdex-console-{name}-{}-{:?}",+ std::process::id(),+ std::thread::current().id()+ ));+ let _ = std::fs::remove_dir_all(&root);+ let dir = root.join("findings").join("main");+ std::fs::create_dir_all(&dir).unwrap();+ std::fs::write(dir.join("fuzzer_stats"), MAIN_STATS).unwrap();+ std::fs::write(dir.join("plot_data"), REAL_PLOT).unwrap();++ let store = Store::open(root.join("lisdex.sqlite")).unwrap();+ let mut campaign = Campaign::new("lisdex_libpng_read");+ let id = store.insert_campaign(&campaign).unwrap();+ campaign.advance(CampaignStatus::Building).unwrap();+ campaign.advance(CampaignStatus::Fuzzing).unwrap();+ store+ .update_campaign_status(id, CampaignStatus::Fuzzing)+ .unwrap();+ for (index, report) in [KEYED_WRITE_REPORT, KEYED_WRITE_REPORT, KEYED_READ_REPORT]+ .iter()+ .enumerate()+ {+ store+ .insert_crash(&Crash::from_report(+ id,+ format!("input-{index}").into_bytes(),+ *report,+ ))+ .unwrap();+ }+ Lab { root }+ }++ fn source(&self) -> Source {+ Source {+ db: self.root.join("lisdex.sqlite"),+ findings: self.root.join("findings"),+ campaign: None,+ }+ }++ fn add_crash(&self, report: &str) {+ let store = Store::open(self.root.join("lisdex.sqlite")).unwrap();+ let (id, _) = store.list_campaigns().unwrap().pop().unwrap();+ store+ .insert_crash(&Crash::from_report(id, b"unsymbolized".to_vec(), report))+ .unwrap();+ }+}++impl Drop for Lab {+ fn drop(&mut self) {+ let _ = std::fs::remove_dir_all(&self.root);+ }+}++struct Server {+ addr: SocketAddr,+}++impl Server {+ fn start(source: Source) -> Server {+ let runtime = tokio::runtime::Builder::new_current_thread()+ .enable_all()+ .build()+ .unwrap();+ let listener = runtime+ .block_on(async { tokio::net::TcpListener::bind(loopback(0)).await })+ .unwrap();+ let addr = listener.local_addr().unwrap();+ let app = router(source);+ std::thread::spawn(move || {+ runtime.block_on(async move {+ let _ = axum::serve(listener, app).await;+ });+ });+ Server { addr }+ }++ fn get(&self, path: &str) -> (String, String) {+ let mut attempt = 0;+ let mut stream = loop {+ match TcpStream::connect(self.addr) {+ Ok(stream) => break stream,+ Err(err) if attempt < 50 => {+ attempt += 1;+ std::thread::sleep(std::time::Duration::from_millis(20));+ let _ = err;+ }+ Err(err) => panic!("console never accepted a connection: {err}"),+ }+ };+ write!(+ stream,+ "GET {path} HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n"+ )+ .unwrap();+ stream.flush().unwrap();++ let mut reader = BufReader::new(stream);+ let mut status = String::new();+ reader.read_line(&mut status).unwrap();+ let mut headers = String::new();+ loop {+ let mut line = String::new();+ reader.read_line(&mut line).unwrap();+ if line == "\r\n" || line.is_empty() {+ break;+ }+ headers.push_str(&line);+ }+ let mut body = String::new();+ reader.read_to_string(&mut body).unwrap();+ (format!("{status}{headers}"), body)+ }+}++fn console(lab: &Lab) -> (Server, serde_json::Value) {+ let server = Server::start(lab.source());+ let (head, body) = server.get(SNAPSHOT_ROUTE);+ assert!(+ head.starts_with("HTTP/1.1 200"),+ "unexpected status: {head}"+ );+ let json = serde_json::from_str(&body).expect("the console must answer with valid JSON");+ (server, json)+}++#[test]+fn the_console_serves_a_self_contained_page() {+ let lab = Lab::new("page");+ let server = Server::start(lab.source());+ let (head, body) = server.get("/");+ assert!(head.starts_with("HTTP/1.1 200"));+ assert!(head.contains("text/html"));+ assert!(body.contains("<title>lisdex console</title>"));+ for loader in [+ "src=\"http",+ "src=\"//",+ "href=\"http",+ "href=\"//",+ "@import",+ ] {+ assert!(+ !body.contains(loader),+ "a keyless local tool must not fetch its own console assets from the internet"+ );+ }+}++#[test]+fn the_snapshot_endpoint_reports_the_campaign_on_disk() {+ let lab = Lab::new("snapshot");+ let (_server, json) = console(&lab);+ assert_eq!(json["campaign"]["target"], "lisdex_libpng_read");+ assert_eq!(json["campaign"]["phase"], "FUZZING");+ assert_eq!(json["summary"]["live"], true);+ assert_eq!(json["summary"]["total_crashes"], 3);+ assert_eq!(json["summary"]["distinct_bugs"], 2);+ assert_eq!(json["summary"]["peak_edges"], 13647);+ assert_eq!(json["summary"]["elapsed_secs"], 600);+}++#[test]+fn the_console_reports_the_same_coverage_the_stats_file_holds() {+ let lab = Lab::new("totals");+ let (_server, json) = console(&lab);+ assert_eq!(json["totals"]["edges_found"], 13647);+ assert_eq!(json["totals"]["total_edges"], 69140);+ assert_eq!(json["totals"]["execs_done"], 34_283_406_u64);+ assert_eq!(json["totals"]["afl_version"], "++5.02c");+ let ratio = json["totals"]["edge_ratio"].as_f64().unwrap();+ assert!((ratio - 13_647.0 / 69_140.0).abs() < 1e-9);+ assert!((0.0..=1.0).contains(&ratio));+}++#[test]+fn the_console_serves_the_curve_a_real_campaign_wrote() {+ let lab = Lab::new("curve");+ let (_server, json) = console(&lab);+ let curve = json["curve"].as_array().unwrap();+ assert!(+ curve.len() > 100,+ "the 600s magma capture has over a hundred samples; a truncated curve would still draw a plausible chart"+ );+ assert_eq!(curve.last().unwrap()["secs"], 600);+ assert_eq!(curve.last().unwrap()["edges"], 13647);+ assert_eq!(json["summary"]["curve_instance"], "main");+}++#[test]+fn the_console_ranks_findings_the_way_the_model_did() {+ let lab = Lab::new("findings");+ let (_server, json) = console(&lab);+ let findings = json["findings"].as_array().unwrap();+ assert_eq!(findings.len(), 2);+ assert_eq!(findings[0]["severity"], "EXPLOITABLE");+ assert_eq!(findings[0]["crash_site"], "png_handle_PLTE");+ assert_eq!(findings[0]["crash_count"], 2);+ assert_eq!(findings[1]["severity"], "NOT_EXPLOITABLE");+ assert!(+ findings[0]["sanitizer_report"]+ .as_str()+ .unwrap()+ .contains("AddressSanitizer"),+ "the raw report an advisory would quote must reach the console"+ );+}++#[test]+fn a_crash_that_could_not_be_keyed_is_served_as_a_finding_but_not_as_a_bug() {+ let lab = Lab::new("unkeyed");+ lab.add_crash(REAL_UNSYMBOLIZED);+ let (_server, json) = console(&lab);+ let summary = &json["summary"];+ let findings = json["findings"].as_array().unwrap();++ assert_eq!(summary["total_crashes"], 4);+ assert_eq!(summary["unkeyed_crashes"], 1);+ assert_eq!(+ findings.len(),+ 3,+ "the unkeyed crash is its own finding, because two crashes that cannot be keyed must never be merged with each other"+ );+ assert_eq!(+ summary["distinct_bugs"], 2,+ "distinct_bugs counts the crashes that really keyed; serving findings.len() here would report a refusal as a third bug"+ );+ assert_ne!(+ summary["distinct_bugs"].as_u64().unwrap(),+ findings.len() as u64,+ "if these are equal the assertion above cannot tell the two quantities apart, and this test proves nothing"+ );++ let unkeyed: Vec<&serde_json::Value> =+ findings.iter().filter(|f| f["keyed"] == false).collect();+ assert_eq!(unkeyed.len(), 1);+ assert_eq!(unkeyed[0]["short_key"], "unkeyed");+ assert!(+ unkeyed[0]["key_status"]+ .as_str()+ .unwrap()+ .contains("no symbolized frames"),+ "the console must serve the reason a crash was refused, not an empty field"+ );+ assert_eq!(+ unkeyed[0]["severity"], "EXPLOITABLE",+ "refusing to key a crash must not discard the severity the classifier did decide"+ );+}++#[test]+fn a_console_pointed_at_nothing_answers_rather_than_failing() {+ let empty = std::env::temp_dir().join(format!("lisdex-console-empty-{}", std::process::id()));+ std::fs::create_dir_all(&empty).unwrap();+ let server = Server::start(Source {+ db: empty.join("missing.sqlite"),+ findings: empty.clone(),+ campaign: None,+ });+ let (head, body) = server.get(SNAPSHOT_ROUTE);+ assert!(head.starts_with("HTTP/1.1 200"));+ let json: serde_json::Value = serde_json::from_str(&body).unwrap();+ assert!(json["campaign"].is_null());+ assert!(+ json["notices"]+ .as_array()+ .unwrap()+ .iter()+ .any(|notice| notice.as_str().unwrap().contains("no campaign")),+ "an empty console must say why it is empty rather than render zeroes that look real"+ );+ let _ = std::fs::remove_dir_all(&empty);+}++#[test]+fn an_unknown_route_is_not_answered_with_the_console() {+ let lab = Lab::new("unknown");+ let server = Server::start(lab.source());+ let (head, _) = server.get("/api/../etc/passwd");+ assert!(+ !head.starts_with("HTTP/1.1 200"),+ "the console serves two routes; anything else must not resolve"+ );+}diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/Cargo.toml b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/Cargo.tomlindex 833a14d3..33e50037 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/Cargo.toml+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/Cargo.toml@@ -3,7 +3,7 @@[package]name = "lisdex-fuzz"-version = "0.0.0"+version.workspace = trueedition.workspace = truerust-version.workspace = truelicense.workspace = truediff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-harness/Cargo.toml b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-harness/Cargo.tomlindex 0a819954..3ad65b82 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-harness/Cargo.toml+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-harness/Cargo.toml@@ -3,7 +3,7 @@[package]name = "lisdex-harness"-version = "0.0.0"+version.workspace = trueedition.workspace = truerust-version.workspace = truelicense.workspace = truediff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-ingest/Cargo.toml b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-ingest/Cargo.tomlindex e45d1042..38d6d159 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-ingest/Cargo.toml+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-ingest/Cargo.toml@@ -3,7 +3,7 @@[package]name = "lisdex-ingest"-version = "0.0.0"+version.workspace = trueedition.workspace = truerust-version.workspace = truelicense.workspace = truediff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-llm/Cargo.toml b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-llm/Cargo.tomlindex 908ac946..d16dd6ff 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-llm/Cargo.toml+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-llm/Cargo.toml@@ -3,7 +3,7 @@[package]name = "lisdex-llm"-version = "0.0.0"+version.workspace = trueedition.workspace = truerust-version.workspace = truelicense.workspace = truediff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-monitor/Cargo.toml b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-monitor/Cargo.tomlindex bc437ded..26660326 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-monitor/Cargo.toml+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-monitor/Cargo.toml@@ -3,7 +3,7 @@[package]name = "lisdex-monitor"-version = "0.0.0"+version.workspace = trueedition.workspace = truerust-version.workspace = truelicense.workspace = truediff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-report/Cargo.toml b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-report/Cargo.tomlindex 9eb3adce..7de363f9 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-report/Cargo.toml+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-report/Cargo.toml@@ -3,7 +3,7 @@[package]name = "lisdex-report"-version = "0.0.0"+version.workspace = trueedition.workspace = truerust-version.workspace = truelicense.workspace = truediff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-surface/Cargo.toml b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-surface/Cargo.tomlindex 2fea1925..f83a72e8 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-surface/Cargo.toml+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-surface/Cargo.toml@@ -3,7 +3,7 @@[package]name = "lisdex-surface"-version = "0.1.0"+version.workspace = trueedition.workspace = truerust-version.workspace = truelicense.workspace = truediff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-triage/Cargo.toml b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-triage/Cargo.tomlindex ea8ecbcd..da6414c5 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-triage/Cargo.toml+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-triage/Cargo.toml@@ -3,7 +3,7 @@[package]name = "lisdex-triage"-version = "0.0.0"+version.workspace = trueedition.workspace = truerust-version.workspace = truelicense.workspace = truediff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-tui/Cargo.toml b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-tui/Cargo.tomlindex a0851d4b..1bbfa022 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-tui/Cargo.toml+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-tui/Cargo.toml@@ -3,7 +3,7 @@[package]name = "lisdex-tui"-version = "0.0.0"+version.workspace = trueedition.workspace = truerust-version.workspace = truelicense.workspace = truediff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex/Cargo.toml b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex/Cargo.tomlindex 99622227..5e74bb50 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex/Cargo.toml+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex/Cargo.toml@@ -3,7 +3,7 @@[package]name = "lisdex"-version = "0.0.0"+version.workspace = trueedition.workspace = truerust-version.workspace = truelicense.workspace = true@@ -29,4 +29,5 @@ lisdex-report.workspace = truelisdex-triage.workspace = truelisdex-monitor.workspace = truelisdex-tui.workspace = true+lisdex-dashboard.workspace = trueserde_json.workspace = truediff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex/src/main.rs b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex/src/main.rsindex 1031ac37..082e5be6 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex/src/main.rs+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex/src/main.rs@@ -120,6 +120,33 @@ enum Command {Corpus(CorpusArgs),#[command(about = "watch a campaign live in a terminal dashboard")]Tui(TuiArgs),+ #[command(about = "serve a local web console over the same campaign state")]+ Serve(ServeArgs),+}++#[derive(clap::Args)]+struct ServeArgs {+ #[arg(long, help = "sqlite database a campaign is writing to")]+ db: PathBuf,+ #[arg(long, help = "afl-fuzz output directory the campaign is writing to")]+ findings: PathBuf,+ #[arg(+ long,+ help = "campaign id to serve; defaults to the most recent one in the store"+ )]+ campaign: Option<i64>,+ #[arg(+ long,+ default_value_t = lisdex_dashboard::DEFAULT_PORT,+ help = "port to bind"+ )]+ port: u16,+ #[arg(+ long,+ default_value_t = lisdex_dashboard::DEFAULT_HOST,+ help = "address to bind; the default keeps the console on this machine, and anything else publishes unfixed vulnerabilities to whoever can reach it"+ )]+ host: std::net::IpAddr,}#[derive(clap::Args)]@@ -594,9 +621,22 @@ fn dispatch() -> Result<(), Box<dyn Error>> {Command::Minimize(args) => minimize_campaign(args),Command::Llm(args) => llm(args),Command::Tui(args) => tui(args),+ Command::Serve(args) => serve(args),}}+fn serve(args: &ServeArgs) -> Result<(), Box<dyn Error>> {+ lisdex_dashboard::serve(+ MonitorSource {+ db: args.db.clone(),+ findings: args.findings.clone(),+ campaign: args.campaign,+ },+ std::net::SocketAddr::new(args.host, args.port),+ )?;+ Ok(())+}+fn tui(args: &TuiArgs) -> Result<(), Box<dyn Error>> {let source = MonitorSource {db: args.db.clone(),diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/dev.compose.yml b/PROJECTS/advanced/zero-day-vulnerability-scanner/dev.compose.ymlindex cc5b06b7..b43bce3c 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/dev.compose.yml+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/dev.compose.yml@@ -19,7 +19,9 @@ services:AFL_NO_AFFINITY: "1"AFL_I_DONT_CARE_ABOUT_MISSING_CRASHES: "1"RUST_BACKTRACE: "1"- LISDEX_LLM_ENDPOINT: "http://host.docker.internal:11434"+ LISDEX_LLM_ENDPOINT: "http://host.docker.internal:${LISDEX_OLLAMA_PORT:-49327}"+ ports:+ - "127.0.0.1:${LISDEX_CONSOLE_PORT:-47119}:47119"volumes:- .:/work- cargo-target:/cargo-targetdiff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/install.sh b/PROJECTS/advanced/zero-day-vulnerability-scanner/install.shnew file mode 100755index 00000000..74a5d318--- /dev/null+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/install.sh@@ -0,0 +1,304 @@+#!/usr/bin/env bash+# ©AngelaMos | 2026+# install.sh++set -euo pipefail++REPO_OWNER="CarterPerez-dev"+REPO_NAME="lisdex"+BINARY="lisdex"+TAGLINE="keyless memory-corruption scanner for C/C++ parsers"+REPO_URL="https://github.com/${REPO_OWNER}/${REPO_NAME}.git"+INSTALL_DIR="${LISDEX_INSTALL_DIR:-$HOME/.local/bin}"+DEFAULT_BRANCH="main"+MIN_RUST="1.97"+VERIFIED_AFL="5.02c"+SKIP_AFL=0++if [ -t 2 ] && [ -z "${NO_COLOR:-}" ]; then+ BOLD=$'\033[1m'; DIM=$'\033[2m'; RED=$'\033[31m'; GREEN=$'\033[32m'+ YELLOW=$'\033[33m'; CYAN=$'\033[36m'; MAGENTA=$'\033[35m'; RESET=$'\033[0m'+else+ BOLD=""; DIM=""; RED=""; GREEN=""; YELLOW=""; CYAN=""; MAGENTA=""; RESET=""+fi++info() { printf '%s\n' " ${CYAN}+${RESET} $*" >&2; }+ok() { printf '%s\n' " ${GREEN}+${RESET} $*" >&2; }+warn() { printf '%s\n' " ${YELLOW}!${RESET} $*" >&2; }+die() { printf '%s\n' " ${RED}x $*${RESET}" >&2; exit 1; }+header(){ printf '\n%s\n\n' "${BOLD}${CYAN}--- $* ---${RESET}" >&2; }+have() { command -v "$1" >/dev/null 2>&1; }++trap 'printf "%s\n" "${RED}x install failed${RESET}" >&2' ERR+TMP_DIR=""+cleanup() { [ -n "$TMP_DIR" ] && rm -rf "$TMP_DIR"; return 0; }+trap cleanup EXIT++banner() {+ printf '%s' "${BOLD}${MAGENTA}" >&2+ cat >&2 <<'ART'+ _ ___ ____ ____ _______ __+ | | |_ _/ ___|| _ \| ____\ \/ /+ | | | |\___ \| | | | _| \ /+ | |___ | | ___) | |_| | |___ / \+ |_____|___|____/|____/|_____/_/\_\+ART+ printf '%s\n' "${RESET}" >&2+ printf '%s\n' " ${DIM}${TAGLINE}${RESET}" >&2+}++SUDO=""+if [ "$(id -u)" -ne 0 ]; then+ if have sudo; then SUDO="sudo"; fi+fi++pkg_install() {+ if have apt-get; then+ $SUDO apt-get update -y >/dev/null 2>&1 || warn "apt update had errors; continuing"+ $SUDO apt-get install -y --no-install-recommends "$@"+ elif have dnf; then $SUDO dnf install -y "$@"+ elif have pacman; then $SUDO pacman -S --needed --noconfirm "$@"+ elif have zypper; then $SUDO zypper install -y "$@"+ elif have apk; then $SUDO apk add "$@"+ elif have brew; then brew install "$@"+ else die "no known package manager. Install manually: $*"; fi+}++pkg_try() {+ if pkg_install "$@" >/dev/null 2>&1; then return 0; fi+ return 1+}++download() {+ if have curl; then curl -fsSL "$1" -o "$2" || return 1+ elif have wget; then wget -qO "$2" "$1" || return 1+ else die "need curl or wget"; fi+}++usage() {+ cat >&2 <<USAGE+install.sh — install ${BINARY}++ ./install.sh [options]+ curl -fsSL https://angelamos.com/${BINARY}/install.sh | bash++options:+ --prefix DIR install dir (default: ${INSTALL_DIR})+ --skip-afl do not try to install AFL++; ${BINARY} still analyses and reports,+ but 'build', 'fuzz', 'corpus' and 'minimize' need it+ -h, --help this help+USAGE+}++while [ $# -gt 0 ]; do+ case "$1" in+ --prefix) INSTALL_DIR="$2"; shift 2 ;;+ --prefix=*) INSTALL_DIR="${1#*=}"; shift ;;+ --skip-afl) SKIP_AFL=1; shift ;;+ -h|--help) usage; exit 0 ;;+ *) die "unknown option: $1 (try --help)" ;;+ esac+done++OS="$(uname -s)"; ARCH="$(uname -m)"+case "$OS" in+ Linux) OS="linux" ;;+ Darwin) OS="darwin" ;;+ MINGW*|MSYS*|CYGWIN*) die "Windows unsupported. Use WSL: this tool drives AFL++, which is Linux-first." ;;+ *) die "unsupported OS: $OS" ;;+esac+case "$ARCH" in+ x86_64|amd64) ARCH="amd64" ;;+ aarch64|arm64) ARCH="arm64" ;;+ *) die "unsupported arch: $ARCH" ;;+esac++resolve_repo() {+ local self="${BASH_SOURCE[0]:-}"+ if [ -f "./Cargo.toml" ] && [ -d "./crates/${BINARY}" ]; then pwd; return; fi+ if [ -n "$self" ] && [ -f "$(dirname "$self")/Cargo.toml" ]; then+ (cd "$(dirname "$self")" && pwd); return+ fi+ if ! have git; then+ warn "git missing — installing it"+ pkg_install git+ fi+ have git || die "could not install git; install it then re-run"+ local cache="${XDG_CACHE_HOME:-$HOME/.cache}/${BINARY}"+ if [ -d "$cache/.git" ]; then+ info "updating cached clone at $cache"+ git -C "$cache" pull --ff-only --quiet 2>/dev/null || warn "pull failed; using existing clone"+ else+ info "cloning ${REPO_URL}"+ git clone --depth 1 --branch "$DEFAULT_BRANCH" --quiet "$REPO_URL" "$cache" \+ || die "clone failed from ${REPO_URL}"+ fi+ printf '%s\n' "$cache"+}++version_at_least() {+ [ "$(printf '%s\n%s\n' "$2" "$1" | sort -V | head -1)" = "$2" ]+}++need_toolchain() {+ if ! have cargo; then+ info "installing Rust via rustup"+ if have curl; then+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path+ else+ TMP_DIR="$(mktemp -d)"+ download "https://sh.rustup.rs" "$TMP_DIR/rustup.sh" || die "could not fetch rustup"+ sh "$TMP_DIR/rustup.sh" -y --no-modify-path+ fi+ # shellcheck disable=SC1091+ [ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"+ export PATH="$HOME/.cargo/bin:$PATH"+ hash -r 2>/dev/null || true+ fi+ have cargo || die "rust installed but cargo is not on PATH; open a new shell and re-run"++ local version+ version="$(cargo --version 2>/dev/null | awk '{print $2}')"+ if version_at_least "$version" "$MIN_RUST"; then+ ok "cargo ${version}"+ else+ warn "cargo ${version} is older than ${MIN_RUST}; updating"+ if have rustup; then+ rustup update stable >/dev/null 2>&1 || warn "rustup update failed; trying the build anyway"+ else+ warn "no rustup to update with; the build may fail on edition 2024"+ fi+ fi+}++need_system_deps() {+ if have apt-get; then+ pkg_install build-essential pkg-config libclang-dev+ elif have dnf; then+ pkg_install gcc gcc-c++ make pkgconf-pkg-config clang-devel+ elif have pacman; then+ pkg_install base-devel clang+ elif have zypper; then+ pkg_install gcc gcc-c++ make pkg-config clang-devel+ elif have apk; then+ pkg_install build-base pkgconf clang-dev+ elif have brew; then+ pkg_install llvm+ else+ warn "unknown package manager; ensure a C compiler and libclang are present"+ return 0+ fi+ ok "build toolchain and libclang present"+}++afl_version() {+ afl-fuzz -h 2>&1 | head -1 | sed -E 's/.*afl-fuzz\+\+([0-9.]+[a-z]*).*/\1/' | head -1+}++need_afl() {+ if [ "$SKIP_AFL" = "1" ]; then+ warn "skipping AFL++ (--skip-afl); 'build', 'fuzz', 'corpus' and 'minimize' will not run"+ return 0+ fi+ if have afl-fuzz; then+ ok "AFL++ $(afl_version) already installed"+ return 0+ fi+ info "installing AFL++ (the fuzzer ${BINARY} drives)"+ local installed=1+ if have apt-get; then pkg_try "afl++" && installed=0+ elif have dnf; then pkg_try american-fuzzy-lop++ && installed=0+ elif have pacman; then pkg_try afl++ && installed=0+ elif have apk; then pkg_try afl++ && installed=0+ elif have brew; then pkg_try afl-fuzz && installed=0+ fi++ if [ "$installed" -ne 0 ] || ! have afl-fuzz; then+ warn "no AFL++ package for this system"+ warn "build it from upstream (do NOT patch it — ${BINARY} is AGPL-3.0 and relies on AFL++ staying unmodified):"+ warn " git clone https://github.com/AFLplusplus/AFLplusplus && cd AFLplusplus && make distrib && ${SUDO:-} make install"+ return 0+ fi++ local found+ found="$(afl_version)"+ ok "AFL++ ${found}"+ if ! version_at_least "$found" "$VERIFIED_AFL"; then+ warn "this AFL++ is older than ${VERIFIED_AFL}, which is the release ${BINARY} is tested against"+ warn "campaigns still run; for the verified toolchain build upstream AFL++ as above"+ fi+}++build_from_source() {+ info "building ${BINARY} (release, this takes a few minutes on a cold cache)"+ cargo install --path "crates/${BINARY}" --root "${INSTALL_DIR%/bin}" --force --quiet \+ || die "build failed"+ if have strip; then strip "${INSTALL_DIR}/${BINARY}" 2>/dev/null || true; fi+ ok "installed ${INSTALL_DIR}/${BINARY}"+}++wire_path() {+ case ":$PATH:" in *":$INSTALL_DIR:"*) ok "$INSTALL_DIR already on PATH"; export PATH="$INSTALL_DIR:$PATH"; return ;; esac+ local shell rc=""+ shell="$(basename "${SHELL:-bash}")"+ case "$shell" in+ zsh) rc="$HOME/.zshrc" ;;+ fish) mkdir -p "$HOME/.config/fish/conf.d"+ printf 'fish_add_path %s\n' "$INSTALL_DIR" > "$HOME/.config/fish/conf.d/${BINARY}.fish"+ ok "added to fish conf.d" ;;+ bash) rc="$HOME/.bashrc"; [ -f "$rc" ] || rc="$HOME/.bash_profile" ;;+ *) rc="$HOME/.profile" ;;+ esac+ if [ -n "$rc" ] && ! grep -q "$INSTALL_DIR" "$rc" 2>/dev/null; then+ printf '\nexport PATH="%s:$PATH"\n' "$INSTALL_DIR" >> "$rc"+ ok "added $INSTALL_DIR to PATH in $rc"+ fi+ export PATH="$INSTALL_DIR:$PATH"+}++main() {+ banner+ if have "$BINARY"; then info "existing install at $(command -v "$BINARY") — updating"; fi++ header "Dependencies"+ need_system_deps+ need_afl++ header "Building from source"+ REPO="$(resolve_repo)"+ cd "$REPO"+ need_toolchain+ build_from_source++ wire_path++ header "Verify"+ if have "$BINARY"; then+ ok "$BINARY -> $(command -v "$BINARY")"+ "$BINARY" --version 2>/dev/null || true+ else+ warn "installed to $INSTALL_DIR but not yet on PATH — open a new shell"+ fi++ printf '\n%s\n\n' " ${GREEN}${BOLD}${BINARY} is ready.${RESET}" >&2+ cat >&2 <<FOOTER+ ${DIM}rank the parser entry points of a source tree:${RESET}+ ${CYAN}${BINARY} surface ./libpng${RESET}++ ${DIM}build a target under sanitizers, then fuzz it:${RESET}+ ${CYAN}${BINARY} build https://github.com/glennrp/libpng --work /tmp/lisdex${RESET}+ ${CYAN}${BINARY} fuzz --target <harness> --seeds <dir> --findings /tmp/out --db /tmp/lisdex.sqlite${RESET}++ ${DIM}watch it live, or open the local console:${RESET}+ ${CYAN}${BINARY} tui --db /tmp/lisdex.sqlite --findings /tmp/out${RESET}+ ${CYAN}${BINARY} serve --db /tmp/lisdex.sqlite --findings /tmp/out${RESET}++ ${DIM}draft a coordinated-disclosure advisory for each distinct bug:${RESET}+ ${CYAN}${BINARY} advisory --db /tmp/lisdex.sqlite --campaign 1${RESET}++ ${DIM}docs: https://github.com/${REPO_OWNER}/${REPO_NAME}${RESET}+FOOTER+ return 0+}++main "$@" </dev/nulldiff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/justfile b/PROJECTS/advanced/zero-day-vulnerability-scanner/justfileindex ad6bb57d..7e95d464 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/justfile+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/justfile@@ -94,8 +94,35 @@ m8-gate:m8-gate-reset:docker compose -f dev.compose.yml exec toolchain bash scripts/m8-gate.sh reset+# Binds 0.0.0.0 INSIDE the container because docker forwards a published port to+# the container's eth0, never to its loopback. Exposure is clamped on the host+# side instead: dev.compose.yml publishes 127.0.0.1:${LISDEX_CONSOLE_PORT}, so+# the console is still unreachable from anywhere but this machine.+ollama-up:+ docker compose -f ollama.compose.yml up -d++ollama-down:+ docker compose -f ollama.compose.yml down++# Pulls the one model that satisfies 14-32B + Q6 + a permissive licence+# (doc 03 D5: Codestral is MNPL non-production, the cloud-labelled models+# need an account, so qwen2.5-coder Apache-2.0 is what survives).+ollama-model:+ docker compose -f ollama.compose.yml exec ollama ollama pull qwen2.5-coder:14b-instruct-q6_K++console DB FINDINGS:+ docker compose -f dev.compose.yml exec toolchain \+ /cargo-target/debug/lisdex serve --db {{DB}} --findings {{FINDINGS}} \+ --host 0.0.0.0 --port 47119+m9-gate:docker compose -f dev.compose.yml exec toolchain bash scripts/m9-gate.shm9-gate-reset:docker compose -f dev.compose.yml exec toolchain bash scripts/m9-gate.sh reset++m10-gate:+ docker compose -f dev.compose.yml exec toolchain bash scripts/m10-gate.sh++m10-gate-reset:+ docker compose -f dev.compose.yml exec toolchain bash scripts/m10-gate.sh resetdiff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/learn/00-OVERVIEW.md b/PROJECTS/advanced/zero-day-vulnerability-scanner/learn/00-OVERVIEW.mdnew file mode 100644index 00000000..e35c3219--- /dev/null+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/learn/00-OVERVIEW.md@@ -0,0 +1,187 @@+# lisdex++## What This Is++lisdex is a point-and-run zero-day scanner for C and C++ parsers. You give it a+source tree; it ranks the parser entry points, synthesizes a fuzz harness for+the best one, builds the library under AddressSanitizer, runs an AFL++ campaign,+buckets the crashes into distinct bugs, classifies how bad each one is, and+drafts a coordinated-disclosure advisory with a reproducer you can attach to a+report.++It needs no API key, no account, and no cloud service. Everything runs on your+machine.++## Why This Matters++Memory-corruption bugs in file-format parsers are still the way people get owned+in 2026, and the reason is boring: parsers are written in C, they run on+attacker-controlled bytes, and most of them are nobody's full-time job.++Three real ones, all from 2025:++- **CVE-2025-53367**, an out-of-bounds write in DjVuLibre's `MMRDecoder::scanruns`.+ Antonio Morales at GitHub Security Lab found it while looking at Evince. The+ proof of concept achieved working code execution and bypassed ASLR on a fully+ updated Ubuntu 25.04. DjVuLibre is a transitive dependency most people did not+ know they shipped, and it has never been enrolled in OSS-Fuzz, so there was no+ continuous fuzzing pressure on it at all.+- **CVE-2025-54874**, CVSS 9.8, an out-of-bounds heap write in openjpeg's+ `opj_jp2_read_header` when the input stream is shorter than the header claims.+- **CVE-2025-5914**, CVSS 7.8, an integer overflow in libarchive's+ `archive_read_format_rar_seek_data` that leads to a double free.++None of these are exotic. They are the same three shapes that have been showing+up since the 1990s: a length field nobody checked, a buffer walked past its end,+and a pointer freed twice.++**Real world scenarios where this applies:**++- You maintain a product that links an image, archive, or document library you+ did not write, and you want to know what its parser does on malformed input+ before someone else finds out.+- You are a security researcher who wants to hunt in a library that OSS-Fuzz+ does not cover, and you do not want to spend the first two days hand-writing a+ harness and a build script.+- You are triaging a crash pile from an existing fuzzer and you need to know how+ many *distinct* bugs are in it, which ones are exploitable, and what to put in+ the report.++## What You'll Learn++**Security concepts:**++- How memory-safety bugs actually present at runtime: what a heap overflow looks+ like in an AddressSanitizer report, why the read/write distinction dominates+ severity, and why a null dereference is usually a denial of service rather+ than a foothold.+- Why crash counts lie. A campaign that reports 182 crashes may have found two+ bugs. Getting from one number to the other is the whole discipline of triage.+- What coordinated disclosure actually requires, which fields a CVE record needs,+ and why refusing to guess at a field is more useful than filling it in.++**Technical skills:**++- Reading a C header with libclang and deciding which functions take+ attacker-controlled bytes.+- Building an arbitrary C project under sanitizers and coverage instrumentation+ without hand-writing a build script for it.+- Driving AFL++: persistent mode, cmplog, dictionaries, parallel campaigns, and+ reading the coverage curve it writes.+- Stack hashing for crash deduplication, and how to tell when your hash is+ merging bugs that are actually distinct.++**Tools and techniques:**++- AFL++ 5.02c (`afl-clang-lto`, `afl-fuzz`, `afl-cmin`, `afl-tmin`)+- AddressSanitizer and UndefinedBehaviorSanitizer+- libclang for entry-point discovery+- CASR for exploitability classification+- Magma, the bug-injection benchmark, as ground truth for whether the triage+ layer is telling the truth++## Prerequisites++**You should already know:**++- C well enough to read a header and know what `const unsigned char *data,+ size_t len` implies.+- What a stack trace is and roughly how heap allocation works.+- Enough shell to run a long-lived process and read its output.++**You do not need to know:**++- Rust. lisdex is written in it, but you can use the tool without reading it.+- Anything about fuzzing. That is what this project teaches.++**Tools:** Linux, a C compiler, and about 4 GB of disk for a build tree. The+installer handles the rest.++## Quick Start++```sh+curl -fsSL https://angelamos.com/lisdex/install.sh | bash+```++That ends with `lisdex` on your PATH. Then:++```sh+# 1. What in this source tree parses untrusted bytes?+lisdex surface ./libpng++# 2. Build it under AddressSanitizer, with no hand-written build script+lisdex build https://github.com/glennrp/libpng --work /tmp/lisdex++# 3. Fuzz the harness+lisdex fuzz --target /tmp/lisdex/builds/libpng/afl/harness \+ --seeds ./corpus --findings /tmp/out --db /tmp/lisdex.sqlite++# 4. Watch it, in the terminal or in a browser+lisdex tui --db /tmp/lisdex.sqlite --findings /tmp/out+lisdex serve --db /tmp/lisdex.sqlite --findings /tmp/out++# 5. How many distinct bugs, and how bad?+lisdex crashes --db /tmp/lisdex.sqlite --campaign 1++# 6. Draft the disclosure+lisdex advisory --db /tmp/lisdex.sqlite --campaign 1+lisdex bundle --db /tmp/lisdex.sqlite --campaign 1 --out /tmp/bundles+```++Step 6 writes a directory per distinct bug containing the advisory in both+human and machine form, the reproducer input, the sanitizer report, and an+executable `reproduce.sh`.++## Project Structure++```+crates/+ lisdex/ the CLI, one subcommand per verb above+ lisdex-ingest/ acquiring a source tree (git URL or local path)+ lisdex-surface/ libclang entry-point discovery and ranking+ lisdex-harness/ harness synthesis and the four oracles that judge it+ lisdex-build/ the auto-build ladder: cmake, autotools, make, meson+ lisdex-fuzz/ AFL++ invocation, dictionaries, corpus, coverage curve+ lisdex-triage/ exploitability classification (CASR + lisdex's own rules)+ lisdex-core/ the store, the crash model, dedup, sanitizer parsing+ lisdex-report/ advisories, reproducer bundles, the disclosure template+ lisdex-monitor/ the read-model: one immutable snapshot of a campaign+ lisdex-tui/ the terminal dashboard (a pure view over the model)+ lisdex-dashboard/ the local web console (the same view, over HTTP)+```++The split between `lisdex-monitor` and the two view crates is deliberate and+is explained in `02-ARCHITECTURE.md`.++## Next Steps++- `01-CONCEPTS.md` - what memory corruption is, how sanitizers catch it, why+ crash counts lie, and what disclosure requires.+- `02-ARCHITECTURE.md` - the pipeline, the layering, and the design decisions+ that cost the most to get right.+- `03-IMPLEMENTATION.md` - how each stage works, with the code.+- `04-CHALLENGES.md` - extensions, from a weekend to a research project.++## Common Issues++**`lisdex surface` finds nothing, or half of what you expected.**+Parsing a C project without a compilation database silently halves buffer+detection while still returning success. Point lisdex at a tree that has a+`compile_commands.json`, or let `lisdex build` produce one first.++**`lisdex fuzz` runs at 1,500 execs/sec instead of 200,000.**+Your harness defines its own `main`, which links against the driver's weak+`main` and shadows it, so nothing is actually being fuzzed. lisdex warns about+this: look for the line about persistent mode in the campaign output.++**A campaign reports crashes but `lisdex crashes` shows no distinct bugs.**+The crashes were captured unsymbolized, so every one of them would hash to the+same module offset. lisdex refuses to key them rather than invent a bucket. Build+the target with symbols and re-run.++## Related Projects++- `PROJECTS/advanced/binary-analysis-tool` - static analysis of the compiled+ artifact rather than the source.+- `PROJECTS/intermediate/sbom-generator-vulnerability-matcher` - finding out+ which of these libraries you actually ship.diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/learn/01-CONCEPTS.md b/PROJECTS/advanced/zero-day-vulnerability-scanner/learn/01-CONCEPTS.mdnew file mode 100644index 00000000..63901b3b--- /dev/null+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/learn/01-CONCEPTS.md@@ -0,0 +1,377 @@+# Core Security Concepts++This document covers what you need to understand to use lisdex and to trust what+it tells you. The running example is a PNG parser, because libpng is small+enough to read and old enough to have had every kind of bug.++## Memory Corruption in Parsers++### What It Is++A parser reads bytes it did not write. Somewhere in it, a length from the input+gets used to index or copy into a buffer whose size came from somewhere else.+When those two disagree, memory outside the buffer gets read or written.++The canonical shape, in a chunk-based format like PNG:++```c+/* the file says how long the chunk is */+png_uint_32 length = png_get_uint_31(png_ptr, chunk_length);++/* the parser allocated a buffer at some earlier, unrelated moment */+png_bytep buffer = png_ptr->chunk_buffer; /* say, 8192 bytes */++/* and then trusts the file */+memcpy(buffer, input + offset, length); /* length can be 0x7fffffff */+```++Nothing here is exotic. The bug is that `length` is attacker data and `buffer`+is a fixed size, and no line compares them.++### Why It Matters++C has no bounds checking, so this does not fail loudly. It corrupts whatever is+adjacent and the program keeps going. What is adjacent decides what an attacker+gets:++- Another heap buffer: information disclosure, or a controlled write into data+ the program trusts.+- Heap metadata: control of a later `malloc` or `free`, which is a classic route+ to arbitrary write.+- A function pointer or a C++ vtable pointer: direct control of the instruction+ pointer.++CVE-2025-53367 in DjVuLibre is the full chain. An out-of-bounds write in+`MMRDecoder::scanruns` produced working code execution with an ASLR bypass on a+fully patched Ubuntu 25.04.++### How It Works++There are four shapes worth being able to name on sight.++**Heap buffer overflow.** Read or write past the end of a `malloc`'d region.+AddressSanitizer catches this because it places poisoned redzones around every+allocation.++```+==53767==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7bd6bfde0020+WRITE of size 32 at 0x7bd6bfde0020 thread T0+ #0 0x558474e40fd8 in png_handle_PLTE /src/libpng/pngrutil.c:992:4+```++**Use after free.** A pointer is kept past the `free` that invalidated it. ASAN+catches it by quarantining freed memory rather than returning it immediately.+The shadow byte for freed heap is `0xfd`.++**Double free.** `free` called twice on the same pointer. Depending on the+allocator this corrupts the free list, which is a well-trodden route to an+arbitrary write.++**Stack buffer overflow.** The same thing on a stack array, which is more+directly dangerous because return addresses live there.++### Common Attacks++**Malformed length field.** Set a declared length larger than the data actually+present, or larger than any buffer the parser has. This is the single most+productive mutation against a chunked format and it is why format-aware+dictionaries matter.++**Integer overflow into an allocation.** Make `count * sizeof(item)` wrap, so a+small allocation is followed by a large loop.++```c+/* wrong: count is attacker controlled */+items = malloc(count * sizeof(struct item));+for (i = 0; i < count; i++) items[i] = read_item(input);+```++CVE-2025-5914 in libarchive is this bug, in+`archive_read_format_rar_seek_data`, ending in a double free.++**Truncation.** Declare a header, then end the file early. The parser reads+fields that were never written. CVE-2025-54874 in openjpeg is exactly this: an+out-of-bounds heap write in `opj_jp2_read_header` when the stream is too short.++### Defense Strategies++- **Validate before allocating, and validate against the real remaining input**,+ not against the value the file supplied.+- **Use checked arithmetic** for any size computation involving input.+- **Fuzz continuously**, because the space of malformed inputs is far too large+ to enumerate by hand.+- **Compile with sanitizers in CI**, not only when investigating. A bug that+ only corrupts memory silently in a release build is a bug you will not notice+ until someone else does.++## Sanitizers: Turning Corruption Into a Crash++### What It Is++A sanitizer is compiler instrumentation that makes undefined behavior loud.+AddressSanitizer maintains a shadow map: one byte of metadata per eight bytes of+application memory, recording whether each is addressable. Every load and store+gets a check against that map.++### Why It Matters++Without a sanitizer, a fuzzer only finds bugs that happen to segfault. Most+overflows do not. They land in memory the process owns, the program continues,+and the fuzzer records nothing. Instrumentation is the difference between+finding the bug and walking straight past it.++### How It Works++```+application memory [ alloc'd 32 bytes ][ redzone ]+shadow map 00 00 00 00 fa fa fa+ ^ addressable ^ poisoned+```++Reading the redzone hits a poisoned shadow byte, and ASAN reports rather than+continuing. The legend appears in every report:++```+Shadow byte legend (one shadow byte represents 8 application bytes):+ Addressable: 00+ Heap left redzone: fa+ Freed heap region: fd+```++Note `fd` for freed heap. A common mistake, which lisdex's own research+originally made, is to key a use-after-free detector on `0xfb`. That value does+not exist in the legend, and a detector written against it fails closed and+never fires.++### Common Pitfalls++**Assuming ASAN aborts.** On Linux it does not abort by default. If your harness+keeps running after a report, you get one crash file with several stacked+reports in it. Set `abort_on_error=1` when you want one crash per report.++**Assuming symbolization.** ASAN only symbolizes if it can find a symbolizer and+the binary has symbols. An unsymbolized report looks like this:++```+ #0 0x7fc82135353b (/lib/x86_64-linux-gnu/libc.so.6+0x4553b)+```++That frame is a module plus an offset. Every crash of that kind in that module+produces the same frame, so any bucketing built on it merges unrelated bugs.+lisdex refuses to key such a report at all, which is covered below.++## Why Crash Counts Lie++### What It Is++A fuzzer saves one file per input that produced a new crash *signature by its own+coverage metric*, which is not the same as one file per bug. A single bug reached+by twenty different paths produces twenty files.++### Why It Matters++This is the difference between a useful report and noise. Real numbers from a+lisdex campaign against a Magma-instrumented libpng:++```+182 crash files -> 2 distinct bugs+```++If you reported 182 issues, you would be ignored. If you reported 2, with a+reproducer each, you would be taken seriously.++The academic version of this: a triage layer takes crash-report precision from+about 2.7% to about 89.7%. Most of what a fuzzer saves is the same bug again.++### How It Works: Stack Hashing++Take the crash stack, drop the frames that are noise, keep the top N, hash them.+Two crashes with the same hash are the same bug.++```+raw stack after filtering key+----------------------------- -------------------- ------+#0 __asan_memcpy png_handle_PLTE sha256(+#1 png_handle_PLTE png_read_info "png_handle_PLTE+#2 png_read_info LLVMFuzzerTestOneInput png_read_info+#3 LLVMFuzzerTestOneInput ...")+#4 main (dropped: noise)+#5 __libc_start_main (dropped: noise)+```++Two decisions here carry all the weight.++**Which frames are noise.** `__asan_*`, `__interceptor_*`, `main`,+`_start`, and the fuzzer driver's own frames appear in every crash and carry no+information. Including them makes every crash look similar.++**How many frames, N.** Too few and you merge distinct bugs that share a leaf+function. Too many and you split one bug across the different paths that reach+it. lisdex uses N=5, validated against Magma's canary ground truth across two+real campaigns: N=1 and N=2 both merged bugs that the canaries prove are+distinct.++### The Refusal++If the stack has no symbolized frames, lisdex does not key it. It reports the+crash, classifies its severity, and marks it unkeyed, rather than putting it in a+bucket.++This matters because the alternative is worse than useless. Keying on+`libc.so.6+0x4553b` would merge every SEGV in libc into one "bug", and you would+report one issue that is actually thirty, or thirty that are actually one.++## Exploitability Classification++### What It Is++Given a crash, how bad is it? The industry vocabulary comes from `!exploitable`+and its descendants: EXPLOITABLE, PROBABLY_EXPLOITABLE, NOT_EXPLOITABLE,+UNDEFINED.++### How It Works++lisdex uses CASR for the main classification and applies its own rules where CASR+is silent. The dominant factor is one most severity tables omit entirely: whether+the faulting access was a **read** or a **write**.++```+heap-buffer-overflow WRITE -> EXPLOITABLE+heap-buffer-overflow READ -> NOT_EXPLOITABLE+```++Both are the same CWE. Both are the same function. The write is a foothold; the+read is an information leak at best and usually a crash. A severity table that+keys on the bug class alone will publish "High" for the read, and it will be+wrong.++The second factor is the fault address. A dereference near zero is a null+pointer bug, which is a denial of service. A dereference at a wild address is a+corrupted pointer, which is not.++```+fault address interpretation+0x0000000000 null dereference -> not security relevant+0x0000000018 null + small offset -> still a null dereference+0x00007f2c9bb0 wild pointer -> security relevant+```++### Industry Standards++| Standard | What it maps to here |+|---|---|+| CWE-787 | Out-of-bounds write |+| CWE-125 | Out-of-bounds read |+| CWE-416 | Use after free |+| CWE-415 | Double free |+| CWE-190 | Integer overflow leading to one of the above |+| CVSS 3.1/4.0 | The score a CNA may assign. lisdex does not guess one. |++## Coordinated Disclosure++### What It Is++You found a bug in someone else's software. Disclosure is the process of telling+them, giving them time to fix it, and then telling everyone else.++### What a Report Needs++The OpenSSF publishes a disclosure template, and lisdex renders it. The parts+that matter:++- What the bug is, in one sentence, with the CWE.+- Where it is: the function, the file, the version you tested.+- How to reproduce it: the exact input, and a script that runs it.+- What an attacker gets.+- Who found it.++### The Fields lisdex Refuses To Fill++An advisory drafted from a fuzzing campaign genuinely does not know some things,+and lisdex leaves them empty rather than guessing:++- **Affected version ranges.** The campaign fuzzed one build. It does not know+ when the bug was introduced or whether older releases have it.+- **CVSS score.** That is the CNA's to assign, and a guessed vector is worse+ than none.+- **Attacker reachability.** Whether this parser is reachable from the network+ in your product is a question about your product.++This is a deliberate design decision and it is defensible on the record: these+are required *keys* in the schemas, typed string-or-null. A CVE record accepts+`defaultStatus: unknown`, and the CNA Rules allow a permanently unknown value.+Leaving them null makes a record incomplete. Inventing them makes it wrong.++### Real World Examples++**CVE-2025-53367, DjVuLibre.** Found by targeted fuzzing of a library that was+not in OSS-Fuzz. Reported through GitHub Security Lab, fixed in 3.5.29. The+research writeup demonstrated ASLR-bypassing code execution, which is what moved+it from "a crash" to "an emergency".++**Project Zero's disclosure trial, announced 2025-07-29.** Google now announces+that a report *exists* within a week of filing, before any technical detail.+The point is to let downstream consumers start asking their vendors, without+handing attackers the bug.++One rule that follows from all of this: **a CVE record must not be the first+public disclosure.** Tell the maintainer, agree a timeline, then publish.++## How the Concepts Relate++```+ source tree+ |+ v+ entry point discovery ......... which functions eat untrusted bytes+ |+ v+ harness + instrumented build .. sanitizers make corruption loud+ |+ v+ fuzzing campaign .............. coverage-guided mutation finds inputs+ |+ v+ crash pile (182 files)+ |+ +--> stack hashing ...... 182 files -> 2 distinct bugs+ |+ +--> classification ..... read vs write -> severity+ |+ v+ advisory + reproducer ......... what a maintainer can act on+```++Each stage is only as good as the one before it. A harness that reads none of+its input produces a campaign with no crashes. A campaign with no symbols+produces crashes that cannot be bucketed. Bucketing that merges two bugs+produces an advisory that describes neither.++## Testing Your Understanding++1. A campaign reports 300 crash files and your triage says 1 distinct bug. What+ are the two most likely explanations, and how would you tell them apart?+2. You get a `heap-buffer-overflow READ of size 1`. The maintainer asks whether+ they should treat it as urgent. What do you tell them, and what would change+ your answer?+3. Why is keying a crash bucket on `libc.so.6+0x4553b` worse than refusing to+ key it at all?+4. Your fuzzer is running at 1,200 execs/sec on a small PNG parser. What is the+ first thing you check?++## Further Reading++**Essential:**++- AddressSanitizer algorithm and shadow mapping: `github.com/google/sanitizers/wiki/AddressSanitizer`+- AFL++ documentation: `aflplus.plus/docs/`+- The OpenSSF vulnerability disclosure template++**Deep dive:**++- Klees et al., *Evaluating Fuzz Testing* (CCS 2018), on why single-trial fuzzing+ comparisons are meaningless.+- Hazimeh, Herrera, Payer, *Magma: A Ground-Truth Fuzzing Benchmark* (2021), the+ canary approach lisdex uses to check its own triage.+- GitHub Security Lab's CVE-2025-53367 writeup, for a complete modern chain from+ fuzz crash to ASLR bypass.diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/learn/02-ARCHITECTURE.md b/PROJECTS/advanced/zero-day-vulnerability-scanner/learn/02-ARCHITECTURE.mdnew file mode 100644index 00000000..6670f747--- /dev/null+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/learn/02-ARCHITECTURE.md@@ -0,0 +1,313 @@+# Architecture++## High Level++lisdex is a pipeline. Each stage produces an artifact the next stage consumes,+and every stage can be run on its own from the CLI.++```+ git URL or path+ |+ v+ +-------------+ source tree+ | ingest |------------------++ +-------------+ |+ v+ +-----------------+ ranked entry points+ | surface |--------------------++ | (libclang) | |+ +-----------------+ v+ +-----------------++ +-------------+ instrumented archive | harness |+ | build |<---------------------------------------| + 4 oracles |+ | (the ladder)| +-----------------++ +-------------+ |+ | |+ | harness binary (ASAN + AFL + cmplog) |+ +------------------------+--------------------------------++ v+ +-----------------++ | fuzz | afl-fuzz, N instances+ +-----------------++ | |+ plot_data | | crashes/+ fuzzer_stats| |+ v v+ +-----------------------++ | store | sqlite: campaigns, crashes+ +-----------------------++ |+ v+ +-----------------------++ | dedup + triage | stack hash, CASR+ +-----------------------++ |+ +------------------+------------------++ v v+ +-----------------+ +-----------------++ | monitor | Snapshot | report | advisory,+ | (read-model) | | | bundle+ +-----------------+ +-----------------++ | |+ v v+ tui dashboard+```++## Component Breakdown++| Crate | Responsibility |+|---|---|+| `lisdex-ingest` | Acquire a source tree from a git URL or a local path. Detect the build system. |+| `lisdex-surface` | Parse headers with libclang, find functions that take attacker bytes, rank them. |+| `lisdex-harness` | Synthesize a harness for a ranked entry point and judge it with four oracles. |+| `lisdex-build` | The auto-build ladder. Inject sanitizer and coverage flags into cmake, autotools, meson, or plain make. |+| `lisdex-fuzz` | Build the `afl-fuzz` invocation, choose dictionaries, run instances, harvest crashes, parse `plot_data` and `fuzzer_stats`. |+| `lisdex-core` | The domain: `Campaign`, `Crash`, the sqlite store, sanitizer-report parsing, stack hashing, dedup. |+| `lisdex-triage` | Exploitability classification via CASR plus lisdex's own fault-address rules. |+| `lisdex-report` | Advisory drafting, the OpenSSF template, JSON and markdown renderers, reproducer bundles. |+| `lisdex-monitor` | The read-model. Collapses store + curve + stats + dedup + classification into one immutable `Snapshot`. |+| `lisdex-tui` | Terminal dashboard. Renders `Snapshot`. Nothing else. |+| `lisdex-dashboard` | Local web console. Renders `Snapshot` over HTTP. Nothing else. |++## The Layering Decision That Cost the Most++The milestone plan called for one crate, `lisdex-tui`, described as "a pure view+over core with zero analysis logic". The exit condition was that two auditors+agree it is a pure view.++That is an opinion for exactly as long as the view *can* call analysis. So the+read-model was split into its own crate:++```+ lisdex-core lisdex-fuzz lisdex-triage <- analysis lives here+ \ | /+ \ | /+ +-----------+-----------++ |+ lisdex-monitor <- one Snapshot of owned data+ |+ +-----------+-----------++ | |+ lisdex-tui lisdex-dashboard <- views, and nothing else+```++`lisdex-tui`'s dependency list is `lisdex-monitor`, `ratatui`, `thiserror`.+`lisdex-dashboard`'s is `lisdex-monitor`, `axum`, `tokio`, `serde`, `thiserror`.+Neither can call `classify()` or `group_crashes()` or `plot::parse()` because+those crates are not linked. Purity stops being a judgement call and becomes a+manifest fact plus a grep, which is what the exit gate checks.++`Snapshot` also carries no analysis types. `lisdex_triage::Severity`,+`lisdex_triage::classify::DecidedBy`, and `lisdex_core::CampaignStatus` are each+*projected* onto a monitor-owned enum, so the views cannot reach the analysis+crates transitively either.++### The property this actually buys++A view that computes anything drifts from the tool it claims to be a view over.+The exit gate asserts they agree:++```+lisdex crashes --db X --campaign 1 -> 83 crashes, 2 distinct bugs+lisdex coverage --findings Y -> curve_peak_edges 13504++panel shows: crashes 83, bugs 2, peak edges 13,504+```++If the TUI computed its own bug count, that check would fail. It is a+differential oracle, and it is stronger than any amount of reading the code.++## Data Flow: One Crash, End to End++1. **afl-fuzz saves a file** under `findings/<instance>/crashes/id:000001,...`.++2. **`runner::harvest` re-runs it** against the target with+ `ASAN_OPTIONS`/`UBSAN_OPTIONS` set, captures stderr, and caps it at+ `MAX_REPORT_BYTES` so a pathological report cannot exhaust memory.++3. **`SanitizerReport::parse` reads that text.** It finds the header line, pulls+ the sanitizer name, the bug kind, and the fault address, then parses the+ frames.++4. **`SanitizerReport::stack_hash` keys it.** Noise frames are dropped+ (`NOISE_FRAME_PREFIXES`, `NOISE_FRAME_EXACT`), unsymbolized frames disqualify+ the stack entirely, and the surviving top frames are hashed.++5. **`Store::insert_crash` persists** the input bytes, the raw report, and the+ key.++6. **`dedup::group_crashes` buckets** by key at read time. Crashes with no key+ are never merged with each other.++7. **`classify::classify` judges severity** from the report text: CASR for the+ main verdict, `FaultAddress` for the null-versus-wild distinction.++8. **`Advisory::draft` builds the disclosure** from the group's representative+ crash, refusing the fields it cannot know.++## Design Decisions++### The stored stack hash is a cache, not the truth++A crash row stores its key, but `Store::crashes_for_campaign` recomputes the key+from the retained report rather than trusting the stored one.++This looks redundant until you change the frame filter. Measured on two real+libpng campaigns: adding a single entry to `NOISE_FRAME_EXACT` invalidated all+127 stored keys. If the store had trusted them, rows written before and after the+change would have counted as different bugs, and the campaign would have reported+4 bugs where the Magma canaries prove there are 2.++The report is the durable artifact. The key is derived from it, every time.++### Coverage is a maximum, never a sum++When N instances fuzz in parallel they share one coverage map and sync through+the main instance. `runner::combine_stats` therefore adds the work and takes the+maximum of the coverage:++```rust+combined.execs_done += stats.execs_done; // work is additive+combined.edges_found = max(a.edges_found, b.edges_found); // coverage is not+```++Summing `edges_found` across four instances would report coverage the campaign+never had.++### The coverage curve comes from one authoritative instance++`plot_data` is per-instance. `runner::primary_instance` picks main, then default,+then the first, and the curve is read from that one. Choosing which instance is+authoritative is a policy decision, so it lives in `lisdex-fuzz` and not in+either view.++### Falling coverage means the campaign was resumed++`plot_data` is appended to on resume, so a resumed campaign's curve is two+campaigns concatenated and its coverage appears to fall at the seam. lisdex+detects this and raises a notice rather than silently reporting a first-to-last+delta that understates the run. It is a true positive, not a bug to fix.++### The dictionary cap of four is structural++`afl-fuzz` fatals on a fifth `-x`. lisdex caps the dictionaries it selects at+four and warns when a corpus has more recognized formats than fit. This is a+property of the binary, not a style choice.++### The model owns every sentence on screen++Notices, severity labels, the reason a crash could not be keyed: all of these+are strings the model produces. A view that composes its own sentence about, say,+how dedup treats unkeyed crashes can contradict dedup while every test stays+green. The rule is that a view places words, it does not choose them.++The same rule caught a subtler bug. The instances panel said "N running", but+`afl-fuzz` leaves `fuzzer_stats` on disk after it exits, so instance count can+never be a liveness signal. Only the campaign's own phase is.++## Data Models++```rust+struct Campaign { target: String, status: CampaignStatus }++struct Crash {+ campaign_id: CampaignId,+ input: Vec<u8>, // the exact bytes that crashed it+ sanitizer_report: String, // the durable artifact+ stack_hash: Option<String> // None means "refused to key", not "no bug"+}+```++`stack_hash` being `Option` is the whole refusal doctrine in one field.++The sqlite schema is deliberately small:++```sql+CREATE TABLE campaigns (id INTEGER PRIMARY KEY, target TEXT, status TEXT);+CREATE TABLE crashes (+ id INTEGER PRIMARY KEY,+ campaign_id INTEGER REFERENCES campaigns(id),+ input BLOB NOT NULL,+ sanitizer_report TEXT NOT NULL,+ stack_hash TEXT+);+```++There is no version column, no severity column, no bug table. Severity and+bucketing are computed from the report on read, so improving the classifier+improves every campaign already in the store.++## Security Architecture++lisdex handles unfixed vulnerabilities in other people's software. The threat+model is mostly about not leaking them.++| Asset | Exposure | Control |+|---|---|---|+| Crash inputs | Files under `findings/` | Local filesystem only |+| Sanitizer reports | The sqlite store | Local file |+| The web console | HTTP | Binds `127.0.0.1` by default; a non-loopback bind prints a warning naming what it exposes |+| Advisory drafts | Files you choose to write | Marked NOT DISCLOSABLE when the finding came from a synthetic benchmark |++The console page loads nothing from the network. No CDN, no font service, no+analytics. This is enforced by a test that asserts the only absolute URL in the+page is the SVG namespace string, which browsers never fetch.++### The synthetic-benchmark guard++lisdex validates itself against Magma, which works by injecting known bugs into+real libraries. A Magma crash is a *planted* bug, and reporting one to libpng+would be embarrassing at best. `provenance_of` detects the Magma canary frames+and stamps the advisory NOT DISCLOSABLE with no filing route.++## Performance Considerations++The bottleneck is never lisdex. It is `afl-fuzz` exec rate, and the two things+that wreck it:++- **A harness that shadows the driver's `main`.** Silently drops from ~240,000+ execs/sec to ~1,600. lisdex checks `target_mode` in `fuzzer_stats` and warns.+- **Not using persistent mode.** Forking per input costs more than the parse.++Everything lisdex does per-crash (re-run, parse, hash, classify) is cheap+relative to a campaign, and the read-model rebuilds the whole snapshot on each+1 Hz refresh without noticeable cost.++## Deployment++lisdex is a single binary. It shells out to `afl-fuzz`, `afl-cmin`, `afl-tmin`+and the AFL++ compilers; it does not link them. That matters legally as well as+technically: AFL++ is AGPL-3.0-or-later, lisdex is AGPL-3.0, and lisdex installs+AFL++ upstream and unmodified rather than vendoring a fork.++The Docker setup is for development and for the Magma validation rig. Users get+the binary.++## Limitations++- **C and C++ only.** The entry-point discovery is libclang.+- **File-format and codec parsers.** The ranking heuristics look for+ `(bytes, length)` shapes and callback-registration patterns. A network+ protocol parser with a socket-shaped entry point ranks poorly.+- **Auto-build is the hard wall.** Building arbitrary C projects under sanitizers+ succeeds well under half the time in the published measurements, and lisdex is+ not magic. When the ladder fails it says so rather than producing a broken+ archive.+- **Harness synthesis will not invent a producer.** Roughly 58% of refusals are+ entry points needing an opaque context object that has to be built by another+ call. lisdex refuses rather than emitting a harness that fuzzes handle+ plumbing.++## Comparison++| | lisdex | OSS-Fuzz | OSS-Fuzz-Gen | OGHarn |+|---|---|---|---|---|+| Needs an existing harness | no | yes | no | no |+| Needs an API key / account | no | n/a | yes (LLM) | no |+| Runs locally | yes | no | partly | yes |+| Struct-based entry points | yes | n/a | varies | authors declare unsupported |+| Ships triage + advisory | yes | separate | no | no |++The honest framing: OGHarn's authors name libPNG, libVPX and libAOM as+unsupported because of their struct-based entry points. That is the niche lisdex+is built for, and it is a checkable claim rather than a marketing one.diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/learn/03-IMPLEMENTATION.md b/PROJECTS/advanced/zero-day-vulnerability-scanner/learn/03-IMPLEMENTATION.mdnew file mode 100644index 00000000..d5a17b27--- /dev/null+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/learn/03-IMPLEMENTATION.md@@ -0,0 +1,418 @@+# Implementation++This walks the pipeline in the order a campaign actually runs it. Code is quoted+by function and file, never by line number, because line numbers rot.++## File Structure++```+crates/lisdex-surface/+ headers.rs which files are headers worth parsing+ extract.rs libclang: declarations out of a translation unit+ signature.rs does this parameter list look like (bytes, length)?+ complexity.rs how much work is behind this entry point+ rank.rs the scoring function+ ladder.rs ordering entry points into a call sequence+ surface.rs analyze(), the thing the CLI calls++crates/lisdex-harness/+ search.rs try candidates, keep survivors+ synth.rs build a harness body from a signature+ emit.rs write the .c file+ compile.rs build and link it against the instrumented archive+ oracle.rs the four judgements+ verify.rs Verdict, Corpus, Toolchain, Bench++crates/lisdex-fuzz/+ runner.rs afl-fuzz invocation, instances, harvest, reproduce+ dictionary.rs pick dictionaries from seed magic bytes+ plot.rs parse plot_data+ stats.rs parse fuzzer_stats+ corpus.rs afl-cmin+ minimize.rs afl-tmin+```++## Stage 1: Finding the Entry Points++### Why libclang and not tree-sitter++The original design called for a tree-sitter pre-filter with libclang behind it.+That was measured and abandoned. On real `png.h`, tree-sitter-c returns **719+ERROR nodes and 0 functions**, where libclang returns **256 functions with 0+diagnostics**. The pre-filter deleted 24.3% of all true entry points across the+corpus, and 100% of libpng's.++libclang was also 1.9 to 3.4 times *faster* on real parser headers, and used+75 MB rather than 380 MB. The two-phase design was slower, heavier, and wrong.++### The trap that halves your results silently++Parsing a translation unit without a compilation database still returns `Ok`. It+just resolves fewer types, so fewer parameters look like buffers. Buffer+detection drops by about half and nothing tells you.++`SurfaceOptions::parse_options` builds the arguments, and `analyze` gates on+diagnostics severity rather than on the absence of an error:++```rust+// a translation unit that produced Error or Fatal diagnostics is not+// trustworthy, even though libclang happily returned a cursor for it+```++Another libclang trap: `is_in_main_file()` returns **0 of 256** functions on+macro-heavy headers, because the declarations arrive through includes. Never+filter on it.++### What counts as an entry point++`signature.rs` looks for the shapes that eat untrusted bytes:++```c+int decode(const unsigned char *data, size_t len); /* DirectBuffer */+int decode(const char *buf, int n); /* DirectBuffer */+```++The buffer-and-length pair is the easy case. The hard case is the one that+matters for real libraries:++```c+void png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,+ png_rw_ptr read_data_fn); /* callback-driven */+```++`png_read_info`, `TIFFClientOpen`, and `opj_read_header` all rank #1 for their+libraries and **none of them is visible to buffer-and-length matching**. They+take a context and a callback. A detector without a callback-registration rule+misses the most important entry point in three of the five reference libraries,+which is why `signature.rs` has one.++### Ranking++`rank::rank` scores each candidate. The signals:++- **Signature shape.** A direct buffer outranks a callback, which outranks+ anything needing an opaque context.+- **Complexity behind it.** `complexity::complexity_score` estimates how much+ code the entry point reaches. A deep parser is a better target than a getter.+- **Argument simplicity.** `complexity::arg_simplicity` penalizes every extra+ context argument the harness would have to construct.+- **Novelty.** A static signal standing in for "has this been fuzzed before",+ because runtime coverage is not available at cold start.++The output is what `lisdex surface` prints:++```+ 1. png_read 0.4350 DirectBuffer undiscovered=0 accumulated=0+ 2. png_decode 0.4090 DirectBuffer undiscovered=0 accumulated=0+```++## Stage 2: Synthesizing a Harness++`synth.rs` builds a harness body from the signature; `emit.rs` writes it. The+generated file is a libFuzzer-style entry point so it can link against+`libAFLDriver.a`:++```c+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {+ if (size < 1) return 0;+ png_read(data, size);+ return 0;+}+```++That is the easy case. The interesting part is what happens when the harness is+wrong, which is most of the time.++### The four oracles++A harness that compiles is not a harness that works. `oracle.rs` runs four+independent judgements, and a candidate has to survive all of them.++**1. Execution.** `judge_execution` rejects a harness that crashes on valid+input, hangs, or exits non-zero. If your harness segfaults on a good PNG, every+crash the campaign finds is your bug, not libpng's.++**2. Stderr.** `judge_stderr` rejects a harness whose output shows it rejected+the input outright. A harness that prints "unsupported format" for every seed is+reading the bytes and throwing them away.++**3. Inter-seed divergence.** `judge_inter_seed_divergence` requires different+seeds to produce *different* coverage. This is the one that catches the most+common failure: a harness that reads none of its input.++```+seed A -> 1,204 edges+seed B -> 1,204 edges identical coverage across different inputs+seed C -> 1,204 edges => the harness is not reading the bytes+```++**4. Novelty.** The candidate has to reach edges an empty harness does not, so a+harness that only exercises setup and teardown is culled.++### Why refusal is the right default++Measured across the reference corpus, **58% of refusals are entry points that+need an opaque context object** built by some other call. lisdex does not guess+at one. A harness that constructs a half-initialized `png_struct` and fuzzes it+will find bugs in lisdex's initialization, not in libpng.++`Rejection` names the reason, and `lisdex harness` prints it, so a refusal is+actionable rather than a shrug.++## Stage 3: Building Under Sanitizers++This is the hard wall. Published measurements put automated builds of arbitrary+C/C++ projects under sanitizers well below 50% success, and the honest baseline+without an LLM scores about the same as Google's LLM agent.++`lisdex-build/ladder.rs` tries build systems in order and injects flags into+each. The injection points are not obvious, and getting them wrong fails+silently.++### The flag injection that survives++The documented "most reliable method", `CMAKE_<LANG>_FLAGS_INIT` in a toolchain+file, **does not survive a project's own `set(CMAKE_C_FLAGS ...)`**. Reproduced+on CMake 4.4.0. The injection that does survive:++```+-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=<file with add_compile_options()>+```++### Two-pass builds need a clean between them++GNU Make decides what to rebuild by mtime alone. A two-pass+uninstrumented-then-instrumented build in the same directory silently reuses the+uninstrumented objects, and you get an archive with no coverage instrumentation+that builds and links perfectly.++`make clean` between passes is mandatory. It is also safe: only+`maintainer-clean` erases bison and flex output.++### AFL_NOOPT++`AFL_NOOPT=1` must be set for the *configure* step and unset for the *build*+step. Configure scripts compile tiny probe programs, and AFL++'s instrumentation+makes some of them fail, so configure concludes the feature is missing.++## Stage 4: Fuzzing++`runner::AflOptions::invocation` builds the command line. The pieces that matter:++```+afl-fuzz -i <seeds> -o <findings> -m none+ -V <duration>+ -c <cmplog binary> # solves magic bytes and checksums+ -x <dict> ... (max 4) # format-aware tokens+ -M main | -S secondary1 -p fast+ -- <target>+```++### Dictionaries, capped at four++`dictionary::select` reads the magic bytes of the seed corpus, matches them to+AFL++'s shipped dictionaries, and passes up to `MAX_DICTIONARIES` of them.++The cap is four because **`afl-fuzz` fatals on a fifth `-x`**. It is a property+of the binary, so lisdex caps and warns rather than letting the campaign die at+startup.++A related gotcha for anyone reading AFL++'s docs: `-P` is the mutation strategy+and `-p` is the power schedule. They share value names and the upstream docs use+both within four lines of each other.++### Parallel instances++`runner::instance_plan` builds one main and N-1 secondaries, each secondary on a+different power schedule (`fast`, `coe`, `lin`, `quad`, `exploit`, `rare`).+Secondaries sync through the main instance, which is why coverage combines with+`max` and not `+`.++### Harvesting crashes++`runner::discover_crash_inputs` walks **every** instance directory, not just+`default/`. `runner::harvest` re-runs each crashing input under the sanitizer to+get a fresh report:++```rust+pub fn reproduce(target: &Path, input: &Path, timeout: Duration)+ -> Result<Reproduction, RunnerError>+```++It captures stderr with a timeout and a byte cap. Both matter: a target that+hangs would block the harvest forever, and a target in a report loop can emit+hundreds of megabytes.++## Stage 5: Deduplication++`SanitizerReport::stack_hash` is the whole thing:++```rust+pub fn significant_frames(&self) -> Vec<&str> // noise dropped+pub fn stack_hash(&self) -> Option<String> // None if nothing survives+```++Two filters run:++```rust+const NOISE_FRAME_PREFIXES: [&str; 7] =+ ["__asan", "__ubsan", "__msan", "__sanitizer", "__interceptor", "__libc", "_start"];++const NOISE_FRAME_EXACT: [&str; 7] =+ ["kill", "abort", "raise", "main", "LLVMFuzzerRunDriver",+ "ExecuteFilesOnyByOne", "magma_log"];+```++Then the top frames are hashed. If **no symbolized frame survives**, the function+returns `None` and the crash is never bucketed.++`dedup::group_crashes` does the grouping, and its contract is worth stating+plainly:++```rust+match crash.stack_hash() {+ Some(key) => by_key.entry(key).or_default().push(crash),+ None => unkeyed.push(crash), // never merged with each other+}+```++Groups are sorted by size, then by key, so the output is deterministic.++## Stage 6: Classification++`classify::classify` runs CASR first and applies lisdex's own rules where CASR is+silent:++```rust+pub fn classify(text: &str) -> Option<Classification> {+ let parsed = SanitizerReport::parse(text)?;+ let fault_address = FaultAddress::of(parsed.fault_address());+ if parsed.is_undefined_behavior() { /* UBSan: lisdex decides */ }+ let anchored = report::anchored_lines(text)?;+ let context = AsanContext(...);+ let class = context.severity().ok()?; // CASR+ ...+}+```++Two things are worth knowing.++**CASR does not triage UBSan.** UndefinedBehaviorSanitizer reports get lisdex's+own verdict, `Severity::Undefined`, because feeding them to an ASAN classifier+produces nonsense.++**Double free is upgraded.** CASR's own verdict for `double-free` is lower than+the exploitation literature supports, so `DOUBLE_FREE_SEVERITY` overrides it to+`ProbablyExploitable` and the classification records `DecidedBy::Lisdex` so the+override is visible rather than hidden.++`FaultAddress::of` handles the null-versus-wild distinction, and+`is_security_relevant` is what makes a null dereference render as+"(non-security)" in the panels.++## Stage 7: The Advisory++`Advisory::draft` builds from a group's representative crash:++```rust+pub fn draft(target: &str, representative: &Crash, crash_count: usize)+ -> Option<Advisory>+```++It returns `None` when the crash cannot support an advisory, which is the same+refusal discipline as everywhere else.++`weakness.rs` maps the bug class to a CWE. `markdown.rs` and `json.rs` render the+OpenSSF template. `bundle.rs` writes a directory per bug:++```+bundles/2167ce84a15d/+ advisory.md human form+ advisory.json machine form+ poc.bin the exact crashing bytes+ report.txt the sanitizer output+ reproduce.sh executable, takes the target as $1+```++The exit gate for this stage **executes the emitted `reproduce.sh`** and requires+the same fault to come back. A reproducer that does not reproduce is worse than+no reproducer.++### The provenance guard++`provenance_of` inspects the frames for Magma's canary functions. A crash from an+instrumented benchmark is stamped `NOT DISCLOSABLE` and carries no filing route,+because reporting a planted bug to a maintainer wastes their time.++## Stage 8: The Read-Model++`Snapshot::read` collapses everything into one immutable value:++```rust+pub fn read(source: &Source) -> Result<Snapshot, MonitorError>+```++The design rule is that a missing artifact is a *notice*, not an error. A+campaign that has not written its first `plot_data` sample yet still renders:++```rust+let Ok(curve) = runner::read_curve(findings) else {+ notices.push(Notice::NoCurveRecorded);+ return (Vec::new(), None);+};+```++Only an unusable source is a hard error, and there is exactly one:+`CampaignNotFound`, raised when you name a campaign id the store does not hold.+Silently falling back to a different campaign would show you numbers from a run+you did not ask about.++## Error Handling++Every crate has one `thiserror` enum and no `unwrap` in library code. The pattern+that recurs:++```rust+#[derive(Debug, thiserror::Error)]+pub enum RunnerError {+ #[error("io error: {0}")]+ Io(#[from] std::io::Error),+ #[error("{AFL_FUZZ_BIN} failed before writing stats ({status}); \+ check the {AFL_FUZZ_BIN} output above")]+ AflFailed { status: String },+ #[error("asked to resume but {findings} holds no previous instance; \+ drop --resume to start a new campaign there")]+ NothingToResume { findings: String },+}+```++Error text says what to do next, not just what went wrong.++## Testing Strategy++The suite is about a thousand tests, and the ones that earn their keep share a+shape: they assert a property against a **real captured artifact**, and their+failure message says what breaks in the product.++```rust+assert_eq!(+ totals.edges_found, 13_647,+ "instances share one coverage map and sync; summing edges_found would \+ report 26647 edges the campaign never had"+);+```++Fixtures are real: a 600-second libpng `plot_data` with 107 rows, and 19+sanitizer captures taken from actual crashes. The unsymbolized ones are kept+deliberately, because they are the corpus that proves the refusal works.++Above the unit tests are exit gates, one per milestone, each running a real+campaign against a Magma-instrumented libpng and checking the result against+canary ground truth. The gates are shell scripts so they can assert on the+shipped binary rather than on library internals.++A gate is only trusted after it has been **gutted**: break the thing it checks+and confirm it goes red. Three consecutive gates in this project went red on+their first run because the *check* was wrong, not the product, and one control+passed while gutted because the only tell was that it ran in 5.01 seconds+instead of 0.10.diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/learn/04-CHALLENGES.md b/PROJECTS/advanced/zero-day-vulnerability-scanner/learn/04-CHALLENGES.mdnew file mode 100644index 00000000..0124be51--- /dev/null+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/learn/04-CHALLENGES.md@@ -0,0 +1,164 @@+# Challenges and Extensions++Ordered roughly by effort. Each one is a real gap, not a made-up exercise, and+several are things lisdex deliberately does not do.++## Warm-up++### 1. Add a format to the dictionary selector++`dictionary::select` matches seed magic bytes to AFL++'s shipped dictionaries.+Add one it does not know: WebP (`RIFF....WEBP`), or AVIF, or a format your target+uses.++The interesting part is the cap. `afl-fuzz` fatals on a fifth `-x`, so if a+corpus contains five recognized formats something must be dropped. What is the+right thing to drop? Frequency in the corpus, or the format with the largest+dictionary, or the one whose magic appears in the most seeds?++### 2. Teach the classifier a new sanitizer++lisdex handles ASAN and UBSan. Add LeakSanitizer, or MemorySanitizer.++Before you write the parser, run the sanitizer and capture real output. The+research for this project prescribed six ASAN regexes; when they were finally+executed against real reports, **three matched nothing** and a fourth reported+the column number as the line number. Write the test against a capture, not+against the documentation.++### 3. Make the console show the crash input++The dashboard serves the sanitizer report but not the reproducer bytes. Add a+hexdump panel.++Watch the layering: the bytes live on `Crash`, and the wire DTO in+`lisdex-dashboard/wire.rs` is built from `Snapshot`. If you find yourself adding+`lisdex-core` to the dashboard's dependencies, stop and put it on the model+instead.++## Real work++### 4. A second target library, end to end++Take lisdex through a library it has never seen. libjpeg-turbo, libwebp,+libarchive, or DjVuLibre.++Expect to fail at the build ladder. That is the honest state of automated+building. When it fails, the useful question is *which* injection point the+project defeated, and whether the fix generalizes or is a one-off.++Success criterion: a harness that survives all four oracles, and a campaign+whose coverage curve climbs for at least an hour.++### 5. Make the null-dereference rule match Chromium's++Chromium's rule for whether a null dereference is security relevant has two+halves. lisdex implements the address-range half: a fault near zero is a null+dereference, not a wild pointer.++The other half is *consistency*: a null dereference that reproduces identically+across runs is a plain bug, while one whose fault address moves between runs+suggests something is being computed from uninitialized memory, which is a+different and more interesting problem.++Implementing this means running each crash more than once and comparing. Think+about what that costs on a pile of 200 crashes, and whether the answer changes+any advisory.++### 6. Target-level provenance++The Magma guard reads the crash stack for canary frames. That works, but the real+property is of the **target tree**: a build that was patched with bug canaries is+a benchmark build, whatever any individual stack looks like.++Move the signal to where it belongs. The `campaigns` table would need a column,+and `lisdex build` would need to record that it applied benchmark patches. Then+a campaign against an instrumented target is non-disclosable even for a crash+whose stack happens to contain no canary frame.++### 7. Statistical rigor for comparisons++If you change the ranking function, or the dictionary policy, or the power+schedule, how do you know it helped?++Klees et al. (CCS 2018) is the standard answer and most fuzzing work still+ignores it: 30 trials, a Mann-Whitney U test, and a stated effect size. One run+of each is not evidence, because fuzzing variance across seeds is enormous.++Build this as a subcommand. `lisdex bench --trials 30 --arm A --arm B` that runs+the campaigns, collects the curves, and reports a p-value and an effect size.+Then use it on your own changes and be prepared for most of them to show nothing.++## Research-scale++### 8. Synthesize a producer for opaque contexts++This is the biggest single win available.++58% of harness refusals are entry points that need an opaque context object+built by another call. `png_read_info` needs a `png_structp` from+`png_create_read_struct`. lisdex refuses rather than guessing.++Nine of the ten most common blockers **already have a producer in headers lisdex+already parses**. The information is there. What is missing is the machinery to+find "which function returns the type this parameter needs", order the calls, and+thread the results through.++Note what this is not: it is not a search problem, it is a plumbing problem.+Treating it as a search over random call sequences is what the prior art does,+and it is why the prior art loses to deterministic approaches on this class of+target.++### 9. Structure-aware mutation++Dictionaries and cmplog get you past magic bytes and checksums. They do not get+you past a format where a length field must agree with the actual chunk size,+because a random mutation breaks the agreement and the parser rejects the file+before reaching anything interesting.++The general solution is a grammar or a custom mutator that understands+"chunk = length ++ type ++ data ++ crc" and mutates the data while fixing up the+length and the CRC. AFL++ supports custom mutators.++The measurable question: does a PNG-aware mutator reach deeper into+`pngrutil.c` than cmplog alone, and by how much? Use the answer from challenge 7+to find out honestly.++### 10. An honest coverage-over-time comparison against OSS-Fuzz++lisdex's positioning claim is that it works on struct-based entry points that+other harness generators decline. OGHarn's authors name libPNG, libVPX and+libAOM as unsupported for exactly that reason.++Test the claim. Take a library that OSS-Fuzz *does* cover, run lisdex against it,+and compare coverage after a fixed budget against the OSS-Fuzz harness. Expect to+lose, because the OSS-Fuzz harness was hand-written by someone who knows the+library. The useful result is *by how much*, and whether the gap is in the+harness or in the campaign.++## What Not To Build++Two things that look like obvious improvements and are not.++**A separate MSAN campaign path.** AFL++ ships SAND (`-w` plus+`AFL_LLVM_ONLY_FSRV`), which routes only interesting inputs to sanitizer-only+forkservers. It is a pre-filter that trades recall for throughput, and the only+miss rate its authors publish for the cheap abstraction is about 15%. lisdex's+bottleneck is not throughput, and multiplying builds makes the auto-build wall+worse. Fuzzing an MSAN build is already just+`lisdex fuzz --target <msan build>`.++**Filling in the advisory fields lisdex refuses.** Version ranges, CVSS, and+attacker reachability are left null on purpose. They are required *keys*, typed+string-or-null, and both CVE and GHSA accept an unknown. An incomplete record is+recoverable; a record with an invented affected-version range sends maintainers+and downstream consumers chasing something that was never measured.++## If You Only Do One++Do challenge 4. Take lisdex at a library it has never seen and get to a working+harness.++Everything else in this document is an improvement to a pipeline you understand.+That one teaches you where the pipeline actually breaks, which is not where the+architecture diagram suggests.diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/ollama.compose.yml b/PROJECTS/advanced/zero-day-vulnerability-scanner/ollama.compose.ymlnew file mode 100644index 00000000..0edfbfae--- /dev/null+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/ollama.compose.yml@@ -0,0 +1,29 @@+# ©AngelaMos | 2026+# ollama.compose.yml+#+# The OPTIONAL local model booster. lisdex does its whole job without this:+# every command works keyless, and the booster only ever proposes an answer+# that lisdex's own oracles then accept or refuse.+#+# The host port is deliberately NOT 11434. That is Ollama's default, which is+# the one port most likely to be held already by an Ollama you are running+# yourself. The container keeps 11434 internally; only the host side moves.++name: lisdex-ollama++services:+ ollama:+ image: ollama/ollama:latest+ container_name: lisdex-ollama+ init: true+ restart: unless-stopped+ ports:+ - "127.0.0.1:${LISDEX_OLLAMA_PORT:-49327}:11434"+ volumes:+ - ollama-models:/root/.ollama+ environment:+ OLLAMA_KEEP_ALIVE: "30m"+ OLLAMA_MAX_LOADED_MODELS: "1"++volumes:+ ollama-models:diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/scripts/m10-gate.sh b/PROJECTS/advanced/zero-day-vulnerability-scanner/scripts/m10-gate.shnew file mode 100755index 00000000..5408ecf4--- /dev/null+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/scripts/m10-gate.sh@@ -0,0 +1,254 @@+#!/usr/bin/env bash+# ©AngelaMos | 2026+# m10-gate.sh++set -euo pipefail++WORK="${MAGMA_WORK:-/opt/magma-work}"+OUT_ROOT="$WORK/out/libpng"+SEEDS="$WORK/libpng/corpus/libpng_read_fuzzer"+GATE="$WORK/m10"+FINDINGS="$GATE/findings"+DB="$GATE/lisdex.sqlite"+EMPTY="$GATE/empty"+SANDBOX="$GATE/sandbox"+GATE_LOG="$GATE/stage.log"+CAMPAIGN_LOG="$GATE/campaign.log"+SERVE_LOG="$GATE/serve.log"+INSTALL_LOG="$GATE/install.log"+LISDEX_BIN="${CARGO_TARGET_DIR:-/cargo-target}/debug/lisdex"+TARGET="$OUT_ROOT/afl/lisdex_libpng_read"+CMPLOG="$OUT_ROOT/cmplog/lisdex_libpng_read"+GATE_DURATION="${LISDEX_M10_DURATION:-180}"+GATE_PORT="${LISDEX_M10_PORT:-47231}"++DASH_MANIFEST="crates/lisdex-dashboard/Cargo.toml"+DASH_SRC="crates/lisdex-dashboard/src"+LEARN="learn"+LEARN_DOCS=(00-OVERVIEW.md 01-CONCEPTS.md 02-ARCHITECTURE.md 03-IMPLEMENTATION.md 04-CHALLENGES.md)++ANALYSIS_SYMBOLS=("classify" "group_crashes" "SanitizerReport" "plot::parse" "stack_hash" "libcasr" "rusqlite")++FAILURES=0+SERVE_PID=""++log() { printf '\n[m10] %s\n' "$1"; }+die() { printf '\n[m10] FAIL: %s\n' "$1" >&2; exit 1; }+pass() { printf ' PASS %s\n' "$1"; }+fail() { printf ' FAIL %s\n' "$1"; FAILURES=$((FAILURES + 1)); }++stop_server() { [ -n "$SERVE_PID" ] && kill "$SERVE_PID" 2>/dev/null; return 0; }+trap stop_server EXIT++if [ "${1:-}" = "reset" ]; then+ log "resetting $GATE"+ rm -rf "$GATE"+fi++[ -x "$TARGET" ] || die "magma libpng not built; run: just magma-libpng"+[ -f "$DASH_MANIFEST" ] || die "run this from the project root; $DASH_MANIFEST not found"++mkdir -p "$GATE" "$EMPTY"++log "stage 1/8: build lisdex"+cargo build -p lisdex+[ -x "$LISDEX_BIN" ] || die "lisdex binary not found at $LISDEX_BIN"++log "stage 2/8: the console is a view, exactly like the panel"+LINKED="$(awk '/^\[dependencies\]/{on=1;next} /^\[/{on=0} on' "$DASH_MANIFEST" \+ | grep -oE '^lisdex-[a-z]+' | sort -u | tr '\n' ' ' | sed 's/ $//')"+if [ "$LINKED" = "lisdex-monitor" ]; then+ pass "lisdex-dashboard links exactly one lisdex crate: $LINKED"+else+ fail "lisdex-dashboard links [$LINKED]; a pure view must link only lisdex-monitor"+fi+CONSOLE_HITS=0+for symbol in "${ANALYSIS_SYMBOLS[@]}"; do+ HITS="$(grep -rF -- "$symbol" "$DASH_SRC" | grep -c . || true)"+ [ "$HITS" -ne 0 ] && CONSOLE_HITS=$((CONSOLE_HITS + 1))+done+if [ "$CONSOLE_HITS" -eq 0 ]; then+ pass "the console's source names no analysis symbol"+else+ fail "the console mentions $CONSOLE_HITS analysis symbol(s); analysis belongs in the model"+fi++log "stage 3/8: the console answers for itself"+if cargo test -p lisdex-dashboard > "$GATE_LOG" 2>&1; then+ TESTS="$(grep -oE 'test result: ok\. [0-9]+' "$GATE_LOG" | grep -oE '[0-9]+' | paste -sd+ | bc)"+ pass "lisdex-dashboard: $TESTS tests"+else+ fail "lisdex-dashboard tests (see $GATE_LOG)"+fi++log "stage 4/8: a real campaign for the console to serve (${GATE_DURATION}s)"+if [ ! -f "$DB" ]; then+ rm -rf "$FINDINGS"+ "$LISDEX_BIN" fuzz --target "$TARGET" --cmplog "$CMPLOG" --seeds "$SEEDS" \+ --findings "$FINDINGS" --db "$DB" --duration "$GATE_DURATION" \+ > "$CAMPAIGN_LOG" 2>&1 || die "campaign failed (see $CAMPAIGN_LOG)"+else+ log "reusing the campaign already at $DB"+fi++log "stage 5/8: lisdex serve is live and answers over HTTP"+"$LISDEX_BIN" serve --db "$DB" --findings "$FINDINGS" \+ --host 127.0.0.1 --port "$GATE_PORT" > "$SERVE_LOG" 2>&1 &+SERVE_PID=$!++WAITED=0+until curl -fsS -o /dev/null "http://127.0.0.1:${GATE_PORT}/" 2>/dev/null; do+ sleep 1+ WAITED=$((WAITED + 1))+ [ "$WAITED" -gt 30 ] && die "console never came up (see $SERVE_LOG)"+done+pass "the console answered on 127.0.0.1:${GATE_PORT} after ${WAITED}s"++PAGE="$GATE/console.html"+curl -fsS "http://127.0.0.1:${GATE_PORT}/" -o "$PAGE"+if grep -q '<title>lisdex console</title>' "$PAGE"; then+ pass "it serves the console page"+else+ fail "the page served is not the console"+fi+if grep -qE 'src="http|src="//|href="http|href="//|@import' "$PAGE"; then+ fail "the console page loads an asset off this machine"+else+ pass "the console page loads nothing from the network"+fi++SNAP="$GATE/snapshot.json"+curl -fsS "http://127.0.0.1:${GATE_PORT}/api/snapshot" -o "$SNAP"+if python3 -c "import json,sys; json.load(open('$SNAP'))" 2>/dev/null; then+ pass "the snapshot endpoint answers with valid JSON"+else+ fail "the snapshot endpoint did not answer with valid JSON"+fi++log "stage 6/8: the console agrees with the tools it is a view over"+CLI_CRASHES="$("$LISDEX_BIN" crashes --db "$DB" --campaign 1 | grep -c 'stack_hash' || true)"+CLI_BUGS="$("$LISDEX_BIN" crashes --db "$DB" --campaign 1 \+ | grep -oE 'stack_hash [0-9a-f]+' | sort -u | grep -c . || true)"+CLI_PEAK="$("$LISDEX_BIN" coverage --findings "$FINDINGS" | awk '/curve_peak_edges/ {print $2}')"++read -r WEB_CRASHES WEB_BUGS WEB_PEAK WEB_TARGET <<EOF+$(python3 -c "+import json+d = json.load(open('$SNAP'))+s = d['summary']+print(s['total_crashes'], s['distinct_bugs'], s['peak_edges'], d['campaign']['target'])+")+EOF++if [ "$CLI_CRASHES" -gt 0 ]; then+ pass "the campaign persisted $CLI_CRASHES crash(es), so the comparison is not vacuous"+else+ fail "no crash was persisted; the comparison below proves nothing"+fi+[ "$WEB_CRASHES" = "$CLI_CRASHES" ] \+ && pass "crash count agrees with 'lisdex crashes': $WEB_CRASHES" \+ || fail "console shows $WEB_CRASHES crashes, 'lisdex crashes' reports $CLI_CRASHES"+[ "$WEB_BUGS" = "$CLI_BUGS" ] \+ && pass "distinct-bug count agrees with 'lisdex crashes': $WEB_BUGS" \+ || fail "console shows $WEB_BUGS bugs, 'lisdex crashes' reports $CLI_BUGS"+[ "$WEB_PEAK" = "$CLI_PEAK" ] \+ && pass "peak edges agrees with 'lisdex coverage': $WEB_PEAK" \+ || fail "console shows $WEB_PEAK peak edges, 'lisdex coverage' reports $CLI_PEAK"++EMPTY_SNAP="$GATE/empty.json"+"$LISDEX_BIN" serve --db "$EMPTY/none.sqlite" --findings "$EMPTY" \+ --host 127.0.0.1 --port "$((GATE_PORT + 1))" > /dev/null 2>&1 &+EMPTY_PID=$!+sleep 2+curl -fsS "http://127.0.0.1:$((GATE_PORT + 1))/api/snapshot" -o "$EMPTY_SNAP" 2>/dev/null || true+kill "$EMPTY_PID" 2>/dev/null || true+if [ -s "$EMPTY_SNAP" ] && ! grep -q "$WEB_TARGET" "$EMPTY_SNAP"; then+ pass "an empty console names no target, so the live one really read from disk"+else+ fail "the empty console served the numbers of a real campaign, or did not answer"+fi++stop_server+SERVE_PID=""++log "stage 7/8: install.sh takes a clean prefix to a runnable lisdex"+rm -rf "$SANDBOX"+mkdir -p "$SANDBOX"+if HOME="$SANDBOX" LISDEX_INSTALL_DIR="$SANDBOX/bin" \+ CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-/cargo-target}-rel" \+ bash install.sh --skip-afl > "$INSTALL_LOG" 2>&1; then+ pass "install.sh completed"+else+ fail "install.sh failed (see $INSTALL_LOG)"+fi++if [ -x "$SANDBOX/bin/lisdex" ]; then+ pass "a binary landed in the prefix"+else+ fail "no binary at $SANDBOX/bin/lisdex"+fi++INSTALLED_VERSION="$(PATH="$SANDBOX/bin:$PATH" lisdex --version 2>/dev/null || true)"+if [ -n "$INSTALLED_VERSION" ]; then+ pass "it runs by its bare name: $INSTALLED_VERSION"+else+ fail "the installed binary does not run by its bare name"+fi+if echo "$INSTALLED_VERSION" | grep -qE '0\.0\.0'; then+ fail "the shipped binary reports version 0.0.0"+else+ pass "it reports a real version"+fi+if grep -qE '^export PATH=' "$SANDBOX/.bash_profile" 2>/dev/null \+ || grep -qE '^export PATH=' "$SANDBOX/.bashrc" 2>/dev/null; then+ pass "install.sh wired the prefix onto PATH"+else+ fail "install.sh did not wire PATH, so a fresh shell would not find lisdex"+fi+if bash uninstall.sh --prefix "$SANDBOX/bin" > /dev/null 2>&1 && [ ! -e "$SANDBOX/bin/lisdex" ]; then+ pass "uninstall.sh removes what install.sh placed"+else+ fail "uninstall.sh did not remove the binary"+fi++log "stage 8/8: the public docs are complete and their links resolve"+for doc in "${LEARN_DOCS[@]}"; do+ if [ -s "$LEARN/$doc" ]; then+ pass "learn/$doc"+ else+ fail "learn/$doc is missing or empty"+ fi+done+[ -s README.md ] && pass "README.md" || fail "README.md is missing or empty"++BROKEN=""+while IFS= read -r link; do+ case "$link" in+ http*|\#*) continue ;;+ esac+ [ -e "$link" ] || BROKEN="$BROKEN $link"+done < <(grep -ohE '\]\([^)#]+\)' README.md "$LEARN"/*.md | sed -E 's/^\]\(//; s/\)$//' | sort -u)+if [ -z "$BROKEN" ]; then+ pass "every relative link in README.md and learn/ resolves"+else+ fail "broken relative link(s):$BROKEN"+fi++if grep -rqE 'lisdex surface --source' README.md "$LEARN"/*.md install.sh; then+ fail "the docs show 'surface --source', which is not the flag the CLI takes"+else+ pass "the documented commands match the CLI's own usage"+fi++log "RESULT"+if [ "$FAILURES" -eq 0 ]; then+ printf '\n[m10] M10 EXIT GATE PASSED\n'+ printf ' CHECK 1 the web console is a view over the model, like the panel\n'+ printf ' CHECK 2 lisdex serve answers over HTTP and loads nothing off this machine\n'+ printf ' CHECK 3 its counts equal what lisdex crashes and lisdex coverage report\n'+ printf ' CHECK 4 install.sh yields a lisdex that runs by its bare name, and uninstalls\n'+ printf ' CHECK 5 learn/ 00-04 and the README are complete and their links resolve\n'+ exit 0+fi+printf '\n[m10] M10 EXIT GATE FAILED: %s check(s)\n' "$FAILURES" >&2+exit 1diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/uninstall.sh b/PROJECTS/advanced/zero-day-vulnerability-scanner/uninstall.shnew file mode 100755index 00000000..c147ab46--- /dev/null+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/uninstall.sh@@ -0,0 +1,109 @@+#!/usr/bin/env bash+# ©AngelaMos | 2026+# uninstall.sh++set -euo pipefail++BINARY="lisdex"+INSTALL_DIR="${LISDEX_INSTALL_DIR:-$HOME/.local/bin}"+KEEP_AFL=1++if [ -t 2 ] && [ -z "${NO_COLOR:-}" ]; then+ BOLD=$'\033[1m'; DIM=$'\033[2m'; RED=$'\033[31m'; GREEN=$'\033[32m'+ YELLOW=$'\033[33m'; CYAN=$'\033[36m'; RESET=$'\033[0m'+else+ BOLD=""; DIM=""; RED=""; GREEN=""; YELLOW=""; CYAN=""; RESET=""+fi++info() { printf '%s\n' " ${CYAN}+${RESET} $*" >&2; }+ok() { printf '%s\n' " ${GREEN}+${RESET} $*" >&2; }+warn() { printf '%s\n' " ${YELLOW}!${RESET} $*" >&2; }+die() { printf '%s\n' " ${RED}x $*${RESET}" >&2; exit 1; }+header(){ printf '\n%s\n\n' "${BOLD}${CYAN}--- $* ---${RESET}" >&2; }+have() { command -v "$1" >/dev/null 2>&1; }++usage() {+ cat >&2 <<USAGE+uninstall.sh — remove ${BINARY}++ ./uninstall.sh [options]++options:+ --prefix DIR install dir to clean (default: ${INSTALL_DIR})+ -h, --help this help++AFL++ and libclang are left installed: other tools use them, and this script+will not remove a system package it did not certainly put there.+USAGE+}++while [ $# -gt 0 ]; do+ case "$1" in+ --prefix) INSTALL_DIR="$2"; shift 2 ;;+ --prefix=*) INSTALL_DIR="${1#*=}"; shift ;;+ -h|--help) usage; exit 0 ;;+ *) die "unknown option: $1 (try --help)" ;;+ esac+done++remove_binary() {+ if [ -f "${INSTALL_DIR}/${BINARY}" ]; then+ rm -f "${INSTALL_DIR}/${BINARY}"+ ok "removed ${INSTALL_DIR}/${BINARY}"+ else+ info "no binary at ${INSTALL_DIR}/${BINARY}"+ fi+ if have cargo && cargo install --list 2>/dev/null | grep -q "^${BINARY} "; then+ cargo uninstall "$BINARY" >/dev/null 2>&1 || true+ ok "removed the cargo-installed ${BINARY}"+ fi+}++remove_path_line() {+ local rc+ for rc in "$HOME/.zshrc" "$HOME/.bashrc" "$HOME/.bash_profile" "$HOME/.profile"; do+ [ -f "$rc" ] || continue+ if grep -q "$INSTALL_DIR" "$rc" 2>/dev/null; then+ local tmp+ tmp="$(mktemp)"+ grep -v "^export PATH=\"${INSTALL_DIR}:\$PATH\"$" "$rc" > "$tmp" || true+ if cmp -s "$rc" "$tmp"; then+ warn "$rc mentions $INSTALL_DIR but not as a line this installer wrote; left alone"+ else+ cat "$tmp" > "$rc"+ ok "removed the PATH line from $rc"+ fi+ rm -f "$tmp"+ fi+ done+ local fish="$HOME/.config/fish/conf.d/${BINARY}.fish"+ if [ -f "$fish" ]; then+ rm -f "$fish"+ ok "removed $fish"+ fi+}++remove_cache() {+ local cache="${XDG_CACHE_HOME:-$HOME/.cache}/${BINARY}"+ if [ -d "$cache" ]; then+ rm -rf "$cache"+ ok "removed the cached clone at $cache"+ fi+}++main() {+ header "Removing ${BINARY}"+ remove_binary+ remove_path_line+ remove_cache++ if [ "$KEEP_AFL" = "1" ] && have afl-fuzz; then+ info "AFL++ left installed at $(command -v afl-fuzz)"+ fi++ printf '\n%s\n' " ${GREEN}${BOLD}${BINARY} removed.${RESET}" >&2+ printf '%s\n\n' " ${DIM}campaign databases and findings directories were not touched${RESET}" >&2+ return 0+}++main "$@" </dev/null