Skip to content

Commit 66cce11

Browse files
Merge pull request securing#3 from damianrusinek/master
Release v1.1: Added DeFi.
2 parents 17953dd + 3940d55 commit 66cce11

19 files changed

+83
-45
lines changed

1.0/0x00-Introduction.md renamed to 1.1/0x00-Introduction.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Damian Rusinek, Paweł Kuryłowicz
66

77
## Introduction
88

9-
Smart Contract Security Verification Standard is a FREE 13-part checklist created to standardize the security of smart contracts for developers, architects, security reviewers and vendors. This list helps to avoid the majority of known security problems and vulnerabilities by providing guidance at every stage of the development cycle of the smart contracts (from designing to implementation).
9+
Smart Contract Security Verification Standard (v1.1) is a FREE 14-part checklist created to standardize the security of smart contracts for developers, architects, security reviewers and vendors. This list helps to avoid the majority of known security problems and vulnerabilities by providing guidance at every stage of the development cycle of the smart contracts (from designing to implementation).
1010

1111
**Objectives**
1212
* Help to develop high quality code of the smart contracts.
@@ -40,6 +40,7 @@ Every category has a brief description of the control objectives and a list of s
4040
* V11: Code Clarity
4141
* V12: Test Coverage
4242
* V13: Known Attacks
43+
* V14: Decentralized Finance
4344

4445
**Severity of the risk**
4546

File renamed without changes.
Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
# V3: Blockchain data
2-
3-
## Control Objective
4-
5-
Smart contracts in public blockchains have no built-in mechanism to store secret data securely. It is important to protect sensitive data from reading by an untrusted actor.
6-
7-
Ensure that a verified contract satisfies the following high-level requirements:
8-
* Data stored in smart contract is identified and protected,
9-
* Secret data is not kept in blockchain as plaintext,
10-
* Smart contract is not vulnerable due to data misrepresentation.
11-
12-
Category “V3” lists requirements related to the blockchain data of the smart contracts.
13-
14-
## Security Verification Requirements
15-
16-
| # | Description |
17-
| --- | --- |
18-
| **3.1** | Verify that any data saved in the contracts is not considered safe or private (even private variables). |
19-
| **3.2** | Verify that no confidential data is stored in the blockchain (passwords, personal data, token etc.). |
20-
| **3.3** | Verify that the list of sensitive data processed by the smart contract is identified, and that there is an explicit policy for how access to this data must be controlled and enforced under relevant data protection directives. |
21-
| **3.4** | Verify that there is a component that monitors access to sensitive contract data using events. |
22-
| **3.5** | Verify that contract does not use string literals as keys for mappings. Verify that global constants are used instead to prevent Homoglyph attack. |
23-
24-
25-
## References
26-
27-
For more information, see also:
28-
29-
* [Homoglyph attack](https://github.com/Arachnid/uscc/tree/master/submissions-2017/marcogiglio)
1+
# V3: Blockchain data
2+
3+
## Control Objective
4+
5+
Smart contracts in public blockchains have no built-in mechanism to store secret data securely. It is important to protect sensitive data from reading by an untrusted actor.
6+
7+
Ensure that a verified contract satisfies the following high-level requirements:
8+
* Data stored in smart contract is identified and protected,
9+
* Secret data is not kept in blockchain as plaintext,
10+
* Smart contract is not vulnerable due to data misrepresentation.
11+
12+
Category “V3” lists requirements related to the blockchain data of the smart contracts.
13+
14+
## Security Verification Requirements
15+
16+
| # | Description |
17+
| --- | --- |
18+
| **3.1** | Verify that any data saved in the contracts is not considered safe or private (even private variables). |
19+
| **3.2** | Verify that no confidential data is stored in the blockchain (passwords, personal data, token etc.). |
20+
| **3.3** | Verify that the list of sensitive data processed by the smart contract is identified, and that there is an explicit policy for how access to this data must be controlled and enforced under relevant data protection directives. |
21+
| **3.4** | Verify that there is a component that monitors access to sensitive contract data using events. |
22+
| **3.5** | Verify that contract does not use string literals as keys for mappings. Verify that global constants are used instead to prevent Homoglyph attack. |
23+
24+
25+
## References
26+
27+
For more information, see also:
28+
29+
* [Homoglyph attack](https://github.com/Arachnid/uscc/tree/master/submissions-2017/marcogiglio)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

1.1/0x23-V14-Decentralized-Finance.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# V14: Decentralized Finance
2+
3+
## Control Objective
4+
5+
The Decentralized Finance (DeFi) is a concept with various financial applications deployed on blockchain using smart contracts. This category covers the security requirements for the constructions used by the DeFi applications such as lending pools, flash loans, governance, on-chain oracles, etc.
6+
7+
Ensure that a verified contract satisfies the following high-level requirements:
8+
* The assets controlled by decentralized finance are safe and cannot be withdrawed by an unauthorized person,
9+
* The data sources for decentralized finance (e.g. oracles) cannot be manipulated.
10+
11+
Category “V14” lists requirements related to the contructions used by the decentralized finance solutions.
12+
13+
## Security Verification Requirements
14+
15+
| # | Description |
16+
| --- | --- |
17+
| **14.1** | Verify that the lender's contract does not assume its balance (used to confirm loan repayment) to be changed only with its own functions.
18+
| **14.2** | Verify that the functions which change lender's balance and lend cryptocurrency are non-re-entrant if the smart contract allows to borrow the main platform's cryptocurrency (e.g. Ethereum). It blocks the attacks that update the borrower's balance during the flash loan execution. |
19+
| **14.3** | Verify that the flash loan function can call only a predefined function on the receiver contract. If it is possible, define a trusted subset of contracts to be called. Usually, the sender (borrower) contract is the one to be called back. |
20+
| **14.4** | Verify that the receiver's function that handles borrowed ETH or tokens can be called only by the pool and within a process initiated by the receiver's owner or other trusted source (e.g. multisig), if it includes potentially dangerous operations (e.g. sending back more ETH/tokens than borrowed). |
21+
| **14.5** | Verify that the calculations of the share in a liquidity pool are performed with the highest possible precision (e.g. if the contribution is calculated for ETH it should be done with 18 decimals precision - for Wei, not Ether). The dividend must be multiplied by the 10 to the power of the number of decimals (e.g. dividend * 10**18 / divisor). |
22+
| **14.6** | Verify that the rewards cannot be calculated and distributed within the same function call that deposits tokens (it should also be defined as non-re-entrant). That protects from the momentary fluctuations in shares. |
23+
| **14.7** | Verify that the governance contracts are protected from the attacks that use flash loans. One possible security is to require the process of depositing governance tokens and proposing a change to be executed in different transactions included in different blocks. |
24+
| **14.8** | Verify that, when using an on-chain oracles, the smart contract is able to pause the operations based on the oracle's result (in case of oracle has been compromised). |
25+
| **14.9** | Verify that the external contracts (even trusted) that are allowed to change the attributes of the smart contract (e.g. token price) have the following limitations implemented: a thresholds for the change (e.g. no more/less than 5%) and a limit of updates (e.g. one update per day). |
26+
| **14.10** | Verify that the smart contract attributes that can be updated by the external contracts (even trusted) are monitored (e.g. using events) and the procedure of incident response is implemented (e.g. the response to an ongoing attack). |
27+
| **14.11** | Verify that the complex math operations that consist of both multiplication and division operations firstly perform the multiplications and then division. |
28+
| **14.12** | Verify that, when calculating conversion price (e.g. price in ETH for selling a token), the numerator and denominator are multiplied by the reserves (see the *getInputPrice* function in *UniswapExchange* contract as an example). |
29+
30+
## References
31+
32+
For more information, see also:
33+
34+
* [Damn Vulnerable #DeFi](https://damnvulnerabledefi.xyz)
35+
* [Damn vulnerable #DeFi Write-ups & lessons learned](https://drdr-zz.medium.com/write-ups-and-lessons-learned-from-damn-vulnerable-defi-caa95d2678ec)
36+
* [Uniswap's getInputPrice function](https://github.com/Uniswap/uniswap-v1/blob/master/contracts/uniswap_exchange.vy#L106)
File renamed without changes.

README.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Damian Rusinek ([email protected]), Paweł Kuryłowicz (pawel.kurylowic
66

77
## Introduction
88

9-
Smart Contract Security Verification Standard is a FREE 13-part checklist created to standardize the security of smart contracts for developers, architects, security reviewers and vendors. This list helps to avoid the majority of known security problems and vulnerabilities by providing guidance at every stage of the development cycle of the smart contracts (from designing to implementation).
9+
Smart Contract Security Verification Standard (v1.1) is a FREE 14-part checklist created to standardize the security of smart contracts for developers, architects, security reviewers and vendors. This list helps to avoid the majority of known security problems and vulnerabilities by providing guidance at every stage of the development cycle of the smart contracts (from designing to implementation).
1010

1111
**Objectives**
1212
* Help to develop high quality code of the smart contracts.
@@ -27,22 +27,23 @@ You can use the SCSVS checklist in multiple ways:
2727
The entire checklist is in a form similar to OWASP APPLICATION SECURITY VERIFICATION STANDARD v4.0.
2828
Every category has a brief description of the control objectives and a list of security verification requirements.
2929

30-
[___Download SCSVS PDF version___](SCSVS_v1.0.pdf)
30+
[___Download SCSVS PDF version___](SCSVS_v1.1.pdf)
3131

3232
**Key areas that have been included:**
33-
* [V1: Architecture, Design and Threat Modelling](./1.0/0x10-V1-Architecture-Design-Threat-modelling.md)
34-
* [V2: Access Control](./1.0/0x11-V2-Access-Control.md)
35-
* [V3: Blockchain Data](./1.0/0x12-V3-Blockchain-Data.md)
36-
* [V4: Communications](./1.0/0x13-V4-Communications.md)
37-
* [V5: Arithmetic](./1.0/0x14-V5-Arithmetic.md)
38-
* [V6: Malicious Input Handling](./1.0/0x15-V6-Malicious-Input-Handling.md)
39-
* [V7: Gas Usage & Limitations](./1.0/0x16-V7-Gas-Usage-And-Limitations.md)
40-
* [V8: Business Logic](./1.0/0x17-V8-Business-Logic.md)
41-
* [V9: Denial of Service](./1.0/0x18-V9-Denial-Of-Service.md)
42-
* [V10: Token](./1.0/0x19-V10-Token.md)
43-
* [V11: Code Clarity](./1.0/0x20-V11-Code-Clarity.md)
44-
* [V12: Test Coverage](./1.0/0x21-V12-Test-Coverage.md)
45-
* [V13: Known Attacks](./1.0/0x22-V13-Known-Attacks.md)
33+
* [V1: Architecture, Design and Threat Modelling](./1.1/0x10-V1-Architecture-Design-Threat-modelling.md)
34+
* [V2: Access Control](./1.1/0x11-V2-Access-Control.md)
35+
* [V3: Blockchain Data](./1.1/0x12-V3-Blockchain-Data.md)
36+
* [V4: Communications](./1.1/0x13-V4-Communications.md)
37+
* [V5: Arithmetic](./1.1/0x14-V5-Arithmetic.md)
38+
* [V6: Malicious Input Handling](./1.1/0x15-V6-Malicious-Input-Handling.md)
39+
* [V7: Gas Usage & Limitations](./1.1/0x16-V7-Gas-Usage-And-Limitations.md)
40+
* [V8: Business Logic](./1.1/0x17-V8-Business-Logic.md)
41+
* [V9: Denial of Service](./1.1/0x18-V9-Denial-Of-Service.md)
42+
* [V10: Token](./1.1/0x19-V10-Token.md)
43+
* [V11: Code Clarity](./1.1/0x20-V11-Code-Clarity.md)
44+
* [V12: Test Coverage](./1.1/0x21-V12-Test-Coverage.md)
45+
* [V13: Known Attacks](./1.1/0x22-V13-Known-Attacks.md)
46+
* [V14: Decentralized Finance](./1.1/0x23-V14-Decentralized-Finance.md)
4647

4748
**Severity of the risk**
4849

SCSVS_v1.0.pdf

-573 KB
Binary file not shown.

SCSVS_v1.1.pdf

592 KB
Binary file not shown.

0 commit comments

Comments
 (0)