We are very excited about Trailmark's potential and looking forward to building tooling on top of it. Thanks for open sourcing it!
In its current state, the entrypoints feature (described as "attack surface") is unreliable for Solidity.
Tagging anything with "public" or "external" as an entry point is a heuristic that will fail with nearly all Solidity smart contracts.
|
_SOL_VISIBILITY = re.compile( |
|
r"\bfunction\s+\w+\s*\([^)]*\)\s*(?:[\w\s]*?\b)?(external|public)\b", |
|
) |
For example, view only functions that do not modify the state are marked as an entrypoint / attack surface:
/**
* @notice seconds until the next epoch begins
*/
function secondsToNextEpoch() external view returns (uint256) {
return epoch.end.sub(block.timestamp);
}
Interfaces are scanned (when they should be ignored), and as a result, governor() will be listed as an "entry point" of the target project.
interface IOlympusAuthority {
function governor() external view returns (address);
}
A regex-based approach falls short here, especially with Solidity’s inheritance. When a smart contract overrides an inherited entry point, Trailmark needs to return the override only, not every version in the hierarchy.
Trailofbits implemented in Slither an "entrypoint scanner" for Solidity (thanks @nisedo !) that seems to behave correctly.
Are there any plans to improve entrypoint detection for Solidity?
We are very excited about Trailmark's potential and looking forward to building tooling on top of it. Thanks for open sourcing it!
In its current state, the
entrypointsfeature (described as "attack surface") is unreliable for Solidity.Tagging anything with "public" or "external" as an entry point is a heuristic that will fail with nearly all Solidity smart contracts.
trailmark/src/trailmark/analysis/entrypoints.py
Lines 98 to 100 in a4a8182
For example, view only functions that do not modify the state are marked as an entrypoint / attack surface:
Interfaces are scanned (when they should be ignored), and as a result,
governor()will be listed as an "entry point" of the target project.A regex-based approach falls short here, especially with Solidity’s inheritance. When a smart contract overrides an inherited entry point, Trailmark needs to return the override only, not every version in the hierarchy.
Trailofbits implemented in Slither an "entrypoint scanner" for Solidity (thanks @nisedo !) that seems to behave correctly.
Are there any plans to improve entrypoint detection for Solidity?