Skip to content

Commit 8e1affa

Browse files
committed
Merge with dev
2 parents bc9fda1 + 8deffd7 commit 8e1affa

File tree

72 files changed

+360
-10
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+360
-10
lines changed

slither/detectors/assembly/shift_parameter_mixup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class ShiftParameterMixup(AbstractDetector):
1717

1818
WIKI_TITLE = "Incorrect shift in assembly."
1919
WIKI_DESCRIPTION = "Detect if the values in a shift operation are reversed"
20+
21+
# region wiki_exploit_scenario
2022
WIKI_EXPLOIT_SCENARIO = """
2123
```solidity
2224
contract C {
@@ -28,6 +30,7 @@ class ShiftParameterMixup(AbstractDetector):
2830
}
2931
```
3032
The shift statement will right-shift the constant 8 by `a` bits"""
33+
# endregion wiki_exploit_scenario
3134

3235
WIKI_RECOMMENDATION = "Swap the order of parameters."
3336

slither/detectors/attributes/const_functions_asm.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,18 @@ class ConstantFunctionsAsm(AbstractDetector):
1919
WIKI = "https://github.com/crytic/slither/wiki/Detector-Documentation#constant-functions-using-assembly-code"
2020

2121
WIKI_TITLE = "Constant functions using assembly code"
22+
23+
# region wiki_description
2224
WIKI_DESCRIPTION = """
2325
Functions declared as `constant`/`pure`/`view` using assembly code.
2426
2527
`constant`/`pure`/`view` was not enforced prior to Solidity 0.5.
2628
Starting from Solidity 0.5, a call to a `constant`/`pure`/`view` function uses the `STATICCALL` opcode, which reverts in case of state modification.
2729
2830
As a result, a call to an [incorrectly labeled function may trap a contract compiled with Solidity 0.5](https://solidity.readthedocs.io/en/develop/050-breaking-changes.html#interoperability-with-older-contracts)."""
31+
# endregion wiki_description
2932

33+
# region wiki_exploit_scenario
3034
WIKI_EXPLOIT_SCENARIO = """
3135
```solidity
3236
contract Constant{
@@ -39,6 +43,7 @@ class ConstantFunctionsAsm(AbstractDetector):
3943
```
4044
`Constant` was deployed with Solidity 0.4.25. Bob writes a smart contract that interacts with `Constant` in Solidity 0.5.0.
4145
All the calls to `get` revert, breaking Bob's smart contract execution."""
46+
# endregion wiki_exploit_scenario
4247

4348
WIKI_RECOMMENDATION = (
4449
"Ensure the attributes of contracts compiled prior to Solidity 0.5.0 are correct."

slither/detectors/attributes/const_functions_state.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,18 @@ class ConstantFunctionsState(AbstractDetector):
1919
WIKI = "https://github.com/crytic/slither/wiki/Detector-Documentation#constant-functions-changing-the-state"
2020

2121
WIKI_TITLE = "Constant functions changing the state"
22+
23+
# region wiki_description
2224
WIKI_DESCRIPTION = """
2325
Functions declared as `constant`/`pure`/`view` change the state.
2426
2527
`constant`/`pure`/`view` was not enforced prior to Solidity 0.5.
2628
Starting from Solidity 0.5, a call to a `constant`/`pure`/`view` function uses the `STATICCALL` opcode, which reverts in case of state modification.
2729
2830
As a result, a call to an [incorrectly labeled function may trap a contract compiled with Solidity 0.5](https://solidity.readthedocs.io/en/develop/050-breaking-changes.html#interoperability-with-older-contracts)."""
31+
# endregion wiki_description
2932

33+
# region wiki_exploit_scenario
3034
WIKI_EXPLOIT_SCENARIO = """
3135
```solidity
3236
contract Constant{
@@ -39,6 +43,7 @@ class ConstantFunctionsState(AbstractDetector):
3943
```
4044
`Constant` was deployed with Solidity 0.4.25. Bob writes a smart contract that interacts with `Constant` in Solidity 0.5.0.
4145
All the calls to `get` revert, breaking Bob's smart contract execution."""
46+
# endregion wiki_exploit_scenario
4247

4348
WIKI_RECOMMENDATION = (
4449
"Ensure that attributes of contracts compiled prior to Solidity 0.5.0 are correct."

slither/detectors/attributes/incorrect_solc.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,22 @@ class IncorrectSolc(AbstractDetector):
3030
WIKI = "https://github.com/crytic/slither/wiki/Detector-Documentation#incorrect-versions-of-solidity"
3131

3232
WIKI_TITLE = "Incorrect versions of Solidity"
33+
34+
# region wiki_description
3335
WIKI_DESCRIPTION = """
3436
`solc` frequently releases new compiler versions. Using an old version prevents access to new Solidity security checks.
3537
We also recommend avoiding complex `pragma` statement."""
38+
# endregion wiki_description
39+
40+
# region wiki_recommendation
3641
WIKI_RECOMMENDATION = """
3742
Deploy with any of the following Solidity versions:
3843
- 0.5.16 - 0.5.17
3944
- 0.6.11 - 0.6.12
4045
- 0.7.5 - 0.7.6
4146
Use a simple pragma version that allows any of these versions.
4247
Consider using the latest version of Solidity for testing."""
48+
# endregion wiki_recommendation
4349

4450
COMPLEX_PRAGMA_TXT = "is too complex"
4551
OLD_VERSION_TXT = "allows old versions"

slither/detectors/attributes/locked_ether.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class LockedEther(AbstractDetector): # pylint: disable=too-many-nested-blocks
2525

2626
WIKI_TITLE = "Contracts that lock Ether"
2727
WIKI_DESCRIPTION = "Contract with a `payable` function, but without a withdrawal capacity."
28+
29+
# region wiki_exploit_scenario
2830
WIKI_EXPLOIT_SCENARIO = """
2931
```solidity
3032
pragma solidity 0.4.24;
@@ -34,6 +36,7 @@ class LockedEther(AbstractDetector): # pylint: disable=too-many-nested-blocks
3436
}
3537
```
3638
Every Ether sent to `Locked` will be lost."""
39+
# endregion wiki_exploit_scenario
3740

3841
WIKI_RECOMMENDATION = "Remove the payable attribute or add a withdraw function."
3942

slither/detectors/attributes/unimplemented_interface.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class MissingInheritance(AbstractDetector):
2121
WIKI = "https://github.com/crytic/slither/wiki/Detector-Documentation#missing-inheritance"
2222
WIKI_TITLE = "Missing inheritance"
2323
WIKI_DESCRIPTION = "Detect missing inheritance."
24+
25+
# region wiki_exploit_scenario
2426
WIKI_EXPLOIT_SCENARIO = """
2527
```solidity
2628
interface ISomething {
@@ -35,6 +37,7 @@ class MissingInheritance(AbstractDetector):
3537
```
3638
`Something` should inherit from `ISomething`.
3739
"""
40+
# endregion wiki_exploit_scenario
3841

3942
WIKI_RECOMMENDATION = "Inherit from the missing interface or contract."
4043

slither/detectors/compiler_bugs/array_by_reference.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class ArrayByReference(AbstractDetector):
2626
WIKI_DESCRIPTION = (
2727
"Detect arrays passed to a function that expects reference to a storage array"
2828
)
29+
30+
# region wiki_exploit_scenario
2931
WIKI_EXPLOIT_SCENARIO = """
3032
```solidity
3133
contract Memory {
@@ -48,6 +50,7 @@ class ArrayByReference(AbstractDetector):
4850
4951
Bob calls `f()`. Bob assumes that at the end of the call `x[0]` is 2, but it is 1.
5052
As a result, Bob's usage of the contract is incorrect."""
53+
# endregion wiki_exploit_scenario
5154

5255
WIKI_RECOMMENDATION = "Ensure the correct usage of `memory` and `storage` in the function parameters. Make all the locations explicit."
5356

slither/detectors/compiler_bugs/enum_conversion.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ class EnumConversion(AbstractDetector):
4848
WIKI = "https://github.com/crytic/slither/wiki/Detector-Documentation#dangerous-enum-conversion"
4949
WIKI_TITLE = "Dangerous enum conversion"
5050
WIKI_DESCRIPTION = "Detect out-of-range `enum` conversion (`solc` < `0.4.5`)."
51+
52+
# region wiki_exploit_scenario
5153
WIKI_EXPLOIT_SCENARIO = """
5254
```solidity
5355
pragma solidity 0.4.2;
@@ -61,6 +63,7 @@ class EnumConversion(AbstractDetector):
6163
}
6264
```
6365
Attackers can trigger unexpected behaviour by calling `bug(1)`."""
66+
# endregion wiki_exploit_scenario
6467

6568
WIKI_RECOMMENDATION = "Use a recent compiler version. If `solc` <`0.4.5` is required, check the `enum` conversion range."
6669

slither/detectors/compiler_bugs/multiple_constructor_schemes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class MultipleConstructorSchemes(AbstractDetector):
2020
WIKI_DESCRIPTION = (
2121
"Detect multiple constructor definitions in the same contract (using new and old schemes)."
2222
)
23+
24+
# region wiki_exploit_scenario
2325
WIKI_EXPLOIT_SCENARIO = """
2426
```solidity
2527
contract A {
@@ -37,6 +39,7 @@ class MultipleConstructorSchemes(AbstractDetector):
3739
}
3840
```
3941
In Solidity [0.4.22](https://github.com/ethereum/solidity/releases/tag/v0.4.23), a contract with both constructor schemes will compile. The first constructor will take precedence over the second, which may be unintended."""
42+
# endregion wiki_exploit_scenario
4043

4144
WIKI_RECOMMENDATION = "Only declare one constructor, preferably using the new scheme `constructor(...)` instead of `function <contractName>(...)`."
4245

slither/detectors/compiler_bugs/reused_base_constructor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class ReusedBaseConstructor(AbstractDetector):
3434

3535
WIKI_TITLE = "Reused base constructors"
3636
WIKI_DESCRIPTION = "Detects if the same base constructor is called with arguments from two different locations in the same inheritance hierarchy."
37+
38+
# region wiki_exploit_scenario
3739
WIKI_EXPLOIT_SCENARIO = """
3840
```solidity
3941
pragma solidity ^0.4.0;
@@ -65,6 +67,8 @@ class ReusedBaseConstructor(AbstractDetector):
6567
- `D` inherits from `B` and `C`, both of which construct `A`.
6668
- `E` only inherits from `B`, but `B` and `E` construct `A`.
6769
."""
70+
# endregion wiki_exploit_scenario
71+
6872
WIKI_RECOMMENDATION = "Remove the duplicate constructor call."
6973

7074
def _detect_explicitly_called_base_constructors(self, contract):

0 commit comments

Comments
 (0)