Ambire contest - gpersoon's results

Fastest & simplest way to get into crypto and DeFi even without previous experience.

General Information

Platform: Code4rena

Start Date: 15/10/2021

Pot Size: $35,000 USDC

Total HM: 4

Participants: 10

Period: 4 days

Judge: GalloDaSballo

Total Solo HM: 2

Id: 38

League: ETH

Ambire

Findings Distribution

Researcher Performance

Rank: 2/10

Findings: 3

Award: $11,270.54

🌟 Selected for report: 3

πŸš€ Solo Findings: 1

Findings Information

🌟 Selected for report: gpersoon

Labels

bug
duplicate
sponsor confirmed
disagree with severity
3 (High Risk)
resolved

Awards

7687.9271 USDC - $7,687.93

External Links

Handle

gpersoon

Vulnerability details

Impact

Suppose one of the supplied addrs[i] to the constructor of Identity.sol happens to be 0 ( by accident).

In that case: privileges[0] = 1

Now suppose you call execute() with an invalid signature, then recoverAddrImpl will return a value of 0 and thus signer=0. If you then check "privileges[signer] !=0" this will be true and anyone can perform any transaction.

This is clearly an unwanted situation.

Proof of Concept

https://github.com/code-423n4/2021-10-ambire/blob/bc01af4df3f70d1629c4e22a72c19e6a814db70d/contracts/Identity.sol#L23-L30

https://github.com/code-423n4/2021-10-ambire/blob/bc01af4df3f70d1629c4e22a72c19e6a814db70d/contracts/Identity.sol#L97-L98

Tools Used

In the constructor of Identity.sol, add in the for loop the following: require (addrs[i] !=0,"Zero not allowed");

#0 - Ivshti

2021-10-19T15:32:34Z

duplicate of #2

#2 - GalloDaSballo

2021-10-20T22:35:56Z

This seems to be the risk of having erecover returning zero, any invalid signature ends up being usable from any address to execute arbitrary logic.

Mitigation can be achieved by either reverting when about to return address(0), which the sponsor has used for mitigation

The other mitigation is to ensure that an account with address(0) cannot have privileges set to 1

I believe mitigation from sponsor to be sufficient, however I'd recommend adding a check against having address(0) in the constructor for Identity.sol just to be sure

#3 - Ivshti

2021-10-21T05:43:36Z

@GalloDeSballo an extra check is superfluous IMO, not only cause the revert on 0 in SIgnatureValidatorV2 guarantees that this is fixed, but also because it has to be in three places: constructor, setAddrPrivilege and the account creation system in js/IdentityProxyDeploy which rolls out bytecode that sstores privileges directly

Findings Information

🌟 Selected for report: WatchPug

Also found by: gpersoon

Labels

bug
duplicate
sponsor confirmed
3 (High Risk)
resolved

Awards

3459.5672 USDC - $3,459.57

External Links

Handle

gpersoon

Vulnerability details

Impact

The function cancel() of contract QuickAccManager uses the wrong way to calculate the hash that has to be cancelled. It uses: "bytes32 hashTx = keccak256(abi.encode(address(this), block.chainid, accHash, nonce, txns));"

Where it should use "bytes32 hash = keccak256(abi.encode(address(this), block.chainid, accHash, nonce, txns, false));", the same as send() and execScheduled() are using.

The result of this is that the transactions cannot be cancelled.

Proof of Concept

https://github.com/code-423n4/2021-10-ambire/blob/bc01af4df3f70d1629c4e22a72c19e6a814db70d/contracts/wallet/QuickAccManager.sol#L60-L67

https://github.com/code-423n4/2021-10-ambire/blob/bc01af4df3f70d1629c4e22a72c19e6a814db70d/contracts/wallet/QuickAccManager.sol#L91

https://github.com/code-423n4/2021-10-ambire/blob/bc01af4df3f70d1629c4e22a72c19e6a814db70d/contracts/wallet/QuickAccManager.sol#L101

Tools Used

In function cancel(): replace bytes32 hashTx = keccak256(abi.encode(address(this), block.chainid, accHash, nonce, txns)); with bytes32 hashTx = keccak256(abi.encode(address(this), block.chainid, accHash, nonce, txns, false));

#0 - Ivshti

2021-10-19T15:15:17Z

duplicate of #1 and resolved

#1 - GalloDaSballo

2021-10-24T23:33:02Z

Duplicate of #1

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax Β© 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter