Contents

Close

ESEN

Writing6 min read

A square wheel turns too

A system that works is not thereby better. Reviewing a home-built one, I asked the obvious question, compared with what and at what cost, and then I measured.

A square wheel turns too. Mount it on an axle and give it a push, and round it goes, lurching forward, and whoever built it can film it and say, quite rightly, that it works, although nobody would want it on their car. The phrase comes to me every time I review a system built by hand, because it sums up a very common confusion, the one that takes “it works” to mean “it is better”.

That a system works does not show it to be better than what already exists, which is why I always put the same question to a home-built solution, compared with what and at what cost, and answer it by measuring, since that is the only way for the answer to outlast the meeting.

In security, moreover, the standard option has a virtue that is easily forgotten, because the boring choice, the one everybody makes, can be certified, has been reviewed by others for years and makes sense to any newcomer. Rejecting it because it is what everyone does is an aesthetic argument, and in a system that keeps secrets it comes at a price. A design of one’s own starts life with none of those advantages, with no attacks survived, no certificates and a single person who understands it from top to bottom, the one who wrote it, so it may be very good and still go out into the world carrying those debts, and to make paying them off sensible it has to bring something the standard does not offer, something that can be measured.

Some time ago I led the independent technical review of a system for encrypted communication between servers, which a colleague had built on his own, with a great deal of work and no little ingenuity, and whose project had already been approved. He was also a friend, so before opening the code I set myself a rule, to be serious and informal at once, hard on the system and careful with the person. Every observation was about the code and what the code did, with its test alongside, so that nothing written could be read as a judgement on whoever had programmed it, and the trust between us made it possible to say things as they were, without beating about the bush.

I focused the review on a hard question, whether the system offered clear and measurable advantages over the standard solution, and since the project was going ahead in any case, I turned the outcome into something that could be used the next day, a list of improvements ranked by priority. Each one came with its problem, the evidence behind it, a proposal, its impact and the effort it would take, so that the outstanding work was already in order by the time the list had been read.

The basics held up, and I said so plainly. The system compiled, meaning its code translated without complaint into the machine’s own language, its tests passed, the tests with random inputs, which bombard a program with arbitrary data to see whether anything gives, found no faults, and the performance was what its documentation promised.

Compared with what

The comparison with the standard gave a clear answer, because the home-built design was many times more expensive per message, in both size and computation, and in most cases offered no security advantage to make up for it. The image I used to explain it was the post, where the standard solution puts many letters into a single armoured van while the home-built design sent each letter in its own van, with its own escort and its own notary, so the letters arrive just as safely and the bill is another matter. None of that makes the system insecure, and even so every message pays a price the standard does not charge.

Now comes the detail of how messages were being lost, and anyone who wants to get to the point can skip it.

Under heavy traffic in both directions at once, the system lost messages it had already accepted, and part of that loss was silent, with no warning and no trace. A message lost with a warning is a nuisance, because someone sends it again, whereas one lost after being acknowledged leaves a gap the system knows nothing about, and in communication between servers that is about as bad as it gets. The internal tests were many and very long and never caught it, because real use sent traffic in one direction only and the tests imitated real use, in the same way that a fire drill always run through the same door goes perfectly every year until the day that door is blocked and the other one has never been rehearsed. Once he knew, the author went back through his old tests and found a single lost message he had never been able to explain.

Instead of writing a report on the loss, I handed him an automated test that failed with his code and would pass once he had fixed it, because a failing test is more persuasive than any report and moves the conversation from opinion to evidence. The author fixed it, kept measuring on his own and found another, subtler loss by himself, so he answered the review with more work of his own, and when I verified it the loss stood at zero across millions of messages. A test like that also stays in the code and runs again every time anyone touches that part, years after everyone has forgotten the review.

Every fix has a side effect that has to be tracked down. To solve a performance problem, the author had spaced out a periodic security operation, one of those repeated at intervals so that nothing goes stale, and under heavy traffic it still happened often, while under light traffic it could go weeks without happening, precisely when nobody is watching.

3 pedals

The tests also confirmed a problem I had spotted on paper, because by replaying a captured message, without any credentials, meaning the password or permission that identifies whoever is calling, a server could be forced to carry out a very expensive operation every time, and dozens of replays per second were enough to overwhelm it. When attacking is cheap and defending is expensive, the attacker wins the sums, however well locked the rest of the system may be.

Whatever could not be tested without real infrastructure was declared as unverified, with the recommendation that the author test it in his own environment, because with outstanding work I always operate the same way. “If there is work left, it gets done.” And what I could not do from outside was written down for the person who could.

During the review, the author resisted the standard solution precisely because it was standard, since it seemed too ordinary to him, what everybody does, and I understand that, because we all like our work to have something of its own. “Inventing a bicycle with three pedals is novel, but it adds nothing.” The one people ride to work every morning has 2 and has gone more than a century without any surprises.

The standard option has already been through every surprise, and been through them in other people’s systems, so whoever chooses it inherits years of failed attacks and of fixes they did not have to pay for, and can spend their ingenuity on what is genuinely theirs. Choosing it takes no credit away from whoever does so, because ingenuity is still needed in everything around that piece, which is where each system stakes whatever it has of its own.

Shortly afterwards I saw the plans for his next version, which bring many new parts and, among them, without any fuss, the standard solution.

Round wheels need no introduction.