You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The structure of session keys in the BaseOpenfortAccount is inherently incompatible with the EIP-1271 standard as the current implementation poses security risks.
Specifically, it evaluates the session key's limit as being non-zero yet does not decrement it and it ignores whitelist configurations entirely.
Impact:
Session keys will improperly pass EIP-1271 signature validation even though they should potentially not be accepted.
Example:
function _validateSessionKeyCall(SessionKeyStruct storage_sessionKey, address_to) internalreturns (bool) {
// Check if reenter, do not allowif (_to ==address(this)) returnfalse;
// Limit of transactions per sessionKey reachedif (_sessionKey.limit ==0) returnfalse;
// Deduct one use of the limit for the given session keyunchecked {
_sessionKey.limit = _sessionKey.limit -1;
}
// If there is no whitelist or there is, but the target is whitelisted, return trueif (!_sessionKey.whitelisting || _sessionKey.whitelist[_to]) {
returntrue;
}
// All other cases, denyreturnfalse;
}
/* * @notice See EIP-1271 * Owner and session keys need to sign using EIP712. */function isValidSignature(bytes32_hash, bytesmemory_signature) publicviewoverridereturns (bytes4) {
bytes32 structHash =keccak256(abi.encode(OF_MSG_TYPEHASH, _hash));
bytes32 digest =_hashTypedDataV4(structHash);
address signer = digest.recover(_signature);
if (owner() == signer) return EIP1271_SUCCESS_RETURN_VALUE;
SessionKeyStruct storage sessionKey = sessionKeys[signer];
// If the signer is a session key that is still validif (
sessionKey.validUntil ==0|| sessionKey.validAfter >block.timestamp|| sessionKey.validUntil <block.timestamp|| (!sessionKey.masterSessionKey && sessionKey.limit <1)
) {
return0xffffffff;
}
// Not owner or session key revokedelseif (sessionKey.registrarAddress !=owner()) {
return0xffffffff;
} else {
return EIP1271_SUCCESS_RETURN_VALUE;
}
}
Recommendation:
We advise session keys to not be supported unless a masterSessionKey has been identified as the current integration has been improperly performed.
The text was updated successfully, but these errors were encountered:
ACK.
The EIP-1271 isValidSignature method is ISO with openfort-contracts.
We don't decrement the session key limit nor check for whitelist because the method is only used for message signature validation (i.e. singing an EIP-712 to authenticate to Opensea )
The signer is recovered after adding message prefix to the hash so it can't be an execution.
BOA-03M: Improper Incorporation of Session Keys in EIP-1271
Description:
The structure of session keys in the
BaseOpenfortAccount
is inherently incompatible with the EIP-1271 standard as the current implementation poses security risks.Specifically, it evaluates the session key's limit as being non-zero yet does not decrement it and it ignores whitelist configurations entirely.
Impact:
Session keys will improperly pass EIP-1271 signature validation even though they should potentially not be accepted.
Example:
Recommendation:
We advise session keys to not be supported unless a
masterSessionKey
has been identified as the current integration has been improperly performed.The text was updated successfully, but these errors were encountered: