H1 2025 Web3 Security Report$3.1B in losses, DeFi hit hardest, AI threats on the rise
Read the full report
  • Hacken
  • Audits
  • mina
  • [dApp] Mina | Mina Attestations | Jan2025

Audit name:

[dApp] Mina | Mina Attestations | Jan2025

Date:

Apr 4, 2025

Table of Content

Introduction
Audit Summary
System Overview
Findings
Appendix 1. Severity Definitions
Appendix 2. Scope
Disclaimer

Want a comprehensive audit report like this?

Introduction

We express our gratitude to the Mina team for the collaborative engagement that enabled the execution of this dApp Security Assessment.

Mina Credentials is a library that enables privacy-preserving credential verification where users can prove certain attributes about themselves without revealing the underlying data.

The library is intended to help with importing real-world credentials into the Mina ecosystem: For example, to "import" your passport, you have to verify the passport authority's signature on your passport data. The signature relies one of several hashing and signature schemes such as ECDSA, RSA and SHA2-256, SHA2-384, SHA2-512. Also, the signature will be over a dynamic-length string.

This creates a modular, extensible system where various forms of identity and authorization can be represented while preserving privacy through zero-knowledge cryptography.

Document

NamedApp Code Review and Security Analysis Report for Mina
Audited ByReshma Fareed, Stephen Ajayi
Approved ByNino Lipartiia
Websitehttps://minaprotocol.com/
Changelog07/03/2025 - Preliminary Report
Changelog04/04/2025 - Final Report
PlatformMina
LanguageTypescript
Tagso1js, Wallet, Mina
Methodologyhttps://hackenio.cc/dApp_methodology
  • Document

    Name
    dApp Code Review and Security Analysis Report for Mina
    Audited By
    Reshma Fareed, Stephen Ajayi
    Approved By
    Nino Lipartiia
    Changelog
    07/03/2025 - Preliminary Report
    Changelog
    04/04/2025 - Final Report
    Platform
    Mina
    Language
    Typescript
    Tags
    o1js, Wallet, Mina

Review Scope

Repositoryhttps://github.com/zksecurity/mina-credentials
Commit6951dcbdd3e42e1b7d0933598d10e26f8579c668
Repositoryhttps://github.com/zksecurity/pallad/tree/feat/privCred-presentation/apps/extension
Commitd5ce900012e022d0adefe353ffe2ad12e7bc19e7

Audit Summary

11Total Findings
4Resolved
7Accepted
0Mitigated

The system users should acknowledge all the risks summed up in the risks section of the report

Document Quality

  • The project includes a thorough RFC and technical specification that clearly define the credential formats, protocols, and security considerations.

  • Documentation is distributed across multiple files with some incomplete sections, including a design document that ends mid-sentence.

  • While the technical aspects are well-documented, the project lacks user-oriented guides and integration examples that would facilitate adoption.

Code Quality

  • The codebase demonstrates strong TypeScript implementation with consistent naming conventions and comprehensive type definitions throughout.

  • Core cryptographic functionality is implemented with careful attention to detail, particularly in the zero-knowledge proof systems and context binding mechanisms.

  • Some complex components could benefit from additional inline documentation and more explicit error handling to improve maintainability.

Architecture Quality

  • The architecture effectively separates credential types (simple vs. recursive) and establishes clear protocols for issuance, presentation, and verification.

  • The system is designed with composability in mind, allowing for flexible credential formats while maintaining consistent security properties.

  • The credential presentation model successfully balances privacy needs with practical verification requirements, though the complexity might present adoption challenges.

Test coverage

Code coverage of the project is 93.52% statement coverage and 81.73% function coverage

  • The project includes both unit and integration tests covering core functionality including serialization/deserialization, credential operations, validation, and the presentation protocol.

  • Tests are well-structured using Node.js's test framework with clear assertions and a mix of positive and negative test cases across the dynamic data structures and cryptographic operations.

  • While test coverage appears thorough for the most critical components, there are no explicit coverage metrics, and some areas like stress testing, performance benchmarks and edge cases.

System Overview

The Mina Credentials system is a zero-knowledge credential framework built using o1js to implement privacy-preserving credential verification using recursive SNARKs to enable selective disclosure of attributes.

Core Components

  1. Credential Types

    • Simple Credentials: Based on native Mina signatures over attribute sets

    • Recursive Credentials: Leveraging Kimchi proofs to support arbitrary verification logic

  2. Cryptographic Primitives

    • Dynamic hashing with Poseidon for credential integrity

    • Context binding using domain-separated hash constructions

    • SHA-2 implementations for compatibility with existing standards

  3. Protocol Flow

    • Credential issuance generating cryptographic attestations with issuer signatures

    • Selective disclosure presentations via zero-knowledge proofs

    • Context-bound verification preventing credential replay attacks

  4. Data Structures

    • DynamicArray: Variable-length arrays with ZK-efficient operations

    • DynamicBytes: Specialized container for byte sequences

    • DynamicString: UTF-8 string representation optimized for ZK circuits

    • DynamicRecord: Key-value store with dynamic field access

    • StaticArray: Fixed-length arrays for ZK-friendly operations

    • DynamicSHA2: Implementation of SHA-2 hash function for dynamic data

    • DynamicHash: Hashing of dynamic data types using Poseidon

  5. Security Model

    • Owner binding via public key authentication

    • Issuer identification through commitment schemes

    • Non-malleability guarantees through signature verification

    • Simulation-extractable presentation protocol

The system achieves composable privacy by separating credential issuance from presentation, allowing third-party issuers while maintaining user control over selective disclosure through a unified presentation protocol.

Findings

Code
Title
Status
Severity
F-2025-8613Predictable Private Channel Identifier in BroadcastChannel Communication
fixed

Medium
F-2025-9055Undocumented Edge Case Collisions in Dynamic Hashing
accepted

Low
F-2025-9053Instances of Improper Type Casts That Could Lead to Unexpected Behavior
accepted

Low
F-2025-8976Self-Referential Type Definitions Leading to Potential Stack Overflow
accepted

Low
F-2025-8612Missing Origin Validation in Mina Provider Handlers
accepted

Low
F-2025-8611Insecure Cross-Domain Messaging Without Origin Validation
fixed

Low
F-2025-8972Missing Schema Validation before JSON Parsing in Multiple Deserialization Functions
fixed

Low
F-2025-9051Partially Implemented Features and Missing Details from Credential System RFC
accepted

Observation
F-2025-8975Potential Prototype Pollution in Object Serialization Functions
accepted

Observation
F-2025-8973Hardcoded Version Checks Limiting Future Compatibility and Upgrades
accepted

Observation
1-10 of 11 findings

Protect your dApp with insights like these.

Appendix 1. Severity Definitions

Severity

Description

Critical
These issues present a major security vulnerability that poses a severe risk to the system. They require immediate attention and must be resolved to prevent a potential security breach or other significant harm.

High
These issues present a significant risk to the system, but may not require immediate attention. They should be addressed in a timely manner to reduce the risk of the potential security breach.

Medium
These issues present a moderate risk to the system and cannot have a great impact on its function. They should be addressed in a reasonable time frame, but may not require immediate attention.

Low
These issues present no risk to the system and typically relate to the code quality problems or general recommendations. They do not require immediate attention and should be viewed as a minor recommendation.
  • Severity

    Critical

    Description

    These issues present a major security vulnerability that poses a severe risk to the system. They require immediate attention and must be resolved to prevent a potential security breach or other significant harm.

    Severity

    High

    Description

    These issues present a significant risk to the system, but may not require immediate attention. They should be addressed in a timely manner to reduce the risk of the potential security breach.

    Severity

    Medium

    Description

    These issues present a moderate risk to the system and cannot have a great impact on its function. They should be addressed in a reasonable time frame, but may not require immediate attention.

    Severity

    Low

    Description

    These issues present no risk to the system and typically relate to the code quality problems or general recommendations. They do not require immediate attention and should be viewed as a minor recommendation.

Appendix 2. Scope

The scope of the project includes the following components from the provided repository:

Scope Details

Repositoryhttps://github.com/zksecurity/mina-credentials
Commit6951dcbdd3e42e1b7d0933598d10e26f8579c668
Repositoryhttps://github.com/zksecurity/pallad/tree/feat/privCred-presentation/apps/extension
Commitd5ce900012e022d0adefe353ffe2ad12e7bc19e7

Components in scope

  • src/ excluding the test files *.test.ts

  • spec/ for reference

  • apps/extension/

Assets in Scope

Credentials - Credentials
Cryptographic Operations - Cryptographic Operations
Documentation - Documentation
Dynamic Types - Dynamic Types
Presentation - Presentation
Program & Specifications - Program & Specifications
Serialization - Serialization
Wallet - Wallet

Disclaimer