Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug-Candidate]: 'NoneType' object has no attribute 'can_reenter' #1368

Closed
MaxieYF opened this issue Sep 6, 2022 · 2 comments
Closed

[Bug-Candidate]: 'NoneType' object has no attribute 'can_reenter' #1368

MaxieYF opened this issue Sep 6, 2022 · 2 comments
Labels
bug-candidate Bugs reports that are not yet confirmed

Comments

@MaxieYF
Copy link

MaxieYF commented Sep 6, 2022

Describe the issue:

I install Slither using docker. When i run "slither 0x33c6Eec1723B12c46732f7AB41398DE45641Fa42",get the result : AttributeError: 'NoneType' object has no attribute 'can_reenter'.

I've read the related issues like #1001, #1267. It seems that you've already fixedthe problem.

I docker pull the lastest version, I don't know why I still got the problem. I'm not familiar with solidarity grammar.

The contract on Moonbeam, 0x9909d64A63B0F11b8eed3d4D7313EFedA8Be5daD, I‘ve got the very same issue when I use slither to run it. These two contracts are both v0.8.14+commit.80d49f37 version.

Please help me, thanks.

Code example to reproduce the issue:

slither 0x33c6Eec1723B12c46732f7AB41398DE45641Fa42

Version:

v0.8.14

Relevant log output:

ethsec@b26bd93152fe:~$ slither 0x33c6Eec1723B12c46732f7AB41398DE45641Fa42
Installing '0.8.14'...
Version '0.8.14' installed.
Traceback (most recent call last):
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/__main__.py", line 744, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/__main__.py", line 87, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/__main__.py", line 72, in process_single
    return _process(slither, detector_classes, printer_classes)
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/__main__.py", line 113, in _process
    detector_results = slither.run_detectors()
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/slither.py", line 201, in run_detectors
    results = [d.detect() for d in self._detectors]
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/slither.py", line 201, in <listcomp>
    results = [d.detect() for d in self._detectors]
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/abstract_detector.py", line 152, in detect
    for r in [output.data for output in self._detect()]:
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/reentrancy/reentrancy_eth.py", line 93, in _detect
    super()._detect()
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/reentrancy/reentrancy.py", line 303, in _detect
    self.detect_reentrancy(c)
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/reentrancy/reentrancy.py", line 290, in detect_reentrancy
    self._explore(function.entry_point, [])
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/reentrancy/reentrancy.py", line 282, in _explore
    self._explore(son, visited)
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/reentrancy/reentrancy.py", line 282, in _explore
    self._explore(son, visited)
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/reentrancy/reentrancy.py", line 267, in _explore
    contains_call = fathers_context.analyze_node(node, self)
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/reentrancy/reentrancy.py", line 159, in analyze_node
    if detector.can_callback(ir):
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/reentrancy/reentrancy.py", line 228, in can_callback
    return isinstance(ir, Call) and ir.can_reenter()
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/slithir/operations/library_call.py", line 27, in can_reenter
    return self.function.can_reenter(callstack)
AttributeError: 'NoneType' object has no attribute 'can_reenter'
None
Error in 0x33c6Eec1723B12c46732f7AB41398DE45641Fa42
Traceback (most recent call last):
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/__main__.py", line 744, in main_impl
    ) = process_all(filename, args, detector_classes, printer_classes)
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/__main__.py", line 87, in process_all
    ) = process_single(compilation, args, detector_classes, printer_classes)
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/__main__.py", line 72, in process_single
    return _process(slither, detector_classes, printer_classes)
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/__main__.py", line 113, in _process
    detector_results = slither.run_detectors()
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/slither.py", line 201, in run_detectors
    results = [d.detect() for d in self._detectors]
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/slither.py", line 201, in <listcomp>
    results = [d.detect() for d in self._detectors]
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/abstract_detector.py", line 152, in detect
    for r in [output.data for output in self._detect()]:
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/reentrancy/reentrancy_eth.py", line 93, in _detect
    super()._detect()
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/reentrancy/reentrancy.py", line 303, in _detect
    self.detect_reentrancy(c)
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/reentrancy/reentrancy.py", line 290, in detect_reentrancy
    self._explore(function.entry_point, [])
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/reentrancy/reentrancy.py", line 282, in _explore
    self._explore(son, visited)
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/reentrancy/reentrancy.py", line 282, in _explore
    self._explore(son, visited)
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/reentrancy/reentrancy.py", line 267, in _explore
    contains_call = fathers_context.analyze_node(node, self)
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/reentrancy/reentrancy.py", line 159, in analyze_node
    if detector.can_callback(ir):
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/detectors/reentrancy/reentrancy.py", line 228, in can_callback
    return isinstance(ir, Call) and ir.can_reenter()
  File "/home/ethsec/.local/lib/python3.6/site-packages/slither/slithir/operations/library_call.py", line 27, in can_reenter
    return self.function.can_reenter(callstack)
AttributeError: 'NoneType' object has no attribute 'can_reenter'
@MaxieYF MaxieYF added the bug-candidate Bugs reports that are not yet confirmed label Sep 6, 2022
@elopez
Copy link
Member

elopez commented Sep 6, 2022

Hi @MaxieYF! Those issues you linked have been fixed in the slither development version, but are still a problem in the latest release (0.8.3), which is used in the eth security toolbox. You can wait until 0.8.4 is released, or install the development version (it may not be possible to do so in the eth security toolbox, as the latest slither requires a newer python than the one available in the container)

If you want to use a docker container, there are images containing the development versions in the slither repo:

% docker run -it --platform linux/amd64 ghcr.io/crytic/slither:edge  
slither@298147906d08:~/slither$ slither 0x33c6Eec1723B12c46732f7AB41398DE45641Fa42

Installing '0.8.14'...
Version '0.8.14' installed.

LedgerMarketPass.withdrawAll() (contracts/LedgerNFT.sol#106-112) uses a dangerous strict equality:
	- balance == 0 (contracts/LedgerNFT.sol#108)
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#dangerous-strict-equalities

(...)

@elopez elopez closed this as completed Sep 6, 2022
@MaxieYF
Copy link
Author

MaxieYF commented Sep 7, 2022

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-candidate Bugs reports that are not yet confirmed
Projects
None yet
Development

No branches or pull requests

2 participants