Package: tcheck
Slither, the Solidity source analyzerlmao test esestfdjhf a
adfadfadfaSlither is a Solidity static analysis framework written in Python 3. It runs a suite of vulnerability detectors, prints visual information about contract details, and provides an API to easily write custom analyses. Slither enables developers to find vulnerabilities, enhance their code comprehension, and quickly prototype custom analyses.FeaturesBugs and Optimizations DetectionPrintersToolsHow to InstallGetting HelpFAQPublicationsFeaturesDetects vulnerable Solidity code with low false positives (see the list oftrophies)Identifies where the error condition occurs in the source codeEasily integrates into continuous integration and Truffle buildsBuilt-in 'printers' quickly report crucial contract informationDetector API to write custom analyses in PythonAbility to analyze contracts written with Solidity >= 0.4Intermediate representation (SlithIR) enables simple, high-precision analysesCorrectly parses 99.9% of all public Solidity codeAverage execution time of less than 1 second per contractBugs and Optimizations DetectionRun Slither on a Truffle/Embark/Dapp/Etherlime/Hardhat application:slither.Run Slither on a single file:slithertests/uninitialized.solIntegrationFor GitHub action integration, useslither-action.To generate a Markdown report, useslither [target] --checklist.To generate a Markdown with GitHub source code highlighting, useslither [target] --checklist --markdown-root https://github.com/ORG/REPO/blob/COMMIT/(replaceORG,REPO,COMMIT)Usesolc-selectif your contracts require older versions of solc. For additional configuration, see theusagedocumentation.DetectorsNumDetectorWhat it DetectsImpactConfidence1abiencoderv2-arrayStorage abiencoderv2 arrayHighHigh2arbitrary-send-erc20transferFrom uses arbitraryfromHighHigh3array-by-referenceModifying storage array by valueHighHigh4incorrect-shiftThe order of parameters in a shift instruction is incorrect.HighHigh5multiple-constructorsMultiple constructor schemesHighHigh6name-reusedContract's name reusedHighHigh7protected-varsDetected unprotected variablesHighHigh8public-mappings-nestedPublic mappings with nested variablesHighHigh9rtloRight-To-Left-Override control character is usedHighHigh10shadowing-stateState variables shadowingHighHigh11suicidalFunctions allowing anyone to destruct the contractHighHigh12uninitialized-stateUninitialized state variablesHighHigh13uninitialized-storageUninitialized storage variablesHighHigh14unprotected-upgradeUnprotected upgradeable contractHighHigh15codexUse Codex to find vulnerabilities.HighLow16arbitrary-send-erc20-permittransferFrom uses arbitrary from with permitHighMedium17arbitrary-send-ethFunctions that send Ether to arbitrary destinationsHighMedium18controlled-array-lengthTainted array length assignmentHighMedium19controlled-delegatecallControlled delegatecall destinationHighMedium20delegatecall-loopPayable functions usingdelegatecallinside a loopHighMedium21msg-value-loopmsg.value inside a loopHighMedium22reentrancy-ethReentrancy vulnerabilities (theft of ethers)HighMedium23storage-arraySigned storage integer array compiler bugHighMedium24unchecked-transferUnchecked tokens transferHighMedium25weak-prngWeak PRNGHighMedium26domain-separator-collisionDetects ERC20 tokens that have a function whose signature collides with EIP-2612's DOMAIN_SEPARATOR()MediumHigh27enum-conversionDetect dangerous enum conversionMediumHigh28erc20-interfaceIncorrect ERC20 interfacesMediumHigh29erc721-interfaceIncorrect ERC721 interfacesMediumHigh30incorrect-equalityDangerous strict equalitiesMediumHigh31locked-etherContracts that lock etherMediumHigh32mapping-deletionDeletion on mapping containing a structureMediumHigh33shadowing-abstractState variables shadowing from abstract contractsMediumHigh34tautologyTautology or contradictionMediumHigh35write-after-writeUnused writeMediumHigh36boolean-cstMisuse of Boolean constantMediumMedium37constant-function-asmConstant functions using assembly codeMediumMedium38constant-function-stateConstant functions changing the stateMediumMedium39divide-before-multiplyImprecise arithmetic operations orderMediumMedium40reentrancy-no-ethReentrancy vulnerabilities (no theft of ethers)MediumMedium41reused-constructorReused base constructorMediumMedium42tx-originDangerous usage oftx.originMediumMedium43unchecked-lowlevelUnchecked low-level callsMediumMedium44unchecked-sendUnchecked sendMediumMedium45uninitialized-localUninitialized local variablesMediumMedium46unused-returnUnused return valuesMediumMedium47incorrect-modifierModifiers that can return the default valueLowHigh48shadowing-builtinBuilt-in symbol shadowingLowHigh49shadowing-localLocal variables shadowingLowHigh50uninitialized-fptr-cstUninitialized function pointer calls in constructorsLowHigh51variable-scopeLocal variables used prior their declarationLowHigh52void-cstConstructor called not implementedLowHigh53calls-loopMultiple calls in a loopLowMedium54events-accessMissing Events Access ControlLowMedium55events-mathsMissing Events ArithmeticLowMedium56incorrect-unaryDangerous unary expressionsLowMedium57missing-zero-checkMissing Zero Address ValidationLowMedium58reentrancy-benignBenign reentrancy vulnerabilitiesLowMedium59reentrancy-eventsReentrancy vulnerabilities leading to out-of-order EventsLowMedium60timestampDangerous usage ofblock.timestampLowMedium61assemblyAssembly usageInformationalHigh62assert-state-changeAssert state changeInformationalHigh63boolean-equalComparison to boolean constantInformationalHigh64deprecated-standardsDeprecated Solidity StandardsInformationalHigh65erc20-indexedUn-indexed ERC20 event parametersInformationalHigh66function-init-stateFunction initializing state variablesInformationalHigh67low-level-callsLow level callsInformationalHigh68missing-inheritanceMissing inheritanceInformationalHigh69naming-conventionConformity to Solidity naming conventionsInformationalHigh70pragmaIf different pragma directives are usedInformationalHigh71redundant-statementsRedundant statementsInformationalHigh72solc-versionIncorrect Solidity versionInformationalHigh73unimplemented-functionsUnimplemented functionsInformationalHigh74unused-stateUnused state variablesInformationalHigh75costly-loopCostly operations in a loopInformationalMedium76dead-codeFunctions that are not usedInformationalMedium77reentrancy-unlimited-gasReentrancy vulnerabilities through send and transferInformationalMedium78similar-namesVariable names are too similarInformationalMedium79too-many-digitsConformance to numeric notation best practicesInformationalMedium80constable-statesState variables that could be declared constantOptimizationHigh81external-functionPublic function that could be declared externalOptimizationHigh82immutable-statesState variables that could be declared immutableOptimizationHigh83var-read-using-thisContract reads its own variable usingthisOptimizationHighFor more information, seeTheDetector Documentationfor details on each detectorTheDetection Selectionto run only selected detectors. By default, all the detectors are run.TheTriage Modeto filter individual resultsPrintersQuick Review Printershuman-summary:Print a human-readable summary of the contractsinheritance-graph:Export the inheritance graph of each contract to a dot filecontract-summary:Print a summary of the contractsIn-Depth Review Printerscall-graph:Export the call-graph of the contracts to a dot filecfg:Export the CFG of each functionsfunction-summary:Print a summary of the functionsvars-and-auth:Print the state variables written and the authorization of the functionswhen-not-paused:Print functions that do not usewhenNotPausedmodifier.To run a printer, use--printand a comma-separated list of printers.See thePrinter documentationfor the complete lists.Toolsslither-check-upgradeability:Reviewdelegatecall-based upgradeabilityslither-prop:Automatic unit test and property generationslither-flat:Flatten a codebaseslither-check-erc:Check the ERC's conformanceslither-format:Automatic patch generationslither-read-storage:Read storage values from contractsSee theTool documentationfor additional tools.Contact usto get help on building custom tools.How to installSlither requires Python 3.8+ andsolc, the Solidity compiler.Using Pippip3installslither-analyzerUsing Gitgitclonehttps://github.com/crytic/slither.git&&cdslither
python3setup.pyinstallWe recommend using a Python virtual environment, as detailed in theDeveloper Installation Instructions, if you prefer to install Slither via git.Using DockerUse theeth-security-toolboxdocker image. It includes all of our security tools and every major version of Solidity in a single image./home/sharewill be mounted to/sharein the container.dockerpulltrailofbits/eth-security-toolboxTo share a directory in the container:dockerrun-it-v/home/share:/sharetrailofbits/eth-security-toolboxGetting HelpFeel free to stop by ourSlack channel(#ethereum) for help using or extending Slither.ThePrinter documentationdescribes the information Slither is capable of visualizing for each contract.TheDetector documentationdescribes how to write a new vulnerability analyses.TheAPI documentationdescribes the methods and objects available for custom analyses.TheSlithIR documentationdescribes the SlithIR intermediate representation.FAQHow do I exclude mocks or tests?View our documentation onpath filtering.How do I fix "unknown file" or compilation issues?Because slither requires the solc AST, it must have all dependencies available.
If a contract has dependencies,slither contract.solwill fail.
Instead, useslither .in the parent directory ofcontracts/(you should seecontracts/when you runls).
If you have anode_modules/folder, it must be in the same directory ascontracts/. To verify that this issue is related to slither,
run the compilation command for the framework you are using e.gnpx hardhat compile. That must work successfully;
otherwise, slither's compilation engine, crytic-compile, cannot generate the AST.LicenseSlither is licensed and distributed under the AGPLv3 license.Contact usif you're looking for an exception to the terms.PublicationsTrail of Bits publicationSlither: A Static Analysis Framework For Smart Contracts, Josselin Feist, Gustavo Grieco, Alex Groce - WETSEB '19External publicationsTitleUsageAuthorsVenueReJection: A AST-Based Reentrancy Vulnerability Detection MethodAST-based analysis built on top of SlitherRui Ma, Zefeng Jian, Guangyuan Chen, Ke Ma, Yujia ChenCTCIS 19MPro: Combining Static and Symbolic Analysis forScalable Testing of Smart ContractLeverage data dependency through SlitherWilliam Zhang, Sebastian Banescu, Leodardo Pasos, Steven Stewart, Vijay GaneshISSRE 2019ETHPLOIT: From Fuzzing to Efficient Exploit Generation against Smart ContractsLeverage data dependency through SlitherQingzhao Zhang, Yizhuo Wang, Juanru Li, Siqi MaSANER 20Verification of Ethereum Smart Contracts: A Model Checking ApproachSymbolic execution built on top of Slither’s CFGTam Bang, Hoang H Nguyen, Dung Nguyen, Toan Trieu, Tho QuanIJMLC 20Smart Contract RepairRely on Slither’s vulnerabilities detectorsXiao Liang Yu, Omar Al-Bataineh, David Lo, Abhik RoychoudhuryTOSEM 20Demystifying Loops in Smart ContractsLeverage data dependency through SlitherBen Mariano, Yanju Chen, Yu Feng, Shuvendu Lahiri, Isil DilligASE 20Trace-Based Dynamic Gas Estimation of Loops in Smart ContractsUse Slither’s CFG to detect loopsChunmiao Li, Shijie Nie, Yang Cao, Yijun Yu, Zhenjiang HuIEEE Open J. Comput. Soc. 1 (2020)SAILFISH: Vetting Smart Contract State-Inconsistency Bugs in SecondsRely on SlithIR to build astorage dependency graphPriyanka Bose, Dipanjan Das, Yanju Chen, Yu Feng, Christopher Kruegel, and Giovanni VignaS&P 22SolType: Refinement Types for Arithmetic Overflow in SolidityUse Slither as frontend to build refinement type systemBryan Tan, Benjamin Mariano, Shuvendu K. Lahiri, Isil Dillig, Yu FengPOPL 22Do Not Rug on Me: Leveraging Machine Learning Techniques for Automated Scam DetectionUse Slither to extract tokens' features (mintable, pausable, ..)Mazorra, Bruno, Victor Adan, and Vanesa DazaMathematics 10.6 (2022)If you are using Slither on an academic work, consider applying to theCrytic $10k Research Prize.