Package: tealer
TealerTealer is a static analyzer forTealcode.
It parses the Teal program, and builds its CFG. The analyzer comes with a set of vulnerabilities detectors and printers allowing to quickly review the contracts.
In addition, tealer allows for custom path discovery throughregular expression, and can be configured to follow thegroup informationof the application.UsageDetectors: Vulnerabilities detectorsPrinters: Visual informationRegular expression: Regular expression engineHow to installGroup configurationUsageTo detect vulnerabilitiestealerdetect--contractsfile.tealTo run a printertealerprint<printer_name>--contractsfile.tealTo run the regular expression enginetealerregex<regex_file.txt>--contractsfile.tealFor additional configuration, see theUsagedocumentation.DetectorsNumDetectorWhat it detectsApplies ToImpactConfidence1is-deletableDeletable ApplicationsStatefulHighHigh2is-updatableUpgradable ApplicationsStatefulHighHigh3unprotected-deletableUnprotected Deletable ApplicationsStatefulHighHigh4unprotected-updatableUnprotected Upgradable ApplicationsStatefulHighHigh5group-size-checkUsage of absolute indexes without validating GroupSizeStateless, StatefulHighHigh6can-close-accountMissing CloseRemainderTo field ValidationStatelessHighHigh7can-close-assetMissing AssetCloseTo Field ValidationStatelessHighHigh8missing-fee-checkMissing Fee Field ValidationStatelessHighHigh9rekey-toRekeyable Logic SignaturesStatelessHighHigh10constant-gtxnUnoptimized GtxnStatelessOptimizationHigh11self-accessUnoptimized self accessStatelessOptimizationHigh12sender-accessUnoptimized GtxnStatelessOptimizationHighFor more information, seeTheDetector Documentationfor information on each detectorTheDetection Selectionto run only selected detectors. By default, all the detectors are ran.PrintersNumPrinterWhat it prints1call-graphExport the call graph of contract to a dot file2cfgExport the CFG of entire contract3human-summaryPrint a human-readable summary of the contract4subroutine-cfgExport the CFG of each subroutine5transaction-contextOutput possible values of GroupIndices, GroupSizePrinters outputdotfiles.
Usexdotto open the files  (sudo apt install xdot).Regular expressionTealer can detect if there is a path between a given label and a set of instruction using theregexsubcommand:tealer regex regex.txt --contracts file.teal.The Regular expression file must be on the form:label =>
  ins1
  ins2If there is a match, tealer will generate a DOT file with the graph.For an example, runtealer regex tests/regex/regex.txt --contract tests/regex/vote_approval.teal, with:tests/regex/regex.txttests/regex/vote_approval.tealWhich will generateregex_result.dot.How to installpip3 install tealerUsing Gitgitclonehttps://github.com/crytic/tealer.git&&cdtealer
makedevGroup configurationTo help tealer reasons about applications that are meant to be run in a group of transaction, the user can provide the group information through a configuration file:See theANS configurationexampleSeeLightweight group information specificationdiscussion.The file format is still in development, and it is likely to evolve in the futureLicenseTealer is licensed and distributed under the AGPLv3 license.Contact usif you're looking for an exception to the terms.