code wiki / (root) / nx_pamp.nx

nx_pamp.nx

buildroot/runtime/nx_pamp.nx

9903 B263 linesdepth 2pulls 2 transitivereach 12 importersview sourcekind librarytopic pamp
docsdependenciesstructsconstsfunctions

about

nx_pamp.nx -- Pathogen-Associated Molecular Pattern recognition. Biology: PAMPs are conserved molecular signatures of pathogens (LPS on gram-negative bacteria, flagellin on motile bacteria, viral dsRNA) that TLRs and NOD-like receptors detect to mount the innate immune response. The patterns are recognizable because they're conserved -- pathogens can't change them without losing function. Software substrate: certain byte/structural patterns are similarly conserved across attack classes. Detecting them is cheap and high-signal. nx_pamp ships a sealed enum of pattern KINDS + a scanner over caller-supplied byte buffers. PAMP kinds shipped V1: - TROJAN_SOURCE_HOMOGLYPH -- Cyrillic-Latin homograph in code - ENTROPY_ANOMALY -- shellcode-class entropy spikes - BUILD_INJECTION_HINT -- known build-toolchain backdoor sig - KNOWN_BAD_EGRESS_HEADER -- C2 protocol leading bytes - MICROCODE_INJECT_HINT -- known microcode-patch markers - ROOTKIT_PERSIST_HINT -- known rootkit boot-hook bytes - SHELLCODE_NOPSLED -- 0x90 NOP sled detection - DECOY_INVALID_METHYL_HINT -- our own decoy markers (so we recognize OUR leak fingerprint if it appears upstream) THIS IS THE FIRST-LINE DETECTION. nx_pamp tells "is something suspicious here?". nx_crispr remembers signatures of confirmed threats. nx_restriction (queued) gates IO using both. nx_xenocell records the event into the forensic ledger. V1 ships a scanner over byte buffers with a hardcoded pattern DB. V2 makes the pattern DB content-addressed peer-sharable so the community can extend coverage without recompiling substrate. Gap list (V1 honest perf verdict): - pattern DB hardcoded (V2 makes it data-driven) - no fuzzy / regex matching (exact-byte and entropy only) - no positional context (a pattern in mainline code is same verdict as same pattern in a comment string) - false-positive rate not measured against corpus

dependencies 2 imports · 10 importers

nx_syscalls.nx nx_tier.nx nx_pamp.nx nx_antibody.nx nx_antibody_test.nx nx_crispr.nx nx_crispr_test.nx nx_immune_test.nx nx_mimicry_compose_test.nx nx_pamp_meta.nx nx_pamp_test.nx nx_tier1_immune_compose_test.nx nx_tier2_immune_compose_test.nx

imports: nx_syscalls.nxnx_tier.nx

imported by: nx_antibody.nxnx_antibody_test.nxnx_crispr.nxnx_crispr_test.nxnx_immune_test.nxnx_mimicry_compose_test.nxnx_pamp_meta.nxnx_pamp_test.nxnx_tier1_immune_compose_test.nxnx_tier2_immune_compose_test.nx

structs

85struct NxPampHit

consts

61const NX_PAMP_NONE: nx_int = 0
62const NX_PAMP_TROJAN_SOURCE_HOMOGLYPH: nx_int = 1
63const NX_PAMP_ENTROPY_ANOMALY: nx_int = 2
64const NX_PAMP_BUILD_INJECTION_HINT: nx_int = 3
65const NX_PAMP_KNOWN_BAD_EGRESS: nx_int = 4
66const NX_PAMP_MICROCODE_INJECT_HINT: nx_int = 5
67const NX_PAMP_ROOTKIT_PERSIST_HINT: nx_int = 6
68const NX_PAMP_SHELLCODE_NOPSLED: nx_int = 7
69const NX_PAMP_DECOY_INVALID_METHYL: nx_int = 8
70const NX_PAMP_N_KINDS: nx_int = 9
74const NX_PAMP_OK: nx_int = 0
75const NX_PAMP_DETECTED: nx_int = 1
76const NX_PAMP_ERR_BAD_BUF: nx_int = 2

functions

94func nx_pamp_kind_is_valid(k: nx_int) -> nx_int
107func _pamp_scan_nopsled(buf: *u8, n: nx_size, hit: *NxPampHit) -> nx_int
called by 1: nx_pamp_scan
140func _pamp_scan_homoglyph(buf: *u8, n: nx_size, hit: *NxPampHit) -> nx_int
called by 1: nx_pamp_scan
194func _pamp_scan_entropy(buf: *u8, n: nx_size, hit: *NxPampHit) -> nx_int
called by 1: nx_pamp_scan calls 1: sys_mmap
245func nx_pamp_scan(buf: *u8, n: nx_size, hit: *NxPampHit) -> nx_int