In this guide
How 3D Printer Firmware Attacks Work — and How a Hardware Firewall Catches Them
A 3D printer does exactly what its firmware tells it to do. That sounds obvious until you ask the next question: what checks the firmware? On most desktop printers, nothing does. The G-code file arrives from the slicer, the firmware interprets it, and the stepper motors, heaters and fans obey. If the firmware is compromised — or if a malicious G-code file reaches the printer — the machine will happily print a part with hidden defects, overheat a nozzle, or drive an axis into the frame, all while reporting that everything is fine.
In November 2026, researchers at Texas A&M published Firewall3D, a hardware firewall that watches a printer from the outside and halts it when what the printer is doing stops matching what the G-code says it should be doing. In the same week, Prusa announced a printer that takes the opposite approach: remove every place an attack could hide. This guide explains the attacks, the physics that makes them detectable, and how an independent monitor is built at lab scale.
A student-scale version of this idea — a Blue Pill monitor with current sensors and a Python G-code comparator — is live as a project here: Firewall3D-Inspired 3D Printer Project with STM32 Hardware Firewall and Firmware Attack Protection. The rest of this guide explains the technology behind it.
The trust model: why a printer believes its firmware
A typical printing chain has four links: the slicer turns a 3D model into G-code, a host (a PC or a board like a Raspberry Pi) sends that G-code to the printer, the printer's firmware interprets each command, and the firmware drives stepper drivers, heater cartridges and fans. The firmware is the only component that understands the G-code, and it is also the component that reports the printer's status back to the host.
That makes the firmware a single point of trust. There is no second opinion anywhere in the chain. If the firmware is tampered with — through a malicious firmware update, a compromised USB connection, or a doctored G-code file — the printer will execute the altered instructions and report the expected ones. The host sees "temperature 210 C, position correct" because the firmware says so, not because an independent measurement confirms it.
This is the same problem as asking a cashier to audit their own till. The audit is only meaningful if it is done by someone who does not answer to the cashier. A hardware firewall is that second person: a separate microcontroller with its own sensors, its own processor and its own view of the G-code, sitting outside the printer's control loop.
The three attacks Firewall3D was built to catch
Firewall3D, from Texas A&M ECE researchers Seyed Ali Ghazi Asgar and Narasimha Reddy (preprint arXiv:2607.10484, updated 17 November 2026, covered on Hackster the same day), was validated against three attack types. Each one is worth understanding on its own, because each one breaks a different assumption.
1. Motion manipulation
The attacker alters the toolpath: a move goes to the wrong place, at the wrong speed, or is skipped entirely. The printed part can look right from the outside while a wall is thinner than designed, an infill region is missing, or a layer is shifted. For a decorative print that is a failed print. For a functional part — a bracket, a drone arm, a jig — it is a part that fails under load with no visible warning.
The danger is that motion manipulation is invisible to the usual checks. The printer does not weigh the part as it prints, and the firmware reports the commanded positions, not the real ones.
2. Temperature attacks
The nozzle or the bed is driven outside its intended range. Under-heating weakens layer bonding, so the part delaminates later. Over-heating degrades the filament, changes the part's mechanical properties, and in the worst case creates a fire risk. A temperature attack is especially sneaky because the thermistor reading comes through the firmware: a compromised firmware can report 210 C while the heater is actually running much hotter.
3. End-stop spoofing
End-stops are the small switches (or sensors) that tell the printer where the home position is. At the start of a print, each axis moves until it triggers its end-stop, and the firmware calls that position zero. Spoof a triggered end-stop signal and the printer believes it is home when it is not. Every move after that is offset, axes crash into the frame, and the print is ruined from the first layer — or the printer keeps pushing a stepper against a hard stop, which can damage the machine.
Why firmware cannot report on itself
All three attacks share one root cause: the thing being monitored is also the thing doing the reporting. Firmware that has been tampered with will not volunteer that it has been tampered with. Any check that runs inside the firmware, or that trusts data the firmware supplies, can be lied to in exactly the same way.
The fix is architectural, not a patch: move the checking outside. An independent monitor reads the same G-code the printer is supposed to follow, measures the printer's physical behaviour with its own sensors, and compares the two. The firmware never gets a vote in the comparison. If the measured behaviour deviates from the commanded behaviour beyond a threshold, the monitor raises an alert and halts the print.
This is also why the monitor needs its own hardware. Running the checker as a second program on the same host PC does not help if the host is the compromised link. Firewall3D uses an STM32F103C8K6 microcontroller board that sits between the host PC and the printer over USB: the host talks to the firewall, and the firewall talks to the printer. The checking logic lives on a chip the printer's firmware cannot reach.
How Firewall3D works
The design is deliberately simple in concept and careful in execution:
- It reads the G-code stream. Because it sits in the USB path, the firewall sees every command heading for the printer, so it always knows what the printer is supposed to be doing.
- It measures the printer independently. It monitors stepper motor current, end-stop states, fan speed, and nozzle and bed temperature with its own sensors, rather than asking the firmware for those values.
- It compares prediction with measurement. From the G-code it derives the expected motion and temperature profile; from the sensors it gets the actual behaviour. A deviation beyond a threshold triggers an alert and halts the print.
- It needs minimal wiring and no changes to the printer. No motherboard replacement and no firmware modification, which is what makes it practical as an add-on rather than a redesign.
The researchers validated the system against all three attack types above, and the paper claims sub-millimetre position tracking — that is the paper's claim, from its reported results, and it is the kind of figure to treat as a research result rather than a guaranteed specification for any re-implementation. The motivation is scale: the paper frames 3D printing as a market "exceeding $30 billion" (the paper's figure), so a compromised print is not a hobby problem once printed parts go into real products.
The opposite approach: Prusa's Zero-Trace
In the same week, at Formnext 2026, Prusa announced the CORE One L+ Zero-Trace — a printer that answers the same threat from the opposite direction. Instead of watching behaviour for signs of attack, it removes the places an attack could hide:
- No persistent storage on the printer, no USB port, no SD card slot, no Wi-Fi and no camera.
- Print jobs arrive over encrypted Ethernet from a customer-owned server, and the printer keeps data only in volatile memory — power off and it is gone.
- The encryption key lives on a separate board, the firmware is signed, and the machine keeps audit logs.
- First deliveries are planned for January 2027. The base machine is a CoreXY printer with a 300 x 300 x 330 mm build volume and hot ends rated to 400 C.
The contrast is instructive. Firewall3D says: assume the printer can be attacked, and catch bad behaviour as it happens. Zero-Trace says: assume the printer handles sensitive work, and make sure there is nothing worth stealing and nowhere for malicious code to persist. One watches, the other removes. Both designs agree on the diagnosis — the firmware and the trust boundary around it are the weak point — and they are complementary rather than competing: a monitored printer in a sensitive environment would ideally have both.
Why stepper current reveals motion
The key physical insight behind Firewall3D is that a stepper motor's current is a window into what it is actually doing. A stepper motor produces torque by passing current through its windings, and torque is what accelerates the rotor and overcomes load. For a commanded move, the G-code fixes the distance, the speed and the acceleration — and those fix the torque the motor must produce, which fixes the current the driver must supply. In rough terms: current is proportional to torque, and torque is proportional to the commanded speed and acceleration.
That means the expected current waveform for a print can be predicted from the G-code alone. When the firmware executes a move the G-code never commanded, current flows with no matching command in the model. When a commanded move is skipped, expected current never appears. The comparison is between a predicted waveform and a measured one, and a mismatch is evidence of tampering.
In practice the measurement is done with Hall-effect current sensors such as the ACS712, which measures current without breaking the motor circuit and outputs a voltage proportional to it — 185 mV per amp for the plus-minus 5 A variant — that a microcontroller's ADC can read. The student-scale build linked above uses four of these, one per stepper axis.
Two honest caveats belong here. First, current is an indirect measurement: it tells you about torque and effort, not position directly, and reconstructing motion from it depends on the G-code model being right. Second, real printers are noisy — friction varies, filament drag changes, and a slightly bent lead screw adds load. Thresholds have to tolerate normal variation or the monitor will halt good prints. That trade-off between false alarms and missed attacks is the central engineering problem of any such system, and it is why the student build treats its thresholds as design targets to be tuned by logging real prints first.
Building an independent monitor at lab scale
A lab-scale monitor follows the same architecture as the research system, with cheaper parts and a narrower scope:
- Parse the G-code. A small Python program reads the same G-code file the printer is running and extracts the commands that matter: G0/G1 moves with their X, Y, Z and E coordinates and feed rate, M104/M140 temperature targets, and M106 fan commands. A minimal parser is only a few lines:
# Read one G-code line and pull out the move it commands
line = "G1 X42.5 Y10.0 E1.2 F1800"
parts = line.split()
cmd = parts[0]
coords = {}
for p in parts[1:]:
coords[p[0]] = float(p[1:])
print(cmd, coords)
- Build the expected-motion model. From each move, compute the expected duration and the expected current shape — faster acceleration means higher current. This is the prediction side of the comparison.
- Sample the sensors at a fixed rate. The microcontroller reads the current sensors, the end-stop lines and the temperature sensors on a steady schedule, and streams the readings to the host program.
- Compare and decide. The host program lines up measured readings against the expected profile for the command currently executing. A deviation beyond the threshold raises an alert.
- Halt on alarm. Halting can mean cutting power through a relay, or sending a stop command on a separate path the firmware cannot block. Logging everything matters: a halt you cannot explain afterwards is a debugging dead end.
- Tune with real data. Start with loose thresholds and log only. Print normally for a while, look at the spread of real readings, then tighten the thresholds until false alarms are rare. Only then switch the halt on.
The student project linked at the top of this guide implements exactly this shape — a Blue Pill board, four ACS712 sensors, a Python G-code comparator and a dashboard — and it is deliberately a demonstrator of the principle, not a replica of the paper. Its thresholds are design targets, and the honest way to use it is to treat the first prints as calibration runs.
What a hardware firewall cannot do
A monitor is a strong addition, but it has limits worth stating plainly:
- It cannot verify the G-code file itself. If the slicer profile or the CAD model is malicious, the G-code is "correct" as far as the monitor is concerned, and the printer will faithfully print a bad part. Input validation upstream of the monitor is a separate problem.
- It cannot fix mechanical problems. Wear, a loose belt or a bent rod change the current profile too, and the monitor cannot tell a worn printer from an attacked one without additional data.
- Current-based inference has blind spots. A slow drift or a small change that produces a nearly identical current draw can slip past a threshold tuned for a noisy real printer.
- The tap point matters. If the attacker controls the host PC upstream of the firewall, they can feed the firewall false G-code and the comparison will pass. The firewall has to be trusted itself — signed firmware, physical access control, and no unprotected update path.
- Detection is not prevention. Halting a print mid-way wastes filament and time. The value is in stopping a bad part before it is used, not in saving the print.
Frequently asked questions
Do I need to modify my printer's firmware to add a hardware firewall?
No — that is the point. The monitor sits outside the printer's control loop, reads the G-code stream and measures the printer with its own sensors. The research system needs minimal wiring and no motherboard or firmware changes, and the student-scale version works the same way.
Can current sensing really track position?
Only indirectly. Current reveals torque and effort, and combined with the G-code model that is enough to reconstruct expected motion and spot deviations. It is not a replacement for an encoder, and the paper's sub-millimetre tracking claim is a reported research result, not a specification for a rebuild.
Is this only relevant for expensive industrial printers?
The attacks are cheapest to demonstrate on a desktop printer, which is exactly why it is a good student topic. The consequences scale with what the part is used for: a bracket that holds a load fails the same way whether the printer cost a few hundred or a few thousand.
How is a hardware firewall different from just watching the print?
Watching catches visible failures. A firewall catches failures that are invisible from the outside — a wall printed 0.3 mm thin, a temperature excursion the display never showed — because it compares measured physics against the commanded instructions instead of trusting either one alone.
Where should a student start?
Build the G-code parser first and log one real print's current readings against the prediction. That single comparison teaches you the whole system — the model, the noise, and the threshold problem — before any halting logic exists.
Does Prusa's Zero-Trace make Firewall3D unnecessary?
No. Zero-Trace protects the printer against data theft and persistent tampering; it does not watch for a compromised G-code stream or a tampered host. A monitored printer and a locked-down printer solve different halves of the problem.
Limitations
This guide is based on the Firewall3D preprint and public coverage of the Prusa announcement, both from November 2026. The Firewall3D paper is a preprint, so treat its performance figures as the authors' reported results. The student-scale build described here demonstrates the principle at lab scale with design-target thresholds; it is not a replica of the research system, and its detection performance has not been measured against the paper's attack set. Prices, delivery dates and specifications for the Prusa machine are as announced at Formnext 2026 and may change before first deliveries.