Skip to content

Conversation

drozdziak1
Copy link
Contributor

Motivation

During an audit of oracle code, Amin and I discovered that it is still possible to circumvent the new permissions PDA mechanism if you simply don't pass the permissions account. If you as an attacker have control over price/product/mapping private keys, you can use the legacy privkey-based access control, which means the oracle has a significantly larger attack surface than necessary. This change makes the permissions account mandatory and adjusts all affected unit tests.

Summary of changes

  • program/rust/src/tests/pyth_simulator.rs - always use permissions account in instruction wrappers
  • program/rust/src/utils.rs - Return error on missing permissions account
  • program/rust/src/tests/ - Add permissions_account_setup harness assignments to all affected tests.

Review Highlights

  • program/rust/src/tests/ - Some of the assertions were removed, as they were testing the legacy privkey access control which is no longer available. That said, it's important that useful assertions were not removed.

jayantk
jayantk previously approved these changes Nov 17, 2023
Copy link
Contributor

@jayantk jayantk left a comment

Choose a reason for hiding this comment

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

I think it would be good to validate that forgetting the permissions account is always a failure now, but lgtm aside from that.

permissions_account_data.master_authority = *funding_account.key;
permissions_account_data.data_curation_authority = *funding_account.key;
permissions_account_data.security_authority = *funding_account.key;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

can you test that the old way of invoking these instructions fails now?

Copy link
Contributor

Choose a reason for hiding this comment

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

err also would be good to test the specific authority that is allowed to do these operations. So maybe set that the other authorities are different

(unless this is already tested elsewhere, which i think it probably is)

Copy link
Contributor

@jayantk jayantk left a comment

Choose a reason for hiding this comment

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

🙇

@drozdziak1 drozdziak1 merged commit aad9c00 into main Nov 20, 2023
@drozdziak1 drozdziak1 deleted the drozdziak1/remove-permissionless branch November 20, 2023 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants