Grin Security Audit Cover

Grin Security Audit

Today, per Grin request, we are making public Coinspect’s Grin security audit report, which fully describes the engagement scope, our findings, and Grin remediations.

Summary

During February 2019, Coinspect conducted a security audit of the Grin project’s MimbleWimble blockchain implementation.

After the Grin team fixed all the findings reported, Coinspect verified its remediations during the months of August and September 2019.

The following areas of the code were selected by Grin as the main focus for this engagement and were reviewed:

  • Grin core crate
  • Grin keychain crate
  • Grin chain crate
  • Grin wallet crate

The objectives of the assessment included, but were not limited to, identifying the following types of security vulnerabilities: full system compromise, denial of service attacks, information disclosure, network protocol weaknesses, input validation, and misaligned incentives in consensus rules.

As a result of the Coinspect audit, several issues were discovered:

Risk Quantity
Critical 1
High 5
Medium 7
Low 1

All these findings have been properly addressed by the Grin team and their fixes verified to be correct by Coinspect.


Details

Most vulnerabilities described in the report can be grouped into the following categories, and special care should be taken to prevent these patterns from appearing again in the codebase:

  1. Directory path traversal leading to remote code execution
  2. Memory corruption vulnerabilities in unsafe code blocks located in third-party libraries
  3. Denial of service caused by Rust panics, expects, and unhandled error conditions
  4. Synchronization process denial of service caused by out-of-order P2P messages
  5. Storage-based denial of service caused by failure to clean up temporary files
  6. Node censorship through node ban feature abuse
  7. Failure to ban ill-behaved nodes leading to CPU-based denial of service
  8. Lack of validation of orphan blocks
  9. Insecure file handling leading to local privilege escalation

It is worth noting that even though the project was coded in Rust, the audit team found vulnerabilities that resulted in remote code execution and memory corruption.

Additionally, during the engagement, Coinspect identified the following high-level weaknesses and suggested them as future work goals in order to improve the overall security of the project:

  1. Rust third-party dependencies
  2. Transaction pool and new eviction policy
  3. Transaction and block processing time
  4. Transaction creation workflow

Further detailed suggestions can be found in the full report.


Conclusion

Overall, Coinspect found the project source code to be clearly organized and readable. Most design and implementation decisions were oriented toward maintaining simplicity and were documented. We believe the Grin team has clearly made security a top priority concern in its project development.

Finally, we would like to highlight the Grin team’s prompt and transparent response to the only critical vulnerability we found, which resulted in an almost immediate fix and Grin’s disclosure of CVE-2019-9195.

Download

Grin Security Audit 2019