Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(connector-besu/quorum/xdai): unvalidated dynamic method call #1912

Merged
merged 1 commit into from
Mar 14, 2022

Conversation

petermetz
Copy link
Contributor

Added checks to make sure that the Web3 Contract instances
"methods" object has a property of their own called
the same way the method is called by the request
object. This way if someone tries to execute malicious
code by providing method names that are designed to
execute something other than the smart contract methods
we throw back an error to them instead of complying.

This is needed to fix the following CodeQL security advisories:
https://github.com/hyperledger/cactus/security/code-scanning/23
https://github.com/hyperledger/cactus/security/code-scanning/24
https://github.com/hyperledger/cactus/security/code-scanning/25
https://github.com/hyperledger/cactus/security/code-scanning/26

Todo for later: create a web3-common package that can
be used to house re-usable pieces of code such as the
function that validates if a contract really has a certain
method or not. Right now this method is copy pasted
to all 3 web3 flavored connectors which is not very nice.

Fixes #1911

Signed-off-by: Peter Somogyvari peter.somogyvari@accenture.com

@petermetz petermetz requested review from izuru0, jagpreetsinghsasan and takeutak and removed request for jonathan-m-hamilton March 14, 2022 04:47
@petermetz petermetz added Besu dependencies Pull requests that update a dependency file P1 Priority 1: Highest Quorum Security Related to existing or potential security vulnerabilities Xdai Tasks/bugs related to the Xdai network and the corresponding ledger connector plugin in Cactus and removed dependencies Pull requests that update a dependency file labels Mar 14, 2022
Copy link
Contributor

@jagpreetsinghsasan jagpreetsinghsasan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Added checks to make sure that the Web3 Contract instances
"methods" object has a property of their own called
the same way the method is called by the request
object. This way if someone tries to execute malicious
code by providing method names that are designed to
execute something other than the smart contract methods
we throw back an error to them instead of complying.

This is needed to fix the following CodeQL security advisories:
https://github.com/hyperledger/cactus/security/code-scanning/23
https://github.com/hyperledger/cactus/security/code-scanning/24
https://github.com/hyperledger/cactus/security/code-scanning/25
https://github.com/hyperledger/cactus/security/code-scanning/26

Todo for later: create a web3-common package that can
be used to house re-usable pieces of code such as the
function that validates if a contract really has a certain
method or not. Right now this method is copy pasted
to all 3 web3 flavored connectors which is not very nice.

Fixes hyperledger-cacti#1911

Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
@petermetz petermetz merged commit bdc1aba into hyperledger-cacti:main Mar 14, 2022
@petermetz petermetz deleted the petermetz/issue1911 branch March 14, 2022 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Besu P1 Priority 1: Highest Quorum Security Related to existing or potential security vulnerabilities Xdai Tasks/bugs related to the Xdai network and the corresponding ledger connector plugin in Cactus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix(connector-besu/quorum/xdai): Unvalidated dynamic method call
3 participants