0

Suppose I have a contractA with an add function to add numbers with an onlyOwner modifier. This function calls a library to update the number, but the library is deployed as a standalone entity, and the add function is marked as external. Can an attacker call the external library function in the context of contractA and bypass the ownership check in contractA?

1 Answer 1

1

No

Solidity libraries, even when deployed as standalone contracts, do not hold state and do not have access to the storage of contracts that use them.

If a user calls Contract B that uses the logic of a function of a library that Contract A (That has an onlyOwner modifier) uses, it would not change Contract A's state.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.