Definition
Availability is the security property that authorized users can obtain the service they need, within the time they need it. It is stated for a given load and set of failures: which requests, at what rate, with which parts broken or under attack, must still receive a response within which time. Availability fails when a resource that the service needs, such as processor time, memory, connections or worker threads, is used up or held by someone else. An attack on availability is called a denial of service §1.28.
The idea
A server correctly rejects every request that is not authorized. An attacker sends only invalid requests, and sends them slowly: each one arrives a few bytes at a time and is never finished, and each one holds a worker thread, one of the few instruction sequences the server runs to handle requests, while the server waits for the rest. When all workers are waiting, a legitimate user’s request finds no free worker and gets no answer. No wrong decision was ever made, yet the service is gone: correct decisions about each message do not ensure capacity to make the next decision. The attack on web servers known as Slowloris works this way.
A restaurant with four tables is a fair picture. Four people who sit down and never order block every real diner, although nobody was served the wrong meal. The picture stops being accurate in one respect: an attacker on a network can take a seat thousands of times per second, at almost no cost, from many different addresses. So the design must decide in advance how many seats one party may take, how long a seat may be held without ordering, and which seats are kept for whom.
How it works
Availability is analyzed by following each scarce resource from the moment a request takes it to the moment the request gives it back. Typical resources are connection slots, worker threads, buffers in a memory pool, processor time, locks, storage space, radio airtime §18.2.19 and, on a battery-powered device, energy.
Find where each resource is first taken. It is often taken before the request is authenticated: a connection slot when the first packet arrives, a buffer when a header announces a length.
Bound each request. Limit the size a request may claim, the processor time it may use and how long it may hold a resource. A timeout §9.34, a rule that ends a wait after a fixed time, helps only if it really frees the resource.
Bound the total. Limit how many requests may hold a resource at once, in total and for each source, and how fast new requests are admitted. Rate limiting §9.38, which caps how many requests a source may send per unit of time, is the usual tool.
Release on every path. Success, rejection, error and timeout must all give the resource back. A path that forgets to release leaks the resource, and an attacker who can trigger that path drains the resource completely.
Put cheap checks before expensive work. Check the length, the format and the sender’s rate before verifying a signature or reserving a large buffer.
Decide what happens when a limit is reached. Refuse new requests, drop the oldest waiting one, or give priority to clients that have already authenticated. Keep some capacity for operations that must never be blocked, such as the commands that repair the system.
The classic case is the SYN flood against TCP (Transmission Control Protocol). A TCP connection starts with a handshake of three packets, and the first one is named SYN, short for synchronize. Early servers reserved memory for every SYN they received and kept it until the handshake completed or timed out. An attacker who sent many SYN packets from forged addresses, and never completed a handshake, filled the server’s table of half-open connections, and real clients could no longer connect. SYN cookies remove that reservation: the server encodes the state it needs in the sequence number of its reply, and reserves memory only when the third packet of the handshake, the client’s acknowledgment, arrives carrying that number plus one.
Worked example
A server has 4 worker threads and a 10-second timeout for incomplete requests. An attacker opens one new incomplete request every 2.5 seconds. Each request holds a worker for 10 seconds before the timeout frees it, so at any moment attacker requests are in progress, and all 4 workers are busy. Little’s law §14.39 gives the same number [88]: the average number of requests inside a system equals their arrival rate times the average time each one stays, here . The timeout did free each worker, but the attacker refilled it at once. Cutting the timeout to 2 seconds forces the attacker to send requests per second instead of 0.4, which is still cheap. Limiting each source address to 1 request in progress forces the attacker to use at least 4 addresses. Keeping 1 of the 4 workers for clients that have already authenticated preserves service for them, whatever unauthenticated clients do.
A second example concerns processor time. Handling one request takes at most 2 milliseconds of processor time, and the service promises to handle 1,000 requests per second on one processor core. In the worst case that needs milliseconds of processor time per second, but one core supplies only 1,000 milliseconds per second. The promise cannot be kept in the worst case. The largest rate the core can guarantee is requests per second, and less once other work needs the core. If measured requests usually take 0.1 milliseconds, 1,000 of them use only milliseconds per second, which fits. But an attacker sends the requests that cost the most, so a guarantee that must hold against an attacker is computed from the worst-case cost, not from the measured average.
Stated precisely
A security availability claim names a load envelope and a promise. For example: as long as authorized clients send at most requests per second in total, and any number of other requests arrive and are subject to the admission limits, every authorized request receives a response within seconds. The attacker’s load must be bounded somewhere: by an assumption, such as a limit on the packets the attacker’s link can carry, or by a mechanism that discards the excess before it consumes anything scarce.
For one resource, the basic condition is arithmetic. Let be the amount of the resource available per second, the admitted request rate and the largest amount that one admitted request can consume. Service for every admitted request can be guaranteed only if The condition is necessary but not sufficient. Requests that arrive together still wait for each other, so the response time §9.32 also depends on bursts, priorities and waiting for locks, which a scheduling analysis must cover.
Reliability engineering measures availability as a fraction of time. Let MTTF (mean time to failure) be the average time the system runs before it fails, and MTTR (mean time to repair) the average time it takes to restore it. The long-run fraction of time the system is up is With an MTTF of 999 hours and an MTTR of 1 hour, , called three nines. That allows hours of downtime §18.5.14 in a year of 365 days, which has hours. The formula assumes that failures arrive at random. It does not describe an attacker who causes a new failure every time the system is repaired.
Limits and common mistakes
No finite system serves unlimited hostile load. An attacker with more bandwidth than the victim’s network link fills the link before any check on the server runs; only filtering before that link helps.
Valid does not mean affordable. Authenticated requests can be expensive too, and a compromised or faulty legitimate client can exhaust the service, so limits apply to authenticated requests as well.
A timeout that does not release the resource changes nothing. If a thread is blocked inside a call that cannot be canceled, ending the wait in the caller leaves the thread and its memory held.
Fail closed §1.13, refusing service whenever a check cannot complete, protects integrity §1.9 and confidentiality §1.8 at the cost of availability. An attacker who can make the check fail at will turns that refusal into a denial of service.
Amplification multiplies an attack. A small request that triggers a large response or a long computation lets a weak attacker exhaust a strong service.
Recovery needs reserved capacity. If the repair command competes for the same exhausted resource, the attacker blocks the repair as well.
Availability as a security property differs from reliability. Reliability concerns random faults; availability against an attacker also covers someone who chooses when and how to load the system.
Questions answered
Can invalid requests monopolize a connection, worker, or memory pool?
Yes. Invalid requests can monopolize a connection, a worker or a memory pool whenever the system gives them the resource before it finds out that they are invalid and holds it until that check finishes. Typical cases are a connection slot taken when the first packet arrives, a worker that waits for the rest of a request that never comes, and a buffer reserved for the length a header announces before the message is authenticated. Rejecting each request correctly does not help if the rejection comes after the resource was taken. The defenses are:
reserve as little as possible before cheap checks have passed, and nothing large before authentication §1.6;
limit how long each request may hold a resource, and make the timeout really release it;
limit how many resources requests may hold at once, in total and per source, and how fast new requests are admitted;
release every resource on every path, including errors and timeouts;
keep some capacity for authenticated clients and for recovery commands.
Valid requests need limits too, because an authorized but expensive request exhausts resources in the same way.
Related entries: Denial of service (DoS) (§1.28), Resource confinement (§2.40), Schedulability (§9.37), Rate limiting (§9.38), Connection-slot exhaustion (§7.35), Fail closed (§1.13), Little’s law (§14.39). Further reading: [88].