Skip to content

Lesson 2 of 6

Risk based review

Listen to an AI summary of Risk based review

0:00 / 0:30

What is risk

Risk is how likely a weakness is to be used and how much harm would follow. Two questions help a reviewer judge the risk of a change.

The first question is who can reach the code. A person reaches code when something the person does makes the code run. Typing a word into the search box of a website makes the search code run. Exposure is who can reach a piece of code, such as anyone on the internet or only signed-in people.

The second question is what could be lost if the code had a weakness. The loss could be money or sensitive data, such as passwords or home addresses.

A team sorts changes into low, medium and high risk. The risk is high when many people can reach the code and a lot could be lost. The risk is low when few people can reach the code, or when little could be lost. Every other change is medium.

Three changes to the sports shop

Three changes to the sports shop wait for a review.

The first change fixes a spelling mistake on the help page. Anyone on the internet can read the help page, so the exposure is high. The fix changes one word, so nothing could be lost. The risk is low.

The second change adds a search box. Anyone on the internet can use the search box, so the exposure is high. The search code reads only the list of products, but the database holds other data too. A weakness in the search code could let an attacker read some of the other data. The search code handles no money and no card details, so less could be lost than in the payment code. The risk is medium.

The third change alters the code that takes payments. Anyone who buys from the shop can reach the payment code. The payment code handles money and card details, so a lot could be lost. The risk is high.

  1. Spelling fix

    Nothing could be lost. Low risk.

  2. more risk

    New search box

    Handles no money. Other data could be read. Medium risk.

  3. more risk

    Payment code

    Handles money and card details. High risk.

Three changes to the sports shop in order of risk.

Defence in depth

A control is something that stops or limits an attack, such as a check in the code. Defence in depth is using more than one control, so that a mistake in one control is caught by another.

Two locks on a bike work the same way. Each lock stands for a control. A thief who cuts one lock is stopped by the other lock. Two locks of the same kind can be cut the same way, so different controls work best.

The staff pages of the sports shop have two different controls. The first control is a password. The second control is a six digit number sent to the staff member's phone. An attacker who guesses the password does not have the number.

Relying on one control is a weakness (reliance on a single factor in a security decision, CWE-654).

Check your understanding

  1. State the two questions that help a reviewer judge the risk of a change.

    Show the answer

    Who can reach the code, and what could be lost if the code had a weakness.

  2. State the order of risk of the three changes to the sports shop, lowest first.

    Show the answer

    The spelling fix, then the new search box, then the payment code. The payment code handles money and card details.

  3. Give one reason why a team uses more than one control.

    Show the answer

    A mistake in one control is caught by another control.