-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use taint mode #61
use taint mode #61
Conversation
@@ -19,12 +19,23 @@ rules: | |||
mode: taint | |||
pattern-sinks: | |||
- pattern: $Y - $X | |||
- pattern: $Y -= $X |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we restrict this only to Solidity < 0.8 by matching pragma?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out not yet, pragma matching in semgrep needs enhancements
- focus-metavariable: $X | ||
- patterns: | ||
- pattern-inside: | | ||
function $F(..., $TYPE $X, ...) { ... } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this will match internal functions, should be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it matches the internal functions.
When I deleted it, semgrep stopped matching functions without visibility. This may be critical for contracts with pragma solidity prior to version 0.5.0, since visibility is public by default. This should be known when testing old contracts.
@@ -36,7 +36,7 @@ contract Test{ | |||
|
|||
function sink(address _contract, uint256 _num) internal { | |||
// intraprocedural tainting does not work for now... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete this comment too, because it works now
- pattern-either: | ||
- pattern: $X == ... | ||
- pattern: ... == $X | ||
- pattern: $X >= ... && $X <= ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would leave only strict equality ==
, other comparisons are not exact balance checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- pattern-not-inside: | | ||
function $F(...) { | ||
... | ||
$VAR.withdraw_admin_fees(...); | ||
... | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed duplicate, check pls
No description provided.