An Always-On Spiking Monitor That Catches Credential Writes Before They Hit Disk

Every serious forensic study of mobile and IoT clients keeps finding the same failure: long-lived secrets — OAuth refresh tokens, API keys, even raw passwords — get written to local SQLite databases, XML config files, and debug logs in plaintext. Martini et al. showed that residual tokens on a phone allowed full remote impersonation for five of six cloud apps Mobile Cloud Forensics: An Analysis of Seven Popular Android Apps; Grispos et al. found plaintext passwords and access tokens in an XML configuration file in a HIPAA-claiming medical app Investigating Protected Health Information Leakage from Android Medical Applications; and a crawl of 413,775 mini-apps found 84,491 credential leaks across 54,728 apps The Skeleton Keys: A Large Scale Analysis of Credential Leakage in Mini-apps. These leaks are caught only after the fact, by expensive offline forensics or offline graph-matching audits. Meanwhile, spiking neural networks — networks of neuron models that compute by emitting sparse binary pulses instead of dense floating-point multiplications — have demonstrated microwatt-class inference on neuromorphic silicon, with accumulation operations costing 0.9 pJ versus 4.6 pJ for multiply-accumulate operations in 45nm CMOS SpikingBERT: Distilling BERT to Train Spiking Language Models Using Implicit Differentiation.

The proposal: build an always-on, event-driven spiking credential monitor that runs on the endpoint itself, intercepts each candidate string at the moment it is written to storage or a socket, and classifies it as secret-or-not in real time at microwatt power. The reader should take away: filesystem and IPC events are naturally sparse bursts between long idle periods — exactly the input regime where spiking networks consume near-zero dynamic power — and credentials are exactly the string type that current spiking NLP encodings handle badly, so both sides of the intersection pose real research problems, not just an application pairing.

Core Claim

Two claims, one architectural and one scientific. Architecturally, a two-tier sentinel can sit between an application's I/O calls and disk: a deterministic pre-filter (cheap regex and entropy thresholds, essentially free) passes only ambiguous strings — those without fixed OAuth patterns but suspicious enough to warrant a look — to a spiking classifier that fires only when a write event occurs. Scientifically, credentials are a hard case for existing spiking text models because those models inherit natural-language tokenization: work on code-LLM secret leakage showed that byte-pair encoding collapses high-entropy secret strings into low-entropy token sequences, with a KL divergence of 2.668 between secret tokens and general code distributions Understanding Secret Leakage Risks in Code LLMs: A Tokenization Perspective. The claim is that a character-level temporal spike encoding — one that feeds raw character events directly into the time dimension of leaky integrate-and-fire neurons, bypassing BPE entirely — is both more accurate on unstructured secrets and cheaper, because each incoming character event drives computation only where the input changes.

The nearer-term scientific payoff is a rigorous answer to a question nobody in the file's literature has asked: can spiking text models, which currently trail their dense counterparts by 1–2% on natural language benchmarks Spiking Convolutional Neural Networks for Text Classification, be better than dense models on high-entropy, out-of-distribution strings, precisely because their input encoding does not distort what it cannot parse?

Research Program

Three components. First, the event front-end. On Android, inotify/fanotify-style hooks on application-private directories and a wrapper on local socket IPC produce the event stream. Each write event carries a short byte window around the written value. This mirrors the threat surface documented empirically: the log file at /data/local/tmp/videoserv.log that received a dynamic 16-digit password in Analyzing Use of High Privileges on Android: An Empirical Case Study of Screenshot and Screen Recording Applications, and the sp_user_region_host_info.xml and SQLite artifacts of Forensic Taxonomy of Popular Android mHealth Apps and Investigating Protected Health Information Leakage from Android Medical Applications. The crucial design property is that this event source is bursty and mostly silent, so the monitor's dynamic power tracks actual I/O activity rather than wall-clock time.

Second, the spike encoding and classifier. Each character in the candidate window is encoded as a sparse temporal event: character identity selects a small input neuron pool, and character-class features (alphanumeric, symbol, hex-digit) drive per-channel firing rates, with an explicit "novel character sequence" signal that raises firing when a bigram or trigram is unseen in benign configuration syntax. The classifier is a directly-trained LIF network using threshold-dependent batch normalization for stable variance across depth, following Going Deeper With Directly-Trained Larger Spiking Neural Networks, trained with surrogate gradients and optionally distilled from a conventional teacher in the spirit of SpikingBERT. For new credential formats that emerge after deployment, a growing-when-required layer allocates new neurons on novel input without full retraining, adapting the lifelong-learning mechanism demonstrated for network intrusion detection in zesun33/neuromorphic-cybersecurity-for-lifelong-learning. A hardware-mapped variant will respect the constraints shown to matter on real silicon — 4-bit weights, fan-in of at most 64, synaptic delay lines of up to 15 ticks, per Conversion of Artificial Recurrent Neural Networks to Spiking Neural Networks for Low-power Neuromorphic Hardware — and an open research question is whether neuron-growing continual learning can coexist with rigid weight discretization on such substrates.

Third, and unusual for a security proposal, a self-audit of the monitor itself. Martini et al. recovered master passwords from plaintext RAM heaps Mobile Cloud Forensics; if our sentinel classifies secrets, its own state — membrane potentials, allocated neurons, delay-line spike traces — becomes a new forensic surface. We will test whether the temporal state is reconstructible into the original credential, and design a zeroization policy (reset-on-classify, bounded neuron lifetimes) if it is. Turning the forensic methods of Azfar, Grispos, and Martini against our own monitor is the honest way to close this loop.

Proposed Experiments

The evaluation needs a labeled write-event corpus, an accuracy comparison against the strongest existing detectors, and an energy accounting that can be compared to published spiking-NLP numbers. For the corpus, we will assemble a benchmark of interception events from two sources: replayed forensic artifacts — the SQLite databases, XML files, and logs documented in the four forensic studies above, each labeled at the field level as credential-or-not — and a large-scale static source of real leaked secrets from the mini-app crawl of The Skeleton Keys, injected into a live Android test harness as realistic write streams, so that detection happens under real-time, streaming conditions rather than on static files. Ambient negative examples come from ordinary app I/O (caches, preferences, serialized model files) to measure false-positive rate per device-hour, the number that actually decides whether an always-on monitor is deployable.

Primary metrics are precision and recall at the write-event level, per-event energy in pJ computed from spike counts using the 0.9 pJ per accumulation figure of SpikingBERT, latency in timesteps $T$ per candidate window, and idle dynamic power over a 24-hour device trace. Accuracy targets should be anchored to the best published detector on comparable data: KeyMagnet reported 95.04% precision and 85.56% recall on the 413,775 mini-app crawl The Skeleton Keys; the spiking sentinel counts as competitive if it reaches recall within a few points of that while running online at under a millijoule per classified write — the per-instance energy scale reported for TrueNorth generic classifiers in Martí et al.. A secondary question is whether character-level temporal encoding beats BPE-based rate coding specifically on gibberish-like secrets, using the entropy characterization of Understanding Secret Leakage Risks in Code LLMs (character entropy 6.086 bits for gibberish secrets versus 4.744 for non-secrets) to stratify the test set. Finally, a continual-learning phase introduces credential formats unseen in training, evaluating the growing-when-required layer against a frozen model, with forgetting measured on the original classes.

Baselines

The naive reference point is the deterministic scanner: a combination of regex patterns for structured tokens (OAuth bearer prefixes, key headers) and a Shannon entropy threshold, the approach underlying tools like TruffleHog and Gitleaks, with no learned component. It is the right reference because it is free, deterministic, and already catches the easy cases; our pre-filter reuses it, so the proposal must show marginal value strictly on the ambiguous strings that the scanner defers. It will be run on the identical replayed write-event corpus with identical labeling, and it defines the floor: any learned monitor that does not beat it on the ambiguous subset has no reason to exist. Note that it is expected to miss the documented hard cases: the low-entropy password "MedExp2018" recovered by Grispos et al. and the dynamic 16-digit password dumped to a log in Meng et al. would pass an entropy filter, and KeyMagnet's authors state outright that fixed-pattern tools fail because these credentials lack fixed structure The Skeleton Keys.

The strongest existing detector for the accuracy comparison is KeyMagnet The Skeleton Keys, which built a credential-use semantic graph from platform documentation and matched it against client behavior graphs; on the 413,775 mini-app crawl it reported 95.04% precision and 85.56% recall. It is the strongest competitor because it is the only published method with large-scale, ground-truthed numbers on real leaked credentials in client code. It cannot run on-device — it needs crawler infrastructure and offline graph parsing — so the fair comparison is accuracy-only on the same labeled corpus (their precision/recall being the numbers to match), with the energy and latency comparison reserved for the on-device tier. Beating it means matching its recall within a small margin at comparable precision while adding the property it fundamentally lacks: online interception before the write completes.

For the on-device tier, the strongest competitor is a dense quantized neural text classifier (a MobileBERT- or TextCNN-class model, 8-bit quantized, running on a mobile neural processing unit) trained on the same corpus with the same tuning budget. No reported result exists for such a detector on credential strings — no reported result found on Lacuna for quantized ANN credential detectors on endpoint write streams — so we will run it ourselves as the primary energy and accuracy competitor, measured under identical conditions on the same device. Beating it means comparable accuracy at a large multiple reduction in per-event energy and, critically, near-zero idle power over the 24-hour trace, since dense models must fully evaluate on every event and their NPUs idle-hot. For context on the accuracy-energy trade the spiking side inherits, the conversion-plus-fine-tuning recipe of Lv et al. — which turned a TextCNN into a LIF network reaching 80.91% on SST-2 against 83.25% for the dense original, at 7x to 14x less energy — will be replicated on our corpus as the conventional spiking baseline, before any of our encoding contributions.

Finally, two ablations isolate the key ingredients. One swaps the character-level temporal encoding for BPE-plus-rate coding (the Lv et al. recipe applied to our architecture) with everything else fixed, isolating the encoding claim on high-entropy secrets. The other disables the growing-when-required layer, isolating the continual-learning ingredient on emerging formats.

Why not just…?

Why not just run regex and entropy scanners? They are the right pre-filter and this proposal keeps them in that role. But the empirical record shows they fail exactly where the interesting leaks live. KeyMagnet's authors state that existing tools fail because the credentials lack fixed patterns and are handled dynamically The Skeleton Keys; the entropy characterization of Shi et al. shows why thresholds misfire in both directions — gibberish secrets have high character entropy, but structured low-entropy passwords like "MedExp2018" Grispos et al. sail under the bar while compressed blobs and hashes trigger false positives. Our first experiment directly measures this: the ambiguous-subset accuracy of the deterministic scanner versus the spiking tier is precisely the number that settles it, and if the spiking tier adds nothing there, the proposal should be abandoned rather than defended.

Why not just use a quantized dense model on the phone's NPU? This is the most serious alternative, and we treat it as the primary on-device baseline rather than argue around it. The honest counterargument has two parts. First, arithmetic: dense evaluation is multiply-accumulate dominated at 4.6 pJ per operation against 0.9 pJ per spiking accumulation, the 5.1x figure from Bal & Sengupta, and Lv et al. realized 7x to 14x end-to-end energy savings with only 1–2% accuracy loss in text classification. Second, and more specific to this application: an always-on monitor is idle almost all of the time, and spiking networks consume near-zero dynamic power during silence, while a dense NPU pipeline pays fixed activation costs on every event regardless of content. If the 24-hour device trace shows the NPU route costs little enough in battery terms, this alternative wins and the neuromorphic claim collapses — the trace measurement is included precisely to give that alternative a fair shot at killing the idea.

Why not just mandate Android Keystore / TEEs and fix storage hygiene? Because the forensic record shows developers do not use them, and even when they encrypt, they store the key next to the lock — Box kept a 512-bit encryption key and salts in plaintext in its private directory Martini et al.; developers bypass sandboxing entirely via ADB socket proxies Meng et al.; and 54,728 production mini-apps carried migrated server-side secrets despite platform keychain availability Shi et al.. Hygiene fixes and detection are complements, not substitutes: the monitor is the runtime check that catches hygiene failures when they ship anyway. That said, this is a fair framing objection — if platform vendors can enforce storage APIs, the monitor's value shrinks to a defense-in-depth tripwire, which is a weaker but still real motivation.

Why not just do periodic offline audits like KeyMagnet? Offline audits find leaks after thousands of devices have already persisted the secret for weeks; the documented harms are specifically about long-lived tokens sitting at rest and being harvested by anything with local access Mobile Cloud Forensics. Interception-before-write is the only point at which the secret never touches unencrypted storage at all. Still, offline auditing remains strictly better for whole-ecosystem measurement — which is why this proposal reuses KeyMagnet's labeled corpus rather than competing with its audit role.

Decisive Checks

Three outcomes decide the proposal. The spiking tier must beat the deterministic scanner by a clear margin on the ambiguous subset of the write-event corpus, with false positives low enough to survive a device-week of ordinary I/O (on the order of one alert per device-day, not per hour). The character-level temporal encoding must beat BPE-plus-rate coding specifically on the high-entropy stratum of the test set, confirming that the encoding is the ingredient doing the work rather than the neural architecture generally. And the energy accounting must show the spiking sentinel at millijoule-or-below per classified write with near-zero idle draw, against the dense NPU baseline measured on the same device — the 17 µW recurrent-network deployment of Diehl et al. on TrueNorth being the existence proof that this operating point is reachable on real silicon, and the ~85.3% accuracy of the lifelong-learning NIDS system of zesun33 being the existence proof that spiking classifiers hold up on security data at all. If any one of these checks fails, the honest conclusion is that neuromorphic hardware is not yet ready for endpoint security monitoring, and that negative result — with the energy trace that produced it — would itself be the first data point in an unmeasured gap.