Switching the Lead Field: Moving Target Defense for Closed-Loop Brain Stimulation

Closed-loop brain stimulators record electrical activity from the same implanted electrodes they use to stimulate, and they change stimulation based on what they record. That loop is a security liability. If an adversary can inject a forged signal, it can suppress therapy or trigger harmful stimulation. One way in is electromagnetic pickup on the leads or a compromised processing stage that sits upstream of any encryption. Power grids faced the same problem with forged meter readings. The answer there was a moving target defense, meaning the defender keeps changing the system so that a forgery built for yesterday's configuration stops fitting today's. Grid operators slightly perturb line impedances, so a forgery built for the old physics no longer matches the new one (Moving-Target Defense for Detecting Coordinated Cyber-Physical Attacks in Power Grids). We propose the neural analogue. The stimulator secretly switches which electrode contacts it uses for sensing and stimulation, and each switch changes the "lead field," the mapping from brain sources to recorded voltages. Forged data that keeps the statistics of the old lead field then becomes detectable.

Two facts make this harder than the grid case and also worth doing. First, brain tissue conducts current up to about nine times faster along fiber bundles than across them (Review on solving the forward problem in EEG source analysis). Both the detection power of a switch and its therapeutic side effects therefore depend on direction-dependent ("anisotropic") conductivity. Second, the brain's own coupling between regions changes from second to second. A detector that assumes a fixed source covariance will confuse natural brain-state changes with attacks. The proposal treats these two facts as the core of the method. An anisotropic physical model decides which switches are cheap for the patient and informative for the defender. A dynamic connectivity model supplies the null hypothesis the detector tests against.

Core Claim

A montage-switching defense whose switch schedule is chosen using patient-specific anisotropic lead fields will detect replay and forgery attacks at a higher rate per unit of therapeutic distortion than random switching or isotropically planned switching. This holds only if the detector models time-varying source coupling rather than a fixed covariance.

The expensive physics does not sit in the real-time loop. By the reciprocity principle, which computes the field once per electrode pair rather than once per source (Review on solving the forward problem in EEG source analysis), the lead field $L_m$ for every candidate montage $m$ is computed offline with a finite-element solver. The online defense reduces to small matrix products. This removes the objection that 3D anisotropic modeling is too slow for a dynamic defense.

Research Program

Write $y_t = L_m s_t + n_t$, where $y_t$ is the vector of recorded contact voltages, $s_t$ the activity of a small set of regional sources near the lead, $n_t$ sensor noise, and $L_m$ the lead field of the active montage $m$. A dynamic connectivity model, a sequence model over windowed source covariances in the spirit of BrainATCL, forecasts the source covariance $\hat\Sigma_s(t)$. After a switch to montage $m'$, the detector predicts the recording covariance $L_{m'}\hat\Sigma_s(t)L_{m'}^\top$ and scores its distance from the observed covariance. A replayed or forged stream retains the structure of $L_m$ and fails this check.

The defender picks the next montage by solving

$$ m^\star = \arg\max_{m'} \; D\!\left(L_{m'}\hat\Sigma_s L_{m'}^\top \,\|\, L_{m}\hat\Sigma_s L_{m}^\top\right) - \lambda\, C_{\text{VTA}}(m, m'). $$

Here $D$ is a divergence between Gaussian covariances, which is the expected detection power of the switch. $C_{\text{VTA}}$ is the change in the volume of tissue activated, the region the stimulation field actually drives, computed with the anisotropic model of Butson et al.. The weight $\lambda$ sets the trade-off. Randomization over the near-optimal set keeps the schedule secret. This addresses the warning from Machine Learning Based Resilience Testing of an Address Randomization Cyber Defense that predictable hopping schedules can be learned by the attacker.

Prior work plays three roles here. The grid papers supply the method template. Moving-Target Defense for Detecting Coordinated Cyber-Physical Attacks in Power Grids perturbs scalar line reactances and picks lines by a game. Moving Target Defense Against Adversarial False Data Injection Attacks In Power Grids adds a diversified detector pool. Both assume a static network between perturbations and scalar branch physics; we replace both assumptions. The sensor-coding work of Miao et al. rotates outputs with a secret matrix, and the switching watermarks of Gallo et al. switch secret filters. In both, the defender's secret is a matrix chosen by the designer. In ours the secret is a matrix fixed by the patient's own tissue, and each switch has a physical therapeutic cost.

The anisotropy literature motivates and constrains the design. Butson's clinical case, in which an isotropic model predicted side-effect onset at −1 V against an observed −4 V that the anisotropic model matched, tells us that isotropic cost estimates can be badly wrong. The Calderón non-uniqueness result (Greenleaf, Lassas, Uhlmann) motivates why an attacker cannot easily recover internal tensor fields from boundary data. It is a statement about idealized boundary maps, though, not a proof of secrecy, so we test the secrecy empirically.

The dynamic connectivity literature also motivates the design. STAGIN and Zhi et al. show that static summaries hide transient states. In this setting those hidden states become false alarms.

Baselines

The naive reference is no switching, with a passive anomaly detector on the recordings. We will use a HADiB-style temporal hypergraph anomaly detector (Learning Temporal Higher-order Patterns to Detect Anomalous Brain Activity), which reports 92.23% AUC on ADHD-200 and is the strongest passive detector in our file. It is trained on clean recordings from the same simulated patients with the same tuning budget as our detector. Beating it means higher detection at matched false-alarm rate against replay attacks, where a passive detector should fail by construction.

The strongest existing active method is uniform random montage switching. This is the analogue of the uniform random strategy that Spatial-Temporal Moving Target Defense beats with game-chosen dwell times. Its grid analogue is unoptimized perturbation, which the D-FACTS paper reports at 11.62% defense cost against 2.86% for game-selected lines, with near-100% detection at 5–6% reactance perturbation on IEEE 14-bus. There is no reported result on Lacuna for montage-switching defenses in neurostimulation, so the neural numbers will be ours. The random baseline gets the same montage set, the same switch rate, and the same detector. Beating it means a strictly better detection-versus-VTA-distortion curve.

Two ablations isolate the key ingredients. The first is the identical scheduler planned with isotropic lead fields but evaluated on anisotropic ground truth; it isolates the physics. The second is the identical system with a static source covariance in place of the dynamic forecast; it isolates the connectivity model. Finally, we reimplement the D-FACTS pipeline on IEEE 14-bus in MATPOWER to confirm that our detector code reproduces the reported near-100% detection. This guards against a weak implementation inflating our gains.

Why not just…?

Why not just authenticate the telemetry cryptographically? For attacks on the wireless link, that is the right answer, and this proposal does not compete with it. Our threat model covers injection that occurs before any signing: electromagnetic pickup on the leads, or compromised front-end firmware. Message authentication codes cannot see these because the forged signal is authenticated along with the real one. We will state this scope explicitly rather than claim a general replacement.

Why not just switch montages at random? This is the real threat. If the lead fields of different montages differ enough, almost any switch exposes a replay, and planning adds little to detection. Our expectation is that the advantage appears on the cost side, because isotropic or unplanned switches occasionally produce large off-target activation, as Butson's −1 V versus −4 V discrepancy suggests. If the random-switching curve matches ours within noise, we will report that the anisotropic planning is unnecessary for detection. We will then reposition the contribution as anisotropic cost estimation only.

Why not just use a better passive anomaly detector? An attacker who replays the patient's own past recordings produces data that is in-distribution for any detector trained on that patient. Only a change in the physical mapping can break this. The no-switching HADiB baseline tests this directly. We also give it an advantage by including non-replay synthetic forgeries, where passive detection may do well.

Why not just use a fixed covariance residual like grid bad-data detection? Brain coupling shifts on second scales, so a fixed covariance will alarm on natural state changes. The static-covariance ablation measures how much of the false-alarm rate the dynamic forecast removes.

Proposed Experiments

We build a semi-synthetic benchmark. Patient-specific anisotropic head models come from diffusion imaging, using the HCP S1200 cohort (STAGIN), assuming its diffusion scans are available to us. We implant a virtual directional lead and compute all montage lead fields and VTAs by FEM with algebraic multigrid solvers. Source time courses are drawn from TUH-EEG segments so that the non-stationarity is realistic, including seizures. As a pipeline check, the VTA model must reproduce the anisotropic-versus-isotropic threshold gap reported by Butson.

The attacks are replay, a forgery fitted to the current lead field, and an adaptive attacker who eavesdrops across switches for increasing durations, following Miao et al.'s 20-step eavesdropping protocol. The metrics are detection AUC, time to detection, false alarms per hour on clean data, and VTA distortion.

Three decisive checks follow. The first asks whether the planned anisotropic schedule beats random and isotropically planned schedules on the detection-versus-distortion frontier across held-out subjects. The second asks whether the dynamic covariance forecast lowers false alarms relative to a static one. The third asks how long an eavesdropping attacker needs to estimate enough lead fields to forge consistently, compared with the switch interval, since the defense is only useful if switching outpaces this.