Introduction
We express our gratitude to the Europeum team for the collaborative engagement that enabled the execution of this Smart Contract Security Assessment.
The project implements an EVM-based Decentralized Identifier (DID) registry that conforms to the W3C DID Data Model, allowing users to register on-chain DID documents and manage their controllers, verification methods, and verification relationships. Access to mutating operations is gated by DID controllership or, alternatively, by policies resolved through an external policy registry contract.
Document | |
|---|---|
| Name | Smart Contract Code Review and Security Analysis Report for Europeum |
| Audited By | Khrystyna Tkachuk |
| Approved By | Kerem Solmaz |
| Website | https://europeum.eu/→ |
| Changelog | 28/07/2026 - Preliminary Report |
| 10/08/2026 - Final Report | |
| 12/08/2026 - Updated Final Report | |
| Platform | Private Chain |
| Language | Solidity |
| Tags | Upgradable, Decentralized Identity (DID) |
| Methodology | https://docs.hacken.io/methodologies/smart-contracts→ |
Document
- Name
- Smart Contract Code Review and Security Analysis Report for Europeum
- Audited By
- Khrystyna Tkachuk
- Approved By
- Kerem Solmaz
- Website
- https://europeum.eu/→
- Changelog
- 28/07/2026 - Preliminary Report
- 10/08/2026 - Final Report
- 12/08/2026 - Updated Final Report
- Platform
- Private Chain
- Language
- Solidity
- Tags
- Upgradable, Decentralized Identity (DID)
Review Scope | |
|---|---|
| Repository | https://gitlab.com/europeum/public/core-services/→ |
| Commit | 89bb63b |
| Final Commit | 7f13e31 |
| Updated Final Commit | d1535ba |
Review Scope
- Commit
- 89bb63b
- Final Commit
- 7f13e31
- Updated Final Commit
- d1535ba
Audit Summary
The system users should acknowledge all the risks summed up in the risks section of the report
Documentation quality
Functional requirements is partially missed.
Project overview is suficient.
All roles in the system are not described..
Use cases are not described.
Technical description is provided.
Run instructions are provided.
Technical specification is provided.
NatSpec is insufficient and partially missing for core functions.
Inline comments are present
Code quality
The code leverages OpenZeppelin 5.6.1 (
Initializable) and shared in-house primitives (Pagination,ImplementationInitSelector), and follows the established beacon-proxy upgradeable pattern with a reserved storage gap.The codebase is well-structured and clearly organized, with a clean split between the entry contract, interfaces, and storage-struct libraries.
The development environment is configured.
Test coverage
Code coverage of the project is 91.78% (statement coverage).
Deployment and basic user interactions are covered with 38 passing tests.
The test suite exercises the protocol's core end-to-end features covering both success and revert paths for document insertion, controller add/revoke with the 10-controller cap, verification method add/revoke/expire/roll, relationships, pagination, and policy-based authorization via a mocked policy registry.
System Overview
The system is built around a single upgradeable facade contract, DidRegistry, which is intended to be deployed behind a beacon proxy. Upgrade safety is provided through OpenZeppelin's Initializable pattern, with the constructor disabling initializers via _disableInitializers, an initialize function performing one-time setup, a storage __gap reserved for future variables, and the ImplementationInitSelector mechanism exposing the initializer selector through getImplementationInitSelector. The contract holds three internal storage structures (DidDocuments, Controllers, and VRelationships) whose types are declared in the interface files, and business logic is delegated to three external libraries bound to these structures through using ... for directives. This library-based composition keeps the facade thin while isolating document, controller, and relationship logic into dedicated modules.
State-changing operations follow a consistent pattern in which DidRegistry performs authorization, delegates to the relevant library, and emits an event. Authorization is enforced by the internal onlyControllerOrAuth routine, which first checks whether msg.sender maps to an active capabilityInvocation verification method of one of the DID's controllers, and otherwise queries the external IPolicyRegistry contract via checkPolicy to determine whether the caller is authorized for a named policy attribute. This creates a cross-contract dependency between the registry and an externally deployed policy registry supplied at initialization. Read operations expose paginated views of DIDs, DIDs by controller, and DIDs by verification relationship using the external Pagination utility, and support point-in-time document resolution by filtering verification methods and relationships against a supplied timestamp.
The subsystems are organized by concern. The document subsystem, driven by DidDocumentLib, manages the lifecycle of DID documents, verification methods, and verification relationships, including insertion, updates, key rolling, revocation, and expiry, and derives EVM addresses from secp256k1 public keys. The controller subsystem, driven by ControllersLib, maintains reverse indexes linking controllers to the DIDs they control. The verification relationship subsystem, driven by VRelationshipsLib, maintains time-bounded relationship records indexed by a hash of relationship name and verification method identifier. Supported relationship types follow the W3C DID vocabulary, namely authentication, assertionMethod, keyAgreement, capabilityInvocation, and capabilityDelegation. String comparison across all modules is centralized in UtilsLib.
Files in Scope
DidRegistry.sol: Upgradeable facade contract that stores DID document, controller, and verification relationship state, and exposes external functions such as
insertDidDocument,updateBaseDocument,addController,revokeController,addVerificationMethod,addVerificationRelationship,revokeVerificationMethod,expireVerificationMethod, androllVerificationMethod. It enforces authorization throughonlyControllerOrAuthand_checkController, provides paginated and timestamp-based read views, and integrates with an external policy registry.DidDocumentLib.sol: Core library operating on the
DidDocumentsstorage structure that handles DID document creation and mutation, includinginsertDidDocument,updateBaseDocument,addController,revokeController,addVerificationMethod,addVerificationRelationship,revokeVerificationMethod,expireVerificationMethod, androllVerificationMethod. It also builds timestamp-filtered document views viagetDidDocumentByTimestamp, validates relationship names viaisValidRelationshipName, and derives addresses from public keys throughgetAddressandsanitizePublicKey. It defines theMAX_CONTROLLERSconstant of 10.ControllersLib.sol: Library that maintains the controller-to-DID reverse index, providing
linkDidToControllerto append a DID under a controller andunlinkDidFromControllerto remove it using swap-and-pop with index remapping.VRelationshipsLib.sol: Library that manages time-bounded verification relationship records keyed by a relationship identifier, exposing
addVerificationRelationshipto append a DID with its validity period andupdateVerificationRelationshipto adjust thenotAftertimestamp of an existing entry.UtilsLib.sol: Utility library providing the
equalStringshelper, which compares two strings by length and keccak256 hash for use across the other modules.
Privileged roles
DidRegistry.sol
DID Controller: An address that holds an active
capabilityInvocationverification method belonging to the target DID or any of its linked controller DIDs, validated through_checkControllerinside theonlyControllerOrAuthgate. Authorized to modify a DID document it controls.Can call
updateBaseDocumentto replace the base document of the DID.Can call
addControllerto link an additional controller DID.Can call
revokeControllerto unlink a controller DID.Can call
addVerificationMethodto register a new verification method.Can call
addVerificationRelationshipto register a new verification relationship.Can call
revokeVerificationMethodto revoke a verification method with a pastnotAfter.Can call
expireVerificationMethodto set a futurenotAfterexpiry on a verification method.Can call
rollVerificationMethodto rotate a verification method to a new key while migrating its relationships.
Policy-Authorized Caller: An address that is not a DID controller but is approved by
policyRegistryContractviacheckPolicyfor the specifictprAttributestring of the invoked function, evaluated in theonlyControllerOrAuthgate. Granted the same document-modification powers as the DID Controller.Can call
updateBaseDocumentwhen authorized for policyDID:updateBaseDocument.Can call
addControllerwhen authorized for policyDID:addController.Can call
revokeControllerwhen authorized for policyDID:revokeController.Can call
addVerificationMethodwhen authorized for policyDID:addVerificationMethod.Can call
addVerificationRelationshipwhen authorized for policyDID:addVerificationRelationship.Can call
revokeVerificationMethodwhen authorized for policyDID:revokeVerificationMethod.Can call
expireVerificationMethodwhen authorized for policyDID:expireVerificationMethod.Can call
rollVerificationMethodwhen authorized for policyDID:rollVerificationMethod.
Note: insertDidDocument is permissionless (any caller may register a new DID, provided the first verification method is flagged as secp256k1).
Potential Risks
Partial Audit Scope: The audit scope is a strict subset of the repository's deployable code. Only DidRegistry, DidDocumentLib, ControllersLib, VRelationshipsLib, and UtilsLib are in scope, while the beacon proxy contracts imported through @ebsiint-sc/beacon-proxy (referenced by the out-of-scope BeaconImports.sol helper), the Pagination and ImplementationInitSelector utilities from @ebsiint-sc/bootstrap, and the IPolicyRegistry implementation are excluded. Vulnerabilities in these out-of-scope components that the in-scope contracts depend upon may compromise the overall security posture despite the audited code being correct.
Dependency on External Authorization Logic: The single authorization gate onlyControllerOrAuth in DidRegistry delegates its fallback decision to an external contract by calling checkPolicy on the resolved IPolicyRegistry, where policyRegistryContract is set once during initialize. Every mutating entry point (updateBaseDocument, addController, revokeController, addVerificationMethod, addVerificationRelationship, revokeVerificationMethod, expireVerificationMethod, rollVerificationMethod) trusts the boolean returned by this out-of-scope contract without additional validation. A compromised, misconfigured, or upgraded policy registry that returns true incorrectly would grant unauthorized mutation rights over any DID.
Unbounded Iteration Over Verification Relationships: Per-DID vRelationships and capabilityInvocations arrays grow without an upper bound comparable to MAX_CONTROLLERS, and revoke, expire, and roll never prune entries—they only shorten notAfter or append. getDidDocumentByTimestamp in DidDocumentLib allocates scratch storage sized to the sum of those arrays and de-duplicates methods with a nested string comparison loop, so a DID that accumulates enough history can permanently exceed the block gas limit on whole-document resolution. Roll and revoke are not affected by this growth: they iterate only the per-method vRelationshipsIndexes list, which is bounded to at most four non-CI relationship names, and control resolution via _checkController remains O(1) over the capped controllers list.
Forced Mutation of DIDs Without Controller Consent: The onlyControllerOrAuth check treats a positive checkPolicy result as fully equivalent to being a DID controller, so any address holding the relevant policy attribute in the policy registry can execute state-changing operations on any DID without the subject's approval. Such an authorized party can call addController, revokeController, rollVerificationMethod, revokeVerificationMethod, or updateBaseDocument on a DID it does not control. This permits reassigning control, revoking legitimate keys, or rewriting the base document of a third party's identity entirely outside the DID owner's consent.
Absence of Timelock and Pause Controls: The eight controller-or-policy-gated mutating operations in DidRegistry execute immediately, and no pause, delay, or reversal mechanism exists anywhere in the in-scope contracts. Sensitive actions such as revokeController and rollVerificationMethod take effect within the same transaction they are submitted in. In the event of a key compromise or an erroneously granted policy attribute, there is no buffer window to detect or revert a malicious controller reassignment or verification-method roll before it becomes final.
Single Point of Failure in the Policy Authority: Authorization for all privileged mutations funnels through the external policy registry, and the entity controlling policy assignments can grant itself or others the attributes checked in onlyControllerOrAuth. This makes the policy registry a concentrated point of control able to override the per-DID controller model across the entire registry. Compromise of the policy-granting authority would enable takeover of arbitrary DIDs regardless of their on-chain controllers.
Upgradeable Proxy Logic Replacement: The contract uses the OpenZeppelin Initializable pattern with a disabled constructor via _disableInitializers and an initialize initializer, and is intended to run behind a beacon proxy, allowing its logic to be swapped after deployment. A faulty or malicious upgrade could alter authorization semantics, DID resolution, or key-rotation behavior without redeploying the storage. Because upgrades take effect immediately through the beacon with no in-contract review window, a defective implementation would be live as soon as it is pushed.
Permissionless Registration and Identifier Squatting: insertDidDocument in DidRegistry carries no access-control check, so any caller can register any unused did string, becoming its self-controller through the document's controller push and linkDidToController. There is no on-chain proof binding the arbitrary did string to the registrant's real identity, and registration succeeds for the first party to submit an unused identifier. An attacker can front-run or pre-register identifiers belonging to legitimate off-chain subjects, seizing control of those DIDs and impersonating the intended owner.
Unvalidated Base Document Content: The baseDocument is stored and updated as an opaque string with only a non-empty length check in insertDidDocument and updateBaseDocument, and its contents are never parsed or validated against the on-chain verification methods and relationships. A controller or policy-authorized party can set the base document to arbitrary or inconsistent JSON. Off-chain resolvers that trust this field may consume malformed or contradictory DID document data that diverges from the on-chain key material.
Address Rebinding During Verification Method Roll: When rolling a capability-invocation method, rollVerificationMethod in DidDocumentLib clears the old secp256k1 entry in vMethodIdOfAddress and binds the replacement key's derived address, while migrating relationship and capability-invocation bookkeeping. The CI branch now requires isSecp256k1 and always writes the new binding, so a non-secp replacement can no longer clear control without installing a successor. Address derivation still depends on getAddress / sanitizePublicKey, which only enforce 64- or 65-byte key length (and the 0x04 prefix) and do not validate a secp256k1 curve point. A length-valid but incorrect key therefore still hashes to some address and can be bound during a roll; if no party controls that address, _checkController stops resolving key-based control and recovery requires policy-based intervention.
Findings
Code ― | Title | Status | Severity | |
|---|---|---|---|---|
| F-2026-1870 | Missing Revoked Guard in addVerificationRelationship Grants a Revoked Key Non-Revocable Control | fixed | Medium | |
| F-2026-1869 | Scheduling a Future Expiry Revokes Control Immediately Instead of at the Scheduled Time | fixed | Medium | |
| F-2026-1825 | Rolling a Capability Invocation Key to a Non-secp256k1 Key Strands Identifier Control | fixed | Medium | |
| F-2026-1869 | Trusted Policy Registry Authorization Applies Globally Instead of Per DID | accepted | Low | |
| F-2026-1869 | Permissionless Registration Accepts a Never-Valid Control Window Enabling Squatting and Permanent Lockout | fixed | Low | |
| F-2026-1869 | expireVerificationMethod Accepts a Later Expiry and Can Extend Validity Instead of Shortening It | fixed | Low | |
| F-2026-1846 | revokeController Allows Removing the Last Controller and Locking Out the DID | fixed | Low | |
| F-2026-1889 | Missing Secp256k1 Enforcement in addVerificationRelationship CapabilityInvocation Path Strands DID Control | fixed | Low | |
| F-2026-1870 | Strict Control Bounds Versus Inclusive Read-View Bounds Create a Boundary Asymmetry | fixed | Observation | |
| F-2026-1870 | rollVerificationMethod Sets the Relationship-Uniqueness Tuple Without the Add-Path Guard | fixed | Observation |
Appendix 1. Definitions
Severities
When auditing smart contracts, Hacken is using a risk-based approach that considers Likelihood, Impact, Exploitability and Complexity metrics to evaluate findings and score severities.
Reference on how risk scoring is done is available through the repository in our Github organization:
Severity | Description |
|---|---|
Critical | Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation. |
High | High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation. |
Medium | Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category. |
Low | Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution. |
Severity
- Critical
Description
- Critical vulnerabilities are usually straightforward to exploit and can lead to the loss of user funds or contract state manipulation.
Severity
- High
Description
- High vulnerabilities are usually harder to exploit, requiring specific conditions, or have a more limited scope, but can still lead to the loss of user funds or contract state manipulation.
Severity
- Medium
Description
- Medium vulnerabilities are usually limited to state manipulations and, in most cases, cannot lead to asset loss. Contradictions and requirements violations. Major deviations from best practices are also in this category.
Severity
- Low
Description
- Major deviations from best practices or major Gas inefficiency. These issues will not have a significant impact on code execution.
Potential Risks
The "Potential Risks" section identifies issues that are not direct security vulnerabilities but could still affect the project’s performance, reliability, or user trust. These risks arise from design choices, architectural decisions, or operational practices that, while not immediately exploitable, may lead to problems under certain conditions. Additionally, potential risks can impact the quality of the audit itself, as they may involve external factors or components beyond the scope of the audit, leading to incomplete assessments or oversight of key areas. This section aims to provide a broader perspective on factors that could affect the project's long-term security, functionality, and the comprehensiveness of the audit findings.
Appendix 2. Scope
The scope of the project includes the following smart contracts from the provided repository:
Scope Details | |
|---|---|
| Repository | https://gitlab.com/europeum/public/core-services/→ |
| Commit | 89bb63b74e88c7e3b1602f4801d682e634b6a521 |
| Final Commit | 7f13e31046833e9cfcd90fa5836b3e02b83bb124 |
| Updated Final Commit | d1535bacb0ee03fc987339c58324b34c3db14687 |
| Whitepaper | N/A |
| Requirements | README.md; NatSpec |
| Technical Requirements | README.md; NatSpec |
Scope Details
- Commit
- 89bb63b74e88c7e3b1602f4801d682e634b6a521
- Final Commit
- 7f13e31046833e9cfcd90fa5836b3e02b83bb124
- Updated Final Commit
- d1535bacb0ee03fc987339c58324b34c3db14687
- Whitepaper
- N/A
- Requirements
- README.md; NatSpec
- Technical Requirements
- README.md; NatSpec
Assets in Scope
Appendix 3. Additional Valuables
Additional Recommendations
The smart contracts in the scope of this audit could benefit from the introduction of automatic emergency actions for critical activities, such as unauthorized operations like ownership changes or proxy upgrades, as well as unexpected fund manipulations, including large withdrawals or minting events. Adding such mechanisms would enable the protocol to react automatically to unusual activity, ensuring that the contract remains secure and functions as intended.
To improve functionality, these emergency actions could be designed to trigger under specific conditions, such as:
Detecting changes to ownership or critical permissions.
Monitoring large or unexpected transactions and minting events.
Pausing operations when irregularities are identified.
These enhancements would provide an added layer of security, making the contract more robust and better equipped to handle unexpected situations while maintaining smooth operations.
Frameworks and Methodologies
This security assessment was conducted in alignment with recognised penetration testing standards, methodologies and guidelines, including the NIST SP 800-115 – Technical Guide to Information Security Testing and Assessment →, and the Penetration Testing Execution Standard (PTES) →, These assets provide a structured foundation for planning, executing, and documenting technical evaluations such as vulnerability assessments, exploitation activities, and security code reviews. Hacken’s internal penetration testing methodology extends these principles to Web2 and Web3 environments to ensure consistency, repeatability, and verifiable outcomes.