Skip to content
bIackr0sePublic

About

Browser lab: a stealthy Modbus attack overflows a simulated water tank while an ML intrusion detector stays normal. A physics check on hardwired flow meters catches it.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Tank Lab

Attack a simulated water tank and watch a machine-learning intrusion detector get fooled.

Live demo: https://biackr0se.github.io/tank-lab/

A PLC fills tank T-101 using the level that a transmitter reports over Modbus/TCP. An attacker inline on the field cables rewrites that reading. A small autoencoder, running in your browser, scores every minute of network traffic. A crude attack is caught at once. A stealthy one, which reports a simulated tank that obeys the plant equation, overflows the real tank while the detector stays calm. A physics check on two hardwired flow meters catches it.

Press Play story for the 45 s tour, or use the controls: attack, stealth, physics check, speed. Keys: n none, c crude, s stealthy, p physics check.

Run

npm install
npm run dev        # http://localhost:5178
npm run build      # static site in dist/, relative paths, works offline and on GitHub Pages
npm test           # inference parity, the story's outcome, no false alarms in 3 x 8 h

Retrain and re-evaluate (Python through uv):

npm run gen-data   # simulated windows to train/data/ (not in git)
npm run train      # writes src/detector/model.json and train/report.json
npm run eval       # scores the runs with the shipped model in JS, writes train/eval.json
node scripts/eval-physics.mjs

Results (shipped model, JS inference)

  • Normal operation: 2 false-alarm windows in 34,560 over 4 held-out days.
  • Crude attack: alarm from the first window, 4 of 4 seeds.
  • Stealthy attack at full stealth: 0 alarm windows in 4 of 4 seeds, maximum score 0.03 to 0.14 of the alarm line, while the tank overflows.
  • Physics check: alarm before the overflow in 20 of 20 attack runs; at full stealth 290 to 427 s after the attack starts in 3 seeds and 4246 s in the fourth.

How it works, in detail: docs/MECHANISM.md.

Scope

Simulated plant physics and traffic only, from textbook equations. No real device, product or vulnerability is modelled, and nothing here talks to real equipment. The detector is a teaching model, not a product.

Credits

Reflections: "Peppermint Powerplant 2" by Andreas Mischok, Poly Haven, CC0. Fonts: Barlow, Barlow Semi Condensed (SIL OFL), IBM Plex Mono (SIL OFL). 3D: three.js (MIT).

Licence

Copyright (c) 2026 Jaafer Rahmani. All rights reserved. See LICENSE; third-party components keep their own licences.

About

Browser lab: a stealthy Modbus attack overflows a simulated water tank while an ML intrusion detector stays normal. A physics check on hardwired flow meters catches it.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages