Summary
The Aqara IAM/SSO gateway exposes an unauthenticated service that performs AES encryption and decryption using the platform's signing key.
An attacker can remotely access this bidirectional "crypto oracle" over the network, enabling key misuse and offline cryptographic attacks that undermine the confidentiality of tokens and signed data.
Affected context
This vulnerability occurs in the Aqara IAM/SSO gateway (gw-builder.aqara.com), where a backend cryptographic endpoint is reachable without authentication.
The service exposes AES operations directly against the platform's signing key, effectively turning the gateway into a round-trip encryption/decryption oracle.
The issue is relevant in deployments where this gateway participates in authentication, SSO flows, or token signing and where the crypto service is reachable over the internet or from untrusted networks.
Exploit preconditions
- Attack surface: Public or network-accessible IAM/SSO gateway endpoint (gw-builder.aqara.com).
- Required access: No prior authentication or special privileges; attacker only needs network reachability to the gateway.
- Trigger point: Invocation of the AES "round-trip" or signing-key backed cryptographic operations exposed by the gateway.
- Why exploitation is possible: Critical cryptographic functions tied to the platform signing key are callable without authentication (CWE-306), and the design exposes a symmetric cipher oracle that can be abused for cryptanalytic or key-recovery style attacks (CWE-327).
Why this happens
The core issue is the exposure of a critical cryptographic function without any authentication or access control.
Instead of limiting use of the platform signing key to tightly controlled, server-internal flows, the gateway presents an API that allows arbitrary AES encryption and decryption using that key.
This pattern violates the principle of cryptographic key isolation and turns the system into a practical encryption/decryption oracle, which is categorized as CWE-327: Use of a Broken or Risky Cryptographic Algorithm, compounded by CWE-306: Missing Authentication for Critical Function.
Conceptually, the design treats cryptographic primitives as a remote "utility" for untrusted callers, rather than encapsulating them behind higher-level, policy-enforcing authentication and authorization logic.
Potential impact
- Attackers may leverage the AES oracle to derive or approximate the signing key, depending on mode and implementation details.
- Attackers could decrypt or forge cryptographically protected tokens, cookies, or SSO artifacts encrypted or signed with the same key material.
- Sensitive internal data that relies on the signing key for confidentiality may be exposed or weakened.
- Long-term trust in the IAM/SSO ecosystem could be undermined, enabling impersonation or bypass of authentication flows.
General mitigation guidance
Effective mitigation focuses on removing direct, unauthenticated access to cryptographic key operations and hardening key usage boundaries:
- Restrict cryptographic functions to authenticated, authorized, and strongly audited paths; do not expose generic "encrypt/decrypt" endpoints using production signing keys.
- Encapsulate signing and encryption within higher-level protocols that enforce identity, purpose, and context (e.g., token issuance APIs that issue specific token types rather than raw crypto).
- Use distinct keys per function (signing vs. encryption vs. test utilities) and segregate them so that compromise of one does not expose others.
- Apply least-privilege to services that can access signing keys and ensure key material is stored and used via secure hardware or key management services where possible.
- Design cryptographic APIs to be non-oracle-like, limiting an attacker's ability to submit arbitrary chosen plaintexts or ciphertexts and receive direct round-trips.
How teams detect issues like this
Organizations can identify and monitor similar weaknesses using several approaches:
- Static analysis and code review rules that flag endpoints or services invoking low-level cryptographic primitives directly in request handlers, especially when tied to global signing or encryption keys.
- Architectural reviews that map key usage, highlighting any path where untrusted input directly influences cryptographic operations with long-lived keys.
- API gateway or service-mesh policies that prohibit unauthenticated access to endpoints tagged as "crypto utilities" or "keyed operations".
- Logging and monitoring for high-volume or unusual patterns of cryptographic API calls that resemble oracle-style probing from external sources.
- Periodic penetration testing focused on IAM/SSO components to ensure no raw encryption/decryption or signing endpoints are exposed.

