HabrAugust 27, 2026🇷🇺Translated from Russian

Honeytoken Traps for Detecting Compromised Backends in Encryption Key Services

The service that stores encryption keys must trust its backend application. The backend signs every request with its own key, and the signature validates correctly. If the backend is compromised, the attacker obtains the signing key and can issue perfectly valid requests for any document. All normal issuance checks pass because nothing unusual has occurred from the service’s perspective.

This article describes a detection mechanism, not a prevention control. It assumes an attacker who has already taken over the backend or stolen a service token and is replaying old grants. Rate limits and threshold-based emergency blocking already exist; the new system focuses on reliable detection of slow, careful exfiltration that stays within those limits.

Core Idea: Canary Identifiers Unknown to the Backend

A fake user and a fake document are created. In normal operation these identifiers are never referenced by any interface, workflow, or real user. Therefore any request for them is a high-confidence signal. The approach follows the classic honeytoken pattern, but its implementation must satisfy one strict constraint: the alarm signal cannot originate from the component being monitored.

Consequently the list of canary identifiers lives exclusively inside the key service and is never exposed to the backend. The backend cannot learn which identifiers are traps or avoid them.

Storage as Keyed Hashes

Storing plaintext identifiers would be insecure because user and document IDs are often predictable. The service therefore stores only keyed HMAC-SHA256 digests:

def canary_digest(key: bytes, value: str) -> str:
    return hmac.new(key, value.encode("utf-8"), hashlib.sha256).hexdigest()

The HMAC key resides solely inside the key service. Without it, an attacker who obtains the stored hash list cannot enumerate possible identifiers.

The runtime detector is implemented in a small CanarySet class that performs two HMAC calculations per request and returns either “user”, “document”, or None.

Configuration and Seeding

Four environment variables control the feature:

  • KEYSVC_CANARY_HMAC_KEY_FILE – path to the secret HMAC key file
  • KEYSVC_CANARY_USER_HASHES – JSON array of user canary digests
  • KEYSVC_CANARY_DOCUMENT_HASHES – JSON array of document canary digests
  • KEYSVC_CANARY_AUTOLOCK_ENABLED – whether to trigger emergency lock on hit

A separate seeder program creates realistic-looking records by calling the normal /wrap endpoint, obtaining genuine wrapped keys, and computing the corresponding digests. The digests go into the key-service configuration; the identifier-plus-wrapped-key pairs are inserted into the production database as ordinary rows with no visible markers.

Placement of the Check

The canary test runs after signature validation, lifetime checks, replay protection, and context matching, but before envelope decryption. This placement guarantees that only legitimately signed requests from the trusted backend can trigger the alarm and prevents an unauthenticated attacker from causing an emergency lock.

Silent Response and Internal Actions

When a canary is hit the external response is identical to a normal context-mismatch or locked error. No distinct “canary tripped” status code is returned, because a distinguishable response would allow the attacker to map the trap and avoid it in future. Internally three actions occur in order: an audit record of type “canary_trip” is written, an alert is raised to external monitoring, and, if autolock is enabled, the service erases its master keys and enters the emergency-locked state.

Production Validation

Live tests on a deployed instance confirmed the expected behavior: a normal document request succeeded, a canary request produced a silent 409 locked response, master-key material was cleared, and both the canary_trip and emergency_lock events appeared in the audit trail.

Limitations

The system detects only bulk scraping or user-enumeration attempts that touch the planted canaries. Targeted extraction of documents belonging to a single real user will not trigger it. It is a detection layer for the key-service tier only; equivalent traps are still required in the document store and backend itself.

Related articles

HabrOther

From Root CA to User Authorization in nginx and Apache: Client Certificate Login Explained

This is the third installment in a detailed tutorial series covering the deployment of a two-tier PKI infrastructure with Root CA and intermediate CAs for Person, Server, and Code. The article provides comprehensive configuration guidance for enabling mTLS in nginx and Apache, including full references for all ssl_client_* variables and SSL directives. It explains the differences between password-based and certificate-based authentication, the TLS handshake steps involving CertificateRequest and CertificateVerify, and the importance of proper extendedKeyUsage settings such as clientAuth. Readers learn how to issue client certificates, package them in PKCS#12 format, enforce revocation checks via CRL and OCSP, and safely pass certificate fields to backend applications while mitigating risks from header spoofing. The guide also covers scenarios where the application itself terminates TLS without a reverse proxy and demonstrates login flows protected against CSRF using one-time tokens.

安全客Other

Yisaqi Automation Magician Delivers Self-Healing RPA to Fix Low ROI in Enterprise AI Agents

Meituan's internal experiment revealed that widespread AI agent adoption drove daily token costs into the millions while introducing errors into business processes. MIT research confirmed that 95 percent of generative AI pilots fail to deliver measurable returns despite tens of billions in spending. Yisaqi's Automation Magician addresses these gaps by extending the agent lifecycle beyond conversation to include exploration, automated testing, self-healing, and export of stable scripts. The platform uses natural language input to generate resilient automation flows that adapt to UI changes without repeated model calls. Deployments at Jiage Food and a major central SOE financial shared service center demonstrate large-scale coverage of tax, finance, and manufacturing processes with minimal manual intervention. Zhongtian Technology reported 80 percent efficiency gains and annual savings exceeding one million yuan after rolling out the solution across 112 scenarios.

AntiMalwareOther

Aeroflot to Accept Digital Rubles for Ticket Purchases Starting September 2026

From September 1 2026 Aeroflot will begin accepting digital rubles as a payment method for airline tickets both on its website and in company sales offices. Customers choosing the new option online will see a QR code generated by the site that must be scanned in a participating bank application. The payment is then confirmed from the digital wallet hosted on the Bank of Russia platform and an electronic ticket plus receipt are issued automatically. The same QR-based flow will be used at physical ticket counters where the code appears on the terminal. Ordinary bank cards and other payment methods remain fully available and no physical digital cash is required. On the same date MTS will start accepting digital rubles through MTS Pay while Rostelecom and Megafon are also preparing their systems. Russian authorities have clarified that the digital ruble is the third official form of the national currency alongside cash and non-cash funds rather than a cryptocurrency.

AntiMalwareOther

Russia Permits 5G Deployment on Existing 4G Infrastructure and Frequencies

The Russian Ministry of Digital Development has prepared a draft decision for the State Radio Frequency Commission that introduces technological neutrality for mobile networks. Major operators including Beeline, Megafon, MTS and Tele2 will be allowed to launch 5G services on spectrum and base stations already allocated for LTE. The measure covers foreign equipment installed before September 2026 and aims to accelerate commercial 5G rollout without waiting for entirely new infrastructure. Additional spectrum in the 4.63-4.99 GHz band will be allocated for high-capacity use cases, although these frequencies offer limited coverage. Commercial 5G services must appear in cities with over one million residents by the end of 2027, with gradual expansion through 2031. Domestic base stations are scheduled to replace foreign equipment between 2027 and 2031.