Skip to content

About

Rotates a host's advertised OS fingerprint at random from all 5,652 nmap profiles via userspace NFQUEUE, disrupting nmap -O reconnaissance without kernel patches. Auburn M.S. capstone.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

Β 

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

OPTIMAL β€” Operating System Fingerprint Mutation with Galaxy

A moving-target defense that makes a host lie about what it is β€” and change its story every few seconds.

CI Bash Python 2.7 nmap Platform License Paper

Reconnaissance is the first move in most attacks, and OS fingerprinting is one of its cheapest wins. A single nmap -O tells an attacker which kernel you run, which narrows the payload they need to bring.

OPTIMAL removes that win. It continuously rewrites the TCP/IP header fields that identify a host's operating system, drawing a new identity at random from the full 5,652-entry nmap fingerprint database and holding it for a random 1–20 second interval. Scan the same machine twice and it is a Mac, then an HP iLO management controller, then a Windows XP box. It is really none of those.

Built as my M.S. capstone at Auburn University (CSSE 7980, 2022) and deployed inside Galaxy, a network-emulation framework for co-evolutionary attacker/defender AI research β€” where OPTIMAL was designed to serve as a defender strategy for adversarial agents to learn to play against.

πŸ“„ Read the research paper (6 pages, PDF) Β· 🎬 See it running


The result, in one look

Three consecutive nmap -O scans of the same host (10.3.0.60), unedited:

Three consecutive nmap -O scans of host 10.3.0.60 returning three different operating systems in turn: Linux 2.4.27, then Cisco Nexus V1000 switch running NX-OS, then FreeNAS 0.7 on FreeBSD 7.2-RELEASE.

Scan Device type OS details
1 general purpose Linux 2.4.27
2 switch Cisco Nexus V1000 switch (NX-OS)
3 storage-misc FreeNAS 0.7 (FreeBSD 7.2-RELEASE)

One machine. No reboot, no kernel patch, no dropped connections β€” and it does not merely change operating system, it changes device class: a general-purpose server, then a network switch, then a storage appliance. From nmap -O alone, an attacker building a target profile gets three mutually exclusive answers and no way to tell which, if any, reflects the real host. None of them does.

Full 50-second capture with audio: docs/optimal-demo.mp4 Β· More scan evidence, including successful macOS and HP iLO spoofs, in docs/RESULTS.md.


How it works

OPTIMAL architecture: a bash control loop picks a random nmap fingerprint and dwell time, drives OSfooler-NG, which rewrites TCP/IP header fields in userspace via NFQUEUE, so a remote nmap scan sees a different operating system every time.

Every cycle, src/optimal-mutate.sh:

  1. Draws a fingerprint at random from all 5,652 nmap OS profiles β€” printers, routers, phones, mainframes, anything nmap knows how to recognize.
  2. Draws a dwell time at random from 1–20 seconds, so an observer cannot learn the rotation schedule and time their scan around it.
  3. Loads the profile into OSfooler-NG, which installs an iptables NFQUEUE target and rewrites the identifying header fields β€” TCP window size, options ordering, TTL, IP flags β€” as packets pass through libnetfilter_queue in userspace.
  4. Restores the host's own iptables rules, which the OSfooler-NG lifecycle flushes. This is the part that keeps the host a working network citizen instead of a broken one: Galaxy's connection logging survives every mutation.
  5. Logs the profile, the dwell time, the PID, and every rule change, then tears down and repeats.

Working in userspace rather than the kernel was the central design decision. The earlier generation of fingerprint-spoofing tools (IP Personality, Stealth Patch, Blackhole) were kernel patches pinned to Linux 2.4 and died with it in 2001. A userspace NFQUEUE approach survives host kernel upgrades, which is what makes this deployable rather than a museum piece.

Where it runs: the Galaxy framework

Galaxy is a high-fidelity network emulation framework for cybersecurity research, built under the CEADS-LIN project (Coevolving Attackers and Defenders Strategies for Large Infrastructure Networks) at Missouri S&T and Los Alamos National Laboratory, and published at USENIX CSET '18. I am a co-author on that paper, as Hannah Reinbolt.

Galaxy builds a working clone of an entire network β€” servers, firewalls, admins, users, and the bridges between them β€” from configuration files, then tears it down and rebuilds it clean for the next run. That statelessness is the point: it lets evolutionary algorithms play attacker and defender against each other across thousands of evaluations, discovering strategies rather than having them hand-written. The CSET paper demonstrates this by evolving network enumeration strategies for attacker agents β€” that is, evolving better reconnaissance.

Which is exactly what makes it the right home for OPTIMAL. Galaxy needed active defender strategies to co-evolve against, and OPTIMAL was built to be one: a defense that specifically degrades the reconnaissance phase those attacker agents depend on. It also meant testing against a traditionally routed network rather than the software-defined networks most moving-target-defense research uses β€” a harder and less-studied target, since SDN research can reprogram the network from a central controller and this cannot.

Deploying into Galaxy is documented in docs/DEPLOYMENT.md; the framework paper is included as docs/Galaxy-CSET18-paper.pdf.


What I built vs. what I used

This distinction matters, so it goes near the top rather than buried in a footnote.

Component Whose
πŸ”΅ Mutation orchestration β€” the rotation loop, random profile selection, random dwell scheduling This project
πŸ”΅ nmap fingerprint database ingestion and normalization (5,652 profiles β†’ selectable pool) This project
πŸ”΅ iptables / NFQUEUE lifecycle management, including restoring host rules on every transition This project
πŸ”΅ Galaxy integration β€” master-image overlay, init.d bootstrap, fleet-wide deployment This project
πŸ”΅ Structured run logging and the CPU/memory stress-test methodology This project
🟠 Packet-byte mutation engine β€” the code that actually rewrites TCP/IP header fields OSfooler-NG by Jaime SΓ‘nchez
βšͺ Network emulation environment Galaxy, CEADS-LIN β€” co-authored, not authored by me alone

OSfooler-NG is a single-shot tool: you give it one fingerprint and it holds that fingerprint until you kill it. OPTIMAL is the system that turns it into a moving target β€” the scheduling, the randomization, the firewall-state choreography, and the deployment across a fleet of emulated hosts.


Performance and the stress test

The mutation interval is not an arbitrary constant. It came out of measurement.

Line chart of total host CPU percentage over 20 seconds at four mutation intervals: 1 second holds a sustained 8-11 percent, while 10, 20, and 30 second intervals sit near zero between brief spikes.

Mutation interval Host CPU Verdict
1 s ~11% sustained Starves the Galaxy host β€” it fell over within minutes
10 s near-idle, brief spikes to ~10% Stable, host recovers between cycles
20 s near-idle, brief spikes Stable
30 s near-idle, brief spikes Stable, but slow enough to be scan-able between mutations

Memory cost was ~0.6% of host RAM per mutation.

1–20 seconds was chosen as the random range: fast enough to keep an attacker's validity window short β€” a scan's answer is likely stale by the time it can be acted on β€” and slow enough that the host stays healthy. Two consecutive scans landing on the same fingerprint is unlikely; landing on the same fingerprint and trusting it is the attacker's problem.

Runtime logs from a live mutation cycle:

Terminal log showing NMAP PROFILES CREATED, DROPPING IPTABLES, PROFILE SELECTED Microsoft Windows Vista SP0 or SP1, Windows Server 2008 SP1, or Windows 7, and OSfooler-NG confirming it is mutating to that fingerprint.


Where it breaks β€” and why that's worth knowing

An nmap -A aggressive scan defeats the OS spoof, and the repo says so plainly:

nmap -A output showing OS details Microsoft Windows XP SP3 highlighted in blue, but Service Info OS Linux highlighted in red on the same host.

OS details reports the spoofed Windows XP SP3. But Service Info on the same host reports cpe:/o:linux:linux_kernel β€” read from the SSH service banner, which lives in the application layer where OPTIMAL never reaches. An attentive attacker sees the contradiction and knows something is being spoofed, even if they cannot tell which half.

Known limitations:

  • Application-layer CPE is not spoofed. OPTIMAL operates at the network and transport layers only. Service banners betray the real OS under nmap -A.
  • Active scanning only. Passive fingerprinting (p0f, Wireshark) was out of scope.
  • Mutating too fast destabilizes the host β€” see the stress test above.
  • Header rewriting is not risk-free. Mutating packet flags could break services that depend on specific field ranges. None were observed across Galaxy's user hosts, but the test surface was limited.
  • Some disguises attract the wrong attention. Advertising Windows XP on a modern network is a lure β€” there is a large, readily available payload library for it. Fingerprint choice is a strategy decision, not a uniform random draw, if the goal is deterrence rather than confusion.

Future work

Passive-scanning defense Β· service-CPE spoofing to close the nmap -A gap Β· pruning end-of-life fingerprints from the selection pool Β· full service spoofing alongside OS spoofing.


Quick start

Requirements: Linux with netfilter/iptables, root, Python 2.7, and the OSfooler-NG engine. Run this on hosts you own or are authorized to test.

# 1. Install the OSfooler-NG engine and its dependencies (once per host)
sudo ./deploy/galaxy/setup-osfooler.sh

# 2. Start mutating β€” random fingerprint, random 1-20s dwell, forever
sudo ./src/optimal-mutate.sh

# 3. From another host, watch the identity change
nmap -O <target-ip>    # ...wait 15s...
nmap -O <target-ip>

# 4. Stop and restore the host's real fingerprint and firewall rules
sudo ./src/optimal-stop.sh

Useful variations:

sudo ./src/optimal-mutate.sh --min 30 --max 300      # low-CPU rotation
sudo ./src/optimal-mutate.sh -p "Apple Mac OS X 10.5.7 (Leopard) (Darwin 9.7.0)"   # pin one identity
./src/optimal-mutate.sh --dry-run --once             # inspect selection logic, touch nothing
./src/optimal-mutate.sh --help

Configuration is by environment variable: OPTIMAL_HOME (default /fingerprint) and GALAXY_SUBNET (default 10.0.0.0/8).

Deploying across a Galaxy fleet is documented separately in docs/DEPLOYMENT.md.

Running this today

This is 2022 research code, published as it was written. Being straight about what has aged:

What will not install cleanly. OSfooler-NG targets Python 2.7, which reached end of life in January 2020, and the 0.5 nfqueue bindings, which setup-osfooler.sh pins to a specific amd64 .deb from the Ubuntu archive because that is what built reproducibly on Galaxy's image. Neither ships in current distributions. Expect the engine install to need work on a modern base.

What has aged well. The architecture was the right call and still is β€” userspace NFQUEUE rewriting survives kernel upgrades, which is precisely why the kernel-patch tools this replaced (IP Personality and its contemporaries) died with Linux 2.4 and this did not. The orchestration in src/ is dependency-free bash and is exercised by CI on current Ubuntu on every push.

What I would change first. The control loop talks to the engine across a deliberately narrow seam β€” one command line, osfooler-ng -m "<profile>", plus a process to signal. Porting to the maintained Python 3 NetfilterQueue bindings, or swapping the engine out entirely, means changing start_osfooler and nothing else. That seam is why the interesting part of this repository is still runnable.

Tests

The mutation loop is covered by a smoke test that drives the real optimal-mutate.sh against stubbed osfooler-ng and iptables binaries, so profile normalization, random selection, dwell scheduling, firewall ordering, and process teardown are all exercised without a netfilter stack:

./tests/smoke-test.sh                              # arg handling, dependency checks, dry runs
sudo -E env "PATH=$PATH" ./tests/smoke-test.sh     # adds the live process lifecycle

CI runs both, plus shellcheck --severity=style over every script. One assertion is worth calling out: the engine stub clears a marker file from its SIGTERM handler, so a surviving marker proves teardown never signalled the tracked process. That is a regression test for a real defect in the original 2022 code, where pkill -9 $PID matched the pid as a process name and silently killed nothing.


Repository layout

src/
  optimal-mutate.sh          Mutation control loop β€” profile selection, scheduling,
                             iptables lifecycle, logging
  optimal-stop.sh            Clean shutdown and firewall restoration
deploy/galaxy/
  setup-osfooler.sh          Installs the OSfooler-NG engine + Python 2 dependencies
  install-osfooler           init.d bootstrap baked into the Galaxy master image
tests/
  smoke-test.sh              End-to-end assertions over the mutation loop
  stubs/                     Stand-in osfooler-ng and iptables binaries
.github/workflows/
  ci.yml                     shellcheck + smoke test on every push
docs/
  OPTIMAL-research-paper.pdf The full 6-page capstone paper
  Galaxy-CSET18-paper.pdf    The Galaxy framework paper (USENIX CSET '18), for context
  RESULTS.md                 Validation methodology and complete scan evidence
  DEPLOYMENT.md              Galaxy master-image integration
  optimal-demo.mp4           50-second capture of a live mutation under scan
  images/                    Demo GIF, architecture diagram, scan captures, stress-test data

Citation

@mastersthesis{stroble2022optimal,
  author = {Stroble, Hannah},
  title  = {{OPTIMAL}: Operating System Fingerprint Mutation with Galaxy},
  school = {Auburn University, Department of Computer Science and Software Engineering},
  year   = {2022},
  type   = {{M.S.} Capstone}
}

The Galaxy framework this runs on is a separate, co-authored publication β€” I appear on it as Hannah Reinbolt:

@inproceedings{schoonover2018galaxy,
  author    = {Schoonover, Kevin and Michalak, Eric and Harris, Sean and
               Gausmann, Adam and Reinbolt, Hannah and Tauritz, Daniel R. and
               Rawlings, Chris and Pope, Aaron Scott},
  title     = {Galaxy: A Network Emulation Framework for Cybersecurity},
  booktitle = {11th {USENIX} Workshop on Cyber Security Experimentation and Test ({CSET} '18)},
  year      = {2018},
  address   = {Baltimore, MD},
  publisher = {{USENIX} Association}
}

Acknowledgments

Daniel Tauritz for guidance on security and artificial intelligence, and for the CEADS-LIN/BONSAI program that produced Galaxy Β· Andrew Springall for grounding the work in real-world practice Β· Deacon Seals for late-night Galaxy infrastructure support.

License

MIT β€” Hannah Stroble, 2022 β€” covers the code in this repository (src/, deploy/, tests/) and the documentation I wrote. It does not extend to the two research papers under docs/, which remain under their authors' and publishers' terms; the Galaxy paper is shared here as one of its co-authors and is also available from USENIX. OSfooler-NG is separately licensed by its authors.

About

Rotates a host's advertised OS fingerprint at random from all 5,652 nmap profiles via userspace NFQUEUE, disrupting nmap -O reconnaissance without kernel patches. Auburn M.S. capstone.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages