Activating same Policy multiple times in Kernel possible
The Kernel contract trusted a policy contract's own isActive() return value to decide whether it was already registered, so a malicious policy returning false could be activated repeatedly. This broke uniqueness invariants, made deactivation fail, and could cause out-of-gas denial of service when iterating over the duplicated policy list.
Submitted by Lambda, also found by enckrish
To check that an already active policy is not added a second time, isActive() is called on the policy. However, policy could be a malicious contract that always returns false for isActive(). In such a scenario, it would be possible to activate the policy multiple times for the same Kernel. This would break uniqueness invariants such that _deactivatePolicy() no longer works. However, it could also be used for a DoS attack: As _reconfigurePolicies and _migrateKernel iterate over those lists that now contain duplicates, they could run out of gas if a policy is activated enough times.
Recommended Mitigation Steps
Check getPolicyIndex[policy_] != 0 instead of relying on a value of an untrusted contract.
@ind-igo a few other submissions also mention problems with over-reliance on policy.isActive (i.e. #368). Might be worth mitigating with the suggested step here or the check on activePolicies[index] like 368 mentions.
Dupe of #368
I think this is separate from #368 which is about a policy deactivating that isn’t already active.
I am a bit skeptical at the impact statement currently, but it does seem like protocol functionality does end up in a bad state with the typical policy lifecycle here. Will award as Medium unless Sponsor wants to provide some additional reasoning as to a downgrade.
While the issue is slightly different from #368, the solution is the exact same. The remediation has the new checks to prevent both of these issues.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the contract relied on an untrusted external contract's isActive() return value instead of checking its own internal registry mapping.
Impact
A malicious policy could be activated many times, breaking uniqueness and deactivation, and potentially causing a denial of service through out-of-gas errors in loops over the duplicated list.
What the attacker needed
Attacker controls a policy contract; policy is activated via Kernel
The fix
The check should use the Kernel's own internal policy index mapping rather than the untrusted contract's isActive() return value; the sponsor confirmed the remediation adds new checks.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A smart contract here (the Kernel) keeps a list of helper contracts called policies. Before adding one, it asks the policy itself whether it is already active, which is like trusting a stranger to tell you if they are already on the guest list. A malicious policy can lie and say no every time, so it gets added over and over, filling the list until later loops run out of gas.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.