@snovon/solast 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +190 -0
- package/dist/api.d.ts +89 -0
- package/dist/api.js +33 -0
- package/dist/ast/resolve-return-names.d.ts +2 -0
- package/dist/ast/resolve-return-names.js +199 -0
- package/dist/ast/solc-walker.d.ts +17 -0
- package/dist/ast/solc-walker.js +497 -0
- package/dist/ast/storage-layout.d.ts +21 -0
- package/dist/ast/storage-layout.js +64 -0
- package/dist/cli.d.ts +65 -0
- package/dist/cli.js +755 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.js +284 -0
- package/dist/dedup/files.d.ts +1 -0
- package/dist/dedup/files.js +74 -0
- package/dist/dedup/findings.d.ts +41 -0
- package/dist/dedup/findings.js +211 -0
- package/dist/detectors/_common/access-control.d.ts +204 -0
- package/dist/detectors/_common/access-control.js +377 -0
- package/dist/detectors/_common/ast.d.ts +139 -0
- package/dist/detectors/_common/ast.js +239 -0
- package/dist/detectors/_common/compiler-profile.d.ts +14 -0
- package/dist/detectors/_common/compiler-profile.js +66 -0
- package/dist/detectors/_common/dataflow.d.ts +75 -0
- package/dist/detectors/_common/dataflow.js +57 -0
- package/dist/detectors/_common/fhe.d.ts +7 -0
- package/dist/detectors/_common/fhe.js +40 -0
- package/dist/detectors/_common/integer-overflow-helpers.d.ts +58 -0
- package/dist/detectors/_common/integer-overflow-helpers.js +422 -0
- package/dist/detectors/_common/loop-call-stack.d.ts +9 -0
- package/dist/detectors/_common/loop-call-stack.js +132 -0
- package/dist/detectors/_common/oracle.d.ts +5 -0
- package/dist/detectors/_common/oracle.js +64 -0
- package/dist/detectors/_common/price-rate.d.ts +116 -0
- package/dist/detectors/_common/price-rate.js +446 -0
- package/dist/detectors/_common/source-text.d.ts +11 -0
- package/dist/detectors/_common/source-text.js +82 -0
- package/dist/detectors/_common/weighted-pool-invariant.d.ts +21 -0
- package/dist/detectors/_common/weighted-pool-invariant.js +105 -0
- package/dist/detectors/aave-v2-reentrancy.d.ts +7 -0
- package/dist/detectors/aave-v2-reentrancy.js +286 -0
- package/dist/detectors/access-control.d.ts +103 -0
- package/dist/detectors/access-control.js +983 -0
- package/dist/detectors/add-reentrancy-on-weth-contract.d.ts +7 -0
- package/dist/detectors/add-reentrancy-on-weth-contract.js +536 -0
- package/dist/detectors/ai-generated-randomness.d.ts +32 -0
- package/dist/detectors/ai-generated-randomness.js +239 -0
- package/dist/detectors/amm-spot-oracle-manipulation.d.ts +52 -0
- package/dist/detectors/amm-spot-oracle-manipulation.js +420 -0
- package/dist/detectors/analyzing-the-uniswap-v3-exploit.d.ts +26 -0
- package/dist/detectors/analyzing-the-uniswap-v3-exploit.js +279 -0
- package/dist/detectors/any-token-is-destroyed.d.ts +34 -0
- package/dist/detectors/any-token-is-destroyed.js +527 -0
- package/dist/detectors/anyswap-anytoken-permit-allowance-drain.d.ts +7 -0
- package/dist/detectors/anyswap-anytoken-permit-allowance-drain.js +524 -0
- package/dist/detectors/anyswap-insufficient-token-validation.d.ts +24 -0
- package/dist/detectors/anyswap-insufficient-token-validation.js +342 -0
- package/dist/detectors/approval-based-drain.d.ts +7 -0
- package/dist/detectors/approval-based-drain.js +772 -0
- package/dist/detectors/arbitrary-account-balance-transfer.d.ts +7 -0
- package/dist/detectors/arbitrary-account-balance-transfer.js +485 -0
- package/dist/detectors/arbitrary-address-spoofing-attack.d.ts +7 -0
- package/dist/detectors/arbitrary-address-spoofing-attack.js +444 -0
- package/dist/detectors/arbitrary-address-spoofing.d.ts +9 -0
- package/dist/detectors/arbitrary-address-spoofing.js +657 -0
- package/dist/detectors/arbitrary-call-error.d.ts +127 -0
- package/dist/detectors/arbitrary-call-error.js +1163 -0
- package/dist/detectors/arbitrary-call.d.ts +4 -0
- package/dist/detectors/arbitrary-call.js +11 -0
- package/dist/detectors/arbitrary-delegatecall-target.d.ts +35 -0
- package/dist/detectors/arbitrary-delegatecall-target.js +554 -0
- package/dist/detectors/arbitrary-recipient-no-access-control.d.ts +7 -0
- package/dist/detectors/arbitrary-recipient-no-access-control.js +638 -0
- package/dist/detectors/arbitrary-storage-proof-forgery.d.ts +35 -0
- package/dist/detectors/arbitrary-storage-proof-forgery.js +340 -0
- package/dist/detectors/arbitrary-transfer-from.d.ts +38 -0
- package/dist/detectors/arbitrary-transfer-from.js +339 -0
- package/dist/detectors/arbitrum-cross-chain-message-replay.d.ts +22 -0
- package/dist/detectors/arbitrum-cross-chain-message-replay.js +477 -0
- package/dist/detectors/avs-slashing-without-quorum-check.d.ts +50 -0
- package/dist/detectors/avs-slashing-without-quorum-check.js +386 -0
- package/dist/detectors/bad-debt-propagation.d.ts +13 -0
- package/dist/detectors/bad-debt-propagation.js +480 -0
- package/dist/detectors/bad-k-value-verification.d.ts +7 -0
- package/dist/detectors/bad-k-value-verification.js +512 -0
- package/dist/detectors/bad-randomness-zero-blockhash.d.ts +29 -0
- package/dist/detectors/bad-randomness-zero-blockhash.js +115 -0
- package/dist/detectors/balancer-flash-loan-manipulation.d.ts +33 -0
- package/dist/detectors/balancer-flash-loan-manipulation.js +178 -0
- package/dist/detectors/balancer-pause-guard.d.ts +33 -0
- package/dist/detectors/balancer-pause-guard.js +307 -0
- package/dist/detectors/balancer-weighted-pool-flash-loan.d.ts +42 -0
- package/dist/detectors/balancer-weighted-pool-flash-loan.js +275 -0
- package/dist/detectors/batch-transfer-overflow.d.ts +7 -0
- package/dist/detectors/batch-transfer-overflow.js +465 -0
- package/dist/detectors/beneficiary-validation.d.ts +7 -0
- package/dist/detectors/beneficiary-validation.js +696 -0
- package/dist/detectors/borrow-behalf-consent.d.ts +7 -0
- package/dist/detectors/borrow-behalf-consent.js +400 -0
- package/dist/detectors/break-continue-scope.d.ts +7 -0
- package/dist/detectors/break-continue-scope.js +194 -0
- package/dist/detectors/bridge-accounting-bypass.d.ts +65 -0
- package/dist/detectors/bridge-accounting-bypass.js +449 -0
- package/dist/detectors/bridge-business-logic-flaw-incorrect-acc.d.ts +43 -0
- package/dist/detectors/bridge-business-logic-flaw-incorrect-acc.js +394 -0
- package/dist/detectors/bridge-collateral-drain.d.ts +7 -0
- package/dist/detectors/bridge-collateral-drain.js +630 -0
- package/dist/detectors/bridge-forged-proof.d.ts +7 -0
- package/dist/detectors/bridge-forged-proof.js +754 -0
- package/dist/detectors/bridge-missing-message-nonce.d.ts +57 -0
- package/dist/detectors/bridge-missing-message-nonce.js +638 -0
- package/dist/detectors/bridge-swap-metapool-attack.d.ts +20 -0
- package/dist/detectors/bridge-swap-metapool-attack.js +230 -0
- package/dist/detectors/business-logic-flaw-flashloan-price-mani.d.ts +7 -0
- package/dist/detectors/business-logic-flaw-flashloan-price-mani.js +353 -0
- package/dist/detectors/business-logic-flaw-incorrect-recipient-balance.d.ts +7 -0
- package/dist/detectors/business-logic-flaw-incorrect-recipient-balance.js +403 -0
- package/dist/detectors/business-logic-flaw.d.ts +21 -0
- package/dist/detectors/business-logic-flaw.js +339 -0
- package/dist/detectors/business-logic.d.ts +17 -0
- package/dist/detectors/business-logic.js +22 -0
- package/dist/detectors/bypassed-insolvency-check.d.ts +30 -0
- package/dist/detectors/bypassed-insolvency-check.js +232 -0
- package/dist/detectors/bytecode-divergence-risk.d.ts +32 -0
- package/dist/detectors/bytecode-divergence-risk.js +150 -0
- package/dist/detectors/cache-array-length.d.ts +30 -0
- package/dist/detectors/cache-array-length.js +177 -0
- package/dist/detectors/cache-storage-reads.d.ts +46 -0
- package/dist/detectors/cache-storage-reads.js +323 -0
- package/dist/detectors/calldata-secret-access-control.d.ts +36 -0
- package/dist/detectors/calldata-secret-access-control.js +446 -0
- package/dist/detectors/capital-cross-contract-reentrancy.d.ts +34 -0
- package/dist/detectors/capital-cross-contract-reentrancy.js +481 -0
- package/dist/detectors/cartel-custom-approval-logic.d.ts +7 -0
- package/dist/detectors/cartel-custom-approval-logic.js +407 -0
- package/dist/detectors/ccip-receiver-missing-replay-guard.d.ts +22 -0
- package/dist/detectors/ccip-receiver-missing-replay-guard.js +413 -0
- package/dist/detectors/chain-coupling-risk.d.ts +8 -0
- package/dist/detectors/chain-coupling-risk.js +203 -0
- package/dist/detectors/chainlink-deprecated-function.d.ts +7 -0
- package/dist/detectors/chainlink-deprecated-function.js +205 -0
- package/dist/detectors/chainlink-tx-origin.d.ts +7 -0
- package/dist/detectors/chainlink-tx-origin.js +363 -0
- package/dist/detectors/check-effects-interactions.d.ts +39 -0
- package/dist/detectors/check-effects-interactions.js +783 -0
- package/dist/detectors/check-permit-missing-chainid.d.ts +27 -0
- package/dist/detectors/check-permit-missing-chainid.js +456 -0
- package/dist/detectors/classic-reentrancy.d.ts +93 -0
- package/dist/detectors/classic-reentrancy.js +645 -0
- package/dist/detectors/coinbase-morpho-wethloan-policy.d.ts +29 -0
- package/dist/detectors/coinbase-morpho-wethloan-policy.js +368 -0
- package/dist/detectors/compoundv2-inflation-attack.d.ts +7 -0
- package/dist/detectors/compoundv2-inflation-attack.js +675 -0
- package/dist/detectors/constructor-address-validation.d.ts +24 -0
- package/dist/detectors/constructor-address-validation.js +335 -0
- package/dist/detectors/constructor-interface-no-address-validation.d.ts +32 -0
- package/dist/detectors/constructor-interface-no-address-validation.js +283 -0
- package/dist/detectors/cross-chain-arbitrary-call.d.ts +7 -0
- package/dist/detectors/cross-chain-arbitrary-call.js +601 -0
- package/dist/detectors/cross-chain-input-validation.d.ts +31 -0
- package/dist/detectors/cross-chain-input-validation.js +347 -0
- package/dist/detectors/cross-chain-intent-replay.d.ts +38 -0
- package/dist/detectors/cross-chain-intent-replay.js +453 -0
- package/dist/detectors/cross-chain-intent-stale-resolution.d.ts +7 -0
- package/dist/detectors/cross-chain-intent-stale-resolution.js +463 -0
- package/dist/detectors/cross-chain-message-order-dependency.d.ts +8 -0
- package/dist/detectors/cross-chain-message-order-dependency.js +472 -0
- package/dist/detectors/cross-chain-message-replay.d.ts +8 -0
- package/dist/detectors/cross-chain-message-replay.js +568 -0
- package/dist/detectors/cross-chain-messaging.d.ts +7 -0
- package/dist/detectors/cross-chain-messaging.js +663 -0
- package/dist/detectors/cross-chain-msg-truncation.d.ts +7 -0
- package/dist/detectors/cross-chain-msg-truncation.js +453 -0
- package/dist/detectors/cross-chain-truncation.d.ts +7 -0
- package/dist/detectors/cross-chain-truncation.js +422 -0
- package/dist/detectors/cross-contract-integer-overflow.d.ts +76 -0
- package/dist/detectors/cross-contract-integer-overflow.js +554 -0
- package/dist/detectors/cross-contract-reentrancy-trusted-callee.d.ts +39 -0
- package/dist/detectors/cross-contract-reentrancy-trusted-callee.js +385 -0
- package/dist/detectors/cross-contract-reentrancy.d.ts +63 -0
- package/dist/detectors/cross-contract-reentrancy.js +631 -0
- package/dist/detectors/cross-function-reentrancy.d.ts +37 -0
- package/dist/detectors/cross-function-reentrancy.js +648 -0
- package/dist/detectors/cross-protocol-contagion.d.ts +20 -0
- package/dist/detectors/cross-protocol-contagion.js +445 -0
- package/dist/detectors/cross-protocol-oracle-collateral.d.ts +38 -0
- package/dist/detectors/cross-protocol-oracle-collateral.js +487 -0
- package/dist/detectors/cross-vm-reentrancy.d.ts +7 -0
- package/dist/detectors/cross-vm-reentrancy.js +484 -0
- package/dist/detectors/decimals-mismatch.d.ts +89 -0
- package/dist/detectors/decimals-mismatch.js +451 -0
- package/dist/detectors/deferred-state-update.d.ts +16 -0
- package/dist/detectors/deferred-state-update.js +35 -0
- package/dist/detectors/deflationary-token.d.ts +27 -0
- package/dist/detectors/deflationary-token.js +751 -0
- package/dist/detectors/delegate-transfer-unrestricted-caller.d.ts +44 -0
- package/dist/detectors/delegate-transfer-unrestricted-caller.js +410 -0
- package/dist/detectors/delegatecall-fallback-reentrancy-bypass.d.ts +14 -0
- package/dist/detectors/delegatecall-fallback-reentrancy-bypass.js +241 -0
- package/dist/detectors/delegatecall-in-loops.d.ts +7 -0
- package/dist/detectors/delegatecall-in-loops.js +129 -0
- package/dist/detectors/delegatecall-init-owner-mutator.d.ts +8 -0
- package/dist/detectors/delegatecall-init-owner-mutator.js +655 -0
- package/dist/detectors/delegatecall-init.d.ts +7 -0
- package/dist/detectors/delegatecall-init.js +769 -0
- package/dist/detectors/delegatecall-untrusted-implementation.d.ts +41 -0
- package/dist/detectors/delegatecall-untrusted-implementation.js +888 -0
- package/dist/detectors/delegated-authorization-bypass.d.ts +7 -0
- package/dist/detectors/delegated-authorization-bypass.js +370 -0
- package/dist/detectors/denial-of-service.d.ts +117 -0
- package/dist/detectors/denial-of-service.js +947 -0
- package/dist/detectors/division-before-multiplication.d.ts +7 -0
- package/dist/detectors/division-before-multiplication.js +303 -0
- package/dist/detectors/dn404-mirror-access-control.d.ts +26 -0
- package/dist/detectors/dn404-mirror-access-control.js +315 -0
- package/dist/detectors/doge-flashloan.d.ts +29 -0
- package/dist/detectors/doge-flashloan.js +329 -0
- package/dist/detectors/donate-inflation-exchangerate-roundin.d.ts +7 -0
- package/dist/detectors/donate-inflation-exchangerate-roundin.js +621 -0
- package/dist/detectors/donation-share-inflation.d.ts +24 -0
- package/dist/detectors/donation-share-inflation.js +466 -0
- package/dist/detectors/dont-let-eth-get-rekt.d.ts +84 -0
- package/dist/detectors/dont-let-eth-get-rekt.js +1151 -0
- package/dist/detectors/dos-unbounded-loop-external-call-revert.d.ts +37 -0
- package/dist/detectors/dos-unbounded-loop-external-call-revert.js +541 -0
- package/dist/detectors/eip1167-proxy-reentrancy.d.ts +7 -0
- package/dist/detectors/eip1167-proxy-reentrancy.js +508 -0
- package/dist/detectors/eip4626-vault-reentrancy.d.ts +32 -0
- package/dist/detectors/eip4626-vault-reentrancy.js +312 -0
- package/dist/detectors/eip5792-auth-replay.d.ts +45 -0
- package/dist/detectors/eip5792-auth-replay.js +519 -0
- package/dist/detectors/eip712-domain-separator.d.ts +42 -0
- package/dist/detectors/eip712-domain-separator.js +524 -0
- package/dist/detectors/eip712-signature-verification.d.ts +49 -0
- package/dist/detectors/eip712-signature-verification.js +689 -0
- package/dist/detectors/eip7702-auth-replay.d.ts +7 -0
- package/dist/detectors/eip7702-auth-replay.js +768 -0
- package/dist/detectors/eip7702-cross-chain-replay.d.ts +27 -0
- package/dist/detectors/eip7702-cross-chain-replay.js +307 -0
- package/dist/detectors/eip7702-delegated-eoa-approval-race.d.ts +39 -0
- package/dist/detectors/eip7702-delegated-eoa-approval-race.js +413 -0
- package/dist/detectors/eip7702-delegation-reentrancy.d.ts +21 -0
- package/dist/detectors/eip7702-delegation-reentrancy.js +705 -0
- package/dist/detectors/eip7702-delegation-risk.d.ts +7 -0
- package/dist/detectors/eip7702-delegation-risk.js +745 -0
- package/dist/detectors/eip7702-eoa-assumption.d.ts +57 -0
- package/dist/detectors/eip7702-eoa-assumption.js +461 -0
- package/dist/detectors/erc1155-batch-missing-per-id-approval.d.ts +23 -0
- package/dist/detectors/erc1155-batch-missing-per-id-approval.js +343 -0
- package/dist/detectors/erc1155-reentrancy.d.ts +31 -0
- package/dist/detectors/erc1155-reentrancy.js +217 -0
- package/dist/detectors/erc1271-stub-implementation.d.ts +21 -0
- package/dist/detectors/erc1271-stub-implementation.js +268 -0
- package/dist/detectors/erc20-safe-wrapper-return-unchecked.d.ts +43 -0
- package/dist/detectors/erc20-safe-wrapper-return-unchecked.js +368 -0
- package/dist/detectors/erc20-unchecked-non-standard-return.d.ts +55 -0
- package/dist/detectors/erc20-unchecked-non-standard-return.js +454 -0
- package/dist/detectors/erc2612-permit-frontrunning.d.ts +23 -0
- package/dist/detectors/erc2612-permit-frontrunning.js +246 -0
- package/dist/detectors/erc2771-context-spoofing.d.ts +41 -0
- package/dist/detectors/erc2771-context-spoofing.js +510 -0
- package/dist/detectors/erc4337-validation-storage-access.d.ts +35 -0
- package/dist/detectors/erc4337-validation-storage-access.js +232 -0
- package/dist/detectors/erc4626-totalassets-stub.d.ts +17 -0
- package/dist/detectors/erc4626-totalassets-stub.js +216 -0
- package/dist/detectors/erc6909-balance-overflow.d.ts +7 -0
- package/dist/detectors/erc6909-balance-overflow.js +688 -0
- package/dist/detectors/erc6909-operator-scope.d.ts +49 -0
- package/dist/detectors/erc6909-operator-scope.js +494 -0
- package/dist/detectors/erc721-unchecked-transfer.d.ts +38 -0
- package/dist/detectors/erc721-unchecked-transfer.js +364 -0
- package/dist/detectors/erc7579-module-install-without-threshold.d.ts +40 -0
- package/dist/detectors/erc7579-module-install-without-threshold.js +338 -0
- package/dist/detectors/erc7683-fill-validation.d.ts +53 -0
- package/dist/detectors/erc7683-fill-validation.js +758 -0
- package/dist/detectors/erc7683-intent-resolution.d.ts +7 -0
- package/dist/detectors/erc7683-intent-resolution.js +457 -0
- package/dist/detectors/erc777-callback-reentrancy.d.ts +8 -0
- package/dist/detectors/erc777-callback-reentrancy.js +439 -0
- package/dist/detectors/erc777-reentrancy.d.ts +7 -0
- package/dist/detectors/erc777-reentrancy.js +488 -0
- package/dist/detectors/erc777-tokens-to-send-reentrancy.d.ts +47 -0
- package/dist/detectors/erc777-tokens-to-send-reentrancy.js +674 -0
- package/dist/detectors/estuary-token-flaw.d.ts +16 -0
- package/dist/detectors/estuary-token-flaw.js +547 -0
- package/dist/detectors/euler-debt-token-manipulation.d.ts +32 -0
- package/dist/detectors/euler-debt-token-manipulation.js +347 -0
- package/dist/detectors/exploiting-a-vulnerability-in-curve-fina.d.ts +29 -0
- package/dist/detectors/exploiting-a-vulnerability-in-curve-fina.js +210 -0
- package/dist/detectors/fallback-delegatecall-reentrancy.d.ts +14 -0
- package/dist/detectors/fallback-delegatecall-reentrancy.js +236 -0
- package/dist/detectors/farm-business-logic-flaw-lack-of-access.d.ts +7 -0
- package/dist/detectors/farm-business-logic-flaw-lack-of-access.js +665 -0
- package/dist/detectors/fee-mechanism-exploitation.d.ts +20 -0
- package/dist/detectors/fee-mechanism-exploitation.js +400 -0
- package/dist/detectors/fee-on-transfer-balance-mismatch.d.ts +49 -0
- package/dist/detectors/fee-on-transfer-balance-mismatch.js +394 -0
- package/dist/detectors/fhe-encrypted-input-validation.d.ts +29 -0
- package/dist/detectors/fhe-encrypted-input-validation.js +210 -0
- package/dist/detectors/fhe-handle-leakage.d.ts +44 -0
- package/dist/detectors/fhe-handle-leakage.js +315 -0
- package/dist/detectors/fhe-oz-pattern-misuse.d.ts +26 -0
- package/dist/detectors/fhe-oz-pattern-misuse.js +311 -0
- package/dist/detectors/fhe-state-leakage.d.ts +8 -0
- package/dist/detectors/fhe-state-leakage.js +400 -0
- package/dist/detectors/fi-bridges.d.ts +33 -0
- package/dist/detectors/fi-bridges.js +428 -0
- package/dist/detectors/finance-access-control-price-oracle-man.d.ts +9 -0
- package/dist/detectors/finance-access-control-price-oracle-man.js +640 -0
- package/dist/detectors/finance-bridge-address0safetransferfrom.d.ts +8 -0
- package/dist/detectors/finance-bridge-address0safetransferfrom.js +574 -0
- package/dist/detectors/finance-business-logic-in-mint.d.ts +54 -0
- package/dist/detectors/finance-business-logic-in-mint.js +687 -0
- package/dist/detectors/finance-erc667-reentrancy.d.ts +7 -0
- package/dist/detectors/finance-erc667-reentrancy.js +509 -0
- package/dist/detectors/finance-flashloan-price-oracle-manipul.d.ts +7 -0
- package/dist/detectors/finance-flashloan-price-oracle-manipul.js +546 -0
- package/dist/detectors/finance-flashloan-reentrancy.d.ts +7 -0
- package/dist/detectors/finance-flashloan-reentrancy.js +547 -0
- package/dist/detectors/finance-swap-metapool-attack.d.ts +19 -0
- package/dist/detectors/finance-swap-metapool-attack.js +321 -0
- package/dist/detectors/flashloan-price-manipulation.d.ts +7 -0
- package/dist/detectors/flashloan-price-manipulation.js +950 -0
- package/dist/detectors/flashloan-reentrancy-rari.d.ts +28 -0
- package/dist/detectors/flashloan-reentrancy-rari.js +577 -0
- package/dist/detectors/flashloan-reentrancy.d.ts +7 -0
- package/dist/detectors/flashloan-reentrancy.js +383 -0
- package/dist/detectors/flashloan-token-migrate.d.ts +7 -0
- package/dist/detectors/flashloan-token-migrate.js +274 -0
- package/dist/detectors/force-fed-eth-state-corruption.d.ts +32 -0
- package/dist/detectors/force-fed-eth-state-corruption.js +293 -0
- package/dist/detectors/free-mint-bug.d.ts +41 -0
- package/dist/detectors/free-mint-bug.js +483 -0
- package/dist/detectors/front-running-orderbook-state-update.d.ts +37 -0
- package/dist/detectors/front-running-orderbook-state-update.js +471 -0
- package/dist/detectors/front-running-shared-collateral-write.d.ts +41 -0
- package/dist/detectors/front-running-shared-collateral-write.js +508 -0
- package/dist/detectors/fusion-v1-settlement-arbitrary-yul-calld.d.ts +30 -0
- package/dist/detectors/fusion-v1-settlement-arbitrary-yul-calld.js +354 -0
- package/dist/detectors/generalized-frontrunning.d.ts +7 -0
- package/dist/detectors/generalized-frontrunning.js +836 -0
- package/dist/detectors/governance-flash-loan.d.ts +62 -0
- package/dist/detectors/governance-flash-loan.js +452 -0
- package/dist/detectors/governance-flashloan-vote.d.ts +41 -0
- package/dist/detectors/governance-flashloan-vote.js +272 -0
- package/dist/detectors/halborn-security-report-aave-v3.d.ts +6 -0
- package/dist/detectors/halborn-security-report-aave-v3.js +357 -0
- package/dist/detectors/incorrect-access-control.d.ts +26 -0
- package/dist/detectors/incorrect-access-control.js +328 -0
- package/dist/detectors/incorrect-burn-accounting.d.ts +10 -0
- package/dist/detectors/incorrect-burn-accounting.js +387 -0
- package/dist/detectors/incorrect-dividends-calculation.d.ts +27 -0
- package/dist/detectors/incorrect-dividends-calculation.js +524 -0
- package/dist/detectors/incorrect-dividends.d.ts +27 -0
- package/dist/detectors/incorrect-dividends.js +485 -0
- package/dist/detectors/incorrect-input-validation.d.ts +23 -0
- package/dist/detectors/incorrect-input-validation.js +312 -0
- package/dist/detectors/incorrect-signature-verification.d.ts +26 -0
- package/dist/detectors/incorrect-signature-verification.js +530 -0
- package/dist/detectors/infinite-loop.d.ts +7 -0
- package/dist/detectors/infinite-loop.js +440 -0
- package/dist/detectors/infinite-number-of-loans.d.ts +13 -0
- package/dist/detectors/infinite-number-of-loans.js +565 -0
- package/dist/detectors/inheritance-override.d.ts +26 -0
- package/dist/detectors/inheritance-override.js +320 -0
- package/dist/detectors/initialization-access-control.d.ts +8 -0
- package/dist/detectors/initialization-access-control.js +659 -0
- package/dist/detectors/insecure-randomness.d.ts +73 -0
- package/dist/detectors/insecure-randomness.js +610 -0
- package/dist/detectors/insufficient-access-control-trusted-param.d.ts +39 -0
- package/dist/detectors/insufficient-access-control-trusted-param.js +356 -0
- package/dist/detectors/insufficient-dvn-threshold.d.ts +32 -0
- package/dist/detectors/insufficient-dvn-threshold.js +585 -0
- package/dist/detectors/integer-overflow-detector.d.ts +45 -0
- package/dist/detectors/integer-overflow-detector.js +284 -0
- package/dist/detectors/integer-overflow.d.ts +95 -0
- package/dist/detectors/integer-overflow.js +344 -0
- package/dist/detectors/integer-underflow.d.ts +7 -0
- package/dist/detectors/integer-underflow.js +422 -0
- package/dist/detectors/intent-settlement-balance-manipulation.d.ts +22 -0
- package/dist/detectors/intent-settlement-balance-manipulation.js +548 -0
- package/dist/detectors/l1-to-l2-message-reentrancy.d.ts +7 -0
- package/dist/detectors/l1-to-l2-message-reentrancy.js +545 -0
- package/dist/detectors/l2-withdrawal-validation.d.ts +8 -0
- package/dist/detectors/l2-withdrawal-validation.js +303 -0
- package/dist/detectors/lack-of-access-control.d.ts +7 -0
- package/dist/detectors/lack-of-access-control.js +425 -0
- package/dist/detectors/lack-of-calldata-validation.d.ts +16 -0
- package/dist/detectors/lack-of-calldata-validation.js +914 -0
- package/dist/detectors/lack-of-input-validation-reentrancy.d.ts +7 -0
- package/dist/detectors/lack-of-input-validation-reentrancy.js +637 -0
- package/dist/detectors/lack-of-slippage-control.d.ts +7 -0
- package/dist/detectors/lack-of-slippage-control.js +513 -0
- package/dist/detectors/lack-of-slippage-protection.d.ts +7 -0
- package/dist/detectors/lack-of-slippage-protection.js +474 -0
- package/dist/detectors/lack-of-validation-data.d.ts +23 -0
- package/dist/detectors/lack-of-validation-data.js +391 -0
- package/dist/detectors/lack-of-validation-pool.d.ts +7 -0
- package/dist/detectors/lack-of-validation-pool.js +492 -0
- package/dist/detectors/lack-of-validation-userdata.d.ts +7 -0
- package/dist/detectors/lack-of-validation-userdata.js +583 -0
- package/dist/detectors/lack-of-validation.d.ts +27 -0
- package/dist/detectors/lack-of-validation.js +609 -0
- package/dist/detectors/layerzero-dvn-quorum-missing.d.ts +22 -0
- package/dist/detectors/layerzero-dvn-quorum-missing.js +464 -0
- package/dist/detectors/layerzero-v2-unverified-origin.d.ts +40 -0
- package/dist/detectors/layerzero-v2-unverified-origin.js +368 -0
- package/dist/detectors/liquidation-accounting-desync.d.ts +14 -0
- package/dist/detectors/liquidation-accounting-desync.js +145 -0
- package/dist/detectors/liquidation-gain-manipulation.d.ts +42 -0
- package/dist/detectors/liquidation-gain-manipulation.js +606 -0
- package/dist/detectors/liquidation-price-rounding-advantage.d.ts +26 -0
- package/dist/detectors/liquidation-price-rounding-advantage.js +283 -0
- package/dist/detectors/liquidity-poisoning.d.ts +25 -0
- package/dist/detectors/liquidity-poisoning.js +339 -0
- package/dist/detectors/loans-malicious-proposal-price-oracle.d.ts +44 -0
- package/dist/detectors/loans-malicious-proposal-price-oracle.js +813 -0
- package/dist/detectors/logic-flaw.d.ts +186 -0
- package/dist/detectors/logic-flaw.js +3356 -0
- package/dist/detectors/manipulation-of-funds.d.ts +31 -0
- package/dist/detectors/manipulation-of-funds.js +304 -0
- package/dist/detectors/merkl-unsafe-claim-callback.d.ts +22 -0
- package/dist/detectors/merkl-unsafe-claim-callback.js +94 -0
- package/dist/detectors/mev-boost-timestamp.d.ts +7 -0
- package/dist/detectors/mev-boost-timestamp.js +318 -0
- package/dist/detectors/mev-merge-exploit.d.ts +29 -0
- package/dist/detectors/mev-merge-exploit.js +397 -0
- package/dist/detectors/mev-sandwich-vulnerability.d.ts +24 -0
- package/dist/detectors/mev-sandwich-vulnerability.js +648 -0
- package/dist/detectors/mev-slot-manipulation.d.ts +36 -0
- package/dist/detectors/mev-slot-manipulation.js +691 -0
- package/dist/detectors/mevbot-insufficient-validation.d.ts +48 -0
- package/dist/detectors/mevbot-insufficient-validation.js +574 -0
- package/dist/detectors/migration-rebalance-without-bound.d.ts +7 -0
- package/dist/detectors/migration-rebalance-without-bound.js +514 -0
- package/dist/detectors/mint-hardcoded-asset-parity.d.ts +31 -0
- package/dist/detectors/mint-hardcoded-asset-parity.js +356 -0
- package/dist/detectors/miscalculation-on-spendallowance.d.ts +7 -0
- package/dist/detectors/miscalculation-on-spendallowance.js +188 -0
- package/dist/detectors/misconfiguration.d.ts +27 -0
- package/dist/detectors/misconfiguration.js +410 -0
- package/dist/detectors/missing-access-control-caller-supplied-auth.d.ts +7 -0
- package/dist/detectors/missing-access-control-caller-supplied-auth.js +550 -0
- package/dist/detectors/missing-access-control-receiver-payout.d.ts +7 -0
- package/dist/detectors/missing-access-control-receiver-payout.js +460 -0
- package/dist/detectors/missing-access-control-role-or-transferfrom.d.ts +7 -0
- package/dist/detectors/missing-access-control-role-or-transferfrom.js +663 -0
- package/dist/detectors/missing-access-control.d.ts +19 -0
- package/dist/detectors/missing-access-control.js +781 -0
- package/dist/detectors/missing-sequencer-uptime-check.d.ts +30 -0
- package/dist/detectors/missing-sequencer-uptime-check.js +348 -0
- package/dist/detectors/missing-storage-gap.d.ts +19 -0
- package/dist/detectors/missing-storage-gap.js +193 -0
- package/dist/detectors/missing-swap-deadline-slippage.d.ts +31 -0
- package/dist/detectors/missing-swap-deadline-slippage.js +231 -0
- package/dist/detectors/missing-zk-proof-verification.d.ts +60 -0
- package/dist/detectors/missing-zk-proof-verification.js +547 -0
- package/dist/detectors/my-experience-with-yearn-finance.d.ts +7 -0
- package/dist/detectors/my-experience-with-yearn-finance.js +552 -0
- package/dist/detectors/network-bridge-ronin.d.ts +7 -0
- package/dist/detectors/network-bridge-ronin.js +408 -0
- package/dist/detectors/network-bridge.d.ts +7 -0
- package/dist/detectors/network-bridge.js +444 -0
- package/dist/detectors/network-underflow.d.ts +7 -0
- package/dist/detectors/network-underflow.js +517 -0
- package/dist/detectors/nft-denial-of-service.d.ts +7 -0
- package/dist/detectors/nft-denial-of-service.js +223 -0
- package/dist/detectors/nft-marketplace-order-reentrancy.d.ts +7 -0
- package/dist/detectors/nft-marketplace-order-reentrancy.js +427 -0
- package/dist/detectors/nft-token-standard-access-control.d.ts +7 -0
- package/dist/detectors/nft-token-standard-access-control.js +455 -0
- package/dist/detectors/oracle-manipulation-amm-spot-price.d.ts +42 -0
- package/dist/detectors/oracle-manipulation-amm-spot-price.js +321 -0
- package/dist/detectors/oracle-manipulation-liquidity-withdrawal.d.ts +27 -0
- package/dist/detectors/oracle-manipulation-liquidity-withdrawal.js +192 -0
- package/dist/detectors/oracle-manipulation.d.ts +90 -0
- package/dist/detectors/oracle-manipulation.js +1023 -0
- package/dist/detectors/oracle-vortex-manipulation.d.ts +30 -0
- package/dist/detectors/oracle-vortex-manipulation.js +473 -0
- package/dist/detectors/overpriced-asset-in-oracle.d.ts +41 -0
- package/dist/detectors/overpriced-asset-in-oracle.js +420 -0
- package/dist/detectors/oz-access-control-roles.d.ts +33 -0
- package/dist/detectors/oz-access-control-roles.js +359 -0
- package/dist/detectors/pair-manipulation-transfer-hook.d.ts +38 -0
- package/dist/detectors/pair-manipulation-transfer-hook.js +366 -0
- package/dist/detectors/parameter-access-control.d.ts +47 -0
- package/dist/detectors/parameter-access-control.js +511 -0
- package/dist/detectors/parameter-manipulation.d.ts +7 -0
- package/dist/detectors/parameter-manipulation.js +505 -0
- package/dist/detectors/parity-multisig-delegatecall.d.ts +7 -0
- package/dist/detectors/parity-multisig-delegatecall.js +707 -0
- package/dist/detectors/permissionless-claim-amm-spot-pricing.d.ts +7 -0
- package/dist/detectors/permissionless-claim-amm-spot-pricing.js +351 -0
- package/dist/detectors/permit-future-dated-deadline.d.ts +31 -0
- package/dist/detectors/permit-future-dated-deadline.js +339 -0
- package/dist/detectors/phishing-attack-bybit.d.ts +37 -0
- package/dist/detectors/phishing-attack-bybit.js +513 -0
- package/dist/detectors/post-insolvency-check.d.ts +7 -0
- package/dist/detectors/post-insolvency-check.js +277 -0
- package/dist/detectors/precision-loss-vulnerability.d.ts +7 -0
- package/dist/detectors/precision-loss-vulnerability.js +472 -0
- package/dist/detectors/precision-truncation.d.ts +8 -0
- package/dist/detectors/precision-truncation.js +425 -0
- package/dist/detectors/price-dependency-veth.d.ts +41 -0
- package/dist/detectors/price-dependency-veth.js +588 -0
- package/dist/detectors/price-feed-verification.d.ts +7 -0
- package/dist/detectors/price-feed-verification.js +557 -0
- package/dist/detectors/price-manipulation-reentrancy.d.ts +32 -0
- package/dist/detectors/price-manipulation-reentrancy.js +445 -0
- package/dist/detectors/price-manipulation-via-reentranc.d.ts +7 -0
- package/dist/detectors/price-manipulation-via-reentranc.js +569 -0
- package/dist/detectors/price-oracle-manipulation.d.ts +25 -0
- package/dist/detectors/price-oracle-manipulation.js +530 -0
- package/dist/detectors/project-instant-rewards-unlocked.d.ts +6 -0
- package/dist/detectors/project-instant-rewards-unlocked.js +462 -0
- package/dist/detectors/protocol-reentrancy.d.ts +7 -0
- package/dist/detectors/protocol-reentrancy.js +457 -0
- package/dist/detectors/proxy-init-race.d.ts +11 -0
- package/dist/detectors/proxy-init-race.js +634 -0
- package/dist/detectors/proxy-storage-slot-collision.d.ts +7 -0
- package/dist/detectors/proxy-storage-slot-collision.js +135 -0
- package/dist/detectors/public-internal-function.d.ts +39 -0
- package/dist/detectors/public-internal-function.js +233 -0
- package/dist/detectors/quote-silent-zero.d.ts +25 -0
- package/dist/detectors/quote-silent-zero.js +156 -0
- package/dist/detectors/readonly-reentrancy.d.ts +9 -0
- package/dist/detectors/readonly-reentrancy.js +108 -0
- package/dist/detectors/receipt-redemption-missing-validation.d.ts +31 -0
- package/dist/detectors/receipt-redemption-missing-validation.js +453 -0
- package/dist/detectors/reentrancy-balance.d.ts +36 -0
- package/dist/detectors/reentrancy-balance.js +577 -0
- package/dist/detectors/reentrancy-business-logic-game.d.ts +36 -0
- package/dist/detectors/reentrancy-business-logic-game.js +616 -0
- package/dist/detectors/reentrancy-on-sell-nft.d.ts +23 -0
- package/dist/detectors/reentrancy-on-sell-nft.js +510 -0
- package/dist/detectors/reflection-token-balance-desync.d.ts +28 -0
- package/dist/detectors/reflection-token-balance-desync.js +246 -0
- package/dist/detectors/registry-engine.d.ts +34 -0
- package/dist/detectors/registry-engine.js +388 -0
- package/dist/detectors/rollup-unvalidated-state-update.d.ts +35 -0
- package/dist/detectors/rollup-unvalidated-state-update.js +286 -0
- package/dist/detectors/s-horizon-bridge-private-key-compromis.d.ts +8 -0
- package/dist/detectors/s-horizon-bridge-private-key-compromis.js +615 -0
- package/dist/detectors/share-price-manipulation.d.ts +7 -0
- package/dist/detectors/share-price-manipulation.js +653 -0
- package/dist/detectors/signature-replay.d.ts +30 -0
- package/dist/detectors/signature-replay.js +367 -0
- package/dist/detectors/simpleswap-unverified-approval.d.ts +27 -0
- package/dist/detectors/simpleswap-unverified-approval.js +198 -0
- package/dist/detectors/single-spot-oracle-collateral-valuation.d.ts +22 -0
- package/dist/detectors/single-spot-oracle-collateral-valuation.js +419 -0
- package/dist/detectors/skim-token-balance.d.ts +7 -0
- package/dist/detectors/skim-token-balance.js +788 -0
- package/dist/detectors/sky-oft-governance-payload.d.ts +7 -0
- package/dist/detectors/sky-oft-governance-payload.js +515 -0
- package/dist/detectors/sky-oft-governance-truncation.d.ts +32 -0
- package/dist/detectors/sky-oft-governance-truncation.js +377 -0
- package/dist/detectors/solana-evm-bridge-truncation.d.ts +7 -0
- package/dist/detectors/solana-evm-bridge-truncation.js +638 -0
- package/dist/detectors/solhint-unchecked-low-level-call.d.ts +74 -0
- package/dist/detectors/solhint-unchecked-low-level-call.js +463 -0
- package/dist/detectors/stablecoin-pair-spot-oracle.d.ts +7 -0
- package/dist/detectors/stablecoin-pair-spot-oracle.js +364 -0
- package/dist/detectors/staked-rate-as-oracle.d.ts +44 -0
- package/dist/detectors/staked-rate-as-oracle.js +497 -0
- package/dist/detectors/stale-oracle.d.ts +63 -0
- package/dist/detectors/stale-oracle.js +649 -0
- package/dist/detectors/starkware-proof-validation-gap.d.ts +18 -0
- package/dist/detectors/starkware-proof-validation-gap.js +629 -0
- package/dist/detectors/steth-transfer-reentrancy.d.ts +8 -0
- package/dist/detectors/steth-transfer-reentrancy.js +317 -0
- package/dist/detectors/storage-collision-malicious-proposal.d.ts +27 -0
- package/dist/detectors/storage-collision-malicious-proposal.js +386 -0
- package/dist/detectors/timestamp-manipulation.d.ts +49 -0
- package/dist/detectors/timestamp-manipulation.js +383 -0
- package/dist/detectors/token-access-control.d.ts +7 -0
- package/dist/detectors/token-access-control.js +544 -0
- package/dist/detectors/token-incorrect-signature-verification.d.ts +23 -0
- package/dist/detectors/token-incorrect-signature-verification.js +434 -0
- package/dist/detectors/token-transfer-logic-flaw.d.ts +33 -0
- package/dist/detectors/token-transfer-logic-flaw.js +267 -0
- package/dist/detectors/transfer-double-debit-pool-recipient.d.ts +7 -0
- package/dist/detectors/transfer-double-debit-pool-recipient.js +542 -0
- package/dist/detectors/treasury-reentrancy.d.ts +7 -0
- package/dist/detectors/treasury-reentrancy.js +442 -0
- package/dist/detectors/tstore-poison.d.ts +32 -0
- package/dist/detectors/tstore-poison.js +417 -0
- package/dist/detectors/tstore-race-condition.d.ts +7 -0
- package/dist/detectors/tstore-race-condition.js +632 -0
- package/dist/detectors/types.d.ts +85 -0
- package/dist/detectors/types.js +20 -0
- package/dist/detectors/unauthorized-payer-transferfrom.d.ts +66 -0
- package/dist/detectors/unauthorized-payer-transferfrom.js +339 -0
- package/dist/detectors/unauthorized-transferfrom-shell.d.ts +7 -0
- package/dist/detectors/unauthorized-transferfrom-shell.js +504 -0
- package/dist/detectors/unauthorized-transferfrom.d.ts +16 -0
- package/dist/detectors/unauthorized-transferfrom.js +838 -0
- package/dist/detectors/unbound-zk-verifier-input.d.ts +7 -0
- package/dist/detectors/unbound-zk-verifier-input.js +445 -0
- package/dist/detectors/unbounded-share-price-collateral-oracle.d.ts +48 -0
- package/dist/detectors/unbounded-share-price-collateral-oracle.js +566 -0
- package/dist/detectors/uncapped-reward-emission.d.ts +7 -0
- package/dist/detectors/uncapped-reward-emission.js +493 -0
- package/dist/detectors/unchecked-call-forwarding.d.ts +31 -0
- package/dist/detectors/unchecked-call-forwarding.js +330 -0
- package/dist/detectors/unchecked-external-call-unconditional-state-mutation.d.ts +18 -0
- package/dist/detectors/unchecked-external-call-unconditional-state-mutation.js +311 -0
- package/dist/detectors/unchecked-external-call.d.ts +66 -0
- package/dist/detectors/unchecked-external-call.js +389 -0
- package/dist/detectors/unchecked-oft-return.d.ts +13 -0
- package/dist/detectors/unchecked-oft-return.js +118 -0
- package/dist/detectors/unguarded-governance-execution.d.ts +35 -0
- package/dist/detectors/unguarded-governance-execution.js +422 -0
- package/dist/detectors/unguarded-governance-executor.d.ts +35 -0
- package/dist/detectors/unguarded-governance-executor.js +349 -0
- package/dist/detectors/unindexed-event-address.d.ts +7 -0
- package/dist/detectors/unindexed-event-address.js +268 -0
- package/dist/detectors/uninitialized-implementation.d.ts +27 -0
- package/dist/detectors/uninitialized-implementation.js +333 -0
- package/dist/detectors/uninitialized-storage-pointer.d.ts +7 -0
- package/dist/detectors/uninitialized-storage-pointer.js +110 -0
- package/dist/detectors/uniswap-skim-token-balance-attack.d.ts +8 -0
- package/dist/detectors/uniswap-skim-token-balance-attack.js +331 -0
- package/dist/detectors/uniswap-v4-hook-state-manipulation.d.ts +7 -0
- package/dist/detectors/uniswap-v4-hook-state-manipulation.js +296 -0
- package/dist/detectors/unprotected-admin-or-fund-sink.d.ts +7 -0
- package/dist/detectors/unprotected-admin-or-fund-sink.js +643 -0
- package/dist/detectors/unprotected-dex-swap.d.ts +43 -0
- package/dist/detectors/unprotected-dex-swap.js +334 -0
- package/dist/detectors/unprotected-initializer.d.ts +7 -0
- package/dist/detectors/unprotected-initializer.js +707 -0
- package/dist/detectors/unprotected-pair-initializer.d.ts +22 -0
- package/dist/detectors/unprotected-pair-initializer.js +359 -0
- package/dist/detectors/unprotected-upgrade-function.d.ts +7 -0
- package/dist/detectors/unprotected-upgrade-function.js +180 -0
- package/dist/detectors/unreachable-code-0.8.28.d.ts +19 -0
- package/dist/detectors/unreachable-code-0.8.28.js +206 -0
- package/dist/detectors/unsafe-proxy-storage.d.ts +7 -0
- package/dist/detectors/unsafe-proxy-storage.js +436 -0
- package/dist/detectors/unsafe-transient-storage.d.ts +7 -0
- package/dist/detectors/unsafe-transient-storage.js +1052 -0
- package/dist/detectors/unsafe-tx-origin.d.ts +9 -0
- package/dist/detectors/unsafe-tx-origin.js +179 -0
- package/dist/detectors/unsigned-validity-window.d.ts +20 -0
- package/dist/detectors/unsigned-validity-window.js +220 -0
- package/dist/detectors/unvalidated-interface-address.d.ts +25 -0
- package/dist/detectors/unvalidated-interface-address.js +377 -0
- package/dist/detectors/uups-uninitialized-storage.d.ts +9 -0
- package/dist/detectors/uups-uninitialized-storage.js +366 -0
- package/dist/detectors/v2-error-k-value-attack.d.ts +33 -0
- package/dist/detectors/v2-error-k-value-attack.js +276 -0
- package/dist/detectors/v2-k-invariant-bypass.d.ts +33 -0
- package/dist/detectors/v2-k-invariant-bypass.js +283 -0
- package/dist/detectors/v4-hook-reentrancy.d.ts +9 -0
- package/dist/detectors/v4-hook-reentrancy.js +488 -0
- package/dist/detectors/vault-inflation-rounding.d.ts +23 -0
- package/dist/detectors/vault-inflation-rounding.js +477 -0
- package/dist/detectors/vault-share-price-manipulation.d.ts +7 -0
- package/dist/detectors/vault-share-price-manipulation.js +332 -0
- package/dist/detectors/vortex-interaction-guard.d.ts +45 -0
- package/dist/detectors/vortex-interaction-guard.js +275 -0
- package/dist/detectors/vortex-protocol-reentrancy-guard.d.ts +27 -0
- package/dist/detectors/vortex-protocol-reentrancy-guard.js +408 -0
- package/dist/detectors/vulnerable-price-dependency.d.ts +41 -0
- package/dist/detectors/vulnerable-price-dependency.js +473 -0
- package/dist/detectors/weak-random-mint.d.ts +37 -0
- package/dist/detectors/weak-random-mint.js +271 -0
- package/dist/detectors/withdraw-be-to-withdraw.d.ts +26 -0
- package/dist/detectors/withdraw-be-to-withdraw.js +329 -0
- package/dist/detectors/wrong-function-visibility.d.ts +29 -0
- package/dist/detectors/wrong-function-visibility.js +147 -0
- package/dist/detectors/wrong-price-calculation.d.ts +42 -0
- package/dist/detectors/wrong-price-calculation.js +387 -0
- package/dist/detectors/yearn-vault-v2-share-price-manipulation.d.ts +32 -0
- package/dist/detectors/yearn-vault-v2-share-price-manipulation.js +248 -0
- package/dist/detectors/zero-fee.d.ts +7 -0
- package/dist/detectors/zero-fee.js +596 -0
- package/dist/detectors/zetachain-gateway-hack-analysis.d.ts +7 -0
- package/dist/detectors/zetachain-gateway-hack-analysis.js +629 -0
- package/dist/detectors/zk-rollup-da-gap.d.ts +8 -0
- package/dist/detectors/zk-rollup-da-gap.js +322 -0
- package/dist/detectors/zksync-batch-validation.d.ts +8 -0
- package/dist/detectors/zksync-batch-validation.js +461 -0
- package/dist/detectors/zksync-era-rollup-state-update.d.ts +60 -0
- package/dist/detectors/zksync-era-rollup-state-update.js +360 -0
- package/dist/detectors/zksync-simulation-drift.d.ts +35 -0
- package/dist/detectors/zksync-simulation-drift.js +309 -0
- package/dist/exit-codes.d.ts +15 -0
- package/dist/exit-codes.js +18 -0
- package/dist/formatters/github-actions.d.ts +2 -0
- package/dist/formatters/github-actions.js +61 -0
- package/dist/formatters/sarif.d.ts +24 -0
- package/dist/formatters/sarif.js +670 -0
- package/dist/formatters/text.d.ts +14 -0
- package/dist/formatters/text.js +152 -0
- package/dist/fp-rates.json +70 -0
- package/dist/identity/diff-baseline.d.ts +16 -0
- package/dist/identity/diff-baseline.js +152 -0
- package/dist/identity/hashing.d.ts +39 -0
- package/dist/identity/hashing.js +96 -0
- package/dist/index.d.ts +174 -0
- package/dist/index.js +358 -0
- package/dist/parallel-scan.d.ts +66 -0
- package/dist/parallel-scan.js +227 -0
- package/dist/registry.d.ts +17 -0
- package/dist/registry.js +118 -0
- package/dist/rules/glob.d.ts +5 -0
- package/dist/rules/glob.js +76 -0
- package/dist/rules/suppressions.d.ts +23 -0
- package/dist/rules/suppressions.js +136 -0
- package/dist/rules/tiers.d.ts +23 -0
- package/dist/rules/tiers.js +341 -0
- package/dist/scan-worker.d.ts +1 -0
- package/dist/scan-worker.js +61 -0
- package/dist/scan.d.ts +24 -0
- package/dist/scan.js +558 -0
- package/dist/semantic/contracts.d.ts +10 -0
- package/dist/semantic/contracts.js +141 -0
- package/dist/semantic/diagnostics.d.ts +29 -0
- package/dist/semantic/diagnostics.js +25 -0
- package/dist/semantic/eog.d.ts +56 -0
- package/dist/semantic/eog.js +545 -0
- package/dist/semantic/imports.d.ts +88 -0
- package/dist/semantic/imports.js +246 -0
- package/dist/semantic/index.d.ts +2 -0
- package/dist/semantic/index.js +8 -0
- package/dist/semantic/inheritance.d.ts +33 -0
- package/dist/semantic/inheritance.js +137 -0
- package/dist/semantic/model.d.ts +95 -0
- package/dist/semantic/model.js +232 -0
- package/dist/semantic/taint-tracker.d.ts +49 -0
- package/dist/semantic/taint-tracker.js +410 -0
- package/dist/semantic/types.d.ts +119 -0
- package/dist/semantic/types.js +18 -0
- package/dist/severity.d.ts +10 -0
- package/dist/severity.js +78 -0
- package/package.json +52 -0
|
@@ -0,0 +1,1163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArbitraryCallErrorDetector = void 0;
|
|
4
|
+
const dataflow_1 = require("./_common/dataflow");
|
|
5
|
+
const ast_1 = require("./_common/ast");
|
|
6
|
+
const access_control_1 = require("./_common/access-control");
|
|
7
|
+
const RULE_ID = 'user-controlled-arbitrary-call';
|
|
8
|
+
// Privilege-name policy for this detector. Kept local because the
|
|
9
|
+
// detector deliberately includes `auth`, `govern`, `manager`, and
|
|
10
|
+
// `timelock` (broader than the core access-control detector's set
|
|
11
|
+
// in src/index.ts). The shared structural predicates take this as
|
|
12
|
+
// a parameter so the policy stays here while the AST walking is
|
|
13
|
+
// centralised.
|
|
14
|
+
const ARBITRARY_CALL_PRIVILEGED_NAME = /(owner|admin|role|auth|govern|guardian|manager|operator|timelock)/i;
|
|
15
|
+
function isArbitraryCallPrivilegedName(name) {
|
|
16
|
+
return ARBITRARY_CALL_PRIVILEGED_NAME.test(name);
|
|
17
|
+
}
|
|
18
|
+
const ACCESS_CONTROL_MODIFIER = /^(onlyowner|onlyowners|onlyrole|onlyadmin|onlyauthorized|authorized|auth|onlyoperator|onlyoperators|onlyprotocol|onlygovernance|onlygovernor|onlyguardian|onlymanager|onlytrusted|onlytimelock)$/i;
|
|
19
|
+
const REENTRANCY_GUARD_MODIFIER = /^nonreentrant$/i;
|
|
20
|
+
const MULTICALL_OR_FORWARDER_FUNCTIONS = new Set([
|
|
21
|
+
'multicall',
|
|
22
|
+
'aggregate',
|
|
23
|
+
'batchCall',
|
|
24
|
+
'executeBatch',
|
|
25
|
+
'tryAggregate',
|
|
26
|
+
'forwardRequest',
|
|
27
|
+
]);
|
|
28
|
+
class ArbitraryCallErrorDetector {
|
|
29
|
+
id;
|
|
30
|
+
patternKey;
|
|
31
|
+
supportedAstKinds = ['parser', 'solc'];
|
|
32
|
+
outputSeverity;
|
|
33
|
+
findings = [];
|
|
34
|
+
currentFile = '';
|
|
35
|
+
currentContract = '';
|
|
36
|
+
currentFunction = '';
|
|
37
|
+
currentFunctionGuarded = false;
|
|
38
|
+
currentFunctionContextSuppressed = false;
|
|
39
|
+
verifiedRequestIdentifiers = new Set();
|
|
40
|
+
sawApproval = false;
|
|
41
|
+
parameters = new Set();
|
|
42
|
+
taintedLocals = new Set();
|
|
43
|
+
localOrigins = new Map();
|
|
44
|
+
selectorChecked = new Set();
|
|
45
|
+
targetChecked = new Set();
|
|
46
|
+
stateVariables = new Set();
|
|
47
|
+
immutableStateVariables = new Set();
|
|
48
|
+
seen = new Set();
|
|
49
|
+
currentParameters = [];
|
|
50
|
+
propagatedParamTaint = new Map();
|
|
51
|
+
propagatedParamOrigins = new Map();
|
|
52
|
+
constructor(id = RULE_ID, severity = 'warning') {
|
|
53
|
+
this.id = id;
|
|
54
|
+
this.patternKey = id;
|
|
55
|
+
this.outputSeverity = severity;
|
|
56
|
+
}
|
|
57
|
+
setFile(file) {
|
|
58
|
+
this.currentFile = file;
|
|
59
|
+
this.findings = [];
|
|
60
|
+
this.currentContract = '';
|
|
61
|
+
this.currentFunction = '';
|
|
62
|
+
this.currentFunctionGuarded = false;
|
|
63
|
+
this.currentFunctionContextSuppressed = false;
|
|
64
|
+
this.verifiedRequestIdentifiers.clear();
|
|
65
|
+
this.sawApproval = false;
|
|
66
|
+
this.parameters.clear();
|
|
67
|
+
this.taintedLocals.clear();
|
|
68
|
+
this.localOrigins.clear();
|
|
69
|
+
this.selectorChecked.clear();
|
|
70
|
+
this.targetChecked.clear();
|
|
71
|
+
this.stateVariables.clear();
|
|
72
|
+
this.immutableStateVariables.clear();
|
|
73
|
+
this.seen.clear();
|
|
74
|
+
this.currentParameters = [];
|
|
75
|
+
this.propagatedParamTaint.clear();
|
|
76
|
+
this.propagatedParamOrigins.clear();
|
|
77
|
+
}
|
|
78
|
+
getFindings() {
|
|
79
|
+
return this.findings;
|
|
80
|
+
}
|
|
81
|
+
ContractDefinition(node) {
|
|
82
|
+
this.currentContract = node.name || '<anonymous>';
|
|
83
|
+
this.propagatedParamTaint = this.collectPropagatedParamTaint(node);
|
|
84
|
+
}
|
|
85
|
+
ContractDefinition_post(_node) {
|
|
86
|
+
this.currentContract = '';
|
|
87
|
+
}
|
|
88
|
+
StateVariableDeclaration(node) {
|
|
89
|
+
for (const variable of node.variables || []) {
|
|
90
|
+
if (!variable?.name)
|
|
91
|
+
continue;
|
|
92
|
+
this.stateVariables.add(variable.name);
|
|
93
|
+
if (variable.isImmutable || variable.mutability === 'immutable' || variable.typeName?.mutability === 'immutable') {
|
|
94
|
+
this.immutableStateVariables.add(variable.name);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
FunctionDefinition(node) {
|
|
99
|
+
this.currentFunction = node.name || '<anonymous>';
|
|
100
|
+
this.currentFunctionGuarded = this.hasAccessControl(node);
|
|
101
|
+
this.currentFunctionContextSuppressed = this.hasSuppressedCallerContext(node);
|
|
102
|
+
this.verifiedRequestIdentifiers = this.collectVerifiedRequestIdentifiers(node.body);
|
|
103
|
+
this.sawApproval = false;
|
|
104
|
+
this.parameters.clear();
|
|
105
|
+
this.taintedLocals.clear();
|
|
106
|
+
this.localOrigins.clear();
|
|
107
|
+
this.selectorChecked.clear();
|
|
108
|
+
this.targetChecked.clear();
|
|
109
|
+
this.currentParameters = node.parameters || [];
|
|
110
|
+
const propagated = this.propagatedParamTaint.get(this.currentFunction) || new Set();
|
|
111
|
+
const origins = this.propagatedParamOrigins.get(this.currentFunction) || new Map();
|
|
112
|
+
for (const [index, parameter] of (node.parameters || []).entries()) {
|
|
113
|
+
if (parameter?.name && (this.isExternallyCallable(node) || propagated.has(index))) {
|
|
114
|
+
this.parameters.add(parameter.name);
|
|
115
|
+
const origin = origins.get(index);
|
|
116
|
+
if (origin)
|
|
117
|
+
this.localOrigins.set(parameter.name, origin);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
FunctionDefinition_post(_node) {
|
|
122
|
+
this.currentFunction = '';
|
|
123
|
+
this.currentFunctionGuarded = false;
|
|
124
|
+
this.currentFunctionContextSuppressed = false;
|
|
125
|
+
this.verifiedRequestIdentifiers.clear();
|
|
126
|
+
this.sawApproval = false;
|
|
127
|
+
this.parameters.clear();
|
|
128
|
+
this.taintedLocals.clear();
|
|
129
|
+
this.selectorChecked.clear();
|
|
130
|
+
this.targetChecked.clear();
|
|
131
|
+
this.currentParameters = [];
|
|
132
|
+
}
|
|
133
|
+
VariableDeclarationStatement(node) {
|
|
134
|
+
if (!this.currentFunction)
|
|
135
|
+
return;
|
|
136
|
+
const initialValue = node.initialValue;
|
|
137
|
+
for (const variable of node.variables || []) {
|
|
138
|
+
if (!variable?.name)
|
|
139
|
+
continue;
|
|
140
|
+
if (this.isAbiDecodeOfTainted(initialValue) || this.containsTainted(initialValue)) {
|
|
141
|
+
this.taintedLocals.add(variable.name);
|
|
142
|
+
const origin = this.memberNameInChain(initialValue);
|
|
143
|
+
if (origin)
|
|
144
|
+
this.localOrigins.set(variable.name, origin);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
this.inspectExpression(initialValue);
|
|
148
|
+
}
|
|
149
|
+
ExpressionStatement(node) {
|
|
150
|
+
if (!this.currentFunction || !node.expression)
|
|
151
|
+
return;
|
|
152
|
+
this.trackValidationGate(node.expression);
|
|
153
|
+
this.trackAssignment(node.expression);
|
|
154
|
+
this.inspectExpression(node.expression);
|
|
155
|
+
}
|
|
156
|
+
IfStatement(node) {
|
|
157
|
+
if (!this.currentFunction)
|
|
158
|
+
return;
|
|
159
|
+
this.trackValidationGate(node.condition);
|
|
160
|
+
}
|
|
161
|
+
FunctionCall(node) {
|
|
162
|
+
if (!this.currentFunction)
|
|
163
|
+
return;
|
|
164
|
+
this.inspectExpression(node);
|
|
165
|
+
}
|
|
166
|
+
inspectExpression(expr) {
|
|
167
|
+
if (!expr || typeof expr !== 'object')
|
|
168
|
+
return;
|
|
169
|
+
this.trackInternalCallTaint(expr);
|
|
170
|
+
this.trackApproval(expr);
|
|
171
|
+
const lowLevel = this.lowLevelCall(expr);
|
|
172
|
+
if (lowLevel) {
|
|
173
|
+
this.inspectLowLevelCall(expr, lowLevel.member, lowLevel.target, lowLevel.args, lowLevel.options);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
const addressWrapper = this.addressFunctionCallWrapper(expr);
|
|
177
|
+
if (addressWrapper) {
|
|
178
|
+
this.inspectAddressFunctionCallWrapper(expr, addressWrapper.member, addressWrapper.target, addressWrapper.args);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const external = this.interfaceStyleCall(expr);
|
|
182
|
+
if (external && !this.currentFunctionGuarded && !this.currentFunctionContextSuppressed) {
|
|
183
|
+
if (this.isMinimalForwarderCall(external.target, this.args(expr), []))
|
|
184
|
+
return;
|
|
185
|
+
if (external.oracleSensitive && external.targetTainted && !external.targetChecked) {
|
|
186
|
+
this.addFinding(expr, 'user-controlled-arbitrary-call/oracle-user-controlled-target', {
|
|
187
|
+
callSite: this.expressionToString(expr),
|
|
188
|
+
inputPath: this.inputPathFor(external.target, 'target'),
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
else if (external.targetTainted && external.dataTainted) {
|
|
192
|
+
this.addFinding(expr, 'user-controlled-arbitrary-call/user-controlled-external-call');
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
inspectLowLevelCall(node, member, target, args, options) {
|
|
197
|
+
if (this.currentFunctionGuarded)
|
|
198
|
+
return;
|
|
199
|
+
if (this.currentFunctionContextSuppressed)
|
|
200
|
+
return;
|
|
201
|
+
if (member !== 'call' && member !== 'delegatecall' && member !== 'staticcall')
|
|
202
|
+
return;
|
|
203
|
+
if (this.isAddressThis(target))
|
|
204
|
+
return;
|
|
205
|
+
if (this.isMinimalForwarderCall(target, args, options))
|
|
206
|
+
return;
|
|
207
|
+
const targetTainted = this.containsTainted(target);
|
|
208
|
+
const dataArgs = args.filter(arg => !this.isEmptyCallData(arg));
|
|
209
|
+
const dataTainted = dataArgs.some(arg => this.containsTainted(arg));
|
|
210
|
+
const valueTainted = options.some(option => this.containsTainted(option) || this.isMsgValue(option));
|
|
211
|
+
const oracleSensitive = this.isOracleSensitiveCall(member, target, dataArgs);
|
|
212
|
+
const targetChecked = this.isTargetChecked(target);
|
|
213
|
+
const dataChecked = dataArgs.some(arg => this.isSelectorChecked(arg) || this.hasFixedSelectorCallData(arg));
|
|
214
|
+
if (oracleSensitive) {
|
|
215
|
+
const hasUncheckedTarget = targetTainted && !targetChecked;
|
|
216
|
+
const hasUncheckedData = dataTainted && !dataChecked;
|
|
217
|
+
const hasUncheckedValue = valueTainted;
|
|
218
|
+
if (!hasUncheckedTarget && !hasUncheckedData && !hasUncheckedValue)
|
|
219
|
+
return;
|
|
220
|
+
let pattern = 'user-controlled-arbitrary-call/oracle-user-controlled-calldata';
|
|
221
|
+
if (this.isKelpOracleRoute(target, dataArgs, options)) {
|
|
222
|
+
pattern = 'user-controlled-arbitrary-call/aave-kelp-oracle-route';
|
|
223
|
+
}
|
|
224
|
+
else if (hasUncheckedValue) {
|
|
225
|
+
pattern = 'user-controlled-arbitrary-call/oracle-user-controlled-value';
|
|
226
|
+
}
|
|
227
|
+
else if (hasUncheckedTarget) {
|
|
228
|
+
pattern = 'user-controlled-arbitrary-call/oracle-user-controlled-target';
|
|
229
|
+
}
|
|
230
|
+
this.addFinding(node, pattern, {
|
|
231
|
+
callSite: this.expressionToString(node),
|
|
232
|
+
inputPath: this.inputPathForOracle(target, dataArgs, options, pattern),
|
|
233
|
+
});
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (!targetTainted || !dataTainted)
|
|
237
|
+
return;
|
|
238
|
+
if (dataChecked)
|
|
239
|
+
return;
|
|
240
|
+
let pattern = member === 'delegatecall'
|
|
241
|
+
? 'user-controlled-arbitrary-call/user-controlled-delegatecall'
|
|
242
|
+
: 'user-controlled-arbitrary-call/user-controlled-call';
|
|
243
|
+
if (member === 'call') {
|
|
244
|
+
if (this.sawApproval) {
|
|
245
|
+
pattern = 'user-controlled-arbitrary-call/approval-before-user-call-data';
|
|
246
|
+
}
|
|
247
|
+
else if (this.isAaveRouteCall(target, dataArgs)) {
|
|
248
|
+
pattern = 'user-controlled-arbitrary-call/aave-paraswap-callees';
|
|
249
|
+
}
|
|
250
|
+
else if (this.containsTaintedIndexAccess(target) || dataArgs.some(arg => this.containsRangeAccess(arg))) {
|
|
251
|
+
pattern = 'user-controlled-arbitrary-call/user-controlled-call-array';
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
this.addFinding(node, pattern);
|
|
255
|
+
}
|
|
256
|
+
inspectAddressFunctionCallWrapper(node, member, target, args) {
|
|
257
|
+
if (this.currentFunctionGuarded)
|
|
258
|
+
return;
|
|
259
|
+
if (this.currentFunctionContextSuppressed)
|
|
260
|
+
return;
|
|
261
|
+
if (this.isAddressThis(target))
|
|
262
|
+
return;
|
|
263
|
+
const targetTainted = this.containsTainted(target);
|
|
264
|
+
const dataArgs = args.filter(arg => !this.isEmptyCallData(arg));
|
|
265
|
+
const dataTainted = dataArgs.some(arg => this.containsTainted(arg));
|
|
266
|
+
const dataChecked = dataArgs.some(arg => this.isSelectorChecked(arg) || this.hasFixedSelectorCallData(arg));
|
|
267
|
+
if (!targetTainted || !dataTainted || dataChecked)
|
|
268
|
+
return;
|
|
269
|
+
const pattern = member === 'functiondelegatecall'
|
|
270
|
+
? 'user-controlled-arbitrary-call/user-controlled-delegatecall'
|
|
271
|
+
: 'user-controlled-arbitrary-call/user-controlled-call';
|
|
272
|
+
this.addFinding(node, pattern);
|
|
273
|
+
}
|
|
274
|
+
addFinding(node, pattern, details = {}) {
|
|
275
|
+
// tryLoc-with-floor: solc-walker may yield loc=0 on inner nodes;
|
|
276
|
+
// the line/column also feed the dedup `seen` key below, so a 0
|
|
277
|
+
// floor degrades dedup uniqueness but never crashes the scan.
|
|
278
|
+
const loc = (0, ast_1.tryLoc)(node) ?? { line: 0, endLine: 0, column: 0 };
|
|
279
|
+
const { line, column, endLine } = loc;
|
|
280
|
+
const key = `${this.currentFile}:${line}:${column}:${pattern}`;
|
|
281
|
+
if (this.seen.has(key))
|
|
282
|
+
return;
|
|
283
|
+
this.seen.add(key);
|
|
284
|
+
const functionName = this.currentFunction || '<unknown>';
|
|
285
|
+
const remediation = this.remediationFor(pattern);
|
|
286
|
+
const evidence = details.callSite
|
|
287
|
+
? ` Call site: ${details.callSite}. Input path: ${details.inputPath || 'caller-controlled input reaches the call'}. Remediation: ${remediation}.`
|
|
288
|
+
: '';
|
|
289
|
+
this.findings.push({
|
|
290
|
+
file: this.currentFile,
|
|
291
|
+
contract: this.currentContract,
|
|
292
|
+
'function': functionName,
|
|
293
|
+
line,
|
|
294
|
+
endLine,
|
|
295
|
+
column,
|
|
296
|
+
pattern,
|
|
297
|
+
confidence: 'medium',
|
|
298
|
+
ruleId: this.id,
|
|
299
|
+
severity: this.outputSeverity,
|
|
300
|
+
message: `User-controlled arbitrary call risk in function '${functionName}': caller-controlled target, calldata, or value reaches an external call without an access-control or selector allowlist boundary.${evidence}`,
|
|
301
|
+
contractName: this.currentContract,
|
|
302
|
+
functionName,
|
|
303
|
+
sourceLocation: { line, column },
|
|
304
|
+
findingId: '',
|
|
305
|
+
contractHash: '',
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
lowLevelCall(expr) {
|
|
309
|
+
if (this.kind(expr) !== 'FunctionCall')
|
|
310
|
+
return null;
|
|
311
|
+
const args = this.args(expr);
|
|
312
|
+
let callee = expr.expression;
|
|
313
|
+
let options = [];
|
|
314
|
+
if (this.kind(callee) === 'NameValueExpression' || this.kind(callee) === 'FunctionCallOptions') {
|
|
315
|
+
options = this.args(callee);
|
|
316
|
+
callee = callee.expression;
|
|
317
|
+
}
|
|
318
|
+
if (this.kind(callee) !== 'MemberAccess')
|
|
319
|
+
return null;
|
|
320
|
+
const member = String(callee.memberName || '').toLowerCase();
|
|
321
|
+
if (member !== 'call' && member !== 'delegatecall' && member !== 'staticcall')
|
|
322
|
+
return null;
|
|
323
|
+
return { member, target: callee.expression, args, options };
|
|
324
|
+
}
|
|
325
|
+
addressFunctionCallWrapper(expr) {
|
|
326
|
+
if (this.kind(expr) !== 'FunctionCall')
|
|
327
|
+
return null;
|
|
328
|
+
const args = this.args(expr);
|
|
329
|
+
const callee = expr.expression;
|
|
330
|
+
if (this.kind(callee) !== 'MemberAccess')
|
|
331
|
+
return null;
|
|
332
|
+
const member = String(callee.memberName || '').toLowerCase();
|
|
333
|
+
if (!['functioncall', 'functiondelegatecall', 'functionstaticcall'].includes(member))
|
|
334
|
+
return null;
|
|
335
|
+
const receiver = callee.expression;
|
|
336
|
+
if (this.kind(receiver) === 'Identifier' && /^address$/i.test(receiver.name || '')) {
|
|
337
|
+
const [target, ...rest] = args;
|
|
338
|
+
if (!target)
|
|
339
|
+
return null;
|
|
340
|
+
return { member, target, args: rest };
|
|
341
|
+
}
|
|
342
|
+
return { member, target: receiver, args };
|
|
343
|
+
}
|
|
344
|
+
interfaceStyleCall(expr) {
|
|
345
|
+
if (this.kind(expr) !== 'FunctionCall')
|
|
346
|
+
return null;
|
|
347
|
+
const callee = expr.expression;
|
|
348
|
+
if (this.kind(callee) !== 'MemberAccess')
|
|
349
|
+
return null;
|
|
350
|
+
const member = String(callee.memberName || '');
|
|
351
|
+
if (['call', 'delegatecall', 'staticcall', 'send', 'transfer', 'approve'].includes(member))
|
|
352
|
+
return null;
|
|
353
|
+
const receiver = callee.expression;
|
|
354
|
+
if (this.kind(receiver) !== 'FunctionCall')
|
|
355
|
+
return null;
|
|
356
|
+
const target = this.args(receiver)[0];
|
|
357
|
+
const oracleSensitive = this.isOracleName(`${this.getCalleeName(receiver)}.${member}`) || this.isOracleName(member);
|
|
358
|
+
if (oracleSensitive && this.isReadOnlyOracleAccessor(member) && !this.isDirectTaintedParameterTarget(target))
|
|
359
|
+
return null;
|
|
360
|
+
if (!oracleSensitive && !/(execute|call|route|swap|dispatch)/i.test(member))
|
|
361
|
+
return null;
|
|
362
|
+
const result = {
|
|
363
|
+
target,
|
|
364
|
+
targetTainted: this.containsTainted(target),
|
|
365
|
+
targetChecked: this.isTargetChecked(target),
|
|
366
|
+
dataTainted: this.args(expr).some(arg => this.containsTainted(arg)),
|
|
367
|
+
oracleSensitive,
|
|
368
|
+
};
|
|
369
|
+
if (!this.isDirectTaintedParameterTarget(target) && !result.oracleSensitive)
|
|
370
|
+
return null;
|
|
371
|
+
return result;
|
|
372
|
+
}
|
|
373
|
+
isDirectTaintedParameterTarget(expr) {
|
|
374
|
+
if (!expr || typeof expr !== 'object')
|
|
375
|
+
return false;
|
|
376
|
+
const root = this.rootIdentifier(expr);
|
|
377
|
+
if (!root || !this.parameters.has(root))
|
|
378
|
+
return false;
|
|
379
|
+
const kind = this.kind(expr);
|
|
380
|
+
return kind === 'Identifier' || kind === 'FunctionCall';
|
|
381
|
+
}
|
|
382
|
+
isReadOnlyOracleAccessor(member) {
|
|
383
|
+
return /^(latestRoundData|price|quoteCollateral|getPriceOracle|getPriceOracleSentinel)$/i.test(member);
|
|
384
|
+
}
|
|
385
|
+
trackApproval(expr) {
|
|
386
|
+
if (this.kind(expr) !== 'FunctionCall')
|
|
387
|
+
return;
|
|
388
|
+
const callee = expr.expression;
|
|
389
|
+
if (this.kind(callee) === 'MemberAccess' && String(callee.memberName || '').toLowerCase() === 'approve') {
|
|
390
|
+
this.sawApproval = true;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
trackAssignment(expr) {
|
|
394
|
+
if (!expr || this.kind(expr) !== 'BinaryOperation')
|
|
395
|
+
return;
|
|
396
|
+
if (!String(expr.operator || '').includes('='))
|
|
397
|
+
return;
|
|
398
|
+
const name = this.identifierName(expr.left);
|
|
399
|
+
if (name && this.containsTainted(expr.right))
|
|
400
|
+
this.taintedLocals.add(name);
|
|
401
|
+
}
|
|
402
|
+
trackInternalCallTaint(expr) {
|
|
403
|
+
if (this.kind(expr) !== 'FunctionCall')
|
|
404
|
+
return;
|
|
405
|
+
if (this.currentFunctionGuarded)
|
|
406
|
+
return;
|
|
407
|
+
const callee = this.getCalleeName(expr);
|
|
408
|
+
if (!callee || callee.includes('.'))
|
|
409
|
+
return;
|
|
410
|
+
const tainted = this.propagatedParamTaint.get(callee) || new Set();
|
|
411
|
+
const origins = this.propagatedParamOrigins.get(callee) || new Map();
|
|
412
|
+
this.args(expr).forEach((arg, index) => {
|
|
413
|
+
if (this.containsTainted(arg)) {
|
|
414
|
+
tainted.add(index);
|
|
415
|
+
const origin = this.originForTaintedArgument(arg);
|
|
416
|
+
if (origin)
|
|
417
|
+
origins.set(index, origin);
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
if (tainted.size > 0)
|
|
421
|
+
this.propagatedParamTaint.set(callee, tainted);
|
|
422
|
+
if (origins.size > 0)
|
|
423
|
+
this.propagatedParamOrigins.set(callee, origins);
|
|
424
|
+
}
|
|
425
|
+
originForTaintedArgument(expr) {
|
|
426
|
+
if (this.isMsgValue(expr))
|
|
427
|
+
return 'msg.value';
|
|
428
|
+
const root = this.rootIdentifier(expr);
|
|
429
|
+
if (root && this.localOrigins.has(root))
|
|
430
|
+
return this.localOrigins.get(root);
|
|
431
|
+
if (root && this.parameters.has(root))
|
|
432
|
+
return `${root} <- ${this.currentFunction}(${this.parameterSignature()})`;
|
|
433
|
+
return root || this.memberNameInChain(expr);
|
|
434
|
+
}
|
|
435
|
+
collectPropagatedParamTaint(contractNode) {
|
|
436
|
+
const functions = (contractNode.children || contractNode.subNodes || contractNode.nodes || [])
|
|
437
|
+
.filter((child) => this.kind(child) === 'FunctionDefinition' && child.name);
|
|
438
|
+
const internalFunctionNames = new Set(functions
|
|
439
|
+
.filter((fn) => !this.isExternallyCallable(fn))
|
|
440
|
+
.map((fn) => fn.name));
|
|
441
|
+
const propagated = new Map();
|
|
442
|
+
const returnsTainted = new Set();
|
|
443
|
+
(0, dataflow_1.runFixedPoint)(() => {
|
|
444
|
+
let changed = false;
|
|
445
|
+
for (const fn of functions) {
|
|
446
|
+
const summary = this.summarizeFunctionTaint(fn, internalFunctionNames, propagated, returnsTainted);
|
|
447
|
+
for (const call of summary.internalCalls) {
|
|
448
|
+
const tainted = propagated.get(call.name) || new Set();
|
|
449
|
+
for (const index of call.taintedArgs) {
|
|
450
|
+
if (!tainted.has(index)) {
|
|
451
|
+
tainted.add(index);
|
|
452
|
+
changed = true;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
if (tainted.size > 0)
|
|
456
|
+
propagated.set(call.name, tainted);
|
|
457
|
+
}
|
|
458
|
+
if (summary.returnsTainted && !returnsTainted.has(fn.name)) {
|
|
459
|
+
returnsTainted.add(fn.name);
|
|
460
|
+
changed = true;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
return changed;
|
|
464
|
+
}, { maxPasses: 12, name: 'arbitrary-call-error/inter-procedural-taint' });
|
|
465
|
+
return propagated;
|
|
466
|
+
}
|
|
467
|
+
summarizeFunctionTaint(fn, internalFunctionNames, propagated, returnsTainted) {
|
|
468
|
+
const paramNames = (fn.parameters || []).map((param) => param?.name).filter(Boolean);
|
|
469
|
+
const seededParams = new Set();
|
|
470
|
+
if (this.isExternallyCallable(fn) && !this.hasAccessControl(fn)) {
|
|
471
|
+
for (const name of paramNames)
|
|
472
|
+
seededParams.add(name);
|
|
473
|
+
}
|
|
474
|
+
for (const index of propagated.get(fn.name) || []) {
|
|
475
|
+
const name = paramNames[index];
|
|
476
|
+
if (name)
|
|
477
|
+
seededParams.add(name);
|
|
478
|
+
}
|
|
479
|
+
const locals = new Set();
|
|
480
|
+
const internalCalls = [];
|
|
481
|
+
let returnsUserInput = false;
|
|
482
|
+
const expressionTainted = (expr) => this.containsSummaryTaint(expr, seededParams, locals, returnsTainted);
|
|
483
|
+
(0, dataflow_1.runFixedPoint)(() => {
|
|
484
|
+
let changed = false;
|
|
485
|
+
this.walkExpression(fn.body, node => {
|
|
486
|
+
const kind = this.kind(node);
|
|
487
|
+
if (kind === 'VariableDeclarationStatement') {
|
|
488
|
+
if (!expressionTainted(node.initialValue))
|
|
489
|
+
return;
|
|
490
|
+
for (const variable of node.variables || []) {
|
|
491
|
+
if (variable?.name && !locals.has(variable.name)) {
|
|
492
|
+
locals.add(variable.name);
|
|
493
|
+
changed = true;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
else if (kind === 'BinaryOperation' && String(node.operator || '').includes('=')) {
|
|
498
|
+
const name = this.identifierName(node.left);
|
|
499
|
+
if (name && expressionTainted(node.right) && !locals.has(name)) {
|
|
500
|
+
locals.add(name);
|
|
501
|
+
changed = true;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
return changed;
|
|
506
|
+
}, { maxPasses: 8, name: 'arbitrary-call-error/intra-function-taint' });
|
|
507
|
+
this.walkExpression(fn.body, node => {
|
|
508
|
+
const kind = this.kind(node);
|
|
509
|
+
if (kind === 'FunctionCall') {
|
|
510
|
+
const callee = this.getCalleeName(node);
|
|
511
|
+
if (callee && internalFunctionNames.has(callee)) {
|
|
512
|
+
const taintedArgs = new Set();
|
|
513
|
+
this.args(node).forEach((arg, index) => {
|
|
514
|
+
if (expressionTainted(arg))
|
|
515
|
+
taintedArgs.add(index);
|
|
516
|
+
});
|
|
517
|
+
if (taintedArgs.size > 0)
|
|
518
|
+
internalCalls.push({ name: callee, taintedArgs });
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
else if ((kind === 'ReturnStatement' || kind === 'Return') && expressionTainted(node.expression || node.returnExpression)) {
|
|
522
|
+
returnsUserInput = true;
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
return { internalCalls, returnsTainted: returnsUserInput };
|
|
526
|
+
}
|
|
527
|
+
containsSummaryTaint(expr, parameters, locals, returnsTainted) {
|
|
528
|
+
if (!expr || typeof expr !== 'object')
|
|
529
|
+
return false;
|
|
530
|
+
const name = this.identifierName(expr);
|
|
531
|
+
if (name)
|
|
532
|
+
return parameters.has(name) || locals.has(name);
|
|
533
|
+
if (this.kind(expr) === 'FunctionCall') {
|
|
534
|
+
const callee = this.getCalleeName(expr);
|
|
535
|
+
if (callee && returnsTainted.has(callee))
|
|
536
|
+
return true;
|
|
537
|
+
}
|
|
538
|
+
if (this.isMsgValue(expr))
|
|
539
|
+
return true;
|
|
540
|
+
return this.forEachChild(expr, child => this.containsSummaryTaint(child, parameters, locals, returnsTainted));
|
|
541
|
+
}
|
|
542
|
+
walkExpression(node, visit) {
|
|
543
|
+
if (!node || typeof node !== 'object')
|
|
544
|
+
return;
|
|
545
|
+
visit(node);
|
|
546
|
+
this.forEachChild(node, child => {
|
|
547
|
+
this.walkExpression(child, visit);
|
|
548
|
+
return false;
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
trackValidationGate(expr) {
|
|
552
|
+
if (!expr || typeof expr !== 'object')
|
|
553
|
+
return;
|
|
554
|
+
if (this.kind(expr) === 'FunctionCall' && this.getCalleeName(expr) === 'require') {
|
|
555
|
+
this.markSelectorCompared(this.args(expr)[0]);
|
|
556
|
+
this.markTargetValidated(this.args(expr)[0]);
|
|
557
|
+
}
|
|
558
|
+
this.forEachChild(expr, child => {
|
|
559
|
+
this.trackValidationGate(child);
|
|
560
|
+
return false;
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
markSelectorCompared(expr) {
|
|
564
|
+
if (!expr || typeof expr !== 'object')
|
|
565
|
+
return;
|
|
566
|
+
if (this.kind(expr) === 'BinaryOperation' && (expr.operator === '==' || expr.operator === '!=')) {
|
|
567
|
+
for (const side of [expr.left, expr.right]) {
|
|
568
|
+
const name = this.selectorDataName(side);
|
|
569
|
+
if (name)
|
|
570
|
+
this.selectorChecked.add(name);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
this.forEachChild(expr, child => {
|
|
574
|
+
this.markSelectorCompared(child);
|
|
575
|
+
return false;
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
selectorDataName(expr) {
|
|
579
|
+
if (!expr || typeof expr !== 'object')
|
|
580
|
+
return null;
|
|
581
|
+
if (this.kind(expr) === 'FunctionCall' && this.getCalleeName(expr) === 'bytes4') {
|
|
582
|
+
return this.rootIdentifier(this.args(expr)[0]);
|
|
583
|
+
}
|
|
584
|
+
return null;
|
|
585
|
+
}
|
|
586
|
+
isSelectorChecked(expr) {
|
|
587
|
+
const root = this.rootIdentifier(expr);
|
|
588
|
+
return !!root && this.selectorChecked.has(root);
|
|
589
|
+
}
|
|
590
|
+
hasFixedSelectorCallData(expr) {
|
|
591
|
+
if (!expr || typeof expr !== 'object')
|
|
592
|
+
return false;
|
|
593
|
+
if (this.kind(expr) !== 'FunctionCall')
|
|
594
|
+
return false;
|
|
595
|
+
const callee = this.getCalleeName(expr).toLowerCase();
|
|
596
|
+
if (callee !== 'abi.encodewithselector' && callee !== 'abi.encodecall')
|
|
597
|
+
return false;
|
|
598
|
+
const [selector] = this.args(expr);
|
|
599
|
+
return !!selector && !this.containsTainted(selector);
|
|
600
|
+
}
|
|
601
|
+
markTargetValidated(expr) {
|
|
602
|
+
if (!expr || typeof expr !== 'object')
|
|
603
|
+
return;
|
|
604
|
+
const kind = this.kind(expr);
|
|
605
|
+
if (kind === 'IndexAccess') {
|
|
606
|
+
const base = this.flattenNames(expr.base || expr.baseExpression).toLowerCase();
|
|
607
|
+
const index = this.rootIdentifier(expr.index || expr.indexExpression);
|
|
608
|
+
if (index && /(allow|allowed|allowlist|trusted|approved|oracle)/.test(base)) {
|
|
609
|
+
this.targetChecked.add(index);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
if (kind === 'FunctionCall') {
|
|
613
|
+
const callee = this.getCalleeName(expr).toLowerCase();
|
|
614
|
+
for (const arg of this.args(expr)) {
|
|
615
|
+
const root = this.rootIdentifier(arg);
|
|
616
|
+
if (root && /(allow|allowed|allowlist|trusted|approved|oracle)/.test(callee)) {
|
|
617
|
+
this.targetChecked.add(root);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
this.forEachChild(expr, child => {
|
|
622
|
+
this.markTargetValidated(child);
|
|
623
|
+
return false;
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
isTargetChecked(expr) {
|
|
627
|
+
const root = this.rootIdentifier(expr);
|
|
628
|
+
return !!root && this.targetChecked.has(root);
|
|
629
|
+
}
|
|
630
|
+
isAbiDecodeOfTainted(expr) {
|
|
631
|
+
return this.kind(expr) === 'FunctionCall' &&
|
|
632
|
+
this.getCalleeName(expr).toLowerCase() === 'abi.decode' &&
|
|
633
|
+
this.args(expr).some(arg => this.containsTainted(arg));
|
|
634
|
+
}
|
|
635
|
+
containsTainted(expr) {
|
|
636
|
+
if (!expr || typeof expr !== 'object')
|
|
637
|
+
return false;
|
|
638
|
+
const name = this.identifierName(expr);
|
|
639
|
+
if (name) {
|
|
640
|
+
if (this.parameters.has(name) || this.taintedLocals.has(name))
|
|
641
|
+
return true;
|
|
642
|
+
if (this.stateVariables.has(name))
|
|
643
|
+
return false;
|
|
644
|
+
}
|
|
645
|
+
if (this.isMsgValue(expr))
|
|
646
|
+
return true;
|
|
647
|
+
return this.forEachChild(expr, child => this.containsTainted(child));
|
|
648
|
+
}
|
|
649
|
+
containsTaintedIndexAccess(expr) {
|
|
650
|
+
if (!expr || typeof expr !== 'object')
|
|
651
|
+
return false;
|
|
652
|
+
const kind = this.kind(expr);
|
|
653
|
+
if ((kind === 'IndexAccess' || kind === 'IndexRangeAccess') && this.containsTainted(expr.base || expr.baseExpression)) {
|
|
654
|
+
return true;
|
|
655
|
+
}
|
|
656
|
+
return this.forEachChild(expr, child => this.containsTaintedIndexAccess(child));
|
|
657
|
+
}
|
|
658
|
+
containsRangeAccess(expr) {
|
|
659
|
+
if (!expr || typeof expr !== 'object')
|
|
660
|
+
return false;
|
|
661
|
+
if (this.kind(expr) === 'IndexRangeAccess')
|
|
662
|
+
return true;
|
|
663
|
+
return this.forEachChild(expr, child => this.containsRangeAccess(child));
|
|
664
|
+
}
|
|
665
|
+
isAaveRouteCall(target, args) {
|
|
666
|
+
const names = [
|
|
667
|
+
this.memberNameInChain(target),
|
|
668
|
+
...args.map(arg => this.memberNameInChain(arg)),
|
|
669
|
+
].filter(Boolean).map(name => String(name).toLowerCase());
|
|
670
|
+
return names.some(name => name.includes('callees')) &&
|
|
671
|
+
names.some(name => name.includes('exchangedata')) &&
|
|
672
|
+
names.some(name => name.includes('startindexes'));
|
|
673
|
+
}
|
|
674
|
+
isKelpOracleRoute(target, args, options) {
|
|
675
|
+
const names = [
|
|
676
|
+
this.memberNameInChain(target),
|
|
677
|
+
...args.map(arg => this.memberNameInChain(arg)),
|
|
678
|
+
...options.map(arg => this.memberNameInChain(arg)),
|
|
679
|
+
].filter(Boolean).map(name => String(name).toLowerCase());
|
|
680
|
+
return names.some(name => name.includes('priceoracles') || name.includes('oracles')) &&
|
|
681
|
+
names.some(name => name.includes('oraclecalldata') || name.includes('calldata')) &&
|
|
682
|
+
(names.some(name => name.includes('values')) || options.some(option => this.containsTainted(option)));
|
|
683
|
+
}
|
|
684
|
+
isOracleSensitiveCall(member, target, args) {
|
|
685
|
+
const haystack = [
|
|
686
|
+
this.currentContract,
|
|
687
|
+
member,
|
|
688
|
+
this.memberNameInChain(target),
|
|
689
|
+
...args.map(arg => this.memberNameInChain(arg)),
|
|
690
|
+
].join(' ').toLowerCase();
|
|
691
|
+
return this.isOracleName(haystack);
|
|
692
|
+
}
|
|
693
|
+
isOracleName(value) {
|
|
694
|
+
const normalized = value.replace(/non[-_ ]?oracle/ig, '');
|
|
695
|
+
return /(oracle|price|feed|quote|latestanswer|latestrounddata|getassetprice|getprice)/i.test(normalized);
|
|
696
|
+
}
|
|
697
|
+
remediationFor(pattern) {
|
|
698
|
+
if (pattern === 'user-controlled-arbitrary-call/oracle-user-controlled-calldata') {
|
|
699
|
+
return 'use a selector allowlist or explicit invariant checks before calling the oracle';
|
|
700
|
+
}
|
|
701
|
+
if (pattern === 'user-controlled-arbitrary-call/aave-kelp-oracle-route') {
|
|
702
|
+
return 'constrain decoded oracle routes with allowlists, role gates, and explicit invariant checks';
|
|
703
|
+
}
|
|
704
|
+
return 'add an oracle allowlist, role gate, or explicit invariant checks before the call';
|
|
705
|
+
}
|
|
706
|
+
inputPathForOracle(target, args, options, pattern) {
|
|
707
|
+
if (pattern === 'user-controlled-arbitrary-call/aave-kelp-oracle-route') {
|
|
708
|
+
const origin = [target, ...args, ...options]
|
|
709
|
+
.map(expr => this.rootIdentifier(expr))
|
|
710
|
+
.find(name => !!name && this.localOrigins.has(name || ''));
|
|
711
|
+
const source = origin ? this.localOrigins.get(origin) : 'payload';
|
|
712
|
+
return `${source} -> abi.decode -> r.priceOracles/r.oracleCallData/r.values`;
|
|
713
|
+
}
|
|
714
|
+
const parts = [];
|
|
715
|
+
if (this.containsTainted(target) && !this.isTargetChecked(target)) {
|
|
716
|
+
parts.push(this.inputPathFor(target, 'target'));
|
|
717
|
+
}
|
|
718
|
+
for (const arg of args) {
|
|
719
|
+
if (this.containsTainted(arg) && !this.isSelectorChecked(arg)) {
|
|
720
|
+
parts.push(this.inputPathFor(arg, 'calldata'));
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
for (const option of options) {
|
|
724
|
+
if (this.containsTainted(option) || this.isMsgValue(option)) {
|
|
725
|
+
parts.push(this.inputPathFor(option, 'value'));
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
return parts.join('; ');
|
|
729
|
+
}
|
|
730
|
+
inputPathFor(expr, label) {
|
|
731
|
+
if (this.isMsgValue(expr))
|
|
732
|
+
return 'value <- msg.value';
|
|
733
|
+
const root = this.rootIdentifier(expr);
|
|
734
|
+
if (root && this.localOrigins.has(root)) {
|
|
735
|
+
const origin = this.localOrigins.get(root);
|
|
736
|
+
if (origin === 'raw')
|
|
737
|
+
return 'raw -> _build(raw) -> data -> _read(data)';
|
|
738
|
+
if (origin.includes('<-'))
|
|
739
|
+
return origin;
|
|
740
|
+
return `${origin} -> abi.decode -> ${this.memberNameInChain(expr) || root}`;
|
|
741
|
+
}
|
|
742
|
+
const name = root || this.memberNameInChain(expr) || label;
|
|
743
|
+
return `${name} <- ${this.currentFunction}(${this.parameterSignature()})`;
|
|
744
|
+
}
|
|
745
|
+
parameterSignature() {
|
|
746
|
+
return this.currentParameters
|
|
747
|
+
.map(param => `${this.typeNameToString(param.typeName)} ${param.name || ''}`.trim())
|
|
748
|
+
.filter(Boolean)
|
|
749
|
+
.join(', ');
|
|
750
|
+
}
|
|
751
|
+
typeNameToString(typeName) {
|
|
752
|
+
if (!typeName)
|
|
753
|
+
return '';
|
|
754
|
+
if (typeof typeName === 'string')
|
|
755
|
+
return typeName;
|
|
756
|
+
if (typeName.name)
|
|
757
|
+
return typeName.name;
|
|
758
|
+
if (typeName.namePath)
|
|
759
|
+
return typeName.namePath;
|
|
760
|
+
if (typeName.type === 'ArrayTypeName' || typeName.nodeType === 'ArrayTypeName') {
|
|
761
|
+
return `${this.typeNameToString(typeName.baseTypeName || typeName.baseType)}[]`;
|
|
762
|
+
}
|
|
763
|
+
if (typeName.type === 'ElementaryTypeName' || typeName.nodeType === 'ElementaryTypeName') {
|
|
764
|
+
return typeName.name || '';
|
|
765
|
+
}
|
|
766
|
+
return '';
|
|
767
|
+
}
|
|
768
|
+
isMsgValue(expr) {
|
|
769
|
+
return this.kind(expr) === 'MemberAccess' &&
|
|
770
|
+
String(expr.memberName || '') === 'value' &&
|
|
771
|
+
this.getExpressionName(expr.expression) === 'msg';
|
|
772
|
+
}
|
|
773
|
+
isAddressThis(expr) {
|
|
774
|
+
if (!expr || typeof expr !== 'object')
|
|
775
|
+
return false;
|
|
776
|
+
const kind = this.kind(expr);
|
|
777
|
+
if (kind === 'Identifier')
|
|
778
|
+
return expr.name === 'this';
|
|
779
|
+
if (kind === 'ThisExpression')
|
|
780
|
+
return true;
|
|
781
|
+
if (kind !== 'FunctionCall')
|
|
782
|
+
return false;
|
|
783
|
+
const callee = expr.expression;
|
|
784
|
+
const calleeName = this.kind(callee) === 'ElementaryTypeName'
|
|
785
|
+
? String(callee.name || '').toLowerCase()
|
|
786
|
+
: this.getCalleeName(expr).toLowerCase();
|
|
787
|
+
if (calleeName !== 'address' && calleeName !== 'payable')
|
|
788
|
+
return false;
|
|
789
|
+
const [arg] = this.args(expr);
|
|
790
|
+
return this.isAddressThis(arg);
|
|
791
|
+
}
|
|
792
|
+
expressionToString(expr) {
|
|
793
|
+
if (!expr || typeof expr !== 'object')
|
|
794
|
+
return '';
|
|
795
|
+
const kind = this.kind(expr);
|
|
796
|
+
if (kind === 'Identifier')
|
|
797
|
+
return expr.name || '';
|
|
798
|
+
if (kind === 'MemberAccess') {
|
|
799
|
+
const base = this.expressionToString(expr.expression);
|
|
800
|
+
return base ? `${base}.${expr.memberName || ''}` : expr.memberName || '';
|
|
801
|
+
}
|
|
802
|
+
if (kind === 'IndexAccess') {
|
|
803
|
+
return `${this.expressionToString(expr.base || expr.baseExpression)}[${this.expressionToString(expr.index || expr.indexExpression)}]`;
|
|
804
|
+
}
|
|
805
|
+
if (kind === 'IndexRangeAccess') {
|
|
806
|
+
return `${this.expressionToString(expr.base || expr.baseExpression)}[${this.expressionToString(expr.indexStart || expr.startExpression)}:${this.expressionToString(expr.indexEnd || expr.endExpression)}]`;
|
|
807
|
+
}
|
|
808
|
+
if (kind === 'NameValueExpression' || kind === 'FunctionCallOptions') {
|
|
809
|
+
const names = expr.names || expr.arguments?.names || expr.nameValueList?.map((item) => item?.name) || ['value'];
|
|
810
|
+
const options = this.args(expr).map((arg, index) => `${names[index] || 'value'}: ${this.expressionToString(arg)}`).join(', ');
|
|
811
|
+
return `${this.expressionToString(expr.expression)}{${options}}`;
|
|
812
|
+
}
|
|
813
|
+
if (kind === 'FunctionCall') {
|
|
814
|
+
return `${this.expressionToString(expr.expression)}(${this.args(expr).map(arg => this.expressionToString(arg)).join(', ')})`;
|
|
815
|
+
}
|
|
816
|
+
if (kind === 'StringLiteral')
|
|
817
|
+
return `"${expr.value || ''}"`;
|
|
818
|
+
if (kind === 'NumberLiteral')
|
|
819
|
+
return String(expr.number || expr.value || '');
|
|
820
|
+
return this.memberNameInChain(expr);
|
|
821
|
+
}
|
|
822
|
+
memberNameInChain(expr) {
|
|
823
|
+
if (!expr || typeof expr !== 'object')
|
|
824
|
+
return '';
|
|
825
|
+
if (this.kind(expr) === 'MemberAccess') {
|
|
826
|
+
return `${this.memberNameInChain(expr.expression)}.${expr.memberName || ''}`;
|
|
827
|
+
}
|
|
828
|
+
if (this.kind(expr) === 'IndexAccess' || this.kind(expr) === 'IndexRangeAccess') {
|
|
829
|
+
return this.memberNameInChain(expr.base || expr.baseExpression);
|
|
830
|
+
}
|
|
831
|
+
if (this.kind(expr) === 'FunctionCall') {
|
|
832
|
+
for (const arg of this.args(expr)) {
|
|
833
|
+
const name = this.memberNameInChain(arg);
|
|
834
|
+
if (name)
|
|
835
|
+
return name;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
const identifier = this.identifierName(expr);
|
|
839
|
+
if (identifier && this.localOrigins.has(identifier))
|
|
840
|
+
return this.localOrigins.get(identifier);
|
|
841
|
+
if (identifier)
|
|
842
|
+
return identifier;
|
|
843
|
+
let found = '';
|
|
844
|
+
this.forEachChild(expr, child => {
|
|
845
|
+
found = this.memberNameInChain(child);
|
|
846
|
+
return !!found;
|
|
847
|
+
});
|
|
848
|
+
return found;
|
|
849
|
+
}
|
|
850
|
+
isEmptyCallData(expr) {
|
|
851
|
+
return !expr ||
|
|
852
|
+
this.kind(expr) === 'StringLiteral' && String(expr.value || '') === '' ||
|
|
853
|
+
this.kind(expr) === 'HexLiteral' && String(expr.value || '') === '';
|
|
854
|
+
}
|
|
855
|
+
hasAccessControl(node) {
|
|
856
|
+
for (const modifier of node.modifiers || []) {
|
|
857
|
+
const name = this.nodeName(modifier);
|
|
858
|
+
if (ACCESS_CONTROL_MODIFIER.test(name) || REENTRANCY_GUARD_MODIFIER.test(name) || this.looksLikeAccessControlName(name)) {
|
|
859
|
+
return true;
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
return this.containsAccessRequire(node.body);
|
|
863
|
+
}
|
|
864
|
+
looksLikeAccessControlName(name) {
|
|
865
|
+
return /(owner|admin|role|auth|govern|guardian|manager|operator|timelock)/i.test(name);
|
|
866
|
+
}
|
|
867
|
+
hasSuppressedCallerContext(node) {
|
|
868
|
+
if (MULTICALL_OR_FORWARDER_FUNCTIONS.has(node.name || ''))
|
|
869
|
+
return true;
|
|
870
|
+
if (!this.hasInternalOrPrivateVisibility(node))
|
|
871
|
+
return false;
|
|
872
|
+
return !this.hasExternallyTaintedReachability(node);
|
|
873
|
+
}
|
|
874
|
+
hasInternalOrPrivateVisibility(node) {
|
|
875
|
+
const visibility = String(node.visibility || '').toLowerCase();
|
|
876
|
+
return visibility === 'internal' || visibility === 'private';
|
|
877
|
+
}
|
|
878
|
+
hasExternallyTaintedReachability(node) {
|
|
879
|
+
const name = node.name || '';
|
|
880
|
+
if (!name)
|
|
881
|
+
return false;
|
|
882
|
+
return (this.propagatedParamTaint.get(name)?.size || 0) > 0;
|
|
883
|
+
}
|
|
884
|
+
isExternallyCallable(node) {
|
|
885
|
+
const kind = String(node.kind || node.functionKind || '').toLowerCase();
|
|
886
|
+
if (kind === 'constructor')
|
|
887
|
+
return false;
|
|
888
|
+
const visibility = String(node.visibility || '').toLowerCase();
|
|
889
|
+
return visibility === 'public' || visibility === 'external' || kind === 'fallback' || kind === 'receive';
|
|
890
|
+
}
|
|
891
|
+
containsAccessRequire(expr) {
|
|
892
|
+
if (!expr || typeof expr !== 'object')
|
|
893
|
+
return false;
|
|
894
|
+
if (this.kind(expr) === 'FunctionCall' && this.getCalleeName(expr) === 'require') {
|
|
895
|
+
const arg = this.args(expr)[0];
|
|
896
|
+
if (this.requireArgIsAccessControl(arg))
|
|
897
|
+
return true;
|
|
898
|
+
}
|
|
899
|
+
return this.forEachChild(expr, child => this.containsAccessRequire(child));
|
|
900
|
+
}
|
|
901
|
+
/**
|
|
902
|
+
* Structural predicate — does the require argument express an access
|
|
903
|
+
* control check rather than a generic invariant? Recognized shapes:
|
|
904
|
+
*
|
|
905
|
+
* require(msg.sender == owner) BinaryOperation('==') with
|
|
906
|
+
* require(admin == msg.sender) msg.sender on one side and a
|
|
907
|
+
* privilege-named storage ref on
|
|
908
|
+
* the other.
|
|
909
|
+
* require(_authorized[msg.sender]) IndexAccess base named for a
|
|
910
|
+
* privilege concept, indexed by
|
|
911
|
+
* msg.sender.
|
|
912
|
+
* require(hasRole(role, msg.sender)) FunctionCall whose callee
|
|
913
|
+
* require(_checkRole(role, ...)) tail name matches one of the
|
|
914
|
+
* known role-check helpers.
|
|
915
|
+
*
|
|
916
|
+
* Recurses through &&/||/!/parentheses so multi-clause requires are
|
|
917
|
+
* recognized. The flattened-text fallback below is preserved for
|
|
918
|
+
* shapes the structural predicate doesn't yet recognize, which keeps
|
|
919
|
+
* recall stable while improving precision on the common cases —
|
|
920
|
+
* notably, `require(amount > 0 && callOwnerOf(msg.sender))` no longer
|
|
921
|
+
* matches just because both substrings appear somewhere.
|
|
922
|
+
*/
|
|
923
|
+
requireArgIsAccessControl(expr) {
|
|
924
|
+
// Structural shape — `msg.sender == privileged`, `_admins[msg.sender]`,
|
|
925
|
+
// `hasRole(...)`, etc. — handled by the shared module so the recursion
|
|
926
|
+
// (&&, ||, !, tuples) stays consistent across detectors.
|
|
927
|
+
if ((0, access_control_1.requireExpressesAccessControl)(expr, isArbitraryCallPrivilegedName, e => this.getCalleeName(e))) {
|
|
928
|
+
return true;
|
|
929
|
+
}
|
|
930
|
+
if (!expr || typeof expr !== 'object')
|
|
931
|
+
return false;
|
|
932
|
+
// Fallback: flattened-name match for wrapper shapes the structural
|
|
933
|
+
// predicate doesn't enumerate (e.g. `require(_isAuthorized(msg.sender))`).
|
|
934
|
+
// Operating on identifier names rather than raw source text means
|
|
935
|
+
// string literals and comments still cannot drive a match.
|
|
936
|
+
const text = this.flattenNames(expr).toLowerCase();
|
|
937
|
+
if (text.includes('msg.sender') && /(owner|admin|role|auth)/.test(text))
|
|
938
|
+
return true;
|
|
939
|
+
if (text.includes('hasrole') || text.includes('checkrole'))
|
|
940
|
+
return true;
|
|
941
|
+
return false;
|
|
942
|
+
}
|
|
943
|
+
// Thin instance-method wrappers preserved so existing call sites
|
|
944
|
+
// inside this detector (`this.isMsgSenderExpr(...)`,
|
|
945
|
+
// `this.isPrivilegedReference(...)`) continue to work without a
|
|
946
|
+
// wider edit. Each delegates straight to the shared structural
|
|
947
|
+
// helper; the per-detector privilege-name policy lives at the top
|
|
948
|
+
// of the file.
|
|
949
|
+
isMsgSenderExpr(expr) {
|
|
950
|
+
return (0, access_control_1.isMsgSenderExpr)(expr);
|
|
951
|
+
}
|
|
952
|
+
isPrivilegedReference(expr) {
|
|
953
|
+
return (0, access_control_1.isPrivilegedReference)(expr, isArbitraryCallPrivilegedName);
|
|
954
|
+
}
|
|
955
|
+
collectVerifiedRequestIdentifiers(body) {
|
|
956
|
+
const verified = new Set();
|
|
957
|
+
if (!body)
|
|
958
|
+
return verified;
|
|
959
|
+
this.walkExpression(body, node => {
|
|
960
|
+
if (this.kind(node) !== 'FunctionCall')
|
|
961
|
+
return;
|
|
962
|
+
if (this.getCalleeName(node) !== 'require')
|
|
963
|
+
return;
|
|
964
|
+
const arg = this.args(node)[0];
|
|
965
|
+
this.collectVerifyCallTargets(arg, verified);
|
|
966
|
+
});
|
|
967
|
+
return verified;
|
|
968
|
+
}
|
|
969
|
+
collectVerifyCallTargets(expr, into) {
|
|
970
|
+
if (!expr || typeof expr !== 'object')
|
|
971
|
+
return;
|
|
972
|
+
if (this.kind(expr) === 'FunctionCall') {
|
|
973
|
+
const callee = this.getCalleeName(expr).toLowerCase();
|
|
974
|
+
const calleeBase = callee.includes('.') ? callee.split('.').pop() : callee;
|
|
975
|
+
if (/^_?verify(_?signature|_?eip712|_?typeddata)?$/.test(calleeBase)) {
|
|
976
|
+
const args = this.args(expr);
|
|
977
|
+
if (args.length >= 1) {
|
|
978
|
+
const reqRoot = this.rootIdentifier(args[0]);
|
|
979
|
+
if (reqRoot)
|
|
980
|
+
into.add(reqRoot);
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
this.forEachChild(expr, child => {
|
|
985
|
+
this.collectVerifyCallTargets(child, into);
|
|
986
|
+
return false;
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
isMinimalForwarderCall(target, args, options) {
|
|
990
|
+
if (this.verifiedRequestIdentifiers.size === 0)
|
|
991
|
+
return false;
|
|
992
|
+
if (this.kind(target) !== 'MemberAccess')
|
|
993
|
+
return false;
|
|
994
|
+
const targetRoot = this.rootIdentifier(target);
|
|
995
|
+
if (!targetRoot || !this.verifiedRequestIdentifiers.has(targetRoot))
|
|
996
|
+
return false;
|
|
997
|
+
for (const opt of options) {
|
|
998
|
+
if (!this.allTaintedRootsBoundTo(opt, targetRoot))
|
|
999
|
+
return false;
|
|
1000
|
+
}
|
|
1001
|
+
for (const arg of args) {
|
|
1002
|
+
if (this.isEmptyCallData(arg))
|
|
1003
|
+
continue;
|
|
1004
|
+
if (!this.allTaintedRootsBoundTo(arg, targetRoot))
|
|
1005
|
+
return false;
|
|
1006
|
+
}
|
|
1007
|
+
return true;
|
|
1008
|
+
}
|
|
1009
|
+
allTaintedRootsBoundTo(expr, reqId) {
|
|
1010
|
+
if (!expr || typeof expr !== 'object')
|
|
1011
|
+
return true;
|
|
1012
|
+
if (this.isMsgValue(expr))
|
|
1013
|
+
return false;
|
|
1014
|
+
const name = this.identifierName(expr);
|
|
1015
|
+
if (name) {
|
|
1016
|
+
if (this.parameters.has(name) || this.taintedLocals.has(name))
|
|
1017
|
+
return name === reqId;
|
|
1018
|
+
return true;
|
|
1019
|
+
}
|
|
1020
|
+
if (this.kind(expr) === 'MemberAccess') {
|
|
1021
|
+
const root = this.rootIdentifier(expr);
|
|
1022
|
+
if (root && (this.parameters.has(root) || this.taintedLocals.has(root)))
|
|
1023
|
+
return root === reqId;
|
|
1024
|
+
return true;
|
|
1025
|
+
}
|
|
1026
|
+
let ok = true;
|
|
1027
|
+
this.forEachChild(expr, child => {
|
|
1028
|
+
if (!this.allTaintedRootsBoundTo(child, reqId)) {
|
|
1029
|
+
ok = false;
|
|
1030
|
+
return true;
|
|
1031
|
+
}
|
|
1032
|
+
return false;
|
|
1033
|
+
});
|
|
1034
|
+
return ok;
|
|
1035
|
+
}
|
|
1036
|
+
flattenNames(expr) {
|
|
1037
|
+
if (!expr || typeof expr !== 'object')
|
|
1038
|
+
return '';
|
|
1039
|
+
const name = this.identifierName(expr);
|
|
1040
|
+
const member = this.kind(expr) === 'MemberAccess'
|
|
1041
|
+
? `${this.flattenNames(expr.expression)}.${expr.memberName || ''}`
|
|
1042
|
+
: '';
|
|
1043
|
+
const children = [];
|
|
1044
|
+
this.forEachChild(expr, child => {
|
|
1045
|
+
const value = this.flattenNames(child);
|
|
1046
|
+
if (value)
|
|
1047
|
+
children.push(value);
|
|
1048
|
+
return false;
|
|
1049
|
+
});
|
|
1050
|
+
return [name, member, ...children].filter(Boolean).join(' ');
|
|
1051
|
+
}
|
|
1052
|
+
getCalleeName(call) {
|
|
1053
|
+
const expr = call?.expression;
|
|
1054
|
+
if (!expr)
|
|
1055
|
+
return '';
|
|
1056
|
+
if (this.kind(expr) === 'Identifier')
|
|
1057
|
+
return expr.name || '';
|
|
1058
|
+
if (this.kind(expr) === 'MemberAccess') {
|
|
1059
|
+
const prefix = this.getExpressionName(expr.expression);
|
|
1060
|
+
return prefix ? `${prefix}.${expr.memberName || ''}` : expr.memberName || '';
|
|
1061
|
+
}
|
|
1062
|
+
if (this.kind(expr) === 'ElementaryTypeName')
|
|
1063
|
+
return expr.name || '';
|
|
1064
|
+
return '';
|
|
1065
|
+
}
|
|
1066
|
+
getExpressionName(expr) {
|
|
1067
|
+
if (!expr || typeof expr !== 'object')
|
|
1068
|
+
return '';
|
|
1069
|
+
if (this.kind(expr) === 'Identifier')
|
|
1070
|
+
return expr.name || '';
|
|
1071
|
+
if (this.kind(expr) === 'MemberAccess') {
|
|
1072
|
+
const prefix = this.getExpressionName(expr.expression);
|
|
1073
|
+
return prefix ? `${prefix}.${expr.memberName || ''}` : expr.memberName || '';
|
|
1074
|
+
}
|
|
1075
|
+
return '';
|
|
1076
|
+
}
|
|
1077
|
+
rootIdentifier(expr) {
|
|
1078
|
+
if (!expr || typeof expr !== 'object')
|
|
1079
|
+
return null;
|
|
1080
|
+
if (this.kind(expr) === 'Identifier')
|
|
1081
|
+
return expr.name || null;
|
|
1082
|
+
if (this.kind(expr) === 'MemberAccess')
|
|
1083
|
+
return this.rootIdentifier(expr.expression);
|
|
1084
|
+
if (this.kind(expr) === 'IndexAccess' || this.kind(expr) === 'IndexRangeAccess') {
|
|
1085
|
+
return this.rootIdentifier(expr.base || expr.baseExpression);
|
|
1086
|
+
}
|
|
1087
|
+
if (this.kind(expr) === 'FunctionCall')
|
|
1088
|
+
return this.rootIdentifier(this.args(expr)[0]);
|
|
1089
|
+
return null;
|
|
1090
|
+
}
|
|
1091
|
+
identifierName(expr) {
|
|
1092
|
+
return this.kind(expr) === 'Identifier' ? expr.name || null : null;
|
|
1093
|
+
}
|
|
1094
|
+
nodeName(node) {
|
|
1095
|
+
if (!node)
|
|
1096
|
+
return '';
|
|
1097
|
+
if (typeof node === 'string')
|
|
1098
|
+
return node;
|
|
1099
|
+
if (node.name)
|
|
1100
|
+
return this.nodeName(node.name);
|
|
1101
|
+
if (this.kind(node) === 'Identifier')
|
|
1102
|
+
return node.name || '';
|
|
1103
|
+
if (this.kind(node) === 'ModifierInvocation')
|
|
1104
|
+
return this.nodeName(node.name);
|
|
1105
|
+
if (this.kind(node) === 'MemberAccess')
|
|
1106
|
+
return node.memberName || '';
|
|
1107
|
+
return '';
|
|
1108
|
+
}
|
|
1109
|
+
args(node) {
|
|
1110
|
+
if (Array.isArray(node?.arguments))
|
|
1111
|
+
return node.arguments;
|
|
1112
|
+
if (Array.isArray(node?.arguments?.arguments))
|
|
1113
|
+
return node.arguments.arguments;
|
|
1114
|
+
if (Array.isArray(node?.components))
|
|
1115
|
+
return node.components;
|
|
1116
|
+
return [];
|
|
1117
|
+
}
|
|
1118
|
+
kind(node) {
|
|
1119
|
+
return node?.type || node?.nodeType || '';
|
|
1120
|
+
}
|
|
1121
|
+
forEachChild(node, predicate) {
|
|
1122
|
+
if (!node || typeof node !== 'object')
|
|
1123
|
+
return false;
|
|
1124
|
+
for (const key of [
|
|
1125
|
+
'expression',
|
|
1126
|
+
'left',
|
|
1127
|
+
'right',
|
|
1128
|
+
'subExpression',
|
|
1129
|
+
'base',
|
|
1130
|
+
'index',
|
|
1131
|
+
'baseExpression',
|
|
1132
|
+
'indexExpression',
|
|
1133
|
+
'startExpression',
|
|
1134
|
+
'endExpression',
|
|
1135
|
+
'indexStart',
|
|
1136
|
+
'indexEnd',
|
|
1137
|
+
'initialValue',
|
|
1138
|
+
'value',
|
|
1139
|
+
'returnExpression',
|
|
1140
|
+
'condition',
|
|
1141
|
+
'trueBody',
|
|
1142
|
+
'falseBody',
|
|
1143
|
+
'body',
|
|
1144
|
+
'arguments',
|
|
1145
|
+
'components',
|
|
1146
|
+
'statements',
|
|
1147
|
+
]) {
|
|
1148
|
+
const value = node[key];
|
|
1149
|
+
if (Array.isArray(value)) {
|
|
1150
|
+
for (const item of value) {
|
|
1151
|
+
if (item && typeof item === 'object' && predicate(item))
|
|
1152
|
+
return true;
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
else if (value && typeof value === 'object' && predicate(value)) {
|
|
1156
|
+
return true;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
return false;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
exports.ArbitraryCallErrorDetector = ArbitraryCallErrorDetector;
|
|
1163
|
+
//# sourceMappingURL=arbitrary-call-error.js.map
|