Liquid Staking

Stakelink
DeFiHardhatOracle
50,000 USDC
View results
Submission Details
Severity: medium
Invalid

contracts/ethStaking/KeyValidationOracle.sol

The provided Solidity contract for a Key Validation Oracle appears to be well-structured and utilizes established libraries like OpenZeppelin and Chainlink. However, there are several potential vulnerabilities and areas of concern that you should consider:

1. Chainlink Request Verification

  • Issue: The reportKeyPairValidation function relies on Chainlink to validate the request ID via the recordChainlinkFulfillment modifier. If the request ID is forged or manipulated, it could lead to unexpected behavior or incorrect reports being processed.

  • Recommendation: Ensure that the Chainlink node's integrity is maintained. Consider adding additional checks or event logs to trace the request and response lifecycle.

2. Parameter Decoding in onTokenTransfer

  • Issue: The function decodes parameters from the _calldata without validating the structure or content. If the caller sends unexpected data types or values, it could lead to issues.

  • Recommendation: Implement input validation before decoding, or catch exceptions that may arise during decoding to avoid execution failures.

3. Gas Limit Issues

  • Issue: The sendChainlinkRequest function might fail if the gas limit set for the transaction is not sufficient for the execution of the callback function reportKeyPairValidation.

  • Recommendation: Provide guidance on gas limits or implement checks to ensure adequate gas is provided for operations involving Chainlink requests.

4. Reentrancy Risk

  • Issue: While not explicitly seen in the provided code, if the wlOperatorController or nwlOperatorController contracts have functions that invoke external contracts or callbacks, it could expose the KeyValidationOracle to reentrancy attacks.

  • Recommendation: Utilize the checks-effects-interactions pattern, or implement a reentrancy guard for critical functions that change state.

5. Access Control on reportKeyPairValidation

  • Issue: The function does not enforce access control beyond the Chainlink fulfillment check. If an unauthorized user could somehow call this function directly (e.g., if the Chainlink node is compromised), it could lead to data integrity issues.

  • Recommendation: Consider adding additional security measures, such as ensuring that only authorized Chainlink nodes can invoke this function.

6. Oracle Configuration Updates

  • Issue: The setOracleConfig function allows the owner to change the oracle address, job ID, and fee. If the ownership is compromised, this could lead to exploitation.

  • Recommendation: Ensure that ownership management is secure. Consider implementing a multi-signature wallet or a time-lock mechanism for critical changes.

7. Lack of Input Validation in setOracleConfig

  • Issue: The parameters for the oracle configuration are not validated. Invalid addresses or job IDs can lead to runtime errors or unintended behavior.

  • Recommendation: Validate the addresses and values passed into the setOracleConfig function.

8. Chainlink Token Address Handling

  • Issue: The contract checks the sender in onTokenTransfer against chainlinkTokenAddress(), which is set in the constructor. If this address is changed through malicious means (e.g., if an attacker gains ownership), it could lead to unauthorized access.

  • Recommendation: Implement mechanisms to verify that the Chainlink token address remains consistent and cannot be altered by unauthorized parties.

Conclusion

Overall, the code appears functional, but it could benefit from enhanced validation, access controls, and considerations for potential vulnerabilities. Always conduct thorough testing, including security audits, before deploying contracts to a live environment.

Updates

Lead Judging Commences

inallhonesty Lead Judge
about 1 year ago
inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.