HabrAugust 27, 2026🇷🇺Translated from Russian

Deleted Database Records Remain Recoverable in SQLite Files Despite DELETE Operations

A routine request to delete personal data often ends with a simple DELETE FROM clients WHERE id = ... command. The application reports success because the row disappears from query results and exports. However, the underlying database file still contains the full record, including names and card numbers, which can be recovered with basic tools such as grep.

SQLite behavior and the secure_delete pragma

SQLite marks the page containing the deleted row as free for reuse but does not overwrite its contents when secure_delete is set to 0. The following sequence demonstrates the problem: a database is created with 200 rows, 46 rows are deleted, and the table reports only 154 remaining rows. Searching the file nevertheless finds the deleted name and card number.

The pragma secure_delete = 1 forces the database engine to overwrite freed space with zeros at the moment of deletion. The same search then returns zero matches. The default value depends on the compile-time flag SQLITE_SECURE_DELETE, which varies across distributions and platforms. Therefore the same application can behave differently on a server, in a mobile build, or on a desktop client.

Other database systems exhibit similar issues

  • PostgreSQL marks row versions as dead; physical removal occurs only during VACUUM or VACUUM FULL. Write-ahead logs also retain previous page versions.
  • MySQL with InnoDB releases pages without overwriting them and keeps historical values in undo logs and the binary log.

In every major system, executing DELETE is not equivalent to erasing the data from storage media.

Real-world impact on data protection obligations

Companies responding to deletion requests typically confirm only that the row is absent from the live table. When a database file is later seized or leaked, previously deleted records remain readable. Backup copies created before the deletion continue to hold the data for their entire retention period. Replicas used for reporting and analytics frequently receive the record in a daily export and keep it indefinitely. Mobile application database dumps sent to support teams commonly contain every record the user ever deleted.

Recommended controls

For SQLite, enable immediate overwriting with PRAGMA secure_delete = ON and run VACUUM after large deletions. For server databases, the only reliable approach is to encrypt sensitive fields with a key that is destroyed when deletion is requested; old backups then become unreadable. Organizations should also store less data, enforce retention periods directly in the schema, and include backups, replicas, and analytics exports in every deletion procedure.

Related articles

HabrPrivacy & Surveillance

Amnezia VPN Survives Coordinated Russian Censorship Campaign Targeting AmneziaWG Protocol Fingerprints

Amnezia VPN has published a detailed post-mortem on the multi-wave blocking campaign conducted by Russian authorities against its Amnezia Free and Amnezia Premium services during June and July. The company describes a shift from simple protocol blocking to sophisticated fingerprinting of AmneziaWG traffic combined with infrastructure DDoS attacks and automated IP-subnet blacklisting. Engineers closed multiple detection vectors including zero-length UDP packets, fixed-size keepalive messages, handshake timing patterns, and nonce zero bytes. The incident forced accelerated migration to AmneziaWG 2.0, discontinuation of legacy client support, and development of AmneziaWG 3.0 while expanding VLESS infrastructure as a backup. Self-hosted users largely avoided direct protocol blocks but still faced subnet-level restrictions. The report highlights how Roskomnadzor now applies cumulative scoring across multiple traffic features rather than single definitive markers.

HabrPrivacy & Surveillance

Data Masking: 8 Critical Questions Businesses and Developers Ask About Protecting Sensitive Data

Garda expert Dmitry Larin addresses common challenges in data masking during a recent webinar titled 'Data Masking: Battle of Opinions'. The discussion covers why masking remains essential even when encryption is deployed, how to preserve application functionality after anonymization, and the performance trade-offs of processing large databases such as 5 TB PostgreSQL instances. Different masking types including static, dynamic, selective, and streaming are explained with specific use cases for DevOps pipelines, external contractors, and BI systems. The article also examines why machine learning alone is insufficient for discovering personal data and why custom scripts fail at scale across heterogeneous environments like PostgreSQL and Oracle. Practical recommendations include combining masking with encryption, using deterministic transformations for deduplication, and separating replication from masking tasks to avoid production impact.

AntiMalwarePrivacy & Surveillance

MAX Desktop Client Tested for VPN Detection on Windows, No Tracking Signs Found

A Habra user named Slava_B conducted an experiment on September 8, 2026, to determine whether the MAX desktop client on Windows could detect or route traffic through a VPN configured at the router level. The setup used a Keenetic router that directed Russian resources directly while sending other connections via an OpenConnect tunnel to a European VPS, with no VPN client or virtual adapter present in Windows itself. Monitoring tools including Process Monitor, Wireshark, TCPView, and tcpdump revealed that MAX.exe and MAX-service.exe processes communicate locally and connect to MAX/ONEME infrastructure along with AppTracer services. The application repeatedly accessed MachineGuid, computer name, proxy settings, device IDs, and microphone/camera information, though these reads may support diagnostics and anti-fraud functions. No connections appeared on the VPN interface, and the client did not attempt to reach IP-checking services, Telegram, or WhatsApp. The researcher noted that TLS traffic was not decrypted, so actual transmission of identifiers could not be confirmed, and results apply only to this router-based configuration.

HabrPrivacy & Surveillance

PII-Guard: Open-Source Detector for Personal Data in Russian Text

Andrey Ivanov, an NLP researcher at red_mad_robot, has released PII-Guard, an open-source system that detects and masks personal data in Russian text before it reaches language models. The tool combines rule-based checks with a fine-tuned ruBert-base NER model to handle names, addresses, phones, passports, INN, SNILS, bank cards and other entities. It replaces detected PII with structured XML-like tags that preserve grammatical information such as gender and entity ID, allowing models to generate coherent responses that are later restored with real values. The hybrid pipeline first applies normalization, pattern matching, Luhn and weighted checksum validation, and context windows with positive and negative keywords, then merges results with model predictions via an arbitration module. Evaluation on four public datasets, including Hivetrace, alexen2 and alrosait, shows PII-Guard outperforming other open solutions on both strict span matching and type-overlap micro-F1 metrics. The project, including datasets and code, is available on GitHub and aims to reduce leakage risks while maintaining downstream model utility.