ContentsThe library

The Mistakes Behind Most Breaches

Follow It From the Field to the Place It Runs

Last timeAsking for Somebody Else's Record

Somebody typed something into a box. Trace it, hop by hop, to a place that interprets it, in a browser or on your own server, and then close that path properly.

The places that interpret

The first lesson gave the cause. This lesson is the exercise, because

nobody fixes this class from the principle alone. You fix it by following

a particular field, in a particular system, to a particular place that

interprets it.

So it helps to know the destinations in advance. In a page: text

assembled into markup and inserted into the document, the contents of an

event handler attribute, the target of a script or image, the body of a

style. On your own server, which people forget entirely: a template

compiled from supplied text, a serialised object turned back into an

object, a path that reaches a shell, and any evaluator your language

offers.

FIG 1One field, and every place it comes to rest
Twelve nodes from one field, and only one of the leaves is safe. The useful property of drawing it this way is that the branches, not the root, are where the work is: cleaning at the root cannot know which branch a value will take.

Tracing one field through

The procedure is mechanical and it is worth doing by hand once, on your

own system, before automating anything.

FIG 2The tracing worksheet
plaintext
field:        the display name on a profile
filled in by: anybody with an account

hop 1  the form submits it
hop 2  the server stores it unchanged
hop 3  the profile page reads it
         destination: set as the text of a node
         verdict: displayed
hop 4  the member list reads it
         destination: assembled into markup
         verdict: interpreted, finding
hop 5  a weekly report reads it
         destination: a mail template
         verdict: interpreted, finding
hop 6  an operator screen reads it
         destination: assembled into markup
         verdict: interpreted, finding
hop 7  a data export writes it
         destination: a file opened elsewhere
         verdict: interpreted by the reader, finding

four of seven hops interpret it, and the
one safe hop is the page it was designed for
One field per sheet. The column that matters is the last one: the function or construct that received the value at its destination, because that is what decides whether the value was displayed or interpreted.

Two habits make this find things. Start from the field, not from the

page, because a page shows you what it uses and not what uses it. And

follow the value through storage rather than stopping at the first

screen, since the whole difficulty of this class is that the dangerous

consumer is usually the one written later by somebody else.

The lesson stops here

4 more paragraphs to go

You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.

The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.

See the planThe contents

This is the reading half

Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.

The contents

The rest of this course

  1. 01One Mistake, Wearing Different Clothes
  2. 02The Caller Is Not Running Your Softwareopening only
  3. 03The Most Common Serious Finding There Isopening only
  4. 04Follow It From the Field to the Place It Runsyou are here
  5. 05Your Server Can Reach Things Nobody Outside Canopening only
  6. 06Nobody Chose This, Which Is the Problemopening only
  7. 07Most of What You Ship, You Did Not Writeopening only
  8. 08Could You Reconstruct It Afterwardsopening only

Read alongside