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

The StoragePositions new function doesn't validate low and up parameters as it states it should #124

Closed
howlbot-integration bot opened this issue Sep 16, 2024 · 2 comments
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-149 partial-75 Incomplete articulation of vulnerability; eligible for partial credit only (75%) 🤖_48_group AI based duplicate group recommendation sufficient quality report This report is of sufficient quality upgraded by judge Original issue severity upgraded from QA/Gas by judge

Comments

@howlbot-integration
Copy link

Lines of code

https://github.com/code-423n4/2024-08-superposition/blob/4528c9d2dbe1550d2660dac903a8246076044905/pkg/seawater/src/position.rs#L29-L39

Vulnerability details

Impact

Parameters could be passed with swapped places and the function will set them.

Proof of Concept

The comments suggest that the function requires the parameters to be in the correct places, but doesn't validate them, so the position can be created with swapped places of up and low price ticks.

Tools Used

Manual Review

Recommended Mitigation Steps

Consider making up and low mutable and swapping the parameters in the beginning of the function if low > up:

pub fn new(&mut self, id: U256, mut low: i32, mut up: i32) {
   if low > up {
      (low, up) = (up, low)
   };

Assessed type

Invalid Validation

@howlbot-integration howlbot-integration bot added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value 🤖_48_group AI based duplicate group recommendation bug Something isn't working duplicate-59 sufficient quality report This report is of sufficient quality labels Sep 16, 2024
howlbot-integration bot added a commit that referenced this issue Sep 16, 2024
@c4-judge
Copy link
Contributor

alex-ppg changed the severity to 3 (High Risk)

@c4-judge c4-judge added 3 (High Risk) Assets can be stolen/lost/compromised directly upgraded by judge Original issue severity upgraded from QA/Gas by judge and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Sep 23, 2024
@c4-judge
Copy link
Contributor

alex-ppg marked the issue as partial-75

@c4-judge c4-judge added the partial-75 Incomplete articulation of vulnerability; eligible for partial credit only (75%) label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate-149 partial-75 Incomplete articulation of vulnerability; eligible for partial credit only (75%) 🤖_48_group AI based duplicate group recommendation sufficient quality report This report is of sufficient quality upgraded by judge Original issue severity upgraded from QA/Gas by judge
Projects
None yet
Development

No branches or pull requests

1 participant