Model NITI Aayog, 24-27 Dec, online. Write an original white paper.

How Does Ransomware Lock Up a Computer? | How It Works

12 min read

On this page

What is the short answer?

Ransomware is malicious software that locks people out of their own files or computers, then demands money to let them back in. Most of it encrypts files, scrambling them so that they can be read only with a secret key that the attacker keeps.

Agencies in the United States and the United Kingdom advise against paying. Their guidance stresses offline backups, prompt updates, multi-factor authentication and a rehearsed response plan.

Definition: The UK National Cyber Security Centre (NCSC) defines ransomware as malware that prevents access to a computer or the data stored on it, which may be locked, stolen, deleted or encrypted. The US Cybersecurity and Infrastructure Security Agency (CISA) adds that attackers then demand a ransom in exchange for decryption.

How is ransomware different from other malware?

Malware is any malicious software. The NCSC lists its harms: locking devices, stealing or encrypting data, taking over machines, stealing logins and mining cryptocurrency. Much malware tries to stay hidden. Ransomware works quietly at first, the No More Ransom project explains, then reveals itself on purpose with a demand for payment.

The project describes two main kinds:

  • Encryption ransomware scrambles files and leaves payment instructions beside them.
  • Lock-screen ransomware covers the screen with a demand but encrypts no personal files.

The project dates the first known ransomware to 1989. It stresses that encryption itself is not malicious: many honest programs use it.

How does an attack unfold, stage by stage?

The NCSC's 2023 white paper on ransomware says most incidents are not due to sophisticated techniques, and most first break-ins are opportunistic: attackers use whatever weak spot they find.

  1. Getting in: through phishing emails, devices without security updates, remote-access services exposed to the internet, or weak or stolen passwords with no second check.
  2. Spreading: some ransomware tries to reach other machines on the network, the NCSC notes.
  3. Stealing: many attackers copy data out first, so that they can threaten to publish it.
  4. Encrypting: files are scrambled and the originals deleted, No More Ransom notes; the victim may notice only when a file will not open.
  5. The ransom note: a message says the data is locked and demands payment for the key.

Each stage gives defenders a chance to stop the attack.

Why can the files not simply be unlocked?

Without the right key, encrypted data reveals nothing useful. The World 101 subject Cryptography & Digital Security explains public-key encryption; one idea matters here. With two linked keys, a public key can lock data that only the matching private key can unlock.

Early ransomware used one key both ways, and security companies could often help recover files, the No More Ransom project explains. Criminals then switched to public-key methods, keeping the private key themselves.

Guessing is no way out. The Advanced Encryption Standard (AES), published by the US National Institute of Standards and Technology (NIST) in 2001, uses keys of 128, 192 or 256 bits; the worked example shows why even 128 bits allow too many keys to try.

The project offers free decryption tools for some types of ransomware, but warns that bugs in the malware can ruin data even with the right key.

What are double extortion and ransomware as a service?

The UK Information Commissioner's Office (ICO), the data protection regulator, describes criminals who take information out before encrypting a network, then threaten to leak it unless paid: double extortion. CISA notes that attackers may also threaten to sell stolen data or login details.

So a victim can restore every file and still see private records published. The NCSC's white paper adds that some groups skip encryption and only steal and extort.

In ransomware as a service (RaaS), the NCSC explains, a group typically offers an online portal where affiliates, or customers, customise its ransomware. It is typically the affiliate that gets into victims' networks, so one piece of ransomware can serve many attackers.

What happened in the WannaCry and Colonial Pipeline attacks?

How did WannaCry affect the NHS in 2017?

On 12 May 2017, WannaCry spread worldwide; the UK government later said it hit 300,000 computers in 150 countries. The National Audit Office (NAO), an independent public spending watchdog, reported in October 2017 that in England:

  • at least 81 of 236 NHS trusts, 34%, were disrupted, and 603 other NHS organisations were infected;
  • NHS England recorded 6,912 cancelled appointments and estimated more than 19,000 in all;
  • infected organisations had unpatched or unsupported Windows systems, though NHS Digital had issued critical alerts to patch in March and April 2017;
  • no NHS organisation paid the ransom.

On 19 December 2017, the UK government attributed WannaCry to North Korean actors known as the Lazarus Group, citing an NCSC assessment that this was "highly likely".

What happened at Colonial Pipeline in 2021?

On 7 May 2021, Colonial Pipeline, a US fuel pipeline company, proactively shut down its pipeline system after a ransomware attack, the US Department of Energy (DOE) records. The FBI confirmed on 10 May that DarkSide ransomware was responsible; a CISA and FBI advisory said it had hit the company's information technology (IT) network.

CISA later recalled long lines of cars at fuel stations along the eastern seaboard. Colonial announced on 13 May that its entire pipeline system had restarted. At a US Senate hearing on 8 June 2021, chief executive Joseph Blount confirmed paying a ransom the day after the attack; senators put it at about $4.4 million. The day before, the Justice Department had said it seized back 63.7 of the 75 bitcoins paid, then worth about $2.3 million, NPR, a US news organisation, reported.

How do organisations prevent attacks and recover?

The NCSC's guidance on malware and ransomware sets out the core defences:

  • Backups: back up important files regularly, keep offline copies separate and test restoring. The 3-2-1 rule the NCSC describes means at least 3 copies, on 2 devices, with 1 offsite; it adds that backups should never all be connected at once.
  • Patching: install security updates as soon as they appear, and patch internet-facing devices immediately.
  • Multi-factor authentication (MFA) at every remote-access point, so that stolen passwords cannot easily be reused.
  • Phishing training: the NCSC warns that no training can teach people to spot every attempt, so it pairs training with technical layers and with reassuring staff that reporting brings no trouble.
  • A response plan: plan for an attack, rehearse the plan and update it afterwards.

Victims are asked to report. CISA says every US ransomware incident should be reported to the FBI's Internet Crime Complaint Center, CISA or the Secret Service; one report reaches all three. The UK government's reporting page leads to an NCSC service. In India, directions of 28 April 2022 made reporting cyber incidents to CERT-In, the national agency under the Information Technology Act, 2000, mandatory.

What do supporters and critics argue?

Should victims ever pay a ransom?

  • Against: The FBI, a US federal law enforcement agency, said in September 2016 that it "does not support paying a ransom": payment may not bring the data back and emboldens attackers. The NCSC, a UK government agency, says it and UK law enforcement do not condone paying. On 1 November 2023, the International Counter Ransomware Initiative, an intergovernmental initiative of 50 members, said its signatories agreed that relevant institutions under their national governments should not pay.
  • Why some pay: Colonial's chief executive told the Senate he paid because the company could not yet see how far the attack had spread and needed the pipeline back quickly: "I put the interests of the country first." The No More Ransom project, a police and industry partnership, notes that restoring backups can sometimes cost more than paying.

Should paying be banned, or reported by law?

  • Supporters: The UK Home Office, a government department, consulted from January 2025. On 22 July 2025, the government said it would take forward proposals to ban ransom payments by public sector bodies, such as the NHS, councils and schools, and operators of critical national infrastructure, and to make other businesses give notice before paying. Nearly three quarters of respondents backed the ban. Its release quoted the British Library, hit in October 2023, which did not pay.
  • Critics: On 3 April 2025, four authors warned, in a commentary for the Royal United Services Institute (RUSI), a defence and security think tank, that the consultation proposals "could cause more harm than good"; RUSI notes the views are the authors' own. They called retaliation by gangs "a more likely outcome", and asked what recourse a business barred from paying would have if it had no viable alternative to rescue its operations or protect its people.

How does this work with real numbers?

Both examples use illustrative inputs.

How long would guessing a 128-bit key take?

Take a 128-bit AES key and an illustrative speed of 1 trillion (10¹²) guesses a second.

  • Keys: each bit is 0 or 1, so there are 2¹²⁸ keys, about 3.4 × 10³⁸.
  • Guesses: on average, half must be tried: about 1.7 × 10³⁸.
  • Seconds: 1.7 × 10³⁸ ÷ 10¹² = 1.7 × 10²⁶.
  • Years: a year is 365.25 × 24 × 3,600 ≈ 3.16 × 10⁷ seconds, so 1.7 × 10²⁶ ÷ 3.16 × 10⁷ ≈ 5.4 × 10¹⁸ years.

That is about 390 million times the age of the universe, 13.8 billion years by NASA's figure (5.4 × 10¹⁸ ÷ 1.38 × 10¹⁰ ≈ 3.9 × 10⁸).

How much work can a gap between backups put at risk?

An illustrative school has 500 gigabytes (GB) of files, backed up nightly at 1 am to a drive that is then disconnected.

  • Attack at 3 pm: 15 minus 1 = 14 hours of new or changed files are in no backup.
  • Extra 1 pm backup: the gap falls to 15 minus 13 = 2 hours, one seventh as long.
  • 3-2-1 storage: 3 copies × 500 GB = 1,500 GB, on at least 2 devices, with 1 offsite.

The extra copy helps only if it is also disconnected, since the NCSC reports ransomware reaching connected backups.

Where can the student go deeper in World 101?

This page follows one attack from the first phishing email to the ransom note and the clean-up. The World 101 subject Cybersecurity covers the whole field of keeping computers, networks and data safe, and of bringing them back into service after an attack succeeds.

Three related subjects go further. Cryptography & Digital Security explains the mathematics of keys and ciphers, the same tools that ransomware turns against its victims. Cybercrime Law looks at how police and courts investigate crime involving computers, from gathering electronic evidence to cooperation between countries. Cyber & Critical Infrastructure examines the systems that governments treat as vital, such as fuel pipelines, hospitals and power grids, and why they need special protection.

Sources

  • CISA, "Ransomware 101" and "Report Ransomware", read 11 November 2026; CISA and FBI, advisory AA21-131A, 11 May 2021; CISA, Colonial Pipeline post, 7 May 2023.
  • FBI, Internet Crime Complaint Center announcement on ransomware, 15 September 2016.
  • UK NCSC: malware and ransomware guidance, reviewed 9 September 2021; offline backups blog, 13 August 2019; phishing guidance, reviewed 13 February 2024; white paper on the cyber crime ecosystem, 11 September 2023; ransomware hub, read 11 November 2026.
  • UK ICO, "Learning from the mistakes of others", and No More Ransom, project and Q&A pages (1989 history), both read 11 November 2026.
  • NIST, FIPS 197, 26 November 2001; NASA JPL, Planck release, 21 March 2013.
  • UK NAO, WannaCry investigation, 27 October 2017; Foreign Office attribution release, 19 December 2017.
  • US DOE, Colonial Pipeline incident timeline, May 2021; US Senate hearing, 8 June 2021; NPR, 7 June 2021.
  • GOV.UK, "Where to report a cyber incident", 13 May 2022; PIB, CERT-In directions, 28 April 2022 (Information Technology Act, 2000).
  • Counter Ransomware Initiative statement, White House, 1 November 2023.
  • UK Home Office, ransomware consultation, January to April 2025, and release, 22 July 2025 (British Library, October 2023); RUSI, "Ransomware: The Final Frontier", 3 April 2025.

Common errors and misconceptions

  • Misconception: Ransomware shows itself the moment it arrives. Correct: It often works silently first, spreading through a network and copying data.
  • Misconception: A backup on a connected drive is safe. Correct: The NCSC reports ransomware reaching connected backups, so one copy should always be offline.
  • Misconception: Paying guarantees that the files come back. Correct: The FBI and the NCSC say there is no guarantee, and No More Ransom warns that faulty malware can ruin data even with the key.
  • Misconception: Gangs carefully pick each victim and use advanced hacking. Correct: The NCSC says most break-ins are opportunistic, exploiting unpatched devices, weak passwords or missing MFA.
  • Misconception: Restoring from backups ends the threat. Correct: Under double extortion, stolen data can still be leaked.

Key takeaways

  • Ransomware blocks access to files or systems, usually by encrypting them, then demands payment for the key, as the NCSC and CISA describe it.
  • Attacks pass through stages, from getting in and spreading to stealing, encrypting and the ransom note, and each stage gives defenders a chance.
  • A 128-bit key has about 3.4 × 10³⁸ values, so guessing is impractical and recovery depends on backups, flaws or the key.
  • Double extortion adds the threat of leaking stolen data; in ransomware as a service, affiliates use a group's ransomware.
  • WannaCry disrupted at least 34% of NHS trusts in England in 2017, and Colonial Pipeline shut down its pipeline in 2021.
  • Offline backups, patching, multi-factor authentication, phishing training and a rehearsed plan are the core defences, and agencies ask victims to report attacks.

Test yourself

How does ransomware differ from other malware?

Much other malware tries to stay hidden, but ransomware works quietly at first, then reveals itself on purpose to demand payment.

Why is guessing a 128-bit key impractical?

There are 2¹²⁸ keys; at an illustrative 10¹² guesses a second, trying half takes about 5.4 × 10¹⁸ years.

What is double extortion?

Copying data out of a network before encrypting it, then threatening to leak it unless a ransom is paid.

What does the 3-2-1 backup rule mean?

At least 3 copies, on 2 devices, with 1 offsite; the NCSC adds that backups should never all be connected at once.

What did the NAO find about WannaCry and the NHS?

At least 81 of 236 trusts in England were disrupted, infected organisations had unpatched or unsupported Windows systems, and none paid.

What did the UK government say it would do in July 2025?

Take forward proposals to ban ransom payments by public sector bodies and critical national infrastructure, and to make other businesses give notice before paying.

Go deeper in World 101: Cybersecurity

Write about it

Turn a question from this chapter into a paper.

The Writing Studio has a structure guide, a rubric and citation tools for 15 formats, from essays to research papers. A free account keeps up to five drafts. Learnacy Essential adds feedback from an AI writing coach and submission to The OYI Review.

Publication depends on review and is not guaranteed.