The deposit_tokens
function in the bridge.cairo
contract fails to validate the caller's address obtained using starknet::get_caller_address()
. In StarkNet's account abstraction model, this could lead to security vulnerabilities if the function is called directly without an account contract, resulting in a zero address
for the caller.
In StarkNet
, the account abstraction model differs significantly from Ethereum. StarkNet does not use Externally Owned Accounts (EOAs); instead, all user interactions occur through smart contracts known as account contracts
. These account contracts handle user authentication and interact with other contracts on behalf of the user.
The deposit_tokens function in bridge.cairo
uses starknet::get_caller_address()
without validating the returned address:
The deposit_tokens
function assumes it will always be called through an account contract, which is not guaranteed in StarkNet's model.
According to StarkNet's behavior, get_caller_address()
could return 0 if the contract is called directly (i.e., not through an account contract).
It is possible to interact with contracts directly (e.g. through a StarkNet API or SDK). But from the perspective of the bridge.cairo
contract, the caller's address will be zero
.
This is different from calls made through an account contract, where get_caller_address()
would return the account contract's address.
This zero address
value is assigned to the from
parameter and passed to the escrow_deposit_tokens function:
the function will revert due to the zero address
being used in the transfer_from
call, effectively rendering the deposit functionality unusable.
DOS of deposit_tokens
function
Implement explicit caller address validation:
Please, do not suppose impacts, think about the real impact of the bug and check the CodeHawks documentation to confirm: https://docs.codehawks.com/hawks-auditors/how-to-determine-a-finding-validity A PoC always helps to understand the real impact possible.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.