Skip to main content

Hit by ransomware? Isolate affected systems now. Do not reboot or reformat.

SheMo Noransom舍末无勒

Scenario solution

Database Encrypted by Ransomware

  • Microsoft SQL Server
  • Oracle Database
  • MySQL
  • MariaDB
  • PostgreSQL
  • 达梦 DM
  • 人大金仓 KingbaseES

When database files are encrypted, every business system that depends on them stops at once. This page explains how we triage an encrypted database, how recoverability is assessed, and when file repair, backup-plus-log restore, or rebuild is the right path.

Typical symptoms

  • Data and log files carry an appended extension, such as ERP.mdf.locked, orcl.dbf.[random-id].weax or ibdata1.crypted
  • The database service fails to start; the error log reports an invalid file header, a page checksum failure, or that the physical file cannot be opened
  • Applications report connection failures or timeouts; business systems hang at login or return blank pages
  • Ransom notes in TXT / HTML / HTA form appear in the data and backup directories, and the desktop wallpaper has been replaced
  • Backup files (.bak, .dmp, .sql, archived redo logs) are encrypted as well, or the backup directory has been wiped
  • Unknown local administrator accounts exist on the host, and RDP logs show external IP logons outside normal maintenance windows

Business risk & common mistakes

A database is usually the only authoritative copy of a company's data. When it is encrypted, finance, production, inventory, clinical and academic systems fail simultaneously — and downtime is normally determined by the recovery plan, not by the malware. Most prevalent families now use double extortion, exfiltrating data before encryption, so data-exposure and regulatory notification obligations must be assessed alongside the outage.

In practice, what makes data unrecoverable is rarely the encryption itself. It is what happens next:

  • Repeatedly rebooting the host or restarting the database service generates new writes, overwrites unallocated space, and lets the engine damage files that were still repairable.
  • Formatting, reinstalling the OS, or reinstalling the database into the original directory overwrites residual files and recoverable fragments.
  • Running recovery software against the original disk and writing results back to the same volume — self-overwrite, the most common irreversible mistake.
  • Running the attacker's decryptor, or a "universal decryption tool" downloaded from the web. The first often decrypts only part of the data and leaves a backdoor; the second frequently carries a second encryption stage or a miner.
  • Restoring an already-encrypted .bak or .dmp over production files, destroying the last usable material.
  • Disabling endpoint protection and then bringing the host back online to investigate, before the entry point has been closed.

Our position is explicit: we do not recommend paying, and we do not act as negotiators. Payment neither guarantees a working key nor removes the organisation from the target list.

Our response plan

  1. Isolate and preserve evidence

    Disconnect the network but do not rush to power off — memory, sessions and live logs matter. Take a read-only image or storage-layer snapshot of the data volumes; all later analysis and recovery runs against the copy. Collect ransom notes, encrypted samples, suspicious binaries, Windows security logs, database error logs, RDP and firewall logs, scheduled tasks and service inventories.

  2. Identify the family and encryption behaviour

    Determine family and version from the extension, ransom note filename, contact patterns and sample characteristics, then use entropy distribution to establish the encryption mode: full-file, intermittent (encrypt n bytes, skip m bytes), or header/footer only. This single step decides how many usable pages remain inside the database file, and it cannot be guessed.

  3. Assess recoverability

    Score three paths and state a conclusion for each: whether a public decryptor exists for this family and version; how much table data file-level repair can extract, given the encryption coverage established above; and what point in time backup-plus-log restore can reach, given the completeness of full, differential and log backups. The deliverable is a written assessment covering recoverable scope, achievable recovery point, gaps and timeline — before any implementation.

  4. Execute recovery

    Work in an isolated recovery environment, against the image. Prefer backup plus log replay to the latest usable point. Where no usable backup exists, perform page-level repair and data extraction, loading readable tables and rows into a fresh instance and reconciling table by table with the business owners. Where neither suffices, rebuild the schema and load whatever data can be obtained, stating explicitly where the gaps are. Every step is logged, and critical operations are double-checked.

  5. Harden and sign off

    Remove persistence and backdoors (rogue accounts, services, scheduled tasks, web shells), rotate all credentials, and reduce exposure by removing port forwards and restricting database listener addresses. Rebuild the backup architecture with at least one offline or immutable copy, and run a real restore drill. Sign-off is measured in business terms: row counts on key tables, closing balances, latest document numbers — accompanied by an incident report and hardening recommendations.

Recovery paths

There are five possible recovery paths after a database is encrypted. Their preconditions differ sharply, so assessment must precede action — the wrong order destroys data that was still recoverable.

PathPreconditionsTypical outcome
Public decryptorFamily keys leaked or algorithm flawed, and version matchesFull file-level restoration, but only for a small number of families
Encrypted-file repairHeader/footer-only or intermittent encryption, most data pages intactReadable table data extracted; indexes, LOBs and some rows may be lost
Backup plus log restoreFull backup unencrypted, transaction / archived redo / binlogs availableBest outcome; recovery close to the point of failure
Snapshots and VSSVSS is usually deleted, but storage, hypervisor and NAS snapshots may surviveRollback to snapshot time, losing subsequent changes
Low-level carvingDisk not heavily overwritten; deleted backups, exports or tempdb remnants existIncomplete data, used as a supplement

Points we state plainly:

  • File repair produces readable data, not the original file. For large databases, families that encrypt only the header often allow most business data to be recovered; against full-file encryption this path is largely ineffective.
  • There is no universal decryption method. Current families protect per-file keys with asymmetric cryptography; without the key there is no mathematical shortcut. Public tools exist only under specific conditions.
  • We do not use phrases such as "100%" or "guaranteed recovery", and we do not quote a recovery rate before assessment. The assessment states what can be recovered, to which point in time, and what is definitively lost.
  • No ransom payment, no negotiation on your behalf. Where insurers, legal counsel or regulators need to be briefed, we supply the technical facts and reports.

Common ransomware families

Hardening recommendations

  • Keep database servers off the public internet. Never port-forward 1433, 1521, 3306, 5432 or 3389; route remote administration through VPN plus a jump server with MFA. Public reporting indicates RDP brute force and vulnerability exploitation together account for close to 80% of ransomware delivery in China.
  • Tighten database accounts. Eliminate weak and default passwords (especially sa, system, root), disable high-risk extensions such as xp_cmdshell, separate database accounts from domain accounts, and give application connection strings least-privilege credentials.
  • Follow 3-2-1-1 for backups: three copies, two media types, one off-site, and at least one offline or immutable (WORM / object lock). Keep the backup server out of the production domain with dedicated, non-reused credentials.
  • A "backup succeeded" message proves nothing. Run real restore drills on a schedule, record actual RTO/RPO, and verify both file readability and database consistency.
  • Deploy EDR on every database server, with tamper protection, shadow-copy protection and ransomware behaviour blocking enabled. Do not exempt database hosts out of performance anxiety.
  • Patch the front end too. Beyond the database engine itself, ERP, OA, middleware and web applications need patching — a large share of database compromises begin at an exposed application.
  • Segment the network and whitelist ports. Allow only required ports from application servers to the database tier, and never let the office network reach the database segment directly.
  • Retain logs for at least six months, with database auditing, failed-logon alerting and anomalous-export alerting, so the entry point can be traced afterwards.

Emergency response

Data already encrypted? Stop and let an engineer look first

We do not pay ransoms and we do not negotiate with attackers. Engineers run a free assessment first, then propose a recovery plan and a firm quote.

Related questions

Related industries

FAQ

Frequently asked questions

  • Can an encrypted database still be recovered?

    Often yes, but it depends on three objective conditions: the family's encryption mode, how complete the backups and logs are, and whether overwriting operations occurred after the incident. Large database files are frequently only header/footer-encrypted or intermittently encrypted, leaving most data pages intact and allowing readable table data to be extracted; if full backups and transaction logs survive, the outcome is better still. Conversely, full-file encryption combined with wiped backups and a site that has been repeatedly rebooted and reformatted leaves very little room. A real answer comes from assessment, not from a promise.

  • Our database is hundreds of GB — was only part of it encrypted?

    Very likely. To finish before detection, most families encrypt only the beginning (sometimes also the end) of large files, or use intermittent encryption — encrypt a block, skip a block. LockBit, BlackCat, Play and Qilin have all advertised intermittent encryption. For databases this matters: rows live in pages spread across the whole file, and untouched pages still hold complete data. However, encryption coverage must be measured with entropy analysis; it cannot be inferred from file size, and it must not be probed by trying to start the database.

  • Should we reboot the server or try to start the database service?

    No. Isolate the network first and preserve the current state while you engage incident response. Repeatedly starting the database service lets the engine keep writing to and rolling back damaged files, potentially destroying pages that were still extractable. Rebooting also discards valuable memory artefacts and overwrites unallocated disk space, hurting both carving and attribution. The correct sequence is: disconnect, document the scene, stop writing to the original disk, image or snapshot the data volumes read-only, then analyse the copy.

  • Our backup files were encrypted too — is it hopeless?

    Not necessarily. Attackers usually go after online, reachable backups first, but several copies are often missed: storage- or hypervisor-layer snapshots, read-only or immutable snapshots on a NAS, media held off-site or offline, older exports in dev/test environments, and application-side intermediates such as end-of-day exports, reconciliation files and report snapshots. An encrypted .bak may itself be header-only encrypted and still worth repairing. We inventory all of these sources rather than trusting the backup console alone.

  • How long does it take from first contact to business recovery?

    Remote access normally begins shortly after the engagement is confirmed; isolation, evidence preservation, family identification and an initial recoverability read typically yield a directional conclusion within hours. Actual recovery duration depends on data volume, encryption coverage and backup completeness: cases with usable full backups and logs are fastest, while cases requiring page-level repair and table-by-table business reconciliation take considerably longer. We provide a staged timeline during assessment rather than a single vague figure up front.

  • Will you negotiate with the attackers for us?

    No. We do not negotiate and we do not advise paying. Payment cannot guarantee a working key or a complete decryptor, it funds further attacks, and it places the organisation on a list of targets worth revisiting. We put our effort into technical recovery, root-cause attribution and hardening. Where you need to brief insurers, counsel or regulators, we provide a factual technical report to support that.

Updated