Skip to content

Commit b9d3b8f

Browse files
authored
Merge pull request #172 from crytic/update-not-so-algorand
Update not-so-algorand
2 parents 7bfbb7e + 0c4b5c6 commit b9d3b8f

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

not-so-smart-contracts/algorand/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ Each _Not So Smart Contract_ includes a standard set of information:
1414

1515
## Vulnerabilities
1616

17-
| Not So Smart Contract | Description |
18-
| --- | --- |
19-
| [Rekeying](rekeying) | Smart signatures are rekeyable |
20-
| [Unchecked Transaction Fees](unchecked_transaction_fee) | Attacker sets excessive fees for smart signature transactions |
21-
| [Closing Account](closing_account) | Attacker closes smart signature accounts |
22-
| [Closing Asset](closing_asset) | Attacker transfers entire asset balance of a smart signature |
23-
| [Group Size Check](group_size_check) | Contract does not check transaction group size |
24-
| [Time-based Replay Attack](time_based_replay_attack) | Contract does not use lease for periodic payments |
25-
| [Access Controls](access_controls) | Contract does not enfore access controls for updating and deleting application |
26-
| [Asset Id Check](asset_id_check) | Contract does not check asset id for asset transfer operations |
27-
| [Denial of Service](denial_of_service) | Attacker stalls contract execution by opting out of a asset |
17+
| Not So Smart Contract | Description | Applicable to smart signatures | Applicable to smart contracts |
18+
| --- | --- | --- | --- |
19+
| [Rekeying](rekeying) | Attacker rekeys an account | yes | yes |
20+
| [Unchecked Transaction Fees](unchecked_transaction_fee) | Attacker sets excessive fees for smart signature transactions | yes | no |
21+
| [Closing Account](closing_account) | Attacker closes smart signature accounts | yes | no |
22+
| [Closing Asset](closing_asset) | Attacker transfers entire asset balance of a smart signature | yes | no |
23+
| [Group Size Check](group_size_check) | Contract does not check transaction group size | yes | yes |
24+
| [Time-based Replay Attack](time_based_replay_attack) | Contract does not use lease for periodic payments | yes | no |
25+
| [Access Controls](access_controls) | Contract does not enfore access controls for updating and deleting application | no | yes |
26+
| [Asset Id Check](asset_id_check) | Contract does not check asset id for asset transfer operations | yes | yes |
27+
| [Denial of Service](denial_of_service) | Attacker stalls contract execution by opting out of a asset | yes | yes |
2828

2929
## Credits
3030

not-so-smart-contracts/algorand/group_size_check/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ def split_and_withdraw(
4040
- Verify that the group size of an atomic transfer is the intended size in the contracts.
4141

4242
- Use [Tealer](https://github.com/crytic/tealer) to detect this issue.
43+
44+
- Favor using ABI for smart contracts and relative indexes to verify the group transaction.

not-so-smart-contracts/algorand/rekeying/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Contract accounts are accounts which are derived from the Teal code that is in c
1313

1414
Similar issue affects the accounts that created a delegate signature by signing a Teal program. Delegator is only needed to sign the contract and any user with access to delegate signature can construct and submit transactions. Because of this, a malicious user can rekey the sender’s account if the Teal logic accepts a transaction with the rekey-to field set to the user controlled address.
1515

16+
Note: From Teal v6, Applications can also be rekeyed by executing an inner transaction with "RekeyTo" field set to a non-zero address. Rekeying an application allows to bypass the application logic and directly transfer Algos and assets of the application account.
1617
## Exploit Scenarios
1718

1819
A user creates a delegate signature for recurring payments. Attacker rekeys the sender’s account by specifying the rekey-to field in a valid payment transaction.
@@ -43,3 +44,5 @@ def withdraw(
4344
- For the Teal programs written in Teal version 2 or greater, either used as delegate signature or contract account, include a check in the program that verifies rekey-to field to be equal to ZeroAddress or any intended address. Teal contracts written in Teal version 1 are not affected by this issue. Rekeying feature is introduced in version 2 and Algorand rejects transactions that use features introduced in the versions later than the executed Teal program version.
4445

4546
- Use [Tealer](https://github.com/crytic/tealer) to detect this issue.
47+
48+
- For Applications, verify that user provided value is not used for `RekeyTo` field of a inner transaction. Additionally, avoid rekeying an application to admin controlled address. This allows for the possibility of "rug pull" by a malicious admin.

not-so-smart-contracts/algorand/unchecked_transaction_fee/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ def withdraw(
3636

3737
## Recommendations
3838

39-
- Verify that transaction fees are under reasonable bounds before approving the transaction in the Teal contract.
39+
- Force the transaction fee to be `0` and use fee pooling. If the users should be able to call the smart signature outside of a group, force the transaction fee to be minimum transaction fee: `global MinTxnFee`.

0 commit comments

Comments
 (0)