Server systems and the flaws built into software

8 min 6 sections 4 practice questions 14 sources citedISC2 objective 3.5

A server is a computer that provides a service to many people at once, from email to payroll. Because it is shared, reachable and always running, a flaw in its design or its programs affects everyone who depends on it. No technical background is assumed. A security professional recognises the classic flaws by name, knows how each is exploited, and chooses the control that removes it.

By the end of this unit you will be able to:

  • Explain server hardening, single-purpose servers, data flow control and load balancing
  • Describe how a buffer overflow and a time-of-check to time-of-use flaw are exploited
  • Tell apart a covert storage channel and a covert timing channel
  • Tell apart a maintenance hook, a rootkit, data diddling and a salami attack
  • Name the controls against emanations, including TEMPEST and the zone of control

A cash register that kept a penny from every order

An illustrative example

A fast food outlet's manager notices that takings are slightly down every week, although the restaurant is as busy as ever. The till software shows no errors, and the auditors find the totals add up.

Months later a member of staff boasts that he changed the till's program. It charges each customer the full price but records every order one penny lower. Each night he takes the matching pennies from the drawer.

No single loss was large enough to notice. What kind of fraud is this, and which control finds it?

A server is shared, exposed and always on

A server holds data for many users and answers requests from the network around the clock. Its weaknesses are rarely exotic: unneeded services left running, default accounts left in place, missing updates and settings that drift over time.

Hardening
Removing every service, account and sample file the server does not need, and setting the rest to a recorded secure configuration. Removing is better than disabling, since a disabled service can be switched back on.
Single-purpose server
One main job per server, such as web or database, never both. A flaw in one service then cannot expose the other.
Data flow control
Rules that decide where information may travel between systems, such as allowing the web server to reach the database and nothing else.
Load balancing
A device that spreads requests across several identical servers, so that heavy demand or one failed server does not stop the service.

A single point of failure is any one part whose loss stops the whole service: one server, one power supply, one network link. Load balancing and redundant parts remove it. A design review looks for every such point.

Buffer overflow: more data than the space allows

A buffer is a fixed space in memory set aside to hold input. A buffer overflow happens when a program copies input into a buffer without checking that it fits.

A surname field with room for twenty letters

A booking program sets aside room for a surname of up to 20 characters and copies whatever arrives into it.

An attacker sends 200 characters. The extra 180 overwrite the memory beside the buffer, including the address the program will jump to when the current task finishes.

The attacker shapes the extra characters so that this address points back into their own input, which holds instructions. The program then runs the attacker's instructions with the program's own rights.

The root cure is bounds checking: the program checks the length of every input before copying it, and refuses or trims anything too long. Languages that manage memory automatically, called memory-safe languages, make the check for the programmer. Data execution prevention and address space layout randomisation make an overflow harder to exploit but do not remove the flaw.

Time of check to time of use

A ticket inspector checks a passenger's ticket at the platform gate. Between the gate and the train, the passenger hands the ticket back over the barrier to a friend. The check was correct when made, and wrong by the time it mattered.

A time-of-check to time-of-use (TOCTOU) flaw is the same gap in a program. The program checks a resource, such as whether a user may write to a file, and then uses it a moment later. If the resource can change in between, the check no longer applies. An attacker who swaps the file for a link to a protected one in that instant writes where they were never allowed.

A check can be true when made and false when used

A check can be true when made and false when usedAlong a line of time: the program checks a file, then a gap in which the attacker swaps the file for a link to a protected one, then the program uses the file and changes the protected file. Beneath, the fix joins check and use into one step.Programchecks fileuser may write:yesProgram usesfiletrusts theearlier checkProtected filechangednever allowedThe gapfile can still changeAttacker swapsfilelink to aprotected fileFix: one stepcheck and use made indivisible,or the file locked throughoutA check can be true when made and false when usedAlong a line of time: the program checks a file, then a gap in which the attacker swaps the file for a link to a protected one, then the program uses the file and changes the protected file. Beneath, the fix joins check and use into one step.Programchecks fileuser may write:yesProgram usesfiletrusts theearlier checkProtected filechangednever allowedThe gapfile can still changeAttacker swapsfilelink to aprotected fileFix: one stepcheck and use made indivisible,or the file locked throughout
Read this figure as text

A time-of-check to time-of-use flaw is a gap in a program between checking a resource and using it. If the resource can change in between, the check no longer applies. It is one kind of race condition.

  1. First the program checks a resource, such as whether this user may write to this file, and finds that the user may.
  2. In the short gap that follows, the file can still change. The attacker swaps it for a link to a protected file.
  3. The program then uses the file, trusting the earlier check, and writes to it.
  4. The write lands on the protected file, where the user was never allowed to write.
  5. The fix, drawn beneath the whole interval: make the check and the use one indivisible step, lock the resource for the whole operation, or check again at the moment of use.

is one kind of race condition: an outcome that depends on which of two actions happens first. State attacks exploit the same weakness more broadly, by acting while a system is between states, for example after a session is checked but before it is locked to one user.

The controls are to make the check and the use one indivisible step, to lock the resource for the whole operation, and to check again at the moment of use.

Covert channels: storage and timing

A covert channel is a path that lets one process pass information to another in a way the forbids, using something never designed for communication. Overt channels are the designed ones, such as files and messages, which already check.

The two kinds of covert channel
KindHow information passesExample
Covert storage channelOne process writes to a shared place that another can readA high-level program fills a shared disk to mean 1 and empties it to mean 0
Covert timing channelOne process changes its use of a resource so that another sees response times changeA program loads the processor heavily for 1 and lightly for 0, and a low program times itself

defeat Bell-LaPadula, which governs only designed reads and writes. Controls are to find them during design, reduce the shared resources between levels, add noise or fixed timings to slow them, and audit for unusual patterns. The Trusted Computer System Evaluation Criteria (the Orange Book) required covert storage channel analysis from class B2, and covert timing channel analysis as well from class B3.

Maintenance hooks, rootkits and small repeated frauds

Some flaws are put there on purpose.

Maintenance hook
A hidden way into a program left by its developers for testing or support, which bypasses normal security. It is also called a back door or trap door. Code review before release finds it; the fix is to remove it.
Rootkit
A set of tools an attacker installs after gaining the highest level of access, to hide their presence and keep that access. It alters what the operating system reports. , checking and rebuilding the system answer it.
Data diddling
Changing data before or as it is entered, such as altering a delivery quantity on its way into the system. Input checks, and reconciliation answer it.
Salami attack
Taking many slices too small to notice, such as fractions of a penny from every account. Audits that chase even tiny discrepancies answer it.

Signals that leak: emanations

Every screen, cable and keyboard gives off faint electrical and radio signals as it works. Emanations are those signals. With the right equipment, an eavesdropper nearby can sometimes rebuild what was on the screen or typed on the keyboard.

TEMPEST is the United States government name for the study and control of compromising emanations. Four controls are named.

  • Shielding: equipment, or a whole room, enclosed in conducting metal, a Faraday cage, that stops signals escaping.
  • White noise: transmitting meaningless signals that mask the real ones.
  • Control zone: keeping the space around the equipment, called the zone of control, large and controlled enough that no eavesdropper can get close.
  • TEMPEST-rated equipment: devices built and tested to give off less.
Seven design flaws: what goes wrong and the main control
FlawWhat goes wrongMain control
Buffer overflowInput spills past its space and becomes instructionsBounds checking, memory-safe languages
TOCTOUThe resource changes between check and useMake the check and the use one step
Covert channelInformation leaks through a path never meant for itDesign analysis, fewer shared resources
Maintenance hookA hidden entrance bypasses securityCode review, removal before release
RootkitAn attacker hides inside the operating systemSecure boot, integrity checks, rebuild
Data diddling and salamiSmall or early changes to data go unnoticedInput checks, reconciliation, audit
EmanationsSignals leak to a nearby eavesdropperShielding, white noise, zone of control

A question, worked through

A bank's new payment server is due to go live on Monday. A code review finds an undocumented account, used by the supplier's developers during testing, that signs in without the normal checks. The supplier says its support staff still need it.

What should the bank's security manager require?

  1. The supplier removes the hidden account before go-live
  2. The account stays, and every use of it is logged
  3. The account's password is changed and given to the supplier
  4. The account is blocked at the firewall but kept in the code
Decide on your answer, then open the reasoning
  1. The finding is a maintenance hook: a hidden entrance that bypasses normal security. The question is what to require before go-live.
  2. Rule out b. Logging records misuse after it happens. The hidden route still bypasses every check.
  3. Rule out c. A new password leaves the route outside the normal checks, and shares it with more people.
  4. Between a and d: blocking at the firewall depends on one rule staying correct. Any route that reaches the server from inside still opens the hook.
  5. Removing the hook removes the flaw. Support access then goes through a normal, named and monitored account.

Answer: A. The supplier removes the hidden account before go-live

Choosing between good answers

An answer offers to monitor a flaw and another to remove it
prefer removal of a design flaw such as a maintenance hook. Monitoring is the fallback when removal is impossible.
A check is correct when made and wrong when used
name it TOCTOU, a race condition. Choose the answer that makes check and use one step.
Information leaks through disk usage or response times, not through files
name it a covert channel: storage if a shared place is written, timing if response times change.
Many tiny losses go unnoticed
think salami attack, and choose audit and reconciliation of even small discrepancies.
A question concerns signals leaking from equipment
think emanations and TEMPEST: shielding, white noise and a controlled zone.

Try it

A flaw is found in a server already in use. Decide whether to remove, contain or monitor it, and say who decides.

Loading the preview.

Check your understanding

4 questions on this unit, easiest first. Confirm an answer to see the reasoning for it, then the right answer, the other options and the rule to reuse. Your answers are kept in this browser and feed readiness and review.

These questions are drafts that no named reviewer has approved yet.

Question 1 of 4

On a multilevel server, a Secret process slows its replies to a shared service to signal 1 and answers quickly to signal 0. A Confidential process measures how long its own requests take.

What kind of channel is this?

What to remember

  • Servers are hardened by removing what is not needed, running one main job each, controlling data flows, and removing single points of failure with load balancing and redundancy.
  • A buffer overflow writes input past its space; bounds checking removes it.
  • A TOCTOU flaw is a race between a check and its use.
  • A covert storage channel writes to a shared place; a covert timing channel varies response times.
  • Maintenance hooks and rootkits are hidden code. Data diddling alters data on entry; a salami attack takes many tiny slices.
  • Emanations are leaking signals, controlled by shielding, white noise and a zone of control under TEMPEST.

Say it from memory

  1. What weaknesses affect server-based systems, and which controls answer them?

    Servers are shared, exposed and always on. Harden them, give each one main job, control data flows, and remove single points of failure with load balancing. Classic flaws: buffer overflow (bounds checking), TOCTOU and race conditions (one-step check and use), covert storage and timing channels, maintenance hooks, rootkits, data diddling, salami attacks and emanations (TEMPEST controls).

    Read this part again

  2. How does a buffer overflow let an attacker run their own instructions, and what is the root cure?

    The program copies input into a fixed buffer without checking that it fits. The excess overwrites neighbouring memory, including the address the program will jump to, which the attacker points back at instructions in their own input. The root cure is bounds checking: check every input's length before copying, and refuse or trim anything too long.

    Read this part again

  3. What is a time-of-check to time-of-use flaw, and what are its controls?

    A program checks a resource and uses it a moment later; if the resource changes in between, the check no longer applies. It is one kind of race condition. The controls are to make the check and the use one indivisible step, lock the resource for the whole operation, and check again at the moment of use.

    Read this part again

  4. How does a covert storage channel differ from a covert timing channel, and from which Orange Book classes was each analysis required?

    In a storage channel one process writes to a shared place another can read. In a timing channel one process changes its use of a resource so another sees response times change. Covert storage channel analysis was required from class B2, and covert timing channel analysis as well from class B3.

    Read this part again

  5. What are a maintenance hook, a rootkit, data diddling and a salami attack?

    A maintenance hook is a hidden way into a program left by its developers, also called a back door; remove it. A rootkit is tools installed after gaining the highest access, to hide and keep it. Data diddling changes data before or as it is entered. A salami attack takes many slices too small to notice.

    Read this part again

  6. What are emanations, and what four TEMPEST controls answer them?

    Emanations are the faint electrical and radio signals that screens, cables and keyboards give off, from which an eavesdropper can sometimes rebuild what was shown or typed. The controls are shielding in a Faraday cage, white noise, a zone of control, and TEMPEST-rated equipment.

    Read this part again

Sources