SCIF: Compositional Security for Smart Contracts

Table of Contents
In crypto, the security of smart contracts remains a critical concern. Traditional smart contracts often face vulnerabilities when interacting with untrusted code, leading to potential breaches and loss of assets. To address this challenge, a new smart contract language, SCIF (Smart Contract Information Flow), has been designed to provide compositional security. SCIF ensures that contracts maintain their security integrity even when interacting with potentially malicious external code. This article explores the key features of SCIF, including its innovative use of Information Flow Control (IFC), endorsement mechanisms, and robust defenses against Confused Deputy Attacks (CDA).

I. Information Flow Control (IFC)

A cornerstone of SCIF's security model is Information Flow Control (IFC). IFC operates on the principle that untrusted information should not influence trusted information without explicit authorization from the programmer. This is achieved by assigning security labels to expressions, representing the level of trust associated with the information they contain. SCIF's type system then statically analyzes the code to identify any improper information flows, effectively preventing unauthorized access or modification of sensitive data. For instance, SCIF would prevent a malicious contract from altering a trusted contract's data without proper authorization.
Endorsement Mechanism:
While enforcing strict noninterference, where untrusted data cannot affect trusted data at all, is too restrictive for practical applications, SCIF introduces a mechanism called endorsement. Endorsement allows trusted code to selectively elevate the trust level of specific information, enabling controlled interaction with untrusted data. Although endorsement introduces flexibility, it also requires careful management, as misuse can lead to vulnerabilities. SCIF addresses this by requiring all endorsements to be explicit, ensuring that programmers consciously consider their implications, thereby reducing the likelihood of accidental vulnerabilities.
If you're wondering how to strengthen Ethereum security, we recently wrote a post about it: "Strengthening Ethereum PoS: Strategies Against Byzantine Attacks".

II. Defending Against Confused Deputy Attacks (CDA)

Confused Deputy Attacks (CDA) are a significant vulnerability in smart contract systems, where an attacker deceives a trusted entity into misusing its authority to compromise a target. SCIF offers a two-pronged defense against CDAs:
  • Static Type Checking: SCIF leverages its information flow control system to statically verify that the trust levels required by a called method align with the trust level of the caller. If a mismatch is detected at compile time, the code is flagged as potentially vulnerable, prompting the programmer to address the issue.
  • Dynamic Type Checking: Recognizing that static analysis alone cannot guarantee security in an open system where malicious actors can provide ill-typed code, SCIF implements run-time checks to enforce type safety. These checks ensure that the actual type of a called method matches the expected type at the point of invocation, effectively preventing type confusion attacks that form the basis of many CDAs. This dynamic verification is crucial as it prevents attackers from exploiting the system by passing in malicious code disguised as a different, trusted type.

III. Exceptions vs. Failures

SCIF introduces a clear distinction between exceptions and failures, providing developers with more precise control over error handling:
  • Exceptions: Similar to exceptions in other programming languages, SCIF exceptions represent foreseeable deviations from normal execution flow and do not necessitate the rollback of state changes. They are explicitly declared in method signatures, enabling programmers to anticipate and handle them gracefully using try-catch blocks. This explicit handling makes the code more robust and less prone to errors caused by uncaught exceptions.
  • Failures: In contrast to exceptions, failures signify unrecoverable errors, such as resource exhaustion or system-level faults. When a failure occurs, SCIF triggers a transactional rollback, reverting any state changes made within the failing scope. This mechanism ensures that the system remains in a consistent state even in the event of unexpected errors.
This differentiation between exceptions and failures, absent in Solidity, allows developers to write more robust and secure code by explicitly addressing potential failure points while maintaining the flexibility to handle expected exceptions without unnecessary rollbacks.
Original paper: https://arxiv.org/abs/2407.01204

Conclusion

SCIF (Smart Contract Information Flow) represents a significant advancement in the security of smart contracts. By leveraging Information Flow Control (IFC), explicit endorsements, and robust defenses against Confused Deputy Attacks (CDA), SCIF ensures that contracts remain secure even when interacting with untrusted code. The clear distinction between exceptions and failures further enhances the robustness of SCIF, enabling developers to write secure, resilient smart contracts. As blockchain technology continues to evolve, languages like SCIF will play a crucial role in maintaining the integrity and security of decentralized applications.

About Orochi Network

Orochi Network is a cutting-edge zkOS (An operating system based on zero-knowledge proof) designed to tackle the challenges of computation limitation, data correctness, and data availability in the Web3 industry. With the well-rounded solutions for Web3 Applications, Orochi Network omits the current performance-related barriers and makes ways for more comprehensive dApps hence, becoming the backbone of Web3's infrastructure landscape.
Categories
Event Recap
3
Misc
56
Monthly Report
1
Oracles
4
Orand
3
Orosign
19
Partnership
20
Verifiable Random Function
9
Web3
111
Zero-Knowledge Proofs
47
Top Posts
Tag
Orand
NFT
Misc
Web3
Partnership Announcement
Layer 2
Event Recap
Immutable Ledger
Oracles
Verifiable Random Function
Zero-Knowledge Proofs
Multisignature Wallet

Orosign Wallet

Manage all digital assets safely and securely from your mobile devices

zkDatabaseDownload Orosign Wallet
Coming soon
Orochi

zkOS for Web3

© 2021 Orochi