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

[L-03] Revocation State Inconsistency in CertifierHbbft Contract #292

Open
softstackio opened this issue Jan 13, 2025 · 0 comments · May be fixed by #297
Open

[L-03] Revocation State Inconsistency in CertifierHbbft Contract #292

softstackio opened this issue Jan 13, 2025 · 0 comments · May be fixed by #297
Assignees

Comments

@softstackio
Copy link

Likelihood: Medium

Description:
The revoke function in the CertifierHbbft contract does not check if the address was previously certified before revoking its certification. This can lead to inconsistent state tracking and potentially misleading event emissions. The function unconditionally sets the certification status to false and emits a Revoked event, even if the address was not certified to begin with.

The vulnerable code is:

function revoke(address _who) external onlyOwner {
   _certified[_who] = false;
   emit Revoked(_who);
}

This implementation could result in:

  1. Unnecessary state changes if an uncertified address is revoked.
  2. Emission of Revoked events for addresses that were never certified.
  3. Inconsistent tracking of certification history.

Recommendation:
Modify the revoke function to check the current certification status before making changes:

function revoke(address _who) external onlyOwner {
   if (_certified[_who]) {
       _certified[_who] = false;
       emit Revoked(_who);
} }

This change ensures that:

  1. The state is only modified if the address was previously certified.
  2. The Revoked event is only emitted for actually revoked certifications.
  3. The function maintains a consistent certification history.
@axel-muller axel-muller self-assigned this Jan 23, 2025
@axel-muller axel-muller linked a pull request Jan 23, 2025 that will close this issue
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 a pull request may close this issue.

2 participants