Habr•September 9, 2026•🇷🇺Translated from Russian

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

PII-Guard, an open-source detector for personal data in Russian text, has been released by NLP researcher Andrey Ivanov from the R&D laboratory of red_mad_robot. The system addresses the growing need to protect sensitive information when users and companies send working texts to language models.

Personal data such as names, phone numbers, document numbers and addresses frequently accompany prompts. Companies therefore build masking pipelines that anonymize text before model inference. However, simple masking destroys semantic links, forcing models to answer questions about “**** called ****” without knowing how many people are involved or who called whom.

The new requirement is reversible pseudonymization: real values must be replaced by structured placeholders that models can process naturally, after which the original data is restored in the final answer.

From regex to hybrid detection

The first prototype relied on regular expressions. While telephone numbers, INN, SNILS and card numbers have predictable length and structure, real-world text contains spaces, dashes, typos and extra characters that break rigid patterns. Moreover, a 16-digit sequence could be either a bank card or an order ID, and a 10-digit string could match both INN and passport formats.

Control-sum verification was added next. Bank cards use the Luhn algorithm, INN and SNILS employ weighted sums, and OMS policies again apply Luhn. Additional structural checks cover BIK prefixes and postal-index ranges. These filters reduced false positives, yet arithmetic validation alone cannot distinguish a genuine document from a coincidental numeric string that happens to satisfy the checksum.

Context windows were introduced to look for nearby cue words such as “паспорт”, “ИНН” or “полис”. Positive keywords must lie within type-specific distance limits; negative keywords such as “биржевой” can veto an index match regardless of distance. When multiple candidates compete, the system selects the highest-confidence match after ordering document types from most distinctive (birth certificates, military IDs) to most ambiguous (simple six- or ten-digit sequences).

Adding semantic understanding

Names, addresses and telephone numbers lack rigid formats, so rules cannot locate them reliably. The team therefore annotated their own datasets and fine-tuned a ruBert-base NER model. The model handles semantic entities such as person names and addresses while also capturing documents missed by rules because of typos or irregular spacing.

The final architecture runs two independent streams. The rule-based stream normalizes text, extracts candidates, validates checksums and applies keyword context. The model stream processes the entire text and returns its own spans. An arbitration module merges results: when spans overlap but labels differ, rules win; when only the model finds an entity, its prediction is accepted; non-overlapping spans from both streams are retained.

Pseudonymization and grammatical restoration

Detected entities are replaced by XML-style tags containing type, numeric ID and, for persons, grammatical gender inferred by a Russian morphology library. The tag format was chosen to avoid accidental collisions with ordinary text or other system markup. After the model returns its answer, real values are substituted back, with morphological analysis ensuring correct case for names and addresses.

Evaluation was performed on four public datasets, one of which is the team’s own. On the intersection of entity types supported by all compared systems, PII-Guard achieved the highest micro-F1 scores under both strict span matching and type-overlap criteria. The project, datasets and code are publicly available.

Related articles

Habr•Privacy & Surveillance

MTS Mobile Exit Selectively Drops TLS Connections to Hetzner, Apple, Microsoft and Other Providers

Measurements from two separate runs on 29 and 30 November show that a single MTS mobile exit belonging to AS30881 (TENSOR) silently drops connections after large ClientHello messages to 18 out of 144 tested addresses. The affected destinations include Hetzner, OVH, DigitalOcean, Vultr, Contabo, Akamai-hosted Apple and Microsoft addresses, plus several other major clouds and CDNs. The same addresses remain reachable from a second MTS segment (AS48176), from MegaFon, and from a Frankfurt control point. The pattern matches an address-list filter rather than congestion, because neighboring prefixes from the same providers stay unaffected and the drop occurs at a consistent byte threshold of roughly 34-36 KB. Tests with plain HTTP on one Cloudflare address produced identical behavior, confirming that TLS is not required. Researchers emphasize that the measurements cover only one specific MTS exit and do not prove nationwide deployment or involvement of TSPU equipment.

AntiMalware•Privacy & Surveillance

Russian Networks Exhibit HTTPS and VPN Disruptions After 16KB of Data Transfer

Developers from Red Atlas have documented a traffic restriction affecting connections from certain Russian networks to foreign hosting providers. TCP connections establish normally and TLS handshakes complete successfully, yet data flow stops after the first 16,384 bytes of decrypted content. The issue was observed consistently across all tested addresses of Hetzner, Vultr, DigitalOcean, Contabo, and OVH when routed through MTS AS30881. Standard connectivity checks such as port scanning may still return positive results, masking the limitation from basic diagnostics. Researchers note that the 16KB threshold aligns with the maximum size of a single TLS record, suggesting a content-filtering mechanism that inspects decrypted traffic. A comparable filtering approach was previously reported by Cloudflare in June 2025. Red Atlas introduced a specialized test using oversized TLS ClientHello messages to distinguish this behavior from server-side failures.

Habr•Privacy & Surveillance

Russian ISP MTS Blocks TLS Data Transfers to Foreign Hosts After 16KB

A new network filtering mechanism has been detected on MTS network AS30881 that interrupts TLS connections to overseas hosting providers once roughly 16,384 bytes of application data have been received. The interference allows the TCP handshake and TLS handshake to complete normally, after which the connection simply stalls without RST or FIN packets. Red Atlas researchers confirmed the behavior on all tested addresses belonging to Hetzner, Vultr, DigitalOcean, Contabo and OVH when accessed through this specific network. The same test produced no interruptions from other Russian mobile and datacenter networks including MTS AS48176, MegaFon and Timeweb. The effect matches earlier observations reported by Cloudflare in June 2025 and appears to be implemented via deep packet inspection that drops or ignores subsequent packets after a volume threshold. A lightweight Python probe using oversized ClientHello messages with padding extension has been released to allow independent verification of the filtering boundary.

Habr•Privacy & Surveillance

Replacing Names with [PERSON_1] Before Sending Contracts to External LLMs: Does This Qualify as Anonymization Under Russian Law?

Russian organizations frequently need to analyze multi-page contracts containing personal data such as full names, passport details, INN, and phone numbers using external large language models. Simply replacing names with placeholders like [PERSON_1] may not meet the legal threshold for anonymization if the remaining context still allows identification of individuals. Roskomnadzor Order No. 140, effective since September 1 2025, outlines specific methods including identifier introduction, semantic modification, decomposition, shuffling, and array transformation that must be evaluated together. Companies must assess whether the processed query alone or combined with other data available to the provider could lead to re-identification. The correspondence table linking labels to original values must remain strictly inside the organization and separate from the processed data. Additional checks are required for repeated mentions in appendices, job titles, company names, exact amounts, and dates that could link back to public procurement records or court cases.