Posts Tagged ‘Brute Force Chip reverse engineering’
When Brute Force Works: The Attempts × Seconds Test
Every brute force proposal reduces to one line of arithmetic: the size of the space multiplied by the time each attempt takes. That line is easy to compute and almost never the reason a project fails. The reason projects fail is that the multiplication assumes attempts are free, and on real hardware they usually are not.
Sorting a request into “brute force is viable” or “brute force is not viable” therefore takes two questions, not one. How large is the space, and what does one attempt cost in the only currency that matters — wall-clock time before the device locks, slows, or dies.
The naive multiplication
Take a four-digit PIN. Ten thousand candidates. At one attempt per second, 2.8 hours. At ten attempts per second, seventeen minutes. The arithmetic is correct and the conclusion is usually right, which is why this class of problem is the one everybody quotes.
Now take a six-digit PIN. One million candidates, 11.6 days at one attempt per second. Still plausible if the device is on a bench and nobody is waiting. Eight characters of alphanumeric is 2.8 × 10^12, which is 89,000 years at the same rate, and that is the point at which the arithmetic stops being the interesting part of the conversation.
| Space | Size | 1/s | 10/s | 1000/s |
|---|---|---|---|---|
| 4-digit PIN | 10^4 | 2.8 h | 17 min | 10 s |
| 6-digit PIN | 10^6 | 11.6 d | 1.2 d | 17 min |
| 8 hex chars | 4.3 × 10^9 | 136 y | 13.6 y | 50 d |
| 16 hex chars | 1.8 × 10^19 | — | — | 580,000 y |
The table makes the shape obvious: for anything above about 40 bits, online guessing is not a computational problem at all. No amount of parallelism fixes it, because the limit is the number of attempts the target will accept per second, not the number of candidates a machine can generate.
The counter is the real gate
A design that accepts attempts at one per second forever is defeated by arithmetic. A design that accepts three attempts and then locks is not defeated by arithmetic at all. The difference between those two designs is a few bytes of state, and it is the single most effective security measure in the entire product.
Counters are implemented in four ways, and each fails differently.
| Implementation | Where state lives | How it fails |
|---|---|---|
| Volatile counter in RAM | MCU SRAM | Cleared by power cycle or reset pin |
| Counter in EEPROM, written per attempt | External EEPROM | Rewritable if bus is accessible; wears out |
| Counter in protected flash, written on lockout | MCU flash | Survives, but only after the lockout fires |
| Counter plus escalating delay | MCU flash plus timer | Survives and slows the attack |
The first row is defeated by removing power. The second is defeated by any bus access. The third is the first one that actually works, and its weakness is that the lockout is a single event: an attacker who can interrupt power at attempt two never triggers it, and the count is only persisted at the moment of lockout, so interrupt-and-retry resets the count.
The fourth row closes that hole by making the delay part of the state, so that interrupting power does not reset the accumulated time. This is the implementation that turns a ten-thousand-attempt problem into an unfundable one, and it is not expensive to build.
Free attempts versus metered attempts
The distinction that matters commercially is whether an attempt is observable and whether it costs the target anything. Three cases exist.
An attempt against a device that answers instantly and never records anything is free. The attacker can run at the bus limit, and the only cost is the rig. This is the case for an EEPROM read, and it is why an EEPROM has no secrets.
An attempt against a device that records each failure is metered. The rate is now set by the recording mechanism, and the endurance of that mechanism becomes an attack surface in its own right: an EEPROM counter written on every attempt wears out after a million cycles, and a worn-out cell may read as erased, which resets the count. That is a real and underappreciated failure mode, and it means a counter in EEPROM is worse than a counter in flash.
An attempt against a device that records and delays is metered with a rising price. After a few failures the delay doubles, and the total time to exhaust the space becomes dominated by the delay rather than by the number of candidates. A ten-second delay after five failures turns ten thousand attempts into twenty-eight hours; a sixty-second delay turns it into a week.
Measuring the rate before believing the model
The single per-attempt time in the multiplication is an input, not a constant, and it is the one variable that has to be measured rather than assumed.
The measurement is a hundred attempts, timed end to end, divided by a hundred. Doing it properly requires that the hundred attempts be failures, because a success ends the loop early and biases the average downwards. It also requires that the device be in the same state at the start of each attempt as it will be during the campaign: a device that has been power-cycled has a different first-attempt cost from one that has been running.
Three effects make the measured rate differ from the datasheet’s response time.
The first is the reboot. A device that requires a power cycle between attempts adds the boot time to every attempt, and a two-second boot on a device that answers in ten milliseconds turns a rate of a hundred per second into one every two seconds. That single fact changes the campaign duration by two orders of magnitude and is discovered only by measuring.
The second is the backoff. Many designs delay after each failure, and the delay grows. The measured average over the first hundred attempts is then not the average over ten thousand, because the last thousand attempts are much slower than the first hundred. Where backoff is present, the rate has to be measured in the regime the campaign will actually occupy, which means measuring the tenth thousandth attempt rather than the first.
The third is the wear-out of the counter itself. A counter written on every attempt into an EEPROM with a million-cycle endurance will fail somewhere around attempt one million, and the failure mode is usually a cell that reads as erased. That is a route to a reset count rather than a barrier, but it is also a route to a device that no longer boots, and the customer should be told which risk applies before the campaign starts.
| Measured quantity | What it changes | How to measure |
|---|---|---|
| Attempts per second | The whole estimate | 100 failures, timed |
| Reboot time per attempt | Rate, by orders of magnitude | Power cycle and time to first response |
| Backoff schedule | Late-campaign rate | Time attempts 1, 100, 1000, 10000 |
| Counter wear limit | Whether the campaign damages the device | Datasheet endurance of the storage |
Parallelism and its limits
Running many targets in parallel divides the wall-clock time by the number of targets, and this is the one form of parallelism that genuinely works. It requires many physical devices, which is unusual: a customer usually has one failed unit, not a thousand.
Running many generators in parallel — GPUs, FPGAs, clusters — divides nothing, because the target is still answering at one attempt per second. This is the most common misconception in the field, and it comes from confusing online guessing with offline cracking. Offline cracking, where the attacker holds the hash and can test candidates locally, is limited by compute and is exactly what GPUs are for. Online guessing is limited by the target’s response rate and is not helped by a single additional FLOP.
| Attack mode | Limited by | Helped by GPU |
|---|---|---|
| Online, target answers each attempt | Response rate and counters | No |
| Offline, hash or ciphertext in hand | Compute | Yes |
| Offline, key derived from a known structure | Compute plus structure | Yes |
| Physical, per-device extraction | Equipment and operator time | No |
The table is the reason a request that arrives as “we need the password brute forced” has to be classified before it is quoted. Two of the four rows are compute problems and two are not.
Side channels beat brute force
When the space is large and the counter is real, the productive route is usually not to reduce the space by guessing but to observe the device while it decides. A comparison that returns early leaks the position of the first wrong byte, which turns an n-byte search into n single-byte searches. A four-byte PIN becomes four searches of 256, which is a thousand attempts rather than four billion.
That transformation is worth more than any amount of compute, and it is the subject of the timing side of the problem: where timing leaks sets out the four leak shapes, and preventing timing attacks in code explains the defence that removes them.
What we actually do
The service at this layer is a feasibility assessment before a campaign, and it produces one of three answers. The counter classification that decides which answer applies is in brute force on a chip.
If the counter is defeatable — volatile state, or state written only at lockout — the campaign is viable and the time estimate is the multiplication above with the measured response rate. We run it and report the candidate when found.
If the counter is not defeatable and the space is small enough to survive the delay schedule, the campaign is viable but slow, and the estimate includes the delay escalation rather than just the candidate count. Customers frequently accept this and are glad to have been told the real number.
If neither holds, the answer is that online guessing will not work, and the route is a side channel or a physical extraction. Saying that in the first conversation is worth more than a month of attempts, and the alternative routes are set out in glitch attacks as a search problem and extracting IC flash. Where the target is an EEPROM on an accessible bus, the enumeration is a read rather than a guess, as described in brute force on EEPROM.