Skip to content

Commit 1b62270

Browse files
authored
Merge pull request #301 from SmartContractSecurity/patch-disclaimers
add disclaimers to all entries
2 parents 24f30a3 + a2a0052 commit 1b62270

37 files changed

+534
-139
lines changed

entries/docs/SWC-100.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ The content of the SWC registry has not been thoroughly updated since 2020. It i
44

55
For currently maintained guidance on known Smart Contract vulnerabilities written primarily as guidance for security reviewers, please see the
66
[EEA EthTrust Security Levels specification](https://entethalliance.org/specs/ethtrust-sl). As well as the latest release version, an
7-
[Editor's draft](https://entethalliance.github.io/eta-registry/security-levels-spec.html) is available,
7+
[Editor's draft](https://entethalliance.github.io/eta-registry/security-levels-spec.html) is available,
88
that represents the latest work of the group developing the specification.
99

10-
General guidance for developers on what to consider to ensure security, that is currently maintained, is also available through the
10+
General guidance for developers on what to consider to ensure security, that is currently maintained, is also available through the
1111
[Smart Contract Security Verification Standard (SCSVS)](https://github.com/ComposableSecurity/SCSVS).
1212

1313
# Title
@@ -17,7 +17,8 @@ Function Default Visibility
1717
## Relationships
1818

1919
- [CWE-710: Improper Adherence to Coding Standards](https://cwe.mitre.org/data/definitions/710.html)
20-
- [EthTrust Security Levels **[Q] Code Linting**](https://entethalliance.org/specs/ethtrust-sl/#req-3-linted)
20+
- EthTrust Security Levels:
21+
- [**[Q] Code Linting**](https://entethalliance.org/specs/ethtrust-sl/#req-3-linted)
2122

2223
## Description
2324

@@ -39,7 +40,7 @@ Functions can be specified as being `external`, `public`, `internal` or `private
3940
```solidity
4041
/*
4142
* @source: https://github.com/sigp/solidity-security-blog#visibility
42-
* @author: SigmaPrime
43+
* @author: SigmaPrime
4344
* Modified by Gerhard Wagner
4445
*/
4546
@@ -48,7 +49,7 @@ pragma solidity ^0.4.24;
4849
contract HashForEther {
4950
5051
function withdrawWinnings() {
51-
// Winner if the last 8 hex characters of the address are 0.
52+
// Winner if the last 8 hex characters of the address are 0.
5253
require(uint32(msg.sender) == 0);
5354
_sendWinnings();
5455
}
@@ -64,7 +65,7 @@ contract HashForEther {
6465

6566
The function declarations in lines 11 and 17 do not set the visibility of the functions. At least for Solidity 0.4.24
6667
(as specified in the `pragma` statement), this means they will default to being treated as `public`.
67-
This allows anyone to call the `_sendWinings()` function and take the money.
68+
This allows anyone to call the `_sendWinings()` function and take the money.
6869

6970
Instead, the fixed version below restricts the `_sendWinnings()` function visibility to `internal`,
7071
so it can only be activated by the `WithdrawWinnings()` function that enforces a check

entries/docs/SWC-101.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
1+
# Please note, this content is no longer actively maintained.
2+
3+
The content of the SWC registry has not been thoroughly updated since 2020. It is known to be incomplete and may contain errors as well as crucial omissions.
4+
5+
For currently maintained guidance on known Smart Contract vulnerabilities written primarily as guidance for security reviewers, please see the
6+
[EEA EthTrust Security Levels specification](https://entethalliance.org/specs/ethtrust-sl). As well as the latest release version, an
7+
[Editor's draft](https://entethalliance.github.io/eta-registry/security-levels-spec.html) is available,
8+
that represents the latest work of the group developing the specification.
9+
10+
General guidance for developers on what to consider to ensure security, that is currently maintained, is also available through the
11+
[Smart Contract Security Verification Standard (SCSVS)](https://github.com/ComposableSecurity/SCSVS).
12+
113
# Title
214

315
Integer Overflow and Underflow
416

517
## Relationships
618

7-
[CWE-682: Incorrect Calculation](https://cwe.mitre.org/data/definitions/682.html)
19+
- [CWE-682: Incorrect Calculation](https://cwe.mitre.org/data/definitions/682.html)
20+
- EthTrust Security Levels:
21+
- [**[S] No Overflow/Underflow**](https://entethalliance.org/specs/ethtrust-sl/#req-1-overflow-underflow)
22+
- [**[M] Safe Overflow/Underflow**](https://entethalliance.org/specs/ethtrust-sl/#req-2-overflow-underflow)
23+
- [**[M] Documented Defensive Coding**](https://entethalliance.org/specs/ethtrust-sl/#req-2-documented)
824

925
## Description
1026

@@ -650,7 +666,7 @@ contract PausableToken is StandardToken, Pausable {
650666
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
651667
return super.approve(_spender, _value);
652668
}
653-
669+
654670
function batchTransfer(address[] _receivers, uint256 _value) public whenNotPaused returns (bool) {
655671
uint cnt = _receivers.length;
656672
uint256 amount = uint256(cnt) * _value;

entries/docs/SWC-102.md

+9-10
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ The content of the SWC registry has not been thoroughly updated since 2020. It i
44

55
For currently maintained guidance on known Smart Contract vulnerabilities written primarily as guidance for security reviewers, please see the
66
[EEA EthTrust Security Levels specification](https://entethalliance.org/specs/ethtrust-sl). As well as the latest release version, an
7-
[Editor's draft](https://entethalliance.github.io/eta-registry/security-levels-spec.html) is available,
7+
[Editor's draft](https://entethalliance.github.io/eta-registry/security-levels-spec.html) is available,
88
that represents the latest work of the group developing the specification.
99

10-
General guidance for developers on what to consider to ensure security, that is currently maintained, is also available through the
10+
General guidance for developers on what to consider to ensure security, that is currently maintained, is also available through the
1111
[Smart Contract Security Verification Standard (SCSVS)](https://github.com/ComposableSecurity/SCSVS).
1212

1313
# Title
@@ -16,7 +16,12 @@ Outdated Compiler Version
1616

1717
## Relationships
1818

19-
[CWE-937: Using Components with Known Vulnerabilities](http://cwe.mitre.org/data/definitions/937.html)
19+
- [CWE-937: Using Components with Known Vulnerabilities](http://cwe.mitre.org/data/definitions/937.html)
20+
- EEA EthTrust Security Levels:
21+
- [**Level [S]** Improved Compilers](https://entethalliance.org/specs/ethtrust-sl/#sec-1-compile-improvements)
22+
- [**Level [S]** Compiler Security Bugs](https://entethalliance.org/specs/ethtrust-sl/#sec-1-compiler-bugs)
23+
- [**Level [M]** Compiler Bugs and Overriding Requirements](https://entethalliance.org/specs/ethtrust-sl/#sec-level-2-compiler-bugs)
24+
- [**Recommended Practice** Use the Latest Compiler](https://entethalliance.org/specs/ethtrust-sl/#req-R-use-latest-compiler)
2025

2126
## Description
2227

@@ -30,11 +35,6 @@ It is recommended to use a recent version of the Solidity compiler.
3035

3136
- [Solidity Release Notes](https://github.com/ethereum/solidity/releases)
3237
- [Etherscan Solidity Bug Info](https://etherscan.io/solcbuginfo)
33-
- EEA EthTrust Security Levels:
34-
- [**Level [S]** Compiler Security Bugs](https://entethalliance.org/specs/ethtrust-sl/#sec-1-compiler-bugs)
35-
- [**Level [S]** Improved Compilers](https://entethalliance.org/specs/ethtrust-sl/#sec-1-compile-improvements)
36-
- [**Level [M]** Compiler Bugs and Overriding Requirements](https://entethalliance.org/specs/ethtrust-sl/#sec-level-2-compiler-bugs)
37-
- [**Recommended Practice** Use the Latest Compiler](https://entethalliance.org/specs/ethtrust-sl/#req-R-use-latest-compiler)
3838

3939
## Samples
4040

@@ -52,10 +52,9 @@ contract OutdatedCompilerVersion {
5252
#### Comments
5353

5454
As of August 2023 the current version of the compiler is 0.8.21. There are several dozen compiler bugs that have been fixed between that and version 0.4.13,
55-
each of which can lead to data being corrupted, contracts not functioning as expected, or unexpected vulnerabilities in contracts.
55+
each of which can lead to data being corrupted, contracts not functioning as expected, or unexpected vulnerabilities in contracts.
5656
There have also been significant improvements in compiler capabilities to protect against errors.
5757

5858
See also the sections [**Level [S]** Compiler Security Bugs](https://entethalliance.org/specs/ethtrust-sl/#sec-1-compiler-bugs),
5959
[**Level [S]** Improved Compilers](https://entethalliance.org/specs/ethtrust-sl/#sec-1-compile-improvements), and
6060
[**Level [M]** Compiler Bugs and Overriding Requirements](https://entethalliance.org/specs/ethtrust-sl/#sec-level-2-compiler-bugs)
61-

entries/docs/SWC-103.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
1+
# Please note, this content is no longer actively maintained.
2+
3+
The content of the SWC registry has not been thoroughly updated since 2020. It is known to be incomplete and may contain errors as well as crucial omissions.
4+
5+
For currently maintained guidance on known Smart Contract vulnerabilities written primarily as guidance for security reviewers, please see the
6+
[EEA EthTrust Security Levels specification](https://entethalliance.org/specs/ethtrust-sl). As well as the latest release version, an
7+
[Editor's draft](https://entethalliance.github.io/eta-registry/security-levels-spec.html) is available,
8+
that represents the latest work of the group developing the specification.
9+
10+
General guidance for developers on what to consider to ensure security, that is currently maintained, is also available through the
11+
[Smart Contract Security Verification Standard (SCSVS)](https://github.com/ComposableSecurity/SCSVS).
12+
113
# Title
214

315
Floating Pragma
416

517
## Relationships
618

7-
[CWE-664: Improper Control of a Resource Through its Lifetime](https://cwe.mitre.org/data/definitions/664.html)
19+
- [CWE-664: Improper Control of a Resource Through its Lifetime](https://cwe.mitre.org/data/definitions/664.html)
20+
- EEA EthTrust Security Levels:
21+
- [**Level [S]** Improved Compilers](https://entethalliance.org/specs/ethtrust-sl/#sec-1-compile-improvements)
22+
- [**Level [S]** Compiler Security Bugs](https://entethalliance.org/specs/ethtrust-sl/#sec-1-compiler-bugs)
23+
- [**Level [M]** Compiler Bugs and Overriding Requirements](https://entethalliance.org/specs/ethtrust-sl/#sec-level-2-compiler-bugs)
24+
- [**Recommended Practice** Use the Latest Compiler](https://entethalliance.org/specs/ethtrust-sl/#req-R-use-latest-compiler)
825

926
## Description
1027

entries/docs/SWC-104.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
1+
# Please note, this content is no longer actively maintained.
2+
3+
The content of the SWC registry has not been thoroughly updated since 2020. It is known to be incomplete and may contain errors as well as crucial omissions.
4+
5+
For currently maintained guidance on known Smart Contract vulnerabilities written primarily as guidance for security reviewers, please see the
6+
[EEA EthTrust Security Levels specification](https://entethalliance.org/specs/ethtrust-sl). As well as the latest release version, an
7+
[Editor's draft](https://entethalliance.github.io/eta-registry/security-levels-spec.html) is available,
8+
that represents the latest work of the group developing the specification.
9+
10+
General guidance for developers on what to consider to ensure security, that is currently maintained, is also available through the
11+
[Smart Contract Security Verification Standard (SCSVS)](https://github.com/ComposableSecurity/SCSVS).
12+
113
# Title
214

315
Unchecked Call Return Value
416

517
## Relationships
618

7-
[CWE-252: Unchecked Return Value](https://cwe.mitre.org/data/definitions/252.html)
19+
- [CWE-252: Unchecked Return Value](https://cwe.mitre.org/data/definitions/252.html)
20+
- EthTrust Security Levels:
21+
- [**[M] Handle External Call Returns**](https://entethalliance.github.io/eta-registry/security-levels-spec.html#req-2-handle-return)
822

923
## Description
1024

entries/docs/SWC-105.md

+37-22
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1+
# Please note, this content is no longer actively maintained.
2+
3+
The content of the SWC registry has not been thoroughly updated since 2020. It is known to be incomplete and may contain errors as well as crucial omissions.
4+
5+
For currently maintained guidance on known Smart Contract vulnerabilities written primarily as guidance for security reviewers, please see the
6+
[EEA EthTrust Security Levels specification](https://entethalliance.org/specs/ethtrust-sl). As well as the latest release version, an
7+
[Editor's draft](https://entethalliance.github.io/eta-registry/security-levels-spec.html) is available,
8+
that represents the latest work of the group developing the specification.
9+
10+
General guidance for developers on what to consider to ensure security, that is currently maintained, is also available through the
11+
[Smart Contract Security Verification Standard (SCSVS)](https://github.com/ComposableSecurity/SCSVS).
12+
113
# Title
214

315
Unprotected Ether Withdrawal
416

517
## Relationships
618

7-
[CWE-284: Improper Access Control](https://cwe.mitre.org/data/definitions/284.html)
19+
- [CWE-284: Improper Access Control](https://cwe.mitre.org/data/definitions/284.html)
20+
- EthTrust Security Levels:
21+
- [**[M] Protect Self-destruction**](https://entethalliance.github.io/eta-registry/security-levels-spec.html#req-2-self-destruct)
22+
- [**[Q] Enforce Least Privilege**](https://entethalliance.github.io/eta-registry/security-levels-spec.html#req-3-access-control)
823

924
## Description
1025

@@ -230,7 +245,7 @@ pragma solidity ^0.4.23;
230245
contract MultiOwnable {
231246
address public root;
232247
mapping (address => address) public owners; // owner => parent of owner
233-
248+
234249
/**
235250
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
236251
* account.
@@ -239,25 +254,25 @@ contract MultiOwnable {
239254
root = msg.sender;
240255
owners[root] = root;
241256
}
242-
257+
243258
/**
244259
* @dev Throws if called by any account other than the owner.
245260
*/
246261
modifier onlyOwner() {
247262
require(owners[msg.sender] != 0);
248263
_;
249264
}
250-
265+
251266
/**
252267
* @dev Adding new owners
253268
* Note that the "onlyOwner" modifier is used here.
254-
*/
269+
*/
255270
function newOwner(address _owner) onlyOwner external returns (bool) {
256271
require(_owner != 0);
257272
owners[_owner] = msg.sender;
258273
return true;
259274
}
260-
275+
261276
/**
262277
* @dev Deleting owners
263278
*/
@@ -269,7 +284,7 @@ contract MultiOwnable {
269284
}
270285
271286
contract TestContract is MultiOwnable {
272-
287+
273288
function withdrawAll() onlyOwner {
274289
msg.sender.transfer(this.balance);
275290
}
@@ -292,7 +307,7 @@ pragma solidity ^0.4.23;
292307
contract MultiOwnable {
293308
address public root;
294309
mapping (address => address) public owners; // owner => parent of owner
295-
310+
296311
/**
297312
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
298313
* account.
@@ -301,25 +316,25 @@ contract MultiOwnable {
301316
root = msg.sender;
302317
owners[root] = root;
303318
}
304-
319+
305320
/**
306321
* @dev Throws if called by any account other than the owner.
307322
*/
308323
modifier onlyOwner() {
309324
require(owners[msg.sender] != 0);
310325
_;
311326
}
312-
327+
313328
/**
314329
* @dev Adding new owners
315330
* Note that the "onlyOwner" modifier is missing here.
316-
*/
331+
*/
317332
function newOwner(address _owner) external returns (bool) {
318333
require(_owner != 0);
319334
owners[_owner] = msg.sender;
320335
return true;
321336
}
322-
337+
323338
/**
324339
* @dev Deleting owners
325340
*/
@@ -331,7 +346,7 @@ contract MultiOwnable {
331346
}
332347
333348
contract TestContract is MultiOwnable {
334-
349+
335350
function withdrawAll() onlyOwner {
336351
msg.sender.transfer(this.balance);
337352
}
@@ -371,7 +386,7 @@ pragma solidity ^0.4.24;
371386
372387
contract Wallet {
373388
address creator;
374-
389+
375390
mapping(address => uint256) balances;
376391
377392
constructor() public {
@@ -382,7 +397,7 @@ contract Wallet {
382397
assert(balances[msg.sender] + msg.value > balances[msg.sender]);
383398
balances[msg.sender] += msg.value;
384399
}
385-
400+
386401
function withdraw(uint256 amount) public {
387402
require(amount <= balances[msg.sender]);
388403
msg.sender.transfer(amount);
@@ -417,7 +432,7 @@ pragma solidity ^0.4.24;
417432
418433
contract Wallet {
419434
address creator;
420-
435+
421436
mapping(address => uint256) balances;
422437
423438
constructor() public {
@@ -428,7 +443,7 @@ contract Wallet {
428443
assert(balances[msg.sender] + msg.value > balances[msg.sender]);
429444
balances[msg.sender] += msg.value;
430445
}
431-
446+
432447
function withdraw(uint256 amount) public {
433448
require(amount <= balances[msg.sender]);
434449
msg.sender.transfer(amount);
@@ -461,7 +476,7 @@ pragma solidity ^0.4.24;
461476
462477
contract Wallet {
463478
address creator;
464-
479+
465480
mapping(address => uint256) balances;
466481
467482
function initWallet() public {
@@ -472,7 +487,7 @@ contract Wallet {
472487
assert(balances[msg.sender] + msg.value > balances[msg.sender]);
473488
balances[msg.sender] += msg.value;
474489
}
475-
490+
476491
function withdraw(uint256 amount) public {
477492
require(amount <= balances[msg.sender]);
478493
msg.sender.transfer(amount);
@@ -496,13 +511,13 @@ contract Wallet {
496511
pragma solidity ^0.4.24;
497512
498513
/* User can add pay in and withdraw Ether.
499-
Unfortunatelty, the developer was drunk and used the wrong comparison operator in "withdraw()"
514+
Unfortunately, the developer was drunk and used the wrong comparison operator in "withdraw()"
500515
Anybody can withdraw arbitrary amounts of Ether :()
501516
*/
502517
503518
contract Wallet {
504519
address creator;
505-
520+
506521
mapping(address => uint256) balances;
507522
508523
constructor() public {
@@ -513,7 +528,7 @@ contract Wallet {
513528
assert(balances[msg.sender] + msg.value > balances[msg.sender]);
514529
balances[msg.sender] += msg.value;
515530
}
516-
531+
517532
function withdraw(uint256 amount) public {
518533
require(amount >= balances[msg.sender]);
519534
msg.sender.transfer(amount);

0 commit comments

Comments
 (0)