Posts Tagged ‘break mcu source file’
ATtiny25V: There Is No Software Protection to Break
Some microcontrollers implement protection partly in software: a bootloader that refuses to dump memory, a debug port that requires a password, a vendor tool that declines to read certain regions. Those can be worked around by using different software.
This part has none of that. Its protection is two bits in a hardware register, enforced by the programming interface, with no software component anywhere in the path. The distinction matters because it determines what kind of effort is worth making.
The mechanism, stated plainly
Two lock bits encode four states. In the unlocked state everything works. In mode 1, programming is blocked but verification is permitted. In modes 2 and 3, verification is blocked as well, and the EEPROM is included.
The bits are read and written through the programming interface. They are not accessible to code running on the chip — no instruction exists that reads or writes them. Firmware cannot lock itself, cannot unlock itself, and cannot detect its own lock state except by inference.
| Question | Answer |
|---|---|
| Can firmware change the lock bits? | No |
| Can firmware read them? | No |
| Can a bootloader clear them? | No boot section exists here |
| Can any interface bypass them? | No |
| What clears them? | Chip erase, which erases the array |
The last two rows are the whole story. There is no software to defeat, because there is no software in the enforcement path.
Why the phrase persists
Three usages, none of them describing a real software lock.
Colloquial. “Software protection” is used to mean “the code is protected”, as opposed to hardware that is physically difficult to open. It is a description of intent, not of mechanism.
Bootloader gating. A device whose update path requires a signature is described as software-protected. That is accurate about the update path and irrelevant to reading the existing contents, which the lock bits govern separately.
Tool behaviour. A vendor’s programmer refusing to read a region reads as a software restriction. It is usually the tool honouring the hardware state, not adding one.
In each case the actual barrier is the same two bits, and the workaround being imagined does not exist.
What this means for planning
The absence of a software layer removes a whole category of approaches. There is nothing to patch, no handshake to spoof, no version to roll back, no engineer mode to enter.
What remains is the hardware question: is the array readable in its current lock state, and if not, what does the only operation that changes the state cost.
For a device in mode 1, the answer is that it is readable and the “protection” is irrelevant to the task. For mode 2, the answer is that the contents are not obtainable through any documented interface, and the erase that opens the part returns a blank array.
Stating that clearly is more useful than a longer explanation that implies an avenue exists.
Where the real difficulty sits
With the protection question answered, the difficulty moves to the electrical and physical layers, and on this part both are substantial relative to the array size.
Pin access. Six usable pins, four shared with the programmer. A product that loads the reset line or drives the shared pins makes entry awkward.
Potting and placement. A device in an eight-pin package is often the smallest component on a board and sometimes the most thoroughly encapsulated.
Clock configuration. A part configured for an external clock will not answer on a bare adapter until the fuse is dealt with.
Those three account for most of the time on this family. None of them is protection, and all of them are solved by ordinary engineering rather than by defeating something.
What an honest answer looks like
If a device is in mode 1, the array is readable and the work is straightforward. If it is in mode 2 or 3, the contents are not recoverable through the programming interface, and the honest deliverable is a description of what the device does, obtained by observation rather than by reading.
Observation is not a consolation prize. On a two-kilobyte program with six pins, watching the pins and the serial traffic frequently reconstructs the entire functional behaviour, which is what most commercial questions actually require.
Related notes
- ATtiny25 and shared pins — why entry is the hard part on eight pins.
- ATtiny24 and high-voltage entry — an entry path that is not a bypass.
- ATmega8A and the four lock states — the same state machine on a larger part.
FAQ
Can the lock bits be defeated without erasing? No documented interface does that, and no software path exists.
Is there a hidden unlock command? No. The interface implements a fixed command set, and lock state is not among the writable-by-command fields outside the specified sequence.
Does a locked part still run? Yes. The protection governs the programming interface, not execution.
Is observation a legitimate alternative? For functional questions, frequently yes — and it is the only avenue when the array is closed.
Conclusion
Calling it software protection creates an expectation of a patchable barrier. There is none: two hardware bits, enforced at the interface, cleared only by an erase that takes the contents. Accepting that framing early redirects effort to the layers where progress is actually possible — pins, clock, access, and observation.