Last updated 9 months ago
The absence of a general-purpose penetration testing tool for Cardano DApps results in projects unnecessarily wasting time and money to detect and resolve common vulnerabilities.
This is the total amount allocated to XSY - Automated DApp Penetration Testing Tool.
Jann Müller
We will release a command-line tool that can automatically identify a common set of vulnerabilities. The tool will be intuitive to use even for non-developers.
No dependencies.
All project outputs will be open-source under the Apache 2 license.
We propose to expand and open-source the XSY property-based testing toolkit and bundle it into a no-code command line tool. The XSY smart contract testing toolkit is already capable of identifying a large number of common smart contract vulnerabilities, including the dust token attack and the large datum attack.
There are a number of property-based testing frameworks that were designed specifically for use with Cardano smart contracts. However, they never really see much adoption. This is because utilizing these tools requires a significant investment and development effort that production DApps simply cannot afford to spend. Indeed, they must prioritize feature development to stay competitive. Our product is an out-of-the-box general-purpose testing tool along with a command-line interface that requires no time investment and can be applied by any DApp to identify common vulnerabilities via the use of property-based tests.
Including the following common vulnerabilities:
The framework for this toolkit was developed specifically for a live mainnet protocol. The strength of this tool is partly due to a number of methodologies that we have employed specifically for testing and verifying smart contracts, such as the test objectives (i.e., translating parts of the specification into concrete, testable assertions) and attacks (i.e., automatically attempting a large set of predefined transaction modifications during testing to assess the robustness of validators).
The XSY automated penetration testing toolkit will be extended with the aim of achieving the following goals:
The enhanced safety of Cardano’s smart contract platform is frequently advertised. This has been further supported by the absence of any large scale DeFi hacks of Plutus smart contracts. However, as the DeFi ecosystem continues to grow so too will be the number of bad actors attempting to exploit DApps. Currently, DApps are not taking advantage of many of the security mechanisms and strengths provided by the functional design of the Cardano smart contract system because the time investment required to do so is significant. Furthermore, the costs of an audit can be prohibitive to many protocols and even when it isn’t, often projects will opt to direct those funds towards feature development instead. This tool can significantly reduce the engineering hours required to conduct a thorough audit. The tool takes care of identifying all the common vulnerabilities that auditors would otherwise have to attempt to find in meticulous manual review. This allows auditors to focus on ensuring the correctness of the business logic and architecture of the protocol.
The XSY testing command-line tool automatically identifies common smart contract vulnerabilities via our pre-made general purpose property-based smart contract attack framework. This requires no development effort on behalf of the user. It is language agnostic and can be applied to any smart contract (Aiken, PlutusTx, Plutarch, Plu-Ts) with little to no development effort.
In addition to the utility provided by the penetration testing command-line tool, the property-based testing framework itself can be a powerful tool for DApp developers in Cardano. For instance, debugging on Cardano has been notoriously difficult due to obscure error reporting mechanisms. This tool can help developers identify the root-cause of an error by providing a detailed description of the transaction which triggered it.
We know that the tool itself is effective. The tool already exists in a non-generalized form and is used in production. It identified a number of critical issues in a production high-complexity codebase.
Release DApp specific penetration testing framework for Cardano smart contracts. This includes open sourcing the existing testing framework for conducting attacks on Cardano smart contracts. This includes a set of predefined general attacks that can be applied to any contract. This milestone is the framework, not the command-line tool. The framework is well documented and designed to be easy to use; however, property-based testing can be quite involved, and it can be tough for developers who are unfamiliar with similar tooling to utilize it in practice.
Milestone Outputs:
Acceptance Criteria:
Evidence of Milestone Completion:
Research on generalization and reducing development effort required to utilize the tool. This will focus on research and specification of the command-line smart contract penetration testing tool. We will provide thorough documentation for the command-line tool as-well-as the framework at-large. This documentation will serve as a step-by-step guide for developers to leverage the power of this tool to run penetration tests on any Cardano smart contract.
Milestone Outputs:
Acceptance Criteria:
Evidence of Milestone Completion:
Extend the framework with new general attack types to cover more common smart contract vulnerabilities. This will involve aggregating a list of common vulnerabilities that the tool does not currently account for and then introducing new attack types to the tool to make sure they are covered.
Milestone Outputs:
Acceptance Criteria:
Evidence of Milestone Completion:
Introduce functionality to the tool to automatically query for a comprehensive set of "happy case" transactions for any given smart contract. The common vulnerabilities are described in the form of attacks in the toolkit. Attacks are mutations that can be applied to transactions to attempt to perform actions that should not be allowed. If a happy-case transaction still succeeds after applying an attack, then the tool flags it as a potential vulnerability and outputs that information to the developer along with information on potential resolutions. In order to effectively conduct this penetration testing on a smart contract protocol a large number of happy-case transactions are needed to cover each possible action that a protocol can support. Currently, transactions are either required to be built within the tool, or serialized transactions are to be loaded into the framework in order to facilitate attack mutations.
By introducing this query functionality, the user simply needs to provide the script hash of the contract(s) they want to test, and the tool will automatically query the given network to find a comprehensive set of happy-case transactions to apply the attacks to. This way it doesn't matter what offchain framework the protocol is built with; the tool will be able to conduct the attacks on any Cardano protocol irrespective of the protocol's tech stack.
Milestone Outputs:
Acceptance Criteria:
Evidence of Milestone Completion:
Command-line tool publication
This includes the full release of the command-line tool which can be used to perform automated penetration testing on any Cardano smart contract protocol. The command-line tool will be intuitive and simple, allowing immediate use without any prior training or learning curve.
Milestone Outputs:
Acceptance Criteria:
Evidence of Milestone Completion:
Project Close-out Report and Video
A report detailing KPIs and how they were addressed along with the future roadmap for the XSY smart contract penetration testing toolkit.
A video that goes over the development process of the tool and demonstrates the tool performing a live penetration test of a smart contract protocol.
Jean-Frédéric Etienne has more than 15 years of experience in safety and threat analysis and is an expert in several formal verification techniques. He is currently the architecture and technical lead for the Djed implementation on Cardano and has put in place a property-based testing methodology to extensively assess the correctness and robustness of Plutus smart contracts against all potential attacks. He has also specified and proved the adaptation of the Djed protocol on the EUTxO model and has developed a set of Plutus libraries to produce optimized on-chain code.
Jann Müller is a Haskell programmer with years of experience in writing scalable, mission-critical systems. He has been working with Plutus since its inception and is the maintainer of the sc-tools library for Cardano apps. He is the lead developer of XSY and will be working on the off-chain parts of the framework.
Philip DiSarro is an expert in the field of Compiler Development & Programming Language Theory. He has made significant open-source contributions to the Cardano developer ecosystem. As a co-chair of the IOHK developer experience working group he worked to identify and resolve pain points that DApp developers experience in Cardano. He has a vast wealth of professional experience in smart contract security and auditing on Cardano; and was responsible for the identification and resolution of a large number of critical exploits in production open-source smart contracts. Recently, Philip has concentrated his efforts on designing and deploying effective zero-knowledge proof applications within the Cardano ecosystem. Philip is a senior Haskell developer on the XSY team, a consultant and lecturer for Emurgo, and the CEO and co-founder of Anastasia Labs.
Amir H. Meyssami Rad is a Haskell developer and a member of the XSY development team with over two years of experience in developing on Cardano. His expertise spans wallet integration tools, off-chain transaction library development, DApp and on-chain development using Plutus across various projects.
Konstantinos Lambrou-Latreille is a Haskell programmer with more than 5 years of relevant experience. He worked for 3 years in IOG on Plutus off-chain tooling such as a node emulator for testing Plutus applications, a transaction building library, and a chain-indexer.
1 X Haskell Engineer
1 X Haskell Test/QA Engineer
1 X Technical Writer
Some of this work will be done in parallel.
2 x Engineer
1 x Engineer
1 x Engineer
1 x Engineer
The cost of the project represents significant value for money for the Cardano ecosystem by enhancing security through an automated toolkit that identifies common vulnerabilities, thereby safeguarding investments and maintaining trust. This allows DApp developers to focus on feature development, thanks to the toolkit's ease of use and minimal required effort, which accelerates innovation and deployment. The toolkit's language-agnostic nature and applicability to all types of smart contracts ensures universal accessibility, benefiting a wide range of projects. Automating vulnerability detection reduces the costs associated with manual audits, particularly benefiting smaller projects or startups. In fact, for many low-complexity DApps, this tool has the potential to eliminate the need for expensive audits. Moreover, the tool should generally reduce the cost of smart contract audits on Cardano. Currently, a significant portion of the time and effort in an audit is dedicated to manually scanning the entire codebase for common vulnerabilities. This tool automates that work, allowing auditors to focus on auditing the business logic or more application-specific aspects of the protocol. This significantly reduces the time required to perform a comprehensive audit, which should, in turn, lower the prices of audits, making them more accessible and affordable for the entire ecosystem. Furthermore, the open-source nature and extensibility of the toolkit encourage community contributions and collaboration, fostering a culture of security and transparency. Extensive documentation and tutorials further raise awareness about security best practices and empower developers to build more secure applications from the outset. This investment provides the Cardano ecosystem with a powerful tool that not only enhances security but also supports the growth and development of its diverse DApps and smart contracts.