Penetration Test Report (LeastAuthority): LeastAuthority Final ERTP Zoe

ERTP + Zoe
Security Audit Report: Vulnerability
Assessment
Agoric Systems
Final Audit Report: 22 December 2021
Table of Contents
Overview
Background
Project Dates
Review Team
Coverage
Target Code and Revision
Supporting Documentation
Areas of Concern
Findings
General Comments
System Design
Investigation of Security Properties
Testing & Experimentation
Code Quality
Documentation
Scope & Dependencies
Specific Issues & Suggestions
Issue A: ERTP Trusted User Inputs
Issue B: Possible Error Shadowing in Case of External Code Throwing Exceptions
Issue C: Zoe Inconsistent States
Suggestions
Suggestion 1: Adhere to Keyword Standards
Suggestion 2: Improve Behavior When Creating a Purse Hangs or Fails
About Least Authority
Our Methodology
Security Audit Report: Vulnerability Assessment | ERTP + Zoe | Agoric Systems 1
22 December 2021 by Least AuthorityTFAGmbH
This audit makes no statements or warranties and is for discussion purposes only.
Overview
Background
Agoric Systems requested that Least Authority perform a vulnerability assessment of the following
components:
● Electronic Rights Transfer Protocol (ERTP): Agoric'sdigital asset standard and a uniform way of
transferring tokens and other digital assets in JavaScript. All kinds of digital assets can be easily
created and can be transferred in exactly the same ways, with exactly the same security
properties.
● Zoe: a framework for building smart contracts including,but not limited to, auctions, swaps, and
decentralized exchanges. Zoe itself is a smart contract written in JavaScript and running on the
Agoric platform.
Agoricis an open-source development company launchingan interoperable Proof-of-Stake chain and
economy. Agoric’s JavaScript-native smart contract platform aims to offer developers a safe, reusable
library of Decentralized Finance (DeFi) components to rapidly build and deploy on-chain.
Project Dates
● August 9 - September 3: Code review(Completed)
● September 8: Delivery of Initial Audit Report(Completed)
● September 27 - October 22: Additional Code review(Completed)
● October 27: Delivery of Updated Initial Audit Report(Completed)
● November 13 - December 21: Verification Review(Completed)
● December 22: Final Audit Report delivered(Completed)
Review Team
● David Braun, Security Researcher and Engineer
● Dominc Tarr, Security Researcher and Engineer
● Florian Detig, Security Researcher and Engineer
● Jehad Baeth, Security Researcher and Engineer
● Wanas ElHassan, Security Researcher and Engineer
Coverage
Target Code and Revision
For this audit, we performed research, investigation, and review of ERTP + Zoe followed by issue reporting,
along with mitigation and remediation instructions outlined in this report.
The following code repositories are considered in-scope for the review:
● ERTP:https://github.com/Agoric/agoric-sdk/tree/master/packages/ERTP
● Zoe:https://github.com/Agoric/agoric-sdk/tree/master/packages/zoe
Specifically, we examined the following Git revision for our initial review:
198e5c37b4ce3738ed5776c36c949847a226265c
For the verification, we examined the Git revision:
Security Audit Report: Vulnerability Assessment | ERTP + Zoe | Agoric Systems 2
22 December 2021 by Least AuthorityTFAGmbH
This audit makes no statements or warranties and is for discussion purposes only.
fe9a9ff3de86608a0b1f8f9547059f89d45b948d
In addition, an issue was identified by the Agoric team in a later commit of the repository. Our team
reviewed the issue and the implemented mitigation:
● https://github.com/Agoric/agoric-sdk/commit/b67bfcb9051cdcf780aff1a[PII_REDACTED]b21eae#
diff-fe679b1c51464cc0f59ad0c778d5c879cf52dfcb78635b8a2f263f5ea57ca3dc
For the review, the repository was cloned for use during the audit and for reference in this report:
● https://github.com/LeastAuthority/Agoric-Systems-Zoe-ERTP
All file references in this document use Unix-style paths relative to the project’s root directory.
Finally, the Zoesmart contractsand theFees andMeteringfeature, along with any dependency and third
party code, unless specifically mentioned as in-scope, were considered out of scope for this review.
Supporting Documentation
The following documentation was available to the review team:
● ERTP:
○ ERTPREADME.md:
https://github.com/LeastAuthority/Agoric-Systems-Zoe-ERTP/blob/master/packages/ER
TP/README.md
○ ERTP Introduction:
https://agoric.com/documentation/getting-started/ertp-introduction.html
○ ERTP Guide:https://agoric.com/documentation/ertp/guide/
● ERTP Dependencies:
○ Assert:
https://github.com/LeastAuthority/Agoric-Systems-Zoe-ERTP/blob/master/packages/as
sert
○ Marshal:
https://github.com/LeastAuthority/Agoric-Systems-Zoe-ERTP/blob/master/packages/ma
rshal
○ Notifier:
https://github.com/LeastAuthority/Agoric-Systems-Zoe-ERTP/blob/master/packages/not
ifier
● Zoe:
○ ZoeREADME.md:
https://github.com/LeastAuthority/Agoric-Systems-Zoe-ERTP/blob/master/packages/zo
e/README.md
○ Zoe Introduction:https://agoric.com/documentation/getting-started/intro-zoe.html
○ Zoe Guide:https://agoric.com/documentation/zoe/guide/
● Agoric Documentation Guide:https://agoric.com/documentation/getting-started/
● Algebraic Properties of Amounts:https://github.com/Agoric/agoric-sdk/issues/557
● Agoric JavaScript Programming:https://agoric.com/documentation/guides/js-programming/
● User Documentation for Vats:
https://agoric.com/documentation/guides/js-programming/vats.html
● User Documentation for Far() and Remotable Objects:
https://agoric.com/documentation/guides/js-programming/far.html
● User Documentation for Eventual Send:
https://agoric.com/documentation/guides/js-programming/eventual-send.html
● User Documentation for Notifiers and Subscriptions:
https://agoric.com/documentation/guides/js-programming/notifiers.html
Security Audit Report: Vulnerability Assessment | ERTP + Zoe | Agoric Systems 3
22 December 2021 by Least AuthorityTFAGmbH
This audit makes no statements or warranties and is for discussion purposes only.
● User Documentation for SES:
https://agoric.com/documentation/guides/js-programming/ses/ses-guide.html
● Zoe/ERTP Audit Overview.pdf(shared with Least Authorityvia Discord 9 August 2021)
● [Draft] -- Purple Team Report, Hardened JavaScript.pdf (shared with Least Authority via email 27
September 2021)
● ERTP_Zoe-- Scope + Documentation 2.pdf(shared withLeast Authority via email 27 September
2021)
● Handling of Authority in ERTP and Zoe Google Document (shared with Least Authority via email 1
October 2021)
● Moar Agoric Audit Info Google Slide Presentation(sharedwith Least Authority via email 1 October
2021)
● Article “Preventing Reentrancy Attacks in Smart Contracts”:
https://medium.com/agoric/preventing-reentrancy-attacks-in-smart-contracts-3899bf837f23
● Agoric + Protocol Labs // Higher Order Smart Contracts across Chains by Mark S. Miller YouTube
Video:https://www.youtube.com/watch?v=4gNOOC6vucY&list=PLKr-mvz8uvUgybLg53lgXSeL
Op4BiwvB2&t=1860s
● Hack the Orb - Day 5 Events (Nov 11) YouTube Video:https://youtu.be/jHAi7FsbB9Y?t=3606
● M. Miller, T. Van Cutsem, B. Tulloh, 2013, “DistributedElectronic Rights in JavaScript.”ESOP'13
22nd European Symposium on Programming, Springer
● M. Miller, E.D. Tribble, J. Shapiro, 2005, “ConcurrencyAmong Strangers Programming in E as Plan
Coordination.”TGC 2005, LNCS 3705, pp. 195–229.
● S. Drossopoulou, J. Noble, T. Murray, M. Miller, 2015, “Reasoning about Risk and Trust in an Open
World.” Victoria University of Wellington.
In addition, this audit report references the following document:
● M. Samuel Miller, 2006, “Robust Composition: Towards a Unified Approach to Access Control and
Concurrency Control.” [M06]
Areas of Concern
Our investigation focused on the following areas:
● Correctness of the implementation;
● Attacks that impact funds, such as the draining or the manipulation of funds;
● Mismanagement of funds via transactions;
● Denial of Service (DoS) and other security exploits that would impact the intended use or disrupt
the execution of the code;
● Vulnerabilities in