The GMXOracle contract lacks proper access control, allowing any address to interact with its functions without authorization. This vulnerability can potentially lead to unauthorized and malicious operations.
The GMXOracle contract does not implement access control mechanisms, making all functions publicly accessible. As a result, any address, including potential attackers, can call these functions without proper authorization.
The missing access control vulnerability can be found in the getAmountsOut
function within the GMXOracle contract. Below is the vulnerable function:
The getAmountsOut
function, being publicly accessible, is vulnerable to misuse by unauthorized users who can call this function with arbitrary parameters, potentially affecting the contract's behavior. This function should have proper access control to restrict its usage to authorized addresses.
An attacker can exploit the absence of access control to call functions intended only for authorized users. In the following example, the attacker calls the getAmountsOut
function with a malicious value:
In this scenario, the attacker can execute the getAmountsOut
function with arbitrary parameters, potentially affecting the contract's behavior.
It allows unauthorized users to interact with the contract's functions without restriction. This can lead to various potential malicious activities, including manipulating token prices, creating inaccurate market data, or affecting the contract's intended behavior.
Manual
Access control mechanisms should be implemented to restrict the usage of critical functions to authorized addresses. You can use OpenZeppelin's Access Control smart contracts to manage roles and permissions within your contract. Below is an example of how you can apply access control using OpenZeppelin's Access Control library:
Import the AccessControl contract from OpenZeppelin:
Inherit the AccessControl contract in your GMXOracle contract:
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.