Section 1.49

Integrity endorsement: when untrusted input may influence trusted state

Definition

Integrity endorsement is an explicit, authorized exception in an information-flow policy that lets one chosen untrusted value influence one chosen trusted decision or piece of trusted state. Information-flow control §1.41 labels every value with how far it can be trusted and, by default, forbids values from less trusted sources to affect more trusted state. Endorsement raises the trust label of one value, for a stated use, usually after a check. It does not make the value true; it records a decision to rely on it.

The idea

An online shop lets a customer choose how many items to order. The number comes from the customer, an untrusted source, yet it must change trusted state: the stock count and the bill. A strict integrity §1.9 policy, under which nothing untrusted may ever affect trusted state, would forbid every order. The integrity model that Kenneth Biba published in 1977 [445] has such a rule: a subject, meaning a user or a program acting for one, may not write to an object, meaning stored data such as a file, of higher integrity than its own. A useful system must let some outside input through, but only chosen input, for a chosen purpose, after a chosen check.

Endorsement is that controlled opening. It is the integrity counterpart of declassification §1.43, which lets chosen secret information flow to a less protected output. Declassification relaxes confidentiality §1.8, the protection of information against disclosure. Endorsement relaxes integrity, the protection of trusted data against unauthorized change or influence. Permission to reveal a value is not permission to let it change anything.

A customs inspection is a fair picture. An officer opens one crate, checks its contents against a rule and stamps that crate. The stamp means “this crate passed this inspection, approved by this officer”. It does not cover the other crates in the container, it does not vouch for any property the inspection did not check, and a traveler cannot stamp their own crate. The picture stops being accurate in one respect: a stamped crate stays as it was, whereas a value in memory can be changed after the check unless the program prevents it.

How it works

An information-flow system labels values and checks every flow.

  1. Labels. Each value carries an integrity label. The simplest scheme has two labels: trusted (T) and untrusted (U). Input from outside, such as a network message, is labeled U.

  2. Propagation. A value computed from several inputs receives the lowest integrity among them: if any input is U, the result is U. This includes influence through control flow. A value assigned inside a branch that was taken because of an untrusted condition is U, because the condition decided it.

  3. Trusted sinks. A sink is a place where a value takes effect. A trusted sink, such as a write to the stock count or a security decision, accepts only T values. A checker, usually part of the compiler, rejects any program in which a U value can reach a trusted sink.

  4. Endorsement. An explicit operation relabels one value from U to T. The checker then lets that value, and only that value, into the trusted sink.

Taint analysis §3.19, which marks untrusted data as tainted and follows it through a program, has the same structure: a function declared to clean tainted data plays the role of endorsement.

Three conditions make an endorsement sound.

Jif, an extension of the Java language from Cornell University, builds these conditions into the language. Its checked endorse statement has the form endorse (x, L to L') if (e) S else S'. The local variable x carries the more trusted label L' only while the condition e is evaluated and inside the statement S, which runs when e is true; elsewhere, including in S', it keeps its original label. The program may not change x inside e or S. Jif also requires that code which weakens a policy owned by a principal, a party in whose name policies are stated, holds that principal’s authority. With its robustness option, Jif further requires that the decision to endorse, meaning whether and when the endorsement runs, has high enough integrity that an attacker cannot have influenced it.

Worked example

A work queue §6.36 accepts requests from clients. Each request asks for a count xx of work items. Each item costs 20 work units, and the operator allows at most 200 work units per request, so at most 200/20=10200 / 20 = 10 items. The parser turns the request’s text into an integer xx, labeled U. The validator checks 1≤x≤101 \le x \le 10 and, only if the check passes, endorses xx as a trusted count.

The endorsement is narrow. The same request also carries the field role=administrator. Checking the count says nothing about the role, so the role stays U, and code that grants administrator rights must reject it. Labeling the whole request trusted because its count passed would endorse the role too, without any check.

Control flow needs the same care. Suppose the request also names a warehouse, A or B, and the program subtracts xx from the stock count of warehouse A if the request names A, and from that of warehouse B otherwise. The endorsed xx is trusted, but the choice between the two stock counts was made by an untrusted value, so the update is still influenced by U data. The checker flags it, and the program must justify the choice of warehouse separately, for example by checking that the client is authorized to order from that warehouse.

Finally, the check and the use must see the same value. If another thread can change xx from 8 to 50 after the check and before the queue reads it, the check protects nothing. The program copies xx into a local variable that nothing else can change, checks the copy and uses the copy. This is the time-of-check to time-of-use §9.26 (TOCTOU) problem, and Jif’s rule that x may not change inside a checked endorse addresses it within one program.

Stated precisely

Classify every input and every output of a program as trusted or untrusted. Integrity noninterference §1.42 is the property that untrusted inputs cannot affect trusted outputs: any two runs that receive the same trusted inputs produce the same trusted outputs, however their untrusted inputs differ. It is the integrity counterpart of noninterference for secrets, where secret inputs must not affect public outputs.

Endorsement deliberately breaks integrity noninterference at named points. The guarantee that can remain has this form: any two runs that receive the same trusted inputs, and in which every endorsement point released the same values, including whether its check passed, produce the same trusted outputs. In words, untrusted input reaches trusted outputs only through the endorsed values. The guarantee says nothing about whether the endorsed values are correct; it confines the influence to the places the policy approved.

The guarantee rests on three assumptions: every input that an attacker can influence is labeled untrusted; the checker sees every flow, including flows through control flow; and each endorsement is made by code that holds the authority to make it.

Limits and common mistakes

Endorsed does not mean true. A sensor reading endorsed after a range check can still come from a sensor that is badly calibrated, damaged or under an attacker’s control. A message endorsed because its signature is valid can still carry the signer’s mistake or lie.

Authentication §1.6 and validation supply different evidence. A valid message authentication code §5.7 (MAC) or digital signature §5.14 shows that the bytes came from a key holder; it does not show that the value is in range. A range check shows that the value is in range; it does not show who sent it. An endorsement must name which evidence it relies on.

An endorsement used as a cast, to silence the checker without any check, is a hole in the policy. Every endorsement is a decision someone should review: what is endorsed, by whom, after which check and for which use.

Endorsing a container endorses everything inside it. Endorse the checked field, not the message that contains it.

Withdrawing an endorsement rule later does not undo actions already taken on the strength of an earlier endorsement. The system needs its own rule for those.

Questions answered

How does endorsement differ from ordinary parsing?

Parsing changes the representation of input; endorsement changes how far the system trusts it. Parsing turns bytes into a structured value, for example the text 8 into the integer 8, and may reject text that is not a number. The integer still came from the untrusted sender and is as untrusted as the text was. Endorsement is a decision, made by code that holds the authority to make it, that this particular value may now influence a particular trusted decision or piece of trusted state, usually because a check established a property such as 1≤x≤101 \le x \le 10. In an information-flow system, which labels each value as trusted or untrusted and blocks untrusted values from trusted uses, parsing leaves the untrusted label in place and endorsement changes it, for one value and one use. A checked endorsement joins validation and endorsement: it raises the label only in the branch where the check succeeded.

Does an endorsed sensor value become true?

No. Endorsing a sensor value means that the system has decided to let it influence a trusted decision, for example because it arrived with a valid signature or passed a range check. It does not make the value correct. The sensor can be badly calibrated, damaged or manipulated, and the signer can be mistaken or dishonest. A temperature of 21 degrees that passes a check for the range 0 to 100 degrees is plausible, not confirmed. The endorsement records which evidence justified which use; the physical truth needs other evidence, such as a second, independent sensor.

Why is checking one field not enough to trust an entire message?

Because each field controls something different, and a check on one field establishes a property of that field only. A message can carry a count, a target account and a role. Checking that the count lies between 1 and 10 says nothing about whether the sender may use the account or holds the role. Trusting the whole message after checking the count would let an unchecked field, such as role=administrator, influence trusted decisions without any check. Each field that influences trusted state needs its own check and its own endorsement. Fields that select where an action applies, such as the account, need checking as much as the values written.

What does a robust information-flow argument add beyond local range checking?

It shows that untrusted data reaches trusted state only through the approved endorsement points, whereas a range check shows only that one value lies in a range at one place. An information-flow argument, usually made by a checker in the compiler, follows every path along which untrusted data could influence a trusted result, including influence through the branch a program takes. It therefore finds an untrusted value that reaches a trusted decision without any check, or one that chooses the target of an update. Robustness adds a further condition: an attacker must not be able to influence the decision to endorse, meaning whether and when an endorsement happens. The argument still rests on assumptions: the labels on inputs are right, the checker sees every flow, and each endorsement was a sound policy decision. It does not show that the policy is wise or that endorsed values are true.

Related entries: Declassification (§1.43), Noninterference (§1.42), Authorization (§1.7), Integrity (§1.9), Time-of-check to time-of-use (TOCTOU) (§9.26), Digital signature (§5.14), Information-flow control (§1.41), Taint analysis (§3.19). Further reading: [200, 445].