Copyright © 2025 the Contributors to the A Formal Security Analysis of IIFAA DID in Super Apps Specification, published by the Chinese DID & VC Community Group under the W3C Community Final Specification Agreement (FSA). A human-readable summary is available.
Decentralized Identity (DID) enhances authentication and security by shifting control from centralized entities to individuals, ensuring greater privacy and autonomy. This model relies on two principles: (1) users independently manage their cryptographic keys, eliminating third-party reliance, and (2) secure verification occurs through verifiable credentials (VCs) [OID4VC] issued by trusted issuers and verifiable presentations (VPs) [OID4VP] enabling selective disclosure (of claims in VCs). A DID document serves as a unique identifier, functioning without centralized registries and promoting user-centric identity management.
This specification was published by the Chinese DID & VC Community Group. It is not a W3C Standard nor is it on the W3C Standards Track. Please note that under the W3C Community Final Specification Agreement (FSA) other conditions apply. Learn more about W3C Community and Business Groups.
Decentralized Identity (DID) enhances authentication and security by shifting control from centralized entities to individuals, ensuring greater privacy and autonomy. This model relies on two principles: (1) users independently manage their cryptographic keys, eliminating third-party reliance, and (2) secure verification occurs through verifiable credentials (VCs) [OID4VC] issued by trusted issuers and verifiable presentations (VPs) [OID4VP] enabling selective disclosure (of claims in VCs). A DID document serves as a unique identifier, functioning without centralized registries and promoting user-centric identity management.
Since 2017, real-world DID adoption has gained traction globally, with pilot application and standardization efforts such as Microsoft's Entra Verified ID [MEVID], BSN DID in China [BSNDID], and the European Digital Identity Regulation [eIDAS]. IIFAA [IIFAADID], a trusted authentication alliance in China, has played a key role in securing DID implementations. Its technical standard, compatible with Trusted Execution Environments (TEE) and Secure Elements (SE), has been adopted across 1.6 billion devices, 43 phone brands, and 900 models worldwide [IIFAAWebsite].
Mobile-based services, especially within super apps like Alipay and WeChat, are rapidly growing. By hosting diverse services via mini-programs, these apps enable seamless interactions and robust private identity management, making them well-suited for DID integration.
Security Concerns. As DID adoption grows, security concerns—such as protecting users' personal data [VC-Data-Integrity-1.0]—are increasingly relevant, especially as standards continue to evolve. Protocols like DIDComm v2.0 [DIDComm] enhance encryption and messaging, while OIDC4VC [OID4VC] expands support for credential issuance and selective disclosure. However, fragmented DID standards [Braun2024] pose security challenges. To address these, the W3C Threat Modeling Community Group (TMCG) launched in July 2024 to develop threat models. Their initial GitHub draft [W3C-threat-modeling] applies Adam Shostack's four-question framework [Shostack-4-question] for high-level security analysis. While insightful, these efforts provide only a broad overview, lacking the depth for systematic vulnerability assessment.
Motivation for Formal Analysis. Industry security audits rely on established methodologies and expert reviews. To improve rigour and consistency, we conduct the first in-depth formal analysis of a real-world IIFAA application, focusing on its mobile-based integration within Alipay. Using symbolic analysis, we clarify informal DID specifications, identify implicit security assumptions, and verify claimed security properties, despite the IIFAA standard's informal, native-language format, similar to other standards [MEVID, BSNDID, eIDAS]. Moreover, as noted in [W3C-threat-modeling], the threat model is a living document, requiring security analysis tailored to specific contexts. Therefore, we develop a super-app-specific threat model to ensure a more precise and relevant assessment. This analysis contributes to standard refinement and enhances security in real-world deployments.
Related Work. Recent studies have applied formal methods to analyze the security of DID-related protocols. Hauck [verifyOID4VC] examined OpenID for VC Issuance [OID4VC] and VPs [OID4VP] using the Web Infrastructure Model (WIM). However, this pen-and-paper analysis relies on expertise, lacks automation, and covers limited aspects of communication protocols in DID applications. Badertscher et al. [Badertscher2024] conducted the first formal analysis of DIDComm's cryptographic foundations, confirming its anonymity and authenticity while proposing protocol improvements. Braun et al. [verifySSI] analyzed a self-constructed protocol based on SSI specifications. While comprehensive in modeling a DID application's workflow, it remains abstract, relying on a limited Dolev-Yao threat model [DolevYao] and overlooking the varied ways VPs can be derived from VCs, potentially missing real-world attack vectors.
Challenges. This work bridges the gap between formal analysis and practical implementations by systematically analyzing IIFAA DID [IIFAADID] within Alipay using Tamarin [Tamarin] while preserving fine-grained details in our model. Two key challenges arise: (1) Like other DID standards [MEVID, BSNDID, eIDAS], IIFAA DID lacks a detailed specification, providing only a high-level workflow [IIFAADID], which complicates comprehensive modeling, and (2) The complexity of super apps like Alipay poses significant challenges to both formal modeling and verification in Tamarin.
Our Approach. To address these challenges, we first align the IIFAA standard [IIFAADID] with its implementation in Alipay, adding necessary details for a comprehensive formal model. Next, we define security goals using first-order logic (FOL). This is the in-depth analysis of the IIFAA DID standard under a threat model tailored to super apps.
Contributions. Super apps, likened to operating systems, integrate multiple services seamlessly. DID enables a unified, secure identity across these services. Within super apps, access control and cryptographic protocols interact with the DID infrastructure on behalf of mini-programs, introducing new security implications and the need for a dedicated threat model. This report presents the first symbolic model capturing super app and mini-program features under a realistic threat model, enabling a systematic analysis of DID security risks.
In this analysis work, we make the following contributions:
We provide an overview of DID systems, then discuss super apps and their integration with DID technologies.
A DID Document is a key component of decentralized identity, containing claims (attributes), cryptographic keys, authentication protocols, and service endpoints. These elements enable identity verification and secure communication.
A DID system facilitates credential issuance, authentication, and verification among three roles: holder, issuer, and verifier. Note that verifier corresponds to the Service Provider (SP) in the original IIFAA Decentralized Authentication Technical Specification [IIFAADID]. The issuer issues a verifiable credential (VC) to the holder, who later generates a verifiable presentation (VP) for the verifier. A key feature, selective disclosure, allows the holder to share only necessary claims while protecting other personal information.
A VC is a cryptographically secured digital certificate linking a holder to verified attributes. It contains three components: (1) Meta (metadata like validity dates), (2) Claims (verifiable information), and (3) proofVC (a cryptographic proof ensuring integrity and issuer authenticity).
A VP is a cryptographically signed document compiled by the holder, containing one or more VCs. It proves credential possession while enabling selective disclosure. Like a VC, it includes proofVP to ensure integrity and authenticity, allowing verifiers to trust the claims without contacting the issuer.
A super app like Alipay hosts multiple mini-programs, offering diverse services through a unified interface. It consists of a frontend client on the phone and a backend server operated by the super app developer, while each mini-program has its own frontend client and remote backend server. In a DID protocol within a super app, the holder, issuer, and verifier roles map to the super app client (securely managing private keys and credentials in trusted environments like TEE), the mini-program client, and the mini-program server, respectively.
Consider a mini-program on Alipay. The four entities interact as follows:
Mini-program integrity is ensured through signature verification. Upon release, the platform signs the mini-program code and configuration file (generated by the Alipay Server). The Alipay client verifies this signature before execution.
JSAPI access control rules are defined in the mini-program's configuration file. DID-related JSAPIs or plugins require explicit permission, granted only to enterprise mini-programs after a business contract. As a result, multiple mini-programs can access DID services on a holder's device, but the JSAPI link lacks additional encryption and integration protection.
Our threat model, tailored for super apps, extends the Dolev-Yao model, where an adversary can intercept, modify, and inject messages over public channels. Additionally, we consider:
Assumptions.
IIFAA DID [IIFAADID] is a high-level protocol relying on TLS and OAuth [OAuth2.0]. Following [SOAP], we assume such protocols are secure, and adversaries are constrained by cryptographic primitives. In addition, TLS sessions and the super app server remain uncompromised.
VC issuance and VP verification phases.
MP Client and MP Server stand for Mini-Program Client and Mini-Program Server, respectively.
Like other DID standards [MEVID, BSNDID, eIDAS], IIFAA [IIFAADID] is informal and written in a native language. Figure 1 outlines its implementation in Alipay for a specific mini-program on the platform. We distilled the protocol into two sub-protocols—VC Issuance and VP Verification—by manually reviewing the IIFAA standard [IIFAADID] and Alipay implementation documents. The procedures "VC Construction” and "VP Construction” will be referenced in Section 4.2.
As described in Section 2.2, the Alipay client acts as the holder, managing private keys and credentials in a trusted environment (TEE) via services provided by the Alipay server. The mini-program's client (frontend) and server (backend server) function as the issuer for VC issuance and the verifier for VP verification. Message exchanges primarily rely on JSAPI calls and TLS.
Our formal model covers the following aspects of IIFAA: (1) initialization, (2) VC Issuance, (3) VP Verification, (4) SD-JWT Data Format, (5) TLS and JSAPI Calls, and (6) Adversary Capabilities.
Initialization. The protocol starts by initializing a mini-program within a user's Alipay app using the multiset rewriting rule (MSR):
rule MiniprogramRegister:
[ Fr(~appid), Fr(~openid), Fr(~k),
!SuperApp(name, phoneNumber, userid) ]
--[ MiniprogramReg($A, userid, ~appid)]->
[ !MiniProgram($A, ~openid, ~appid),
!MLTK($A, ~k), !MPK($A, pk(~k)) ]
A variable is fresh if prefixed by ~ and public if prefixed by $. To enhance privacy, the Alipay client anonymizes userid across mini-programs, replacing it with openid [Alipay-Docs] to prevent tracking. Each registered mini-program has a unique appid. Upon registration, a persistent key pair (!MLTK, !MPK) is generated, with !MPK stored in the DID document for signature verification. The identifier $A denotes the mini-program's role, either $issuer or $verifier.
VC Issuance.
As shown in Figure 1, the Alipay user requests a
User information (e.g., name and age) is stored on the Alipay server and accessed via OAuth 2.0 [OAuth2.0], specifically the authorization code flow. Upon user consent, Alipay generates an authorization code (AuthCode) for the mini-program, which exchanges it for a short-lived access token to retrieve user data. We abstract this process, modeling only the TLS exchange between the mini-program's server and Alipay servers.
According to the basic user information, the issuer generates the claims about this user (e.g., student of Zhejiang Univ.), then constructs a VC based on the W3C standard [VC-Data-Integrity-1.0]. We model SD-JWT [sdjwt], which enables selective disclosure in a JSON-encoded structure within a JWS payload, aligning with [IIFAADID].
As shown in Figure 1, the "VC Construction" process works as follows:
VP Verification. As shown in Figure 1, a VP verification request originates from the mini-program frontend. The Alipay client, as the holder, constructs the VP using a single VC stored in TEE on the device (see Section 3).
During "VP Construction", the holder selects claims
We model a term structure in Tamarin using the tuple operator
SD-JWT Data Format.
SD-JWT [sdjwt] is a composite JSON-encoded JWS structure enabling selective disclosure.
By separating claims during VC issuance (as shown in the "VC Construction" process in Figure 1),
its signature proof remains valid even when some claims are selectively removed.
TLS and JSAPI Calls. TLS secures communication between mini-program servers and the Alipay server (10 rules), while JSAPI calls enable interactions between mini-program clients and the Alipay client (4 rules).
Adversary Capabilities. We define 10 rules to model adversary capabilities for handling mobile app hooks and private key leakage (see Section 3).
Security requirements in DID systems have been informally discussed across various ecosystems [MEVID, BSNDID, eIDAS, IIFAADID]. TMCG [W3C-threat-modeling] identifies risks through high-level evil stories, such as a verifier over-collecting data from holders or an issuer tracking holders. In a recent work, Braun et al. [Braun2024] formalize authentication lemmas for requirements like the holder presented a credential to the intended verifier but lack clear mappings to security properties like secrecy or integrity.
To address this, we refine incomplete specifications and vague formalizations with clear definitions and FOL formulas in Tamarin [Tamarin] for five security goals, supporting the formal analysis of IIFAA [IIFAADID] in Alipay.
Executability. We validate our model (see Section 5) by defining a lemma that ensures legal executions without an adversary, preventing modeling errors.
Goal 1. Secrecy. Undisclosed data and issued credentials must remain private. See: Section 5.2a “Encryption Communication” in [IIFAADID] We define secrecy as ensuring that private claims are not revealed, even to honest verifiers or third parties. Our formalization guarantees that undisclosed data and credentials are inaccessible to the Dolev-Yao adversary [DolevYao]. We use the following FOL to formalize the secrecy of a VC:
The formula states that once there exists a record of a user
Goal 2. Integrity. A credential must originate from the intended issuer and remain unmodified. See: Section 5.2.e “Data integrity” in [IIFAADID] This ensures that an issued credential cannot be forged or altered. Formally, we model integrity as non-injective authentication.
Goal 3. Injective Agreement. Each verifier-approved VP should correspond to a unique VP request. See: Section 5.2.d “Anti-replay” in [IIFAADID] This prevents replay attacks and ensures that only a legitimate holder can generate a valid VP.
Goal 4. Legal Presentation. The “wallet” presenting a VC must be the one to which it was issued. See: Section 5.2.b “Two-way authentication” in [IIFAADID] This requirement strengthens authentication by ensuring a one-to-one mapping between a VC and its designated holder, preventing unauthorized use of issued credentials.
Goal 5. Selective Disclosure. A verifier can access only a subset of the claims in a VC. See: Section 6.3 “Disclosure of Personal Information” in [IIFAADID] This enforces data minimization, ensuring that only necessary claims are disclosed while preserving the holder's privacy.
We use the following FOL formula to express this goal:
Here,
We summarize our proof effort, and provide recommendations to enhance DID security analysis.
Tamarin requires manual intervention for protocols with large state spaces. We use interactive mode to refine proof strategies, record solving steps, and apply regex-based heuristics for automation. Auxiliary lemmas further aid verification.
This work complements manual auditing by verifying IIFAA [IIFAADID] in Alipay, identifying security assumptions, and proposing mitigations for potential attacks.
Following [Morio2023,
Girol2020],
we formalize each security goal as
This rule states: if
| Goal | Property | Verified | Conditions |
|---|---|---|---|
| 1 | Secrecy |
✘ | Adversary cannot control multiple verifiers. |
| 2 | Integrity |
✔ | |
| 3 | Injective Agreement |
✘ | Challenge Code should be enabled. |
| 4 | Legal Presentation |
✘ | VP should avoid leakage. |
| 5 | Selective Disclosure |
✔ |
As shown in Table 1, our analysis validates three security goals (Executability, Integrity, and Selective Disclosure) and finds that the satisfaction of the other three goals (Secrecy, Injective Agreement, and Legal Presentation) requires additional conditions. We reported these to developers, who confirmed that mitigation solutions were deployed.
1. Multiple VPs may recover VC
The falsification of Goal 1 (Secrecy) reveals that an adversary controlling multiple mini-program verifiers can reconstruct a
The attack proceeds as follows:
In practice, enterprise mini-program verifiers undergo strict registration and audits, making it difficult—but not impossible—for an attacker to control multiple malicious mini-programs to execute this attack.
This attack underscores the need for stricter security in enterprise verifiers, including rigorous registration, auditing, and compliance checks. VP verification should also require user confirmation, particularly for sensitive data, ensuring undisclosed claims remain protected. Additionally, zero-knowledge proof technology can be employed to protect users' sensitive information, preventing verifiers from obtaining accurate personal privacy data.
2. Lack of Challenge Code Enables VP Replay
The falsification of Goal 3 (Injective Agreement) confirms a replay attack in VP verification, as noted in [Braun2024]. Like W3C standards [VC-Data-Integrity-1.0], IIFAA DID [IIFAADID] treats challenge codes as optional. While we recommend using a challenge-response mechanism to prevent replay attacks, developers argue that some applications omit it for efficiency, especially when replay attacks have inconsequential consequences.
Based on our analysis, we recommend a thorough risk assessment to balance efficiency and security, ensuring that omitting challenge codes is justified and aligns with the application's security needs.
3. Decoupling VP from Presenter Identity
Verifying Goal 4 (Legal Presentation) reveals that VPs are not directly bound to the presenter. A VP remains valid even if forwarded to another holder, creating a privacy risk where verification does not confirm the original presenter's identity.
On mobile platforms (e.g., the Alipay client), we recommend implementing VP verification as an "atomic operation" (e.g., one-click actions like "click-to-jump") to minimize the window for interception and misuse. Optionally, biometric authentication (e.g., facial or fingerprint recognition [fingerprint]) can be integrated based on risk levels, further binding a VP to its legitimate user.
A bottom-up modeling approach enhances the efficiency and scalability of DID protocol analysis, facilitating its integration into practical auditing workflows—our most valuable takeaway.
Formal analysis of protocols is highly time-consuming. Extracting the complete protocol (see Section
2.3), modeling in
Tamarin (see Section 3.1), and developing proof strategies took approximately three person-months.
The final model comprises 33 rules, totalling
In practice, the lifecycle of protocols like DID—from design to deployment—evolves rapidly, demanding a verification approach distinct from most academic security studies [SPDM, EME, 5GAKA, TLS1.3]. Existing research emphasizes low-level details (e.g., handshake mechanisms), resulting in complex models with limited scalability. The high effort required to build formal models from scratch further hinders the adoption of automated formal methods in industry.
Enhancing the efficiency of formal analysis is crucial for real-world adoption. As DID depends on infrastructure like TLS, a bottom-up approach proved effective in formalizing complex models like IIFAA DID [IIFAADID]. By initially modeling foundational components such as TLS and JSAPI, integrating these into an updated or entirely new DID protocol model becomes more streamlined. This reuse of models boosts scalability and reduces modeling and proof efforts, vital as [IIFAADID] and similar standards [MEVID, BSNDID, eIDAS] evolve.
We conducted the first formal analysis of a DID application within a super app. Our symbolic model captures the fine-grained mechanisms of DID authentication and its underlying infrastructure. Key security properties—secrecy, integrity, injective agreement, legal presentation, and selective disclosure— are formalized using FOL formulas despite incomplete and imprecise specifications. Through automated auditing based on formal verification, we have either confirmed the validity of security properties or precisely identified the conditions required for their satisfaction, while providing corresponding security recommendations.